From f3b3801cd7110f262ca816666b0da68a533520b2 Mon Sep 17 00:00:00 2001 From: zhangsiqi <2825463979@qq.com> Date: Tue, 18 Jun 2024 17:30:27 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=20=E9=87=87=E8=B4=AD=E7=AE=A1=E7=90=86?= =?UTF-8?q?=EF=BC=9A=E9=87=87=E8=B4=AD=E8=AE=A1=E5=88=92=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E5=8D=95=EF=BC=8C=E6=A0=B9=E6=8D=AE=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E5=8D=95=E5=8F=B7=EF=BC=8C=E6=8A=A5=E4=BB=B7=E7=89=A9?= =?UTF-8?q?=E6=96=99=E5=88=86=E7=BB=84=E6=9F=A5=E8=AF=A2=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=AD=97=E6=AE=B5=E4=BE=9B=E5=BA=94=E5=95=86=EF=BC=8C?= =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E6=8A=A5=E4=BB=B7=EF=BC=8C=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E9=87=87=E8=B4=AD=E5=8D=95=E5=88=86=E7=BB=84=E4=BE=9D?= =?UTF-8?q?=E6=8D=AE=E7=BB=84=E5=90=88=E5=85=B3=E8=81=94=E5=8D=95=E5=8F=B7?= =?UTF-8?q?=EF=BC=8C=E6=9F=A5=E8=AF=A2=E4=BE=9B=E5=BA=94=E5=95=86=E7=9A=84?= =?UTF-8?q?=E6=8A=A5=E4=BB=B7=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/PurchasePlanController.java | 17 +- .../purchase/domain/PurchasePlanChild.java | 47 ++++- .../purchase/domain/PurchaseQuoteChild.java | 43 ++++- .../mapper/PurchasePlanChildMapper.java | 5 + .../mapper/PurchaseQuoteChildMapper.java | 2 +- .../service/IPurchasePlanChildService.java | 2 + .../impl/PurchasePlanChildServiceImpl.java | 7 + .../service/impl/PurchasePlanServiceImpl.java | 9 +- .../impl/PurchaseQuoteServiceImpl.java | 4 + .../purchase/PurchasePlanChildMapper.xml | 100 +++++++--- .../purchase/PurchaseQuoteChildMapper.xml | 22 ++- .../templates/purchase/purchasePlan/add.html | 4 +- .../purchasePlan/addPurchaseOrder.html | 174 +++++++++--------- .../templates/purchase/purchaseQuote/add.html | 6 +- 14 files changed, 289 insertions(+), 153 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java index 81073f24..fe293a93 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/controller/PurchasePlanController.java @@ -1,7 +1,9 @@ package com.ruoyi.purchase.controller; +import java.util.Arrays; import java.util.List; +import com.ruoyi.common.core.text.Convert; import com.ruoyi.purchase.domain.PurchasePlan; import com.ruoyi.purchase.domain.PurchasePlanChild; import com.ruoyi.purchase.domain.PurchaseQuoteChild; @@ -111,13 +113,20 @@ public class PurchasePlanController extends BaseController } @GetMapping("/addPurchaseOrder/{purchasePlanCodes}") public String purChaseOrder(@PathVariable("purchasePlanCodes") String purchasePlanCodes,ModelMap mmap){ + //purchasePlanCodes去除重复数据,purchasePlanCodeArray作为数组类型去除 + String purchasePlanCode = purchasePlanCodes; + String[] purchasePlanCodeArray = purchasePlanCodes.split(","); + purchasePlanCodes = Arrays.toString(Arrays.stream(purchasePlanCodeArray).distinct().toArray()); //查询相关采购计划数据 - List purchasePlanList = purchasePlanService.selectPurchasePlanByPlanCode(purchasePlanCodes); + List purchasePlanList = purchasePlanService.selectPurchasePlanByPlanCode(purchasePlanCode); //根据采购计划编号查询对应的采购报价数据 - List purchasePlanChildList = purchasePlanChildService.selectPurchasePlanChildListByPlanCodes(purchasePlanCodes); - //把物料根据供应商分组,然后根据供应商分组查询对应的供应商报价数据 - //再根据采购计划编号分组查询对应的采购报价数据 + List purchasePlanChildList = purchasePlanChildService.getPurchasePlanChildByPlanCodes(purchasePlanCode); + //再根据采购计划编号分组查询对应的采购报价数据分组 + + purchasePlanCodes = purchasePlanCodes.replace("[","").replace("]",""); + //查询物料报价中供应商 mmap.put("purchasePlanList", purchasePlanList); + mmap.put("purchasePlanCodes", purchasePlanCodes); mmap.put("purchasePlanChildList", purchasePlanChildList); return prefix + "/addPurchaseOrder"; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlanChild.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlanChild.java index 98116ed5..d6c0bcf3 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlanChild.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlanChild.java @@ -1,6 +1,8 @@ package com.ruoyi.purchase.domain; import java.math.BigDecimal; +import java.util.List; + import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; @@ -66,7 +68,12 @@ public class PurchasePlanChild extends BaseEntity private BigDecimal materialRmb; /** 物料的含税单价(RMB) */ - private BigDecimal materialNormb; + private BigDecimal materialNoRmb; + + /*供应商编号*/ + private String supplierCode; + /** 物料供应商 */ + private String supplierName; /** 使用状态 */ private String useStatus; @@ -77,6 +84,8 @@ public class PurchasePlanChild extends BaseEntity /** 删除标志 */ private String delFlag; + private List purchaseQuoteChildList; + public void setPurchasePlanChildId(Long purchasePlanChildId) { this.purchasePlanChildId = purchasePlanChildId; @@ -194,21 +203,45 @@ public class PurchasePlanChild extends BaseEntity { return materialRmb; } - public void setMaterialNormb(BigDecimal materialNormb) + public void setMaterialNoRmb(BigDecimal materialNoRmb) { - this.materialNormb = materialNormb; + this.materialNoRmb = materialNoRmb; } - public BigDecimal getMaterialNormb() + public BigDecimal getMaterialNoRmb() { - return materialNormb; + return materialNoRmb; } public void setUseStatus(String useStatus) { this.useStatus = useStatus; } - public String getUseStatus() + public String getSupplierCode() { + return supplierCode; + } + + public void setSupplierCode(String supplierCode) { + this.supplierCode = supplierCode; + } + + public String getSupplierName() { + return supplierName; + } + + public void setSupplierName(String supplierName) { + this.supplierName = supplierName; + } + + public List getPurchaseQuoteChildList() { + return purchaseQuoteChildList; + } + + public void setPurchaseQuoteChildList(List purchaseQuoteChildList) { + this.purchaseQuoteChildList = purchaseQuoteChildList; + } + + public String getUseStatus() { return useStatus; } @@ -247,7 +280,7 @@ public class PurchasePlanChild extends BaseEntity .append("materialNum", getMaterialNum()) .append("materialSole", getMaterialSole()) .append("materialRmb", getMaterialRmb()) - .append("materialNormb", getMaterialNormb()) + .append("materialNoRmb", getMaterialNoRmb()) .append("createBy", getCreateBy()) .append("createTime", getCreateTime()) .append("updateBy", getUpdateBy()) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseQuoteChild.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseQuoteChild.java index b1a187cb..63027204 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseQuoteChild.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchaseQuoteChild.java @@ -75,7 +75,11 @@ public class PurchaseQuoteChild extends BaseEntity /** 物料的含税单价(RMB) */ @Excel(name = "物料的含税单价(RMB)") - private BigDecimal materialNormb; + private BigDecimal materialNoRmb; + + private String supplierCode; + + private String supplierName; /** 删除状态 */ @Excel(name = "删除状态") @@ -223,21 +227,46 @@ public class PurchaseQuoteChild extends BaseEntity { return materialRmb; } - public void setMaterialNormb(BigDecimal materialNormb) + public void setMaterialNormb(BigDecimal materialNoRmb) { - this.materialNormb = materialNormb; + this.materialNoRmb = materialNoRmb; } public BigDecimal getMaterialNormb() { - return materialNormb; + return materialNoRmb; } public void setUseStatus(String useStatus) { this.useStatus = useStatus; } - public String getUseStatus() + + public BigDecimal getMaterialNoRmb() { + return materialNoRmb; + } + + public void setMaterialNoRmb(BigDecimal materialNoRmb) { + this.materialNoRmb = materialNoRmb; + } + + public String getSupplierCode() { + return supplierCode; + } + + public void setSupplierCode(String supplierCode) { + this.supplierCode = supplierCode; + } + + public String getSupplierName() { + return supplierName; + } + + public void setSupplierName(String supplierName) { + this.supplierName = supplierName; + } + + public String getUseStatus() { return useStatus; } @@ -278,7 +307,9 @@ public class PurchaseQuoteChild extends BaseEntity .append("materialNum", getMaterialNum()) .append("materialSole", getMaterialSole()) .append("materialRmb", getMaterialRmb()) - .append("materialNormb", getMaterialNormb()) + .append("materialNoRmb", getMaterialNormb()) + .append("supplierCode", getSupplierCode()) + .append("supplierName", getSupplierName()) .append("createBy", getCreateBy()) .append("createTime", getCreateTime()) .append("updateBy", getUpdateBy()) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchasePlanChildMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchasePlanChildMapper.java index 10aee428..72e8c520 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchasePlanChildMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchasePlanChildMapper.java @@ -76,4 +76,9 @@ public interface PurchasePlanChildMapper public int restorePurchasePlanChildById(Long purchasePlanChildId); List selectPurchasePlanChildListByPlanCodes(String[] purchasePlanCodes); + + + List getPurchasePlanChildByPlanCodes(String[] purchasePlanCodes); + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseQuoteChildMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseQuoteChildMapper.java index bff8eb7d..edfb285b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseQuoteChildMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/mapper/PurchaseQuoteChildMapper.java @@ -22,7 +22,7 @@ public interface PurchaseQuoteChildMapper /** * 查询采购报价单物料信息列表 * - * @param sysPurchaseQuoteChild 采购报价单物料信息 + * @param purchaseQuoteChild 采购报价单物料信息 * @return 采购报价单物料信息集合 */ public List selectPurchaseQuoteChildList(PurchaseQuoteChild purchaseQuoteChild); diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanChildService.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanChildService.java index 9103e9ed..7f9647ec 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanChildService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/IPurchasePlanChildService.java @@ -79,4 +79,6 @@ public interface IPurchasePlanChildService * @return */ List selectPurchasePlanChildListByPlanCodes(String purchasePlanCodes); + + List getPurchasePlanChildByPlanCodes(String purchaseplanCodes); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanChildServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanChildServiceImpl.java index 921eccf6..4868b514 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanChildServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanChildServiceImpl.java @@ -129,4 +129,11 @@ public class PurchasePlanChildServiceImpl implements IPurchasePlanChildService { return purchasePlanChildMapper.selectPurchasePlanChildListByPlanCodes(Convert.toStrArray(purchasePlanCodes)); } + + + @Override + public List getPurchasePlanChildByPlanCodes(String purchaseplanCodes) + { + return purchasePlanChildMapper.getPurchasePlanChildByPlanCodes(Convert.toStrArray(purchaseplanCodes)); + } } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java index ec1b1495..06210031 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchasePlanServiceImpl.java @@ -4,6 +4,8 @@ import java.time.LocalDateTime; import java.time.format.DateTimeFormatter; import java.util.Date; import java.util.List; + +import com.ruoyi.common.core.redis.RedisCache; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.common.utils.StringUtils; @@ -37,6 +39,9 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService @Autowired private PurchasePlanChildMapper purchasePlanChildMapper; + @Autowired + private RedisCache redisCache; + /** * 查询采购计划单 * @@ -168,7 +173,7 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService private String generateUniquePurchasePlanCode() { // 实现生成唯一采购计划单号的逻辑 // 示例代码,实际情况可能依赖于日期、序列号等 - return "PP-" + LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyyMMddHHmmss")); + return redisCache.generateBillNo("CGJH"); } private PurchasePlan buildPurchasePlan(SysMakeOrder sysMakeOrder, String purchasePlanCode) { @@ -188,6 +193,8 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService purchasePlan.setApplyUser(sysMakeOrder.getSalesman()); purchasePlan.setCreateBy(ShiroUtils.getLoginName()); purchasePlan.setCreateTime(new Date()); + purchasePlan.setAuditStatus("0"); + purchasePlan.setUseStatus("0"); purchasePlan.setPurchasePlanStatus("0"); return purchasePlan; } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java index b874b68a..7aac7fd9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseQuoteServiceImpl.java @@ -125,6 +125,8 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService for(PurchaseQuoteChild child : purchaseQuote.getPurchaseQuoteChildList()){ child.setPurchaseQuoteCode(purchaseQuote.getPurchaseQuoteCode()); child.setCreateBy(loginName); + child.setSupplierCode(purchaseQuote.getPurchaseQuoteCode()); + child.setSupplierName(purchaseQuote.getSupplierName()); child.setCreateTime(DateUtils.getNowDate()); child.setTaxRate(purchaseQuote.getTaxRate()); purchaseQuoteChildService.insertPurchaseQuoteChild(child); @@ -175,6 +177,8 @@ public class PurchaseQuoteServiceImpl implements IPurchaseQuoteService if(childResult > 0){ for(PurchaseQuoteChild child : purchaseQuote.getPurchaseQuoteChildList()){ child.setPurchaseQuoteCode(purchaseQuote.getPurchaseQuoteCode()); + child.setSupplierCode(purchaseQuote.getPurchaseQuoteCode()); + child.setSupplierName(purchaseQuote.getSupplierName()); child.setCreateBy(loginName); child.setCreateTime(DateUtils.getNowDate()); child.setTaxRate(purchaseQuote.getTaxRate()); diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml index 9f4ae98d..20916f8c 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml @@ -3,36 +3,46 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - select purchase_plan_child_id, purchase_plan_code, material_id, material_code, material_name, material_type, process_method, brand, - photoUrl, `describe`, material_num, material_sole, material_rmb, + photoUrl, `describe`, material_num, material_sole, material_rmb,supplier_code,supplier_name, material_noRmb, create_by, create_time, update_by, update_time, remark, use_status, audit_status, del_flag from purchase_plan_child @@ -81,7 +91,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" material_num, material_sole, material_rmb, - material_noRmb, + material_noRmb, create_by, create_time, update_by, @@ -104,7 +114,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{materialNum}, #{materialSole}, #{materialRmb}, - #{materialNormb}, + #{materialNormb}, #{createBy}, #{createTime}, #{updateBy}, @@ -131,7 +141,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" material_num = #{materialNum}, material_sole = #{materialSole}, material_rmb = #{materialRmb}, - material_noRmb = #{materialNormb}, + material_noRmb = #{materialNoRmb}, create_by = #{createBy}, create_time = #{createTime}, update_by = #{updateBy}, @@ -162,5 +172,37 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" update purchase_plan_child set del_flag = '0' where purchase_plan_child_id = #{purchasePlanChildId} - + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteChildMapper.xml index 81a53207..d44c79de 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteChildMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchaseQuoteChildMapper.xml @@ -19,7 +19,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - + + + @@ -33,7 +35,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" select purchase_quote_child_id, purchase_quote_code, material_id, material_code, material_name, material_type, processMethod, brand, photoUrl, `describe`, tax_rate, usd_rate, - material_num, material_sole, material_rmb, material_noRmb, + material_num, material_sole, material_rmb, material_noRmb,supplier_code, supplier_name, create_by, create_time, update_by, update_time, remark, use_status, audit_status, del_flag from purchase_quote_child @@ -41,7 +43,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" + -
+
-
-
-
- 物料信息1 -
-
-
-
-
-
-
+
+
@@ -67,72 +58,85 @@ \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/add.html b/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/add.html index 7e5ead72..4dffe6a5 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/add.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchaseQuote/add.html @@ -10,10 +10,10 @@
-
- +