This commit is contained in:
xd 2024-05-13 13:43:01 +08:00
parent 53898cfc71
commit 5e89e079b9
5 changed files with 44 additions and 26 deletions

View File

@ -205,18 +205,35 @@ public class RedBookController extends BaseController
* @return * @return
*/ */
@DataSource(DataSourceType.MASTER) @DataSource(DataSourceType.MASTER)
@Log(title = "报价单生成", businessType = BusinessType.OTHER) @Log(title = "保存报价单", businessType = BusinessType.INSERT)
@PostMapping("/madeQuot") @PostMapping("/saveQuot")
public void madeQuot(HttpServletResponse response, @RequestBody OAQuot quot) public AjaxResult saveQuot(HttpServletResponse response, @RequestBody OAQuot quot)
{ {
quot.setQuot_id(UUID.fastUUID().toString()); quot.setQuot_id(UUID.fastUUID().toString());
quot.setQuotCode(IdUtils.createNo("BJD_",2)); quot.setQuotCode(IdUtils.createNo("BJD_",2));
quot.setCreateBy(getUsername()); quot.setCreateBy(getUsername());
redBookService.insertOAQuot(quot); redBookService.insertOAQuot(quot);
List<OAQuotProduct> list = quot.getSelectedResultData(); return success(quot);
}
excelUtil.exportExcel(response, list); /**
* 报价单生成
* @param quot
* @return
*/
@DataSource(DataSourceType.MASTER)
@Log(title = "报价单生成", businessType = BusinessType.OTHER)
@PostMapping("/madeQuot")
public void madeQuot(HttpServletResponse response, @RequestBody OAQuot quot)
{
/*quot.setQuot_id(UUID.fastUUID().toString());
quot.setQuotCode(IdUtils.createNo("BJD_",2));
quot.setCreateBy(getUsername());
redBookService.insertOAQuot(quot);*/
List<OAQuotProduct> list = quot.getSelectedResultData();
excelUtil.exportExcel(response,quot,list);
} }

View File

@ -1,5 +1,6 @@
package com.ruoyi.web.controller.redBook; package com.ruoyi.web.controller.redBook;
import com.ruoyi.redBook.domain.OAQuot;
import com.ruoyi.redBook.domain.OAQuotProduct; import com.ruoyi.redBook.domain.OAQuotProduct;
import jxl.HeaderFooter; import jxl.HeaderFooter;
import jxl.Workbook; import jxl.Workbook;
@ -16,25 +17,15 @@ import java.io.IOException;
import java.io.OutputStream; import java.io.OutputStream;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.net.URL; import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
public class excelUtil { public class excelUtil {
public static void exportExcel(HttpServletResponse response, List<OAQuotProduct> list){ public static void exportExcel(HttpServletResponse response, OAQuot quot, List<OAQuotProduct> list){
response.setContentType("application/vnd.ms-excel"); response.setContentType("application/vnd.ms-excel");
BigDecimal totalmoney = BigDecimal.ZERO; BigDecimal totalmoney = BigDecimal.ZERO;
try { try {
/*Date now = new Date();
SimpleDateFormat dateFormat = new SimpleDateFormat("yyMMddss");//
String sNow = dateFormat.format(now);
String fileName = "BJD_" + sNow;
// 生成文件名
response.addHeader("Content-Disposition",
"attachment; filename=\"" + fileName + ".xls" + "\"");*/
OutputStream os = response.getOutputStream(); OutputStream os = response.getOutputStream();
WritableWorkbook wwb = Workbook.createWorkbook(os); WritableWorkbook wwb = Workbook.createWorkbook(os);
@ -89,8 +80,9 @@ public class excelUtil {
wff_merge = new WritableCellFormat(wf_merge); wff_merge = new WritableCellFormat(wf_merge);
wff_merge.setAlignment(Alignment.LEFT); wff_merge.setAlignment(Alignment.LEFT);
wsheet.setRowView(i,380); wsheet.setRowView(i,380);
String[] bjs = {"询价单位:","业务联系人:","项目名称:","联 系 电 话:","询价日期:","编 制:","报价日期:","审 核:"}; String[] bjs = {"询价单位:"+quot.getQuotCustomer(),"业务联系人:"+quot.getQuotLxr(),"项目名称:"+quot.getQuotProject(),"联 系 电 话:"+quot.getQuotLxrdh(),"询价日期:","编 制:","报价日期:","审 核:"};
int k=0; int k=0;
String labelValue = "";
while(k<bjs.length){ while(k<bjs.length){
wsheet.mergeCells(0,i,3,i); wsheet.mergeCells(0,i,3,i);
label = new Label(0, i, bjs[k],wff_merge); label = new Label(0, i, bjs[k],wff_merge);
@ -101,7 +93,6 @@ public class excelUtil {
label = new Label(4, i, bjs[k],wff_merge); label = new Label(4, i, bjs[k],wff_merge);
k++; k++;
wsheet.addCell(label); wsheet.addCell(label);
i++; i++;
} }

View File

@ -105,9 +105,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</insert> </insert>
<insert id="batchOAQuotProduct"> <insert id="batchOAQuotProduct">
insert into OAQuotProduct(quot_product_id, name_0, spec, voltage,stu,setPrice,count,allPrice,per,per2,quot_id) values insert into OAQuotProduct(quot_product_id, name_0, name_1, spec, voltage,stu,setPrice,count,allPrice,per,per2,quot_id) values
<foreach item="item" index="index" collection="list" separator=","> <foreach item="item" index="index" collection="list" separator=",">
( #{item.quot_product_id}, #{item.name_0}, #{item.spec}, #{item.voltage}, #{item.stu},cast(#{item.setPrice,jdbcType=DECIMAL} as decimal(18,2)), cast(#{item.count,jdbcType=DECIMAL} as decimal(18,3)), cast(#{item.allPrice,jdbcType=DECIMAL} as decimal(18,2)),cast(#{item.per,jdbcType=DECIMAL} as decimal(18,2)),cast(#{item.per2,jdbcType=DECIMAL} as decimal(18,2)), #{item.quot_id}) ( #{item.quot_product_id}, #{item.name_0}, #{item.name_1}, #{item.spec}, #{item.voltage}, #{item.stu},cast(#{item.setPrice,jdbcType=DECIMAL} as decimal(18,2)), cast(#{item.count,jdbcType=DECIMAL} as decimal(18,3)), cast(#{item.allPrice,jdbcType=DECIMAL} as decimal(18,2)),cast(#{item.per,jdbcType=DECIMAL} as decimal(18,2)),cast(#{item.per2,jdbcType=DECIMAL} as decimal(18,2)), #{item.quot_id})
</foreach> </foreach>
</insert> </insert>

View File

@ -100,7 +100,14 @@ export function handleSearchData(query) {
params: query params: query
}) })
} }
//保存报价单
export function saveQuot(data) {
return request({
url: '/redBook/redBook/saveQuot',
method: 'post',
data: data
})
}
//生成报价单 //生成报价单
export function madeQuot(data) { export function madeQuot(data) {
return request({ return request({

View File

@ -99,8 +99,8 @@
<el-form-item label="批量调折扣率" label-width="100px"> <el-form-item label="批量调折扣率" label-width="100px">
<el-input style="width:10%" v-model="perc" size="small" @blur="changeData"></el-input> <el-input style="width:10%" v-model="perc" size="small" @blur="changeData"></el-input>
<el-input style="width:10%;margin-left: 5px" v-model="perc2" size="small" @blur="changeData"></el-input> <el-input style="width:10%;margin-left: 5px" v-model="perc2" size="small" @blur="changeData"></el-input>
总价:<span style="color:red">{{sumSelectedResultData}}</span> 总价:<span style="color:red">{{sumSelectedResultData}} </span>
<el-select v-model="form.rbDate" style="width: 40%;float: right" > <el-select v-model="form.rbDate" style="width: 50%;float: right" >
<el-option <el-option
v-for="item in versionList" v-for="item in versionList"
:key="item.value" :key="item.value"
@ -121,7 +121,7 @@
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="版本uid" align="center" prop="uid_0" v-if="false"/> <el-table-column label="版本uid" align="center" prop="uid_0" v-if="false"/>
<el-table-column fixed="left" label="产品型号" align="center" prop="name_0"/> <el-table-column fixed="left" label="产品型号" align="center" prop="name_0" width="180" />
<el-table-column label="型号" align="center" prop="name_1" width="180" v-if="false"/> <el-table-column label="型号" align="center" prop="name_1" width="180" v-if="false"/>
<el-table-column label="规格" align="center" prop="spec" width="180" v-if="false"/> <el-table-column label="规格" align="center" prop="spec" width="180" v-if="false"/>
<el-table-column label="电压" align="center" prop="voltage" width="80"/> <el-table-column label="电压" align="center" prop="voltage" width="80"/>
@ -184,7 +184,7 @@
} }
</style> </style>
<script> <script>
import {toDecimal, productList,versionList,productRemarkList,productXinghList,judgeparent,productZlList,productYsxhListCheck,productYsxhList,productJmListCheck,productJmList,searchData,handleSearchData, madeQuot,updateSelectedResultData} from "@/api/redBook/redBook"; import {toDecimal, productList,versionList,productRemarkList,productXinghList,judgeparent,productZlList,productYsxhListCheck,productYsxhList,productJmListCheck,productJmList,searchData,handleSearchData,saveQuot, madeQuot,updateSelectedResultData} from "@/api/redBook/redBook";
export default { export default {
name: "productSelect", name: "productSelect",
@ -622,7 +622,10 @@
// //
handleSaveClick() { handleSaveClick() {
this.form.selectedResultData = this.selectedResultData;
saveQuot(this.form).then(response => {
this.$modal.msgSuccess("保存报价单成功,单号:"+response.data.quotCode);
})
}, },
// //
handleMadeQuotClick() { handleMadeQuotClick() {