diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/RedBookController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/RedBookController.java index 36f3055..accff63 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/RedBookController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/RedBookController.java @@ -205,18 +205,35 @@ public class RedBookController extends BaseController * @return */ @DataSource(DataSourceType.MASTER) - @Log(title = "报价单生成", businessType = BusinessType.OTHER) - @PostMapping("/madeQuot") - public void madeQuot(HttpServletResponse response, @RequestBody OAQuot quot) + @Log(title = "保存报价单", businessType = BusinessType.INSERT) + @PostMapping("/saveQuot") + public AjaxResult saveQuot(HttpServletResponse response, @RequestBody OAQuot quot) { quot.setQuot_id(UUID.fastUUID().toString()); quot.setQuotCode(IdUtils.createNo("BJD_",2)); quot.setCreateBy(getUsername()); redBookService.insertOAQuot(quot); - List 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 list = quot.getSelectedResultData(); + excelUtil.exportExcel(response,quot,list); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/excelUtil.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/excelUtil.java index d16d1f7..9b6f54d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/excelUtil.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/excelUtil.java @@ -1,5 +1,6 @@ package com.ruoyi.web.controller.redBook; +import com.ruoyi.redBook.domain.OAQuot; import com.ruoyi.redBook.domain.OAQuotProduct; import jxl.HeaderFooter; import jxl.Workbook; @@ -16,25 +17,15 @@ import java.io.IOException; import java.io.OutputStream; import java.math.BigDecimal; import java.net.URL; -import java.text.SimpleDateFormat; -import java.util.Date; import java.util.Iterator; import java.util.List; public class excelUtil { - public static void exportExcel(HttpServletResponse response, List list){ + public static void exportExcel(HttpServletResponse response, OAQuot quot, List list){ response.setContentType("application/vnd.ms-excel"); BigDecimal totalmoney = BigDecimal.ZERO; 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(); WritableWorkbook wwb = Workbook.createWorkbook(os); @@ -89,8 +80,9 @@ public class excelUtil { wff_merge = new WritableCellFormat(wf_merge); wff_merge.setAlignment(Alignment.LEFT); wsheet.setRowView(i,380); - String[] bjs = {"询价单位:","业务联系人:","项目名称:","联 系 电 话:","询价日期:","编 制:","报价日期:","审 核:"}; + String[] bjs = {"询价单位:"+quot.getQuotCustomer(),"业务联系人:"+quot.getQuotLxr(),"项目名称:"+quot.getQuotProject(),"联 系 电 话:"+quot.getQuotLxrdh(),"询价日期:","编 制:","报价日期:","审 核:"}; int k=0; + String labelValue = ""; while(k - 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 - ( #{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}) diff --git a/ruoyi-ui/src/api/redBook/redBook.js b/ruoyi-ui/src/api/redBook/redBook.js index c18aa01..2e955a9 100644 --- a/ruoyi-ui/src/api/redBook/redBook.js +++ b/ruoyi-ui/src/api/redBook/redBook.js @@ -100,7 +100,14 @@ export function handleSearchData(query) { params: query }) } - +//保存报价单 +export function saveQuot(data) { + return request({ + url: '/redBook/redBook/saveQuot', + method: 'post', + data: data + }) +} //生成报价单 export function madeQuot(data) { return request({ diff --git a/ruoyi-ui/src/views/redBook/productSelect.vue b/ruoyi-ui/src/views/redBook/productSelect.vue index e0190ae..91e71a4 100644 --- a/ruoyi-ui/src/views/redBook/productSelect.vue +++ b/ruoyi-ui/src/views/redBook/productSelect.vue @@ -99,8 +99,8 @@ - 总价:{{sumSelectedResultData}} - + 总价:{{sumSelectedResultData}} 元 + - + @@ -184,7 +184,7 @@ }