From d8d2f3a6b0ba9d93d522bbc312b2b8d69addd591 Mon Sep 17 00:00:00 2001 From: xd <844539747@qq.com> Date: Fri, 24 May 2024 15:46:00 +0800 Subject: [PATCH] '123' --- .../web/controller/quot/QuotController.java | 17 +- .../controller/redBook/RedBookController.java | 7 +- .../web/controller/redBook/excelUtil.java | 324 --------- .../ruoyi/web/utils/rbExcel/excelUtil.java | 649 ++++++++++++++++++ .../main/java/com/ruoyi/quot/domain/Quot.java | 5 + .../com/ruoyi/quot/domain/QuotMaterial.java | 44 +- .../quot/service/impl/QuotServiceImpl.java | 2 +- .../main/resources/mapper/quot/QuotMapper.xml | 4 +- ruoyi-ui/src/api/quot/quot.js | 14 + ruoyi-ui/src/views/quot/quot/index.vue | 31 +- ruoyi-ui/src/views/redBook/quots.vue | 14 +- 11 files changed, 758 insertions(+), 353 deletions(-) delete mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/excelUtil.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/utils/rbExcel/excelUtil.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java index a59fc6e..28802ba 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/quot/QuotController.java @@ -4,14 +4,12 @@ import java.util.List; import javax.servlet.http.HttpServletResponse; import com.ruoyi.common.constant.WebsocketConst; -import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.core.domain.model.LoginUser; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.file.FileUploadUtils; import com.ruoyi.common.utils.file.MinioUtil; import com.ruoyi.common.utils.uuid.UUID; -import com.ruoyi.customer.domain.Customer; import com.ruoyi.priceVerification.domain.QuotHj; import com.ruoyi.priceVerification.service.IQuotHjService; import com.ruoyi.quot.domain.QuotFile; @@ -22,6 +20,7 @@ import com.ruoyi.technicalConfirm.domain.QuotJsqr; import com.ruoyi.technicalConfirm.service.IQuotJsqrService; import com.ruoyi.web.utils.IdUtils; import com.ruoyi.web.utils.SendNotice.NoticeUtil; +import com.ruoyi.web.utils.rbExcel.excelUtil; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; @@ -95,6 +94,7 @@ public class QuotController extends BaseController public AjaxResult changQuotPrintStatus(@RequestBody Quot quot) { quot.setQuotPrintUserName(getUsername()); + quot.setUpdateTime(DateUtils.getNowDate()); return toAjax(quotService.changQuotPrintStatus(quot)); } @@ -455,6 +455,19 @@ public class QuotController extends BaseController return success(); } + /** + * 报价单生成 + * @param quot + * @return + */ + @Log(title = "报价单生成", businessType = BusinessType.OTHER) + @PostMapping("/madeQuot") + public void madeQuot(HttpServletResponse response, @RequestBody Quot quot) + { + List list = quot.getQuotMaterialList(); + excelUtil.exportQuotExcel(response,quot,list); + } + /** * 报价组驳回 */ 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 634bc14..a4c809e 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 @@ -18,9 +18,9 @@ import com.ruoyi.redBook.domain.OAQuot; import com.ruoyi.redBook.domain.RbVersionDateResult; import com.ruoyi.redBook.service.IRedBookService; import com.ruoyi.web.utils.IdUtils; +import com.ruoyi.web.utils.rbExcel.excelUtil; import org.apache.commons.collections.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.*; @@ -203,7 +203,7 @@ public class RedBookController extends BaseController } /** - * 报价单生成 + * 保存红本报价单 * @param quot * @return */ @@ -244,7 +244,7 @@ public class RedBookController extends BaseController * @return */ @DataSource(DataSourceType.MASTER) - @Log(title = "报价单生成", businessType = BusinessType.OTHER) + @Log(title = "电子红本报价单生成", businessType = BusinessType.OTHER) @PostMapping("/madeQuot") public void madeQuot(HttpServletResponse response, @RequestBody OAQuot quot) { @@ -257,7 +257,6 @@ public class RedBookController extends BaseController excelUtil.exportExcel(response,quot,list); } - /** * 获取调价日期 * @param oAQuot 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 deleted file mode 100644 index 9edc126..0000000 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/redBook/excelUtil.java +++ /dev/null @@ -1,324 +0,0 @@ -package com.ruoyi.web.controller.redBook; - -import com.ruoyi.common.utils.StringUtils; -import com.ruoyi.redBook.domain.OAQuot; -import com.ruoyi.redBook.domain.OAQuotProduct; -import jxl.HeaderFooter; -import jxl.Workbook; -import jxl.format.Alignment; -import jxl.format.Border; -import jxl.format.BorderLineStyle; -import jxl.format.VerticalAlignment; -import jxl.write.*; -import jxl.write.Number; -import jxl.write.biff.RowsExceededException; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.io.IOException; -import java.io.OutputStream; -import java.math.BigDecimal; -import java.net.URL; -import java.util.Iterator; -import java.util.List; - -public class excelUtil { - - public static void exportExcel(HttpServletResponse response, OAQuot quot, List list){ - response.setContentType("application/vnd.ms-excel"); - BigDecimal totalmoney = BigDecimal.ZERO; - try { - OutputStream os = response.getOutputStream(); - WritableWorkbook wwb = Workbook.createWorkbook(os); - - // 新建一张表 - WritableSheet wsheet = wwb.createSheet("报价单", 0); - Label label = new Label(0, 0, ""); - int i= 0; - //设置单头 - WritableFont wf_merge = new WritableFont(WritableFont.ARIAL,16,WritableFont.BOLD,false); - WritableCellFormat wff_merge = new WritableCellFormat(wf_merge); - wff_merge.setAlignment(Alignment.CENTRE); - wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE); - //wff_merge.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); - wsheet.mergeCells(0,i,7,i); - wsheet.setRowView(i,600); - label = new Label(0, i, "无 锡 江 南 电 缆 有 限 公 司",wff_merge); - wsheet.addCell(label); - i++; - - wf_merge = new WritableFont(WritableFont.ARIAL,15,WritableFont.BOLD,false); - wff_merge = new WritableCellFormat(wf_merge); - wff_merge.setAlignment(Alignment.CENTRE); - wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE); - wsheet.mergeCells(0,i,7,i); - wsheet.setRowView(i,600); - label = new Label(0, i, "WUXI JIANGNAN CABLE CO.,LTD.",wff_merge); - wsheet.addCell(label); - i++; - // - wsheet.mergeCells(0,i,7,i); - wsheet.setRowView(i,500); - wf_merge = new WritableFont(WritableFont.ARIAL,15,WritableFont.NO_BOLD,false); - wff_merge = new WritableCellFormat(wf_merge); - wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE); - //wff_merge.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); - wff_merge.setAlignment(Alignment.CENTRE); - label = new Label(0, i, "产品报价单",wff_merge); - wsheet.addCell(label); - i++; - // - wsheet.mergeCells(0,i,7,i); - wsheet.setRowView(i,500); - wf_merge = new WritableFont(WritableFont.ARIAL,12,WritableFont.BOLD,false); - wff_merge = new WritableCellFormat(wf_merge); - wff_merge.setAlignment(Alignment.CENTRE); - wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE); - label = new Label(0, i, "中国线缆行业十强 中国制造业企业500强 中国民营企业500强 全国用户满意标杆企业",wff_merge); - wsheet.addCell(label); - i++; - //报价信息 - wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false); - wff_merge = new WritableCellFormat(wf_merge); - wff_merge.setAlignment(Alignment.LEFT); - wsheet.setRowView(i,380); - - String QuotCustomer = quot.getQuotCustomer(); - QuotCustomer = StringUtils.isEmpty(QuotCustomer)?"":QuotCustomer; - String QuotProject = quot.getQuotProject(); - QuotProject = StringUtils.isEmpty(QuotProject)?"":QuotProject; - String QuotLxr = quot.getQuotLxr(); - QuotLxr = StringUtils.isEmpty(QuotLxr)?"":QuotLxr; - String QuotLxrdh = quot.getQuotLxrdh(); - QuotLxrdh = StringUtils.isEmpty(QuotLxrdh)?"":QuotLxrdh; - - String[] bjs = {"询价单位:"+QuotCustomer,"业务联系人:"+QuotLxr,"项目名称:"+QuotProject,"联 系 电 话:"+QuotLxrdh,"询价日期:","编 制:","报价日期:","审 核:"}; - int k=0; - while(k it = list.iterator(); it.hasNext();) - { - OAQuotProduct s = it.next(); - wsheet.setRowView(i,400); - labelN = new Number(0, i,j,wff_merge); - labelN.setCellFormat(cellFormat); - wsheet.addCell(labelN); - label = new Label(1, i, s.getName_1(),wff_merge); - label.setCellFormat(cellFormat); - wsheet.addCell(label); - label = new Label(2, i, s.getSpec(),wff_merge); - label.setCellFormat(cellFormat); - wsheet.addCell(label); - label = new Label(3,i,s.getVoltage(),wff_merge); - label.setCellFormat(cellFormat); - wsheet.addCell(label); - label = new Label(4,i,s.getStu(),wff_merge); - label.setCellFormat(cellFormat); - wsheet.addCell(label); - label = new Label(5,i,"1",wff_merge); - label.setCellFormat(cellFormat); - wsheet.addCell(label); - label = new Label(6, i, String.valueOf(s.getSetPrice()),wff_merge); - label.setCellFormat(cellFormat); - wsheet.addCell(label); - label = new Label(7, i, String.valueOf(s.getAllPrice()),wff_merge); - - totalmoney = totalmoney.add(s.getAllPrice()); - label.setCellFormat(cellFormat); - wsheet.addCell(label); - - label = new Label(9, i, s.getName_0(),wff_merge); - label.setCellFormat(cellFormat2); - wsheet.addCell(label); - - if(j>2000) - break; //200改为2000 - i++; - j++; - } - - if(list.size()<=2000) - { - wsheet.mergeCells(0,i,6,i); - wsheet.setRowView(i,400); - wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false); - wff_merge = new WritableCellFormat(wf_merge); - wff_merge.setAlignment(Alignment.LEFT); - wff_merge.setBorder(Border.ALL, BorderLineStyle.THIN); - /*label = new Label(0, i, "",wff_merge); - wsheet.addCell(label);*/ - label = new Label(0, i, " 合计(元):",wff_merge); - wsheet.addCell(label); - label = new Label(7, i, " "+totalmoney,wff_merge); - wsheet.addCell(label); - i++; - } - - wsheet.setRowView(i,390); - wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false); - wff_merge = new WritableCellFormat(wf_merge); - wff_merge.setAlignment(Alignment.LEFT); - wff_merge.setBorder(Border.RIGHT, BorderLineStyle.THIN); - wsheet.mergeCells(1,i,7,i); - label = new Label(1, i, "1、请审核报价单,如数量有误,价格以单价为准,如型号规格或产品工艺不符,需重新报价;",wff_merge); - wsheet.addCell(label); - i++; - wsheet.setRowView(i,390); - wsheet.mergeCells(1,i,7,i); - label = new Label(1, i, "2、本报价为含税、含运费价,此价为即时参考价,具体单价因考虑付款等因素以签订合同为准;",wff_merge); - wsheet.addCell(label); - i++; - wsheet.setRowView(i,390); - wsheet.mergeCells(1,i,7,i); - label = new Label(1, i, "报价为国内报价,如需出口,须提供相应信息另行报价; ",wff_merge); - wsheet.addCell(label); - i++; - wsheet.setRowView(i,390); - wsheet.mergeCells(1,i,7,i); - - wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false); - wff_merge = new WritableCellFormat(wf_merge); - wff_merge.setAlignment(Alignment.LEFT); - wff_merge.setBorder(Border.BOTTOM, BorderLineStyle.THIN); - wff_merge.setBorder(Border.RIGHT, BorderLineStyle.THIN); - - label = new Label(1, i, "3、分支电缆为多芯分支价格,不包其它附件,不含安装费,数量以供方实际测量为准;",wff_merge); - wsheet.addCell(label); - /*i++; - wsheet.setRowView(i,390); - wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false); - wff_merge = new WritableCellFormat(wf_merge); - wff_merge.setAlignment(jxl.format.Alignment.LEFT); - wff_merge.setBorder(jxl.format.Border.BOTTOM,jxl.format.BorderLineStyle.THIN); - wff_merge.setBorder(jxl.format.Border.RIGHT,jxl.format.BorderLineStyle.THIN); - wsheet.mergeCells(1,i,7,i); -// label = new Label(1, i, "4、产品交货总数和单根交货长度允许有±1%公差,如有不符对方要求,需重制作报价单。",wff_merge); - wsheet.addCell(label);*/ - - wsheet.mergeCells(0,i-3,0,i); - wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false); - wff_merge = new WritableCellFormat(wf_merge); - wff_merge.setAlignment(Alignment.CENTRE); - wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE); - wff_merge.setBorder(Border.ALL, BorderLineStyle.THIN); - label = new Label(0, i-3, "备注",wff_merge); - wsheet.addCell(label); - - // 获取当前类加载器 - ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); - // 获取资源的URL - URL resourceUrl = classLoader.getResource("jnlogo.png"); - File file=new File(resourceUrl.getPath()); - //设置图片位置,前两个参数为插入图片的单元格坐标,后面是设置从插入的单元格开始横向和纵向分别要占用的单元格个数,最后传入图片文件 - WritableImage image=new WritableImage(0.3, 0.2, 1.25, 2.55,file); - wsheet.addImage(image); - - // 获取当前类加载器 - ClassLoader classLoader2 = Thread.currentThread().getContextClassLoader(); - // 获取资源的URL - URL resourceUrl2 = classLoader2.getResource("wc.png"); - file=new File(resourceUrl2.getPath()); - //设置图片位置,前两个参数为插入图片的单元格坐标,后面是设置从插入的单元格开始横向和纵向分别要占用的单元格个数,最后传入图片文件 - image=new WritableImage(6.7, 0.2, 1.20, 2.65,file); - wsheet.addImage(image); - - wsheet.getSettings().setBottomMargin(0.7d); - wsheet.getSettings().setTopMargin(0.7d); - wsheet.getSettings().setLeftMargin(0.6d); - wsheet.getSettings().setRightMargin(0.2d); - - HeaderFooter footer = new HeaderFooter(); - footer.getCentre().append("第 "); - footer.getCentre().appendPageNumber(); - footer.getCentre().append(" 页,共 "); - footer.getCentre().appendTotalPages(); - footer.getCentre().append(" 页 "); - footer.getCentre().setFontName("ARIAL"); - footer.getCentre().setFontSize(13); - wsheet.getSettings().setFooter(footer); - - - wsheet.getSettings().setPrintTitles(0, 8, 0, 7); - - - - wwb.write(); - - wwb.close(); - os.close(); - response.flushBuffer(); - - - } catch (RowsExceededException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (WriteException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IOException e) { - e.printStackTrace(); - } - - } -} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/utils/rbExcel/excelUtil.java b/ruoyi-admin/src/main/java/com/ruoyi/web/utils/rbExcel/excelUtil.java new file mode 100644 index 0000000..cf76b66 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/utils/rbExcel/excelUtil.java @@ -0,0 +1,649 @@ +package com.ruoyi.web.utils.rbExcel; + +import com.ruoyi.common.utils.DateUtils; +import com.ruoyi.common.utils.StringUtils; +import com.ruoyi.quot.domain.Quot; +import com.ruoyi.quot.domain.QuotMaterial; +import com.ruoyi.redBook.domain.OAQuot; +import com.ruoyi.redBook.domain.OAQuotProduct; +import jxl.HeaderFooter; +import jxl.Workbook; +import jxl.format.Alignment; +import jxl.format.Border; +import jxl.format.BorderLineStyle; +import jxl.format.VerticalAlignment; +import jxl.write.Number; +import jxl.write.*; +import jxl.write.biff.RowsExceededException; + +import javax.servlet.http.HttpServletResponse; +import java.io.File; +import java.io.IOException; +import java.io.OutputStream; +import java.math.BigDecimal; +import java.net.URL; +import java.util.Date; +import java.util.Iterator; +import java.util.List; + +/** + * 报价单生成工具 + */ +public class excelUtil { + + /** + * 电子红本报价单生成 + * @param response + * @param quot + * @param list + */ + public static void exportExcel(HttpServletResponse response, OAQuot quot, List list){ + response.setContentType("application/vnd.ms-excel"); + BigDecimal totalmoney = BigDecimal.ZERO; + try { + OutputStream os = response.getOutputStream(); + WritableWorkbook wwb = Workbook.createWorkbook(os); + + // 新建一张表 + WritableSheet wsheet = wwb.createSheet("报价单", 0); + Label label = new Label(0, 0, ""); + int i= 0; + //设置单头 + WritableFont wf_merge = new WritableFont(WritableFont.ARIAL,16,WritableFont.BOLD,false); + WritableCellFormat wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setAlignment(Alignment.CENTRE); + wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE); + //wff_merge.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); + wsheet.mergeCells(0,i,7,i); + wsheet.setRowView(i,600); + label = new Label(0, i, "无 锡 江 南 电 缆 有 限 公 司",wff_merge); + wsheet.addCell(label); + i++; + + wf_merge = new WritableFont(WritableFont.ARIAL,15,WritableFont.BOLD,false); + wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setAlignment(Alignment.CENTRE); + wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE); + wsheet.mergeCells(0,i,7,i); + wsheet.setRowView(i,600); + label = new Label(0, i, "WUXI JIANGNAN CABLE CO.,LTD.",wff_merge); + wsheet.addCell(label); + i++; + // + wsheet.mergeCells(0,i,7,i); + wsheet.setRowView(i,500); + wf_merge = new WritableFont(WritableFont.ARIAL,15,WritableFont.NO_BOLD,false); + wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE); + //wff_merge.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); + wff_merge.setAlignment(Alignment.CENTRE); + label = new Label(0, i, "产品报价单",wff_merge); + wsheet.addCell(label); + i++; + // + wsheet.mergeCells(0,i,7,i); + wsheet.setRowView(i,500); + wf_merge = new WritableFont(WritableFont.ARIAL,12,WritableFont.BOLD,false); + wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setAlignment(Alignment.CENTRE); + wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE); + label = new Label(0, i, "中国线缆行业十强 中国制造业企业500强 中国民营企业500强 全国用户满意标杆企业",wff_merge); + wsheet.addCell(label); + i++; + //报价信息 + wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false); + wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setAlignment(Alignment.LEFT); + wsheet.setRowView(i,380); + + String QuotCustomer = quot.getQuotCustomer(); + QuotCustomer = StringUtils.isEmpty(QuotCustomer)?"":QuotCustomer; + String QuotProject = quot.getQuotProject(); + QuotProject = StringUtils.isEmpty(QuotProject)?"":QuotProject; + String QuotLxr = quot.getQuotLxr(); + QuotLxr = StringUtils.isEmpty(QuotLxr)?"":QuotLxr; + String QuotLxrdh = quot.getQuotLxrdh(); + QuotLxrdh = StringUtils.isEmpty(QuotLxrdh)?"":QuotLxrdh; + + String[] bjs = {"询价单位:"+QuotCustomer,"业务联系人:"+QuotLxr,"项目名称:"+QuotProject,"联 系 电 话:"+QuotLxrdh,"询价日期:","编 制:","报价日期:","审 核:"}; + int k=0; + while(k it = list.iterator(); it.hasNext();) + { + OAQuotProduct s = it.next(); + wsheet.setRowView(i,400); + labelN = new Number(0, i,j,wff_merge); + labelN.setCellFormat(cellFormat); + wsheet.addCell(labelN); + label = new Label(1, i, s.getName_1(),wff_merge); + label.setCellFormat(cellFormat); + wsheet.addCell(label); + label = new Label(2, i, s.getSpec(),wff_merge); + label.setCellFormat(cellFormat); + wsheet.addCell(label); + label = new Label(3,i, s.getVoltage(),wff_merge); + label.setCellFormat(cellFormat); + wsheet.addCell(label); + label = new Label(4,i, s.getStu(),wff_merge); + label.setCellFormat(cellFormat); + wsheet.addCell(label); + label = new Label(5,i, String.valueOf(s.getCount()),wff_merge); + label.setCellFormat(cellFormat); + wsheet.addCell(label); + label = new Label(6, i, String.valueOf(s.getSetPrice()),wff_merge); + label.setCellFormat(cellFormat); + wsheet.addCell(label); + label = new Label(7, i, String.valueOf(s.getAllPrice()),wff_merge); + + totalmoney = totalmoney.add(s.getAllPrice()); + label.setCellFormat(cellFormat); + wsheet.addCell(label); + + label = new Label(9, i, s.getName_0(),wff_merge); + label.setCellFormat(cellFormat2); + wsheet.addCell(label); + + if(j>2000) + break; //200改为2000 + i++; + j++; + } + + if(list.size()<=2000) + { + wsheet.mergeCells(0,i,6,i); + wsheet.setRowView(i,400); + wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false); + wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setAlignment(Alignment.LEFT); + wff_merge.setBorder(Border.ALL, BorderLineStyle.THIN); + /*label = new Label(0, i, "",wff_merge); + wsheet.addCell(label);*/ + label = new Label(0, i, " 合计(元):",wff_merge); + wsheet.addCell(label); + label = new Label(7, i, " "+totalmoney,wff_merge); + wsheet.addCell(label); + i++; + } + + wsheet.setRowView(i,390); + wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false); + wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setAlignment(Alignment.LEFT); + wff_merge.setBorder(Border.RIGHT, BorderLineStyle.THIN); + wsheet.mergeCells(1,i,7,i); + label = new Label(1, i, "1、请审核报价单,如数量有误,价格以单价为准,如型号规格或产品工艺不符,需重新报价;",wff_merge); + wsheet.addCell(label); + i++; + wsheet.setRowView(i,390); + wsheet.mergeCells(1,i,7,i); + label = new Label(1, i, "2、本报价为含税、含运费价,此价为即时参考价,具体单价因考虑付款等因素以签订合同为准;",wff_merge); + wsheet.addCell(label); + i++; + wsheet.setRowView(i,390); + wsheet.mergeCells(1,i,7,i); + label = new Label(1, i, "报价为国内报价,如需出口,须提供相应信息另行报价; ",wff_merge); + wsheet.addCell(label); + i++; + wsheet.setRowView(i,390); + wsheet.mergeCells(1,i,7,i); + + wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false); + wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setAlignment(Alignment.LEFT); + wff_merge.setBorder(Border.BOTTOM, BorderLineStyle.THIN); + wff_merge.setBorder(Border.RIGHT, BorderLineStyle.THIN); + + label = new Label(1, i, "3、分支电缆为多芯分支价格,不包其它附件,不含安装费,数量以供方实际测量为准;",wff_merge); + wsheet.addCell(label); + /*i++; + wsheet.setRowView(i,390); + wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false); + wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setAlignment(jxl.format.Alignment.LEFT); + wff_merge.setBorder(jxl.format.Border.BOTTOM,jxl.format.BorderLineStyle.THIN); + wff_merge.setBorder(jxl.format.Border.RIGHT,jxl.format.BorderLineStyle.THIN); + wsheet.mergeCells(1,i,7,i); +// label = new Label(1, i, "4、产品交货总数和单根交货长度允许有±1%公差,如有不符对方要求,需重制作报价单。",wff_merge); + wsheet.addCell(label);*/ + + wsheet.mergeCells(0,i-3,0,i); + wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false); + wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setAlignment(Alignment.CENTRE); + wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE); + wff_merge.setBorder(Border.ALL, BorderLineStyle.THIN); + label = new Label(0, i-3, "备注",wff_merge); + wsheet.addCell(label); + + // 获取当前类加载器 + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + // 获取资源的URL + URL resourceUrl = classLoader.getResource("jnlogo.png"); + File file=new File(resourceUrl.getPath()); + //设置图片位置,前两个参数为插入图片的单元格坐标,后面是设置从插入的单元格开始横向和纵向分别要占用的单元格个数,最后传入图片文件 + WritableImage image=new WritableImage(0.3, 0.2, 1.25, 2.55,file); + wsheet.addImage(image); + + // 获取当前类加载器 + ClassLoader classLoader2 = Thread.currentThread().getContextClassLoader(); + // 获取资源的URL + URL resourceUrl2 = classLoader2.getResource("wc.png"); + file=new File(resourceUrl2.getPath()); + //设置图片位置,前两个参数为插入图片的单元格坐标,后面是设置从插入的单元格开始横向和纵向分别要占用的单元格个数,最后传入图片文件 + image=new WritableImage(6.7, 0.2, 1.20, 2.65,file); + wsheet.addImage(image); + + wsheet.getSettings().setBottomMargin(0.7d); + wsheet.getSettings().setTopMargin(0.7d); + wsheet.getSettings().setLeftMargin(0.6d); + wsheet.getSettings().setRightMargin(0.2d); + + HeaderFooter footer = new HeaderFooter(); + footer.getCentre().append("第 "); + footer.getCentre().appendPageNumber(); + footer.getCentre().append(" 页,共 "); + footer.getCentre().appendTotalPages(); + footer.getCentre().append(" 页 "); + footer.getCentre().setFontName("ARIAL"); + footer.getCentre().setFontSize(13); + wsheet.getSettings().setFooter(footer); + + + wsheet.getSettings().setPrintTitles(0, 8, 0, 7); + + + + wwb.write(); + + wwb.close(); + os.close(); + response.flushBuffer(); + + + } catch (RowsExceededException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (WriteException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + } + + /** + * 报价单生成 + * @param response + * @param quot + * @param list + */ + public static void exportQuotExcel(HttpServletResponse response, Quot quot, List list){ + response.setContentType("application/vnd.ms-excel"); + BigDecimal totalmoney = BigDecimal.ZERO; + try { + OutputStream os = response.getOutputStream(); + WritableWorkbook wwb = Workbook.createWorkbook(os); + + // 新建一张表 + WritableSheet wsheet = wwb.createSheet("报价单", 0); + Label label = new Label(0, 0, ""); + int i= 0; + //设置单头 + WritableFont wf_merge = new WritableFont(WritableFont.ARIAL,16,WritableFont.BOLD,false); + WritableCellFormat wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setAlignment(Alignment.CENTRE); + wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE); + //wff_merge.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); + wsheet.mergeCells(0,i,7,i); + wsheet.setRowView(i,600); + label = new Label(0, i, "无 锡 江 南 电 缆 有 限 公 司",wff_merge); + wsheet.addCell(label); + i++; + + wf_merge = new WritableFont(WritableFont.ARIAL,15,WritableFont.BOLD,false); + wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setAlignment(Alignment.CENTRE); + wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE); + wsheet.mergeCells(0,i,7,i); + wsheet.setRowView(i,600); + label = new Label(0, i, "WUXI JIANGNAN CABLE CO.,LTD.",wff_merge); + wsheet.addCell(label); + i++; + // + wsheet.mergeCells(0,i,7,i); + wsheet.setRowView(i,500); + wf_merge = new WritableFont(WritableFont.ARIAL,15,WritableFont.NO_BOLD,false); + wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE); + //wff_merge.setBorder(jxl.format.Border.ALL,jxl.format.BorderLineStyle.THIN); + wff_merge.setAlignment(Alignment.CENTRE); + label = new Label(0, i, "产品报价单",wff_merge); + wsheet.addCell(label); + i++; + // + wsheet.mergeCells(0,i,7,i); + wsheet.setRowView(i,500); + wf_merge = new WritableFont(WritableFont.ARIAL,12,WritableFont.BOLD,false); + wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setAlignment(Alignment.CENTRE); + wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE); + label = new Label(0, i, "中国线缆行业十强 中国制造业企业500强 中国民营企业500强 全国用户满意标杆企业",wff_merge); + wsheet.addCell(label); + i++; + //报价信息 + wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false); + wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setAlignment(Alignment.LEFT); + wsheet.setRowView(i,380); + + String QuotCustomer = quot.getQuotCustomerName();//客户 + String QuotProject = quot.getQuotProject();//项目 + String QuotLxr = quot.getQuotContacts();//联系人 + QuotLxr = StringUtils.isEmpty(QuotLxr)?"":QuotLxr; + String QuotLxrdh = quot.getQuotPhone();//联系电话 + QuotLxrdh = StringUtils.isEmpty(QuotLxrdh)?"":QuotLxrdh; + String QuotXjrq = DateUtils.dateTime(quot.getQuotInquiryDate());//询价日期 + String QuotBjrq = DateUtils.dateTime(new Date());//报价日期 + + String[] bjs = {"询价单位:"+QuotCustomer,"业务联系人:"+QuotLxr,"项目名称:"+QuotProject,"联 系 电 话:"+QuotLxrdh,"询价日期:"+QuotXjrq,"编 制:","报价日期:"+QuotBjrq,"审 核:"}; + int k=0; + while(k it = list.iterator(); it.hasNext();) + { + QuotMaterial s = it.next(); + wsheet.setRowView(i,400); + labelN = new Number(0, i,j,wff_merge); + labelN.setCellFormat(cellFormat); + wsheet.addCell(labelN); + label = new Label(1, i, s.getMatXingh(),wff_merge); + label.setCellFormat(cellFormat); + wsheet.addCell(label); + label = new Label(2, i, s.getMatGuig(),wff_merge); + label.setCellFormat(cellFormat); + wsheet.addCell(label); + label = new Label(3,i,s.getMatDiany(),wff_merge); + label.setCellFormat(cellFormat); + wsheet.addCell(label); + label = new Label(4,i,s.getMatDanw(),wff_merge); + label.setCellFormat(cellFormat); + wsheet.addCell(label); + label = new Label(5,i,String.valueOf(s.getMatSl()),wff_merge); + label.setCellFormat(cellFormat); + wsheet.addCell(label); + + BigDecimal matQuotPrice = s.getMatQuotPrice(); + matQuotPrice = matQuotPrice==null?BigDecimal.ZERO:matQuotPrice; + label = new Label(6, i, String.valueOf(matQuotPrice),wff_merge); + label.setCellFormat(cellFormat); + wsheet.addCell(label); + + BigDecimal matQuotAllPrice = s.getMatQuotAllPrice(); + matQuotAllPrice = matQuotAllPrice==null?BigDecimal.ZERO:matQuotAllPrice; + label = new Label(7, i, String.valueOf(matQuotAllPrice),wff_merge); + + totalmoney = totalmoney.add(matQuotAllPrice); + label.setCellFormat(cellFormat); + wsheet.addCell(label); + + //label = new Label(9, i, s.getName_0(),wff_merge); + //label.setCellFormat(cellFormat2); + //wsheet.addCell(label); + + if(j>2000) + break; //200改为2000 + i++; + j++; + } + + if(list.size()<=2000) + { + wsheet.mergeCells(0,i,6,i); + wsheet.setRowView(i,400); + wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false); + wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setAlignment(Alignment.LEFT); + wff_merge.setBorder(Border.ALL, BorderLineStyle.THIN); + /*label = new Label(0, i, "",wff_merge); + wsheet.addCell(label);*/ + label = new Label(0, i, " 合计(元):",wff_merge); + wsheet.addCell(label); + label = new Label(7, i, " "+totalmoney,wff_merge); + wsheet.addCell(label); + i++; + } + + wsheet.setRowView(i,390); + wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false); + wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setAlignment(Alignment.LEFT); + wff_merge.setBorder(Border.RIGHT, BorderLineStyle.THIN); + wsheet.mergeCells(1,i,7,i); + label = new Label(1, i, "1、请审核报价单,如数量有误,价格以单价为准,如型号规格或产品工艺不符,需重新报价;",wff_merge); + wsheet.addCell(label); + i++; + wsheet.setRowView(i,390); + wsheet.mergeCells(1,i,7,i); + label = new Label(1, i, "2、本报价为含税、含运费价,此价为即时参考价,具体单价因考虑付款等因素以签订合同为准;",wff_merge); + wsheet.addCell(label); + i++; + wsheet.setRowView(i,390); + wsheet.mergeCells(1,i,7,i); + label = new Label(1, i, "报价为国内报价,如需出口,须提供相应信息另行报价; ",wff_merge); + wsheet.addCell(label); + i++; + wsheet.setRowView(i,390); + wsheet.mergeCells(1,i,7,i); + + wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false); + wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setAlignment(Alignment.LEFT); + wff_merge.setBorder(Border.BOTTOM, BorderLineStyle.THIN); + wff_merge.setBorder(Border.RIGHT, BorderLineStyle.THIN); + + label = new Label(1, i, "3、分支电缆为多芯分支价格,不包其它附件,不含安装费,数量以供方实际测量为准;",wff_merge); + wsheet.addCell(label); + /*i++; + wsheet.setRowView(i,390); + wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false); + wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setAlignment(jxl.format.Alignment.LEFT); + wff_merge.setBorder(jxl.format.Border.BOTTOM,jxl.format.BorderLineStyle.THIN); + wff_merge.setBorder(jxl.format.Border.RIGHT,jxl.format.BorderLineStyle.THIN); + wsheet.mergeCells(1,i,7,i); +// label = new Label(1, i, "4、产品交货总数和单根交货长度允许有±1%公差,如有不符对方要求,需重制作报价单。",wff_merge); + wsheet.addCell(label);*/ + + wsheet.mergeCells(0,i-3,0,i); + wf_merge = new WritableFont(WritableFont.ARIAL,11,WritableFont.NO_BOLD,false); + wff_merge = new WritableCellFormat(wf_merge); + wff_merge.setAlignment(Alignment.CENTRE); + wff_merge.setVerticalAlignment(VerticalAlignment.CENTRE); + wff_merge.setBorder(Border.ALL, BorderLineStyle.THIN); + label = new Label(0, i-3, "备注",wff_merge); + wsheet.addCell(label); + + // 获取当前类加载器 + ClassLoader classLoader = Thread.currentThread().getContextClassLoader(); + // 获取资源的URL + URL resourceUrl = classLoader.getResource("jnlogo.png"); + File file=new File(resourceUrl.getPath()); + //设置图片位置,前两个参数为插入图片的单元格坐标,后面是设置从插入的单元格开始横向和纵向分别要占用的单元格个数,最后传入图片文件 + WritableImage image=new WritableImage(0.3, 0.2, 1.25, 2.55,file); + wsheet.addImage(image); + + // 获取当前类加载器 + ClassLoader classLoader2 = Thread.currentThread().getContextClassLoader(); + // 获取资源的URL + URL resourceUrl2 = classLoader2.getResource("wc.png"); + file=new File(resourceUrl2.getPath()); + //设置图片位置,前两个参数为插入图片的单元格坐标,后面是设置从插入的单元格开始横向和纵向分别要占用的单元格个数,最后传入图片文件 + image=new WritableImage(6.7, 0.2, 1.20, 2.65,file); + wsheet.addImage(image); + + wsheet.getSettings().setBottomMargin(0.7d); + wsheet.getSettings().setTopMargin(0.7d); + wsheet.getSettings().setLeftMargin(0.6d); + wsheet.getSettings().setRightMargin(0.2d); + + HeaderFooter footer = new HeaderFooter(); + footer.getCentre().append("第 "); + footer.getCentre().appendPageNumber(); + footer.getCentre().append(" 页,共 "); + footer.getCentre().appendTotalPages(); + footer.getCentre().append(" 页 "); + footer.getCentre().setFontName("ARIAL"); + footer.getCentre().setFontSize(13); + wsheet.getSettings().setFooter(footer); + + + wsheet.getSettings().setPrintTitles(0, 8, 0, 7); + + + + wwb.write(); + + wwb.close(); + os.close(); + response.flushBuffer(); + + + } catch (RowsExceededException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (WriteException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } catch (IOException e) { + e.printStackTrace(); + } + + } +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/quot/domain/Quot.java b/ruoyi-system/src/main/java/com/ruoyi/quot/domain/Quot.java index b2ea157..1d33e43 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/quot/domain/Quot.java +++ b/ruoyi-system/src/main/java/com/ruoyi/quot/domain/Quot.java @@ -49,6 +49,8 @@ public class Quot extends BaseEntity /** 地址 */ private String quotAddress; + /** 联系人 */ + private String quotContacts; /** 联系电话 */ private String quotPhone; @@ -216,6 +218,9 @@ public class Quot extends BaseEntity { return quotAddress; } + public String getQuotContacts() { return quotContacts; } + + public void setQuotContacts(String quotContacts) { this.quotContacts = quotContacts; } public void setQuotPhone(String quotPhone) { this.quotPhone = quotPhone; diff --git a/ruoyi-system/src/main/java/com/ruoyi/quot/domain/QuotMaterial.java b/ruoyi-system/src/main/java/com/ruoyi/quot/domain/QuotMaterial.java index 97417f7..6c7ea94 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/quot/domain/QuotMaterial.java +++ b/ruoyi-system/src/main/java/com/ruoyi/quot/domain/QuotMaterial.java @@ -47,6 +47,22 @@ public class QuotMaterial extends BaseEntity @Excel(name = "备注") private String matRemark; + /** 料价 */ + private BigDecimal matMatprice; + + /** 红本价 */ + private BigDecimal matPrice; + + /** 报价 */ + private BigDecimal matQuotPrice; + + /** 报价金额 */ + private BigDecimal matQuotAllPrice; + + /** 料价价差率 */ + private String matMatpriceDiff; + + /** */ private String quotId; @@ -110,6 +126,21 @@ public class QuotMaterial extends BaseEntity public String getMatRemark() { return matRemark; } public void setMatRemark(String matRemark) { this.matRemark = matRemark; } + public BigDecimal getMatMatprice() { return matMatprice; } + + public void setMatMatprice(BigDecimal matMatprice) { this.matMatprice = matMatprice; } + public BigDecimal getMatPrice() { return matPrice; } + + public void setMatPrice(BigDecimal matPrice) { this.matPrice = matPrice; } + public BigDecimal getMatQuotPrice() { return matQuotPrice; } + + public void setMatQuotPrice(BigDecimal matQuotPrice) { this.matQuotPrice = matQuotPrice; } + public BigDecimal getMatQuotAllPrice() { return matQuotAllPrice; } + + public void setMatQuotAllPrice(BigDecimal matQuotAllPrice) { this.matQuotAllPrice = matQuotAllPrice; } + public String getMatMatpriceDiff() { return matMatpriceDiff; } + + public void setMatMatpriceDiff(String matMatpriceDiff) { this.matMatpriceDiff = matMatpriceDiff; } public void setQuotId(String quotId) { this.quotId = quotId; @@ -119,17 +150,4 @@ public class QuotMaterial extends BaseEntity { return quotId; } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("matId", getMatId()) - .append("matXingh", getMatXingh()) - .append("matGuig", getMatGuig()) - .append("matDiany", getMatDiany()) - .append("matDanw", getMatDanw()) - .append("matSl", getMatSl()) - .append("quotId", getQuotId()) - .toString(); - } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/quot/service/impl/QuotServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/quot/service/impl/QuotServiceImpl.java index f0e498e..f66fe68 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/quot/service/impl/QuotServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/quot/service/impl/QuotServiceImpl.java @@ -178,7 +178,7 @@ public class QuotServiceImpl implements IQuotService } if (list.size() > 0) { - int batchSize = 200; // 每批次插入的数据量 + int batchSize = 100; // 每批次插入的数据量 for (int i = 0; i < list.size(); i += batchSize) { int toIndex = Math.min(i + batchSize, list.size()); List subList = list.subList(i, toIndex); diff --git a/ruoyi-system/src/main/resources/mapper/quot/QuotMapper.xml b/ruoyi-system/src/main/resources/mapper/quot/QuotMapper.xml index e47cd01..794423e 100644 --- a/ruoyi-system/src/main/resources/mapper/quot/QuotMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/quot/QuotMapper.xml @@ -126,7 +126,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - select count(1) from quot where quot_salesman_code != #{quotSalesmanCode} and quot_customer_bm = #{quotCustomerBm} and quot_project = #{quotProject} and quot_approval_status in ('1','2') diff --git a/ruoyi-ui/src/api/quot/quot.js b/ruoyi-ui/src/api/quot/quot.js index a093ef9..64611a8 100644 --- a/ruoyi-ui/src/api/quot/quot.js +++ b/ruoyi-ui/src/api/quot/quot.js @@ -1,4 +1,5 @@ import request from '@/utils/request' +import { getToken } from "@/utils/auth"; // 打印状态修改 export function changQuotPrintStatus(quotId, quotPrint) { @@ -118,6 +119,19 @@ export function feedbackQuot(data) { }) } +//生成报价单 +export function madeQuot(data) { + return request({ + url: '/quot/quot/madeQuot', + method: 'post', + responseType: "blob", // 表明返回服务器返回的数据类型 + headers: { + 'X-Authorization': getToken() + }, + data: data + }) +} + //驳回按钮 export function rejectQuot(data) { return request({ diff --git a/ruoyi-ui/src/views/quot/quot/index.vue b/ruoyi-ui/src/views/quot/quot/index.vue index 7a09494..42c5b96 100644 --- a/ruoyi-ui/src/views/quot/quot/index.vue +++ b/ruoyi-ui/src/views/quot/quot/index.vue @@ -1285,6 +1285,7 @@ 提交技术协助 提交核价审核 + 生成报价单 提交反馈 驳回 @@ -1361,7 +1362,7 @@