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 002fe95..05a021e 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 @@ -1,5 +1,6 @@ package com.ruoyi.web.controller.redBook; +import com.alibaba.fastjson.JSONArray; import com.ruoyi.common.annotation.DataSource; import com.ruoyi.common.annotation.Log; import com.ruoyi.common.constant.CacheConstants; @@ -14,6 +15,7 @@ import com.ruoyi.common.utils.StringUtils; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.utils.uuid.UUID; import com.ruoyi.customer.domain.Customer; +import com.ruoyi.quot.domain.Quot; import com.ruoyi.quot.domain.QuotMaterial; import com.ruoyi.redBook.domain.*; import com.ruoyi.redBook.service.IRedBookService; @@ -205,8 +207,9 @@ public class RedBookController extends BaseController List list = new ArrayList<>(); String name_0 = product.getName_0();//型号 String model = product.getModel();//规格 - if(!StringUtils.isEmpty(name_0) || !StringUtils.isEmpty(model) ){ - if(!StringUtils.isEmpty(name_0)){ + if(!StringUtils.isBlank(name_0) || !StringUtils.isBlank(model) ){ + if(!StringUtils.isBlank(name_0)){ + name_0 = name_0.replace(" ",""); name_0 = name_0.toUpperCase(); } list = redBookService.handleSearchData(name_0,model); @@ -226,7 +229,9 @@ public class RedBookController extends BaseController { if(StringUtils.isEmpty(quot.getQuot_id())){ quot.setQuot_id(UUID.fastUUID().toString()); - quot.setQuotCode(IdUtils.createNo("BJD_",0)); + //quot.setQuotCode(IdUtils.createNo("BJD_",0)); + String quotCode = redBookService.getCode("RB_BJD"); + quot.setQuotCode(quotCode); quot.setCreateBy(getUsername()); redBookService.insertOAQuot(quot); }else{ @@ -303,6 +308,22 @@ public class RedBookController extends BaseController for(OAQuotProductTemplate temp:tempList){ temp.setIndex(index); temp.setRbUid(rbUid); + + String name_1 = temp.getName_1(); + if(StringUtils.isNotBlank(name_1)){ + name_1 = name_1.replace(" ",""); + name_1 = name_1.toUpperCase(); + temp.setName_1(name_1); + } + + String spec = temp.getSpec(); + if(StringUtils.isNotBlank(spec)){ + spec = spec.replace(" ",""); + temp.setSpec(spec); + } + + String voltage = temp.getVoltage(); + temp.setVoltage(StringUtils.isBlank(voltage)?"0.6/1kV":voltage.replace(" ","")); index++; } @@ -454,4 +475,13 @@ public class RedBookController extends BaseController } return toAjax(redBookService.deleteQuotsByQuotId(quotId)); } + + + @PostMapping("/exportProduct") + public void exportMaterial(HttpServletResponse response, @RequestParam("selectedResultData") String selectedResultData) + { + List list = JSONArray.parseArray(selectedResultData, OAQuotProduct.class); + ExcelUtil util = new ExcelUtil(OAQuotProduct.class); + util.exportExcel(response, list, "报价明细数据"); + } } diff --git a/ruoyi-system/src/main/java/com/ruoyi/redBook/domain/OAQuotProduct.java b/ruoyi-system/src/main/java/com/ruoyi/redBook/domain/OAQuotProduct.java index a32a8a6..fe299cd 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/redBook/domain/OAQuotProduct.java +++ b/ruoyi-system/src/main/java/com/ruoyi/redBook/domain/OAQuotProduct.java @@ -1,17 +1,24 @@ package com.ruoyi.redBook.domain; +import com.ruoyi.common.annotation.Excel; + import java.math.BigDecimal; public class OAQuotProduct implements Comparable{ private Integer index;//序号 private String uid_0;//版本uid private String name_0;//产品型号 + @Excel(name = "型号") private String name_1;//型号 + @Excel(name = "规格") private String spec;//规格 + @Excel(name = "电压") private String voltage;//电压 + @Excel(name = "单位") private String stu;//单位 private String price;//红本价 private BigDecimal setPrice;//单价 + @Excel(name = "数量") private BigDecimal count;//数量 private BigDecimal allPrice;//金额 private String quot_product_id;//id diff --git a/ruoyi-system/src/main/java/com/ruoyi/redBook/domain/OAQuotProductTemplate.java b/ruoyi-system/src/main/java/com/ruoyi/redBook/domain/OAQuotProductTemplate.java index 2a3e286..4d869e8 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/redBook/domain/OAQuotProductTemplate.java +++ b/ruoyi-system/src/main/java/com/ruoyi/redBook/domain/OAQuotProductTemplate.java @@ -15,6 +15,9 @@ public class OAQuotProductTemplate { @Excel(name = "规格") private String spec;//规格 + @Excel(name = "电压") + private String voltage;//电压 + @Excel(name = "数量") private BigDecimal count;//数量 @@ -42,6 +45,10 @@ public class OAQuotProductTemplate { this.spec = spec; } + public String getVoltage() {return voltage;} + + public void setVoltage(String voltage) {this.voltage = voltage;} + public BigDecimal getCount() { return count; } diff --git a/ruoyi-system/src/main/java/com/ruoyi/redBook/mapper/OARedBookMapper.java b/ruoyi-system/src/main/java/com/ruoyi/redBook/mapper/OARedBookMapper.java index 157af00..1449355 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/redBook/mapper/OARedBookMapper.java +++ b/ruoyi-system/src/main/java/com/ruoyi/redBook/mapper/OARedBookMapper.java @@ -123,7 +123,7 @@ public interface OARedBookMapper * @param rbUid * @return */ - OAQuotProduct getFixDatePrice2(@Param("name_1") String name_1, @Param("spec") String spec, @Param("uid_0") String rbUid); + OAQuotProduct getFixDatePrice2(@Param("name_1") String name_1, @Param("spec") String spec, @Param("voltage") String voltage, @Param("uid_0") String rbUid); /** * 查询已生成的报价单列表 @@ -153,4 +153,10 @@ public interface OARedBookMapper */ String rb_price_version(); + /** + * 获取单据编号 + * @param type + * @return + */ + String getCode(String type); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/redBook/service/IRedBookService.java b/ruoyi-system/src/main/java/com/ruoyi/redBook/service/IRedBookService.java index 7a4ecfb..158e2d1 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/redBook/service/IRedBookService.java +++ b/ruoyi-system/src/main/java/com/ruoyi/redBook/service/IRedBookService.java @@ -147,4 +147,10 @@ public interface IRedBookService */ List setRedBookPrice2(List list); + /** + * 获取单据编号 + * @param type + * @return + */ + String getCode(String type); } diff --git a/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/RedBookServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/RedBookServiceImpl.java index d9957b0..af048fd 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/RedBookServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/redBook/service/impl/RedBookServiceImpl.java @@ -223,7 +223,7 @@ public class RedBookServiceImpl implements IRedBookService List OAQuotProducts = new ArrayList<>(); OAQuotProduct oAQuotProduct = new OAQuotProduct(); for(OAQuotProductTemplate oAQuotProductTemplate : list){ - OAQuotProduct rbProduct = oaRedBookMapper.getFixDatePrice2(oAQuotProductTemplate.getName_1(),oAQuotProductTemplate.getSpec(),oAQuotProductTemplate.getRbUid()); + OAQuotProduct rbProduct = oaRedBookMapper.getFixDatePrice2(oAQuotProductTemplate.getName_1(),oAQuotProductTemplate.getSpec(),oAQuotProductTemplate.getVoltage(),oAQuotProductTemplate.getRbUid()); if(rbProduct!=null){ oAQuotProduct = new OAQuotProduct(); oAQuotProduct.setIndex(oAQuotProductTemplate.getIndex()); @@ -241,6 +241,16 @@ public class RedBookServiceImpl implements IRedBookService return OAQuotProducts; } + /** + * 获取单据编号 + * @param type + * @return + */ + @Override + public String getCode(String type) { + return oaRedBookMapper.getCode(type); + } + /** * 查询已生成的报价单列表 diff --git a/ruoyi-system/src/main/resources/mapper/redBook/OARedBookMapper.xml b/ruoyi-system/src/main/resources/mapper/redBook/OARedBookMapper.xml index e0fe44b..3dd0b73 100644 --- a/ruoyi-system/src/main/resources/mapper/redBook/OARedBookMapper.xml +++ b/ruoyi-system/src/main/resources/mapper/redBook/OARedBookMapper.xml @@ -178,7 +178,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" convert(decimal,convert(float,A.红本价格)) price,convert(varchar(10),B.date_0,23) pricedate from [rb_product_price] A left join rb_productVersion B on A.version_uid_0=B.uid_0 - where A.型号 = #{name_1} and A.规格 = #{spec} + where A.型号 = #{name_1} and A.规格 = #{spec} and A.电压等级 = #{voltage} and B.uid_0 = #{uid_0} and (B.sta_0=1 or sta_0=0) @@ -209,7 +209,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ${params.dataScope} - order by a.update_time desc + order by a.quotCode desc @@ -270,4 +270,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" )a order by date_0 desc + + diff --git a/ruoyi-ui/src/views/quot/quot/index.vue b/ruoyi-ui/src/views/quot/quot/index.vue index c152544..dcf9b9f 100644 --- a/ruoyi-ui/src/views/quot/quot/index.vue +++ b/ruoyi-ui/src/views/quot/quot/index.vue @@ -318,8 +318,8 @@ - - + + @@ -347,8 +347,8 @@ - - + + @@ -425,7 +425,7 @@ 删除 - 导入 + 导入 导出 @@ -1126,6 +1126,12 @@ export default { quotQuotationRequire: [ { required: true, message: "报价要求不能为空", trigger: "blur" } ], + quotMaterialsCount: [ + { required: true, message: "明细条数不能为空", trigger: "blur" } + ], + quotTotalPrice: [ + { required: true, message: "总价不能为空", trigger: "blur" } + ], }, //技术协助-特缆、低压、中压、其他 隐藏控制 @@ -1454,6 +1460,13 @@ export default { /** 报价组报价单提交反馈按钮 */ feedbackQuotForm() { + const quotTotalPrice = this.form.quotTotalPrice; + const quotMaterialsCount = this.form.quotMaterialsCount; + if(!quotTotalPrice || !quotMaterialsCount ){ + this.$modal.msgError("明细条数或总价未填"); + return; + } + const quotFkFileNum = this.quotFkFileList.length; if(quotFkFileNum==0){ this.$modal.msgError("反馈附件必须上传"); diff --git a/ruoyi-ui/src/views/redBook/productSelect.vue b/ruoyi-ui/src/views/redBook/productSelect.vue index cefdb4d..5c17411 100644 --- a/ruoyi-ui/src/views/redBook/productSelect.vue +++ b/ruoyi-ui/src/views/redBook/productSelect.vue @@ -759,7 +759,7 @@ // 处理返回的文件流 const content = response; const blob = new Blob([content]); - const fileName = "BJD_"+this.getTodayCourse()+".xls"; + const fileName = "RB_BJD_"+this.getTodayCourse()+".xls"; if ("download" in document.createElement("a")) { // 非IE下载 const elink = document.createElement("a"); @@ -817,7 +817,10 @@ // 导出明细 handleExport(){ - this.$modal.msgWarning("功能还未开放"); + const fileName = "RB_BJD_"+this.getTodayCourse(); + this.download('redBook/redBook/exportProduct', { + selectedResultData: JSON.stringify(this.selectedResultData) + }, fileName +".xlsx") }, //获取调价日期 diff --git a/ruoyi-ui/src/views/redBook/quots.vue b/ruoyi-ui/src/views/redBook/quots.vue index f151e8c..16f9cc4 100644 --- a/ruoyi-ui/src/views/redBook/quots.vue +++ b/ruoyi-ui/src/views/redBook/quots.vue @@ -119,8 +119,8 @@ - - + 导出 + @@ -433,7 +433,7 @@ const content = response; const blob = new Blob([content]); - let fileName = "BJD_"+this.getTodayCourse()+".xls"; + let fileName = "RB_BJD_"+this.getTodayCourse()+".xls"; if(this.form.quotCode){ fileName = this.form.quotCode+".xls"; } @@ -454,6 +454,18 @@ } }); }, + + // 导出明细 + handleExport(){ + let fileName = "RB_BJD_"+this.getTodayCourse(); + if(this.form.quotCode){ + fileName = this.form.quotCode; + } + this.download('redBook/redBook/exportProduct', { + selectedResultData: JSON.stringify(this.selectedResultData) + }, fileName +".xlsx") + }, + // 获取当前时间 getTodayCourse(){ const myDate = new Date();