From 5500865af9cdcd7f261805063bbae2394b854cb2 Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Tue, 19 Nov 2024 15:30:52 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=20=E6=B7=BB=E5=8A=A0=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E8=AE=A2=E5=8D=95=E5=89=8D=E7=AB=AF=E9=A1=B5=E9=9D=A2=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=EF=BC=9A=E6=9C=AC=E6=AC=A1=E5=8D=A0=E7=94=A8=E5=85=B1?= =?UTF-8?q?=E4=BA=AB=E5=BA=93=E5=AD=98=E6=95=B0=E6=96=B0=E5=A2=9E=20?= =?UTF-8?q?=E6=9D=A1=E4=BB=B6=EF=BC=8C=E5=A6=82=E6=9E=9C=E5=85=B1=E4=BA=AB?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E5=8D=A0=E7=94=A8=E6=95=B0=E4=B8=BA0?= =?UTF-8?q?=EF=BC=8C=E5=88=99=E5=85=B6=E7=9A=84=E7=BB=93=E6=9E=9C=E4=B8=BA?= =?UTF-8?q?0=EF=BC=8C=E4=B8=94=E4=B8=8D=E5=8F=AF=E7=BC=96=E8=BE=91?= =?UTF-8?q?=EF=BC=9B=E5=90=A6=E5=88=99=E5=8F=AF=E7=BC=96=E8=BE=91=EF=BC=9B?= =?UTF-8?q?=E8=AE=BE=E7=BD=AE=E6=9C=AC=E6=AC=A1=E9=87=87=E8=B4=AD=E6=95=B0?= =?UTF-8?q?=E4=B8=8D=E8=83=BD=E5=B0=8F=E4=BA=8E=E7=AD=89=E4=BA=8E0?= =?UTF-8?q?=EF=BC=9B=E6=8F=90=E4=BA=A4=E7=9A=84=E6=97=B6=E5=80=99=E5=8E=BB?= =?UTF-8?q?=E6=8E=89=E6=9C=AC=E6=AC=A1=E5=8D=A0=E7=94=A8=E5=85=B1=E4=BA=AB?= =?UTF-8?q?=E5=BA=93=E5=AD=98=E6=95=B0=E4=B8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=92=E5=8D=95=E2=80=9C?= =?UTF-8?q?=EF=BC=9B=20=E9=87=87=E8=B4=AD=E8=AE=A1=E5=88=92=E5=AD=90?= =?UTF-8?q?=E8=A1=A8=E6=96=B0=E5=A2=9E=20=E9=80=9A=E8=BF=87=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E8=AE=A1=E5=88=92=E5=AD=90=E8=A1=A8ID=E9=9B=86?= =?UTF-8?q?=E5=90=88=E6=9F=A5=E8=AF=A2=E9=87=87=E8=B4=AD=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E5=AD=90=E8=A1=A8=E6=95=B0=E6=8D=AE=E6=96=B9=E6=B3=95=20?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=87=E8=B4=AD=E8=AE=A1=E5=88=92=20?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95=E7=AC=AC?= =?UTF-8?q?=E4=BA=8C=E6=AD=A5=E5=B1=95=E7=A4=BA=E9=80=89=E7=89=A9=E6=96=99?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E5=90=8E=E7=AB=AF=E6=96=B9=E6=B3=95=E5=AE=9E?= =?UTF-8?q?=E7=8E=B0=EF=BC=9A=E5=90=88=E5=B9=B6=E9=87=87=E8=B4=AD=E8=AE=A1?= =?UTF-8?q?=E5=88=92=E6=B7=BB=E5=8A=A0=E9=87=87=E8=B4=AD=E8=AE=A2=E5=8D=95?= =?UTF-8?q?=E5=90=8E=EF=BC=8C=E6=96=99=E5=8F=B7=E7=9B=B8=E7=AD=89=E7=9A=84?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=EF=BC=9B=E5=90=88=E5=B9=B6setPurchaseNum?= =?UTF-8?q?=E3=80=81setSharedAvailableInventoryNum=E3=80=81setLatestQuoteR?= =?UTF-8?q?mb=E3=80=81setMaterialNoRmbSum=E3=80=81setMaterialRmbSum?= =?UTF-8?q?=EF=BC=9B=E5=A4=84=E7=90=86=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anChildList=EF=BC=8C?= =?UTF-8?q?=E5=8F=AA=E4=BF=9D=E7=95=99=E5=92=8C=E5=89=8D=E7=AB=AF=20collec?= =?UTF-8?q?tMaterialNo=20=E7=9B=B8=E7=AD=89=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E3=80=81=E5=B0=86=E6=97=A7=E6=95=B0=E6=8D=AE=E6=8C=89=E7=89=A9?= =?UTF-8?q?=E6=96=99=E7=BC=96=E5=8F=B7=E5=88=86=E7=BB=84=E3=80=81=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E5=BD=93=E5=89=8D=E6=97=B6=E9=97=B4=E3=80=81=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E9=81=8D=E5=8E=86=E5=89=8D=E7=AB=AF=E4=BC=A0=E5=85=A5?= =?UTF-8?q?=E7=9A=84=E6=95=B0=E6=8D=AE=20=EF=BC=8C=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E6=97=A7=E6=95=B0=E6=8D=AE=E4=B8=AD=E7=9B=B8=E5=90=8C=E7=89=A9?= =?UTF-8?q?=E6=96=99=E7=BC=96=E5=8F=B7=E7=9A=84=E6=95=B0=E6=8D=AE=E3=80=81?= =?UTF-8?q?=20=E6=8C=89=E7=85=A7=20=E8=AE=A2=E5=8D=95=E5=88=9B=E5=BB=BA?= =?UTF-8?q?=E6=97=B6=E9=97=B4=20=E8=BF=9C=E7=A6=BB=E5=BD=93=E5=89=8D?= =?UTF-8?q?=E6=97=B6=E9=97=B4=E6=8E=92=E5=BA=8F=E3=80=81=E8=AE=A1=E7=AE=97?= =?UTF-8?q?=20=E6=9C=AC=E6=AC=A1=E9=87=87=E8=B4=AD=E6=95=B0=E4=B9=9F?= =?UTF-8?q?=E6=98=AF=E5=AE=9E=E9=99=85=E9=87=87=E8=B4=AD=E6=95=B0=E3=80=81?= =?UTF-8?q?=E8=AE=A1=E7=AE=97=E5=BE=85=E9=87=87=E8=B4=AD=E6=95=B0=E3=80=81?= =?UTF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=8E=E7=9A=84=E5=AD=90?= =?UTF-8?q?=E8=A1=A8=E6=95=B0=E6=8D=AE=E3=80=81=E6=9B=B4=E6=96=B0=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E8=AE=A1=E5=88=92=E5=AD=90=E8=A1=A8=EF=BC=9B=20?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E5=A4=84=E7=90=86=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E4=B8=BB=E8=A1=A8=E5=90=8E=E7=AB=AF=E6=96=B9?= =?UTF-8?q?=E6=B3=95,=E5=AE=9E=E7=8E=B0=EF=BC=9A=E6=9C=AC=E6=AC=A1?= =?UTF-8?q?=E5=87=BA=E8=B4=A7=E7=9A=84=E6=89=80=E6=9C=89=E9=87=87=E8=B4=AD?= =?UTF-8?q?=E8=AE=A1=E5=88=92=E5=AD=90=E8=A1=A8=E7=9A=84=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=EF=BC=8C=E6=8A=8ApurchasePlanChildList=E6=8C=89=E7=85=A7?= =?UTF-8?q?=E7=89=A9=E6=96=99=E9=87=87=E8=B4=AD=E8=AE=A1=E5=88=92=E5=8D=95?= =?UTF-8?q?=E5=8F=B7=E8=BF=9B=E8=A1=8C=E5=88=86=E7=BB=84=E3=80=81=E5=BE=97?= =?UTF-8?q?=E5=88=B0=E6=9C=AC=E6=AC=A1=E9=87=87=E8=B4=AD=E7=9A=84=E6=89=80?= =?UTF-8?q?=E6=9C=89=E9=87=87=E8=B4=AD=E8=AE=A1=E5=88=92=E5=8D=95=E5=8F=B7?= =?UTF-8?q?=E3=80=81=E5=BE=97=E5=88=B0=E6=9C=AC=E6=AC=A1=E5=87=BA=E8=B4=A7?= =?UTF-8?q?=E7=9A=84=E6=89=80=E6=9C=89=E9=87=87=E8=B4=AD=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E5=8D=95=E6=95=B0=E6=8D=AE=E5=BA=93=E4=B8=AD=E7=9A=84=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E3=80=81=E5=88=9B=E5=BB=BA=E4=B8=80=E4=B8=AA=20map=20?= =?UTF-8?q?=E7=94=A8=E4=BA=8E=E5=BF=AB=E9=80=9F=E6=9F=A5=E6=89=BE=E4=B8=BB?= =?UTF-8?q?=E8=A1=A8=E6=95=B0=E6=8D=AE=E3=80=81=E9=81=8D=E5=8E=86=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=E4=B8=BB=E8=A1=A8=E6=95=B0=E6=8D=AE=E3=80=81=E9=80=9A?= =?UTF-8?q?=E8=BF=87=E9=87=87=E8=B4=AD=E5=8D=95=E5=8F=B7=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E4=B8=BB=E8=A1=A8=E6=95=B0=E6=8D=AE=E3=80=81=E5=88=9D=E5=A7=8B?= =?UTF-8?q?=E5=8C=96=20actualPurchaseSum=E3=80=81=E7=B4=AF=E5=8A=A0=20actu?= =?UTF-8?q?alPurchaseSum=E3=80=81=E6=9B=B4=E6=96=B0=20purchaseSum=E3=80=81?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=87=87=E8=B4=AD=E8=AE=A1=E5=88=92=E7=8A=B6?= =?UTF-8?q?=E6=80=81=EF=BC=9A=E5=A6=82=E6=9E=9C=E5=AE=9E=E9=99=85=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E6=95=B0=E5=B0=8F=E4=BA=8E=E8=AE=A1=E5=88=92=E9=87=87?= =?UTF-8?q?=E8=B4=AD=E6=95=B0=EF=BC=8C=E7=8A=B6=E6=80=81=E4=B8=BA=E5=BE=85?= =?UTF-8?q?=E7=94=B3=E8=AF=B7=EF=BC=9B=E5=A6=82=E6=9E=9C=E5=AE=9E=E9=99=85?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E6=95=B0=E7=AD=89=E4=BA=8E=E8=AE=A1=E5=88=92?= =?UTF-8?q?=E9=87=87=E8=B4=AD=E6=95=B0=EF=BC=8C=E7=8A=B6=E6=80=81=E4=B8=BA?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E7=94=B3=E8=AF=B7=E3=80=81=E6=9B=B4=E6=96=B0?= =?UTF-8?q?=E4=B8=BB=E8=A1=A8=E6=95=B0=E6=8D=AE=E5=88=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ruoyi/purchase/domain/PurchasePlan.java | 2 +- .../mapper/PurchasePlanChildMapper.java | 6 + .../impl/PurchaseOrderServiceImpl.java | 192 ++++++++++++++++++ .../service/impl/PurchasePlanServiceImpl.java | 59 +++++- .../purchase/PurchasePlanChildMapper.xml | 8 + .../purchasePlan/addPurchaseOrder.html | 18 +- .../purchase/purchasePlan/purchasePlan.html | 50 +++-- 7 files changed, 307 insertions(+), 28 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlan.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlan.java index 8aa67b2f..fb947531 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlan.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/domain/PurchasePlan.java @@ -51,7 +51,7 @@ public class PurchasePlan extends BaseEntity @Excel(name = "含税总价(RMB)") private BigDecimal rmbSum; - /** 计划采购总数 */ + /** 计划采购总数为之前的数量合计 */ @Excel(name = "计划采购总数") private Integer planPurchaseSum; 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 785700a4..bc0de6a2 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 @@ -101,4 +101,10 @@ public interface PurchasePlanChildMapper * 通过采购计划单号集合查询采购计划子表数据 * */ List selectPurchasePlanChildPlanCodeList(List purchasePlanCodeList); + + /* + * + * 通过采购计划子表ID集合查询采购计划子表数据 + * */ + List selectBatchPurchasePlanChildByIdList(List collectPurchasePlanChildId); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java index 4f551164..4cf9739c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/purchase/service/impl/PurchaseOrderServiceImpl.java @@ -38,6 +38,7 @@ import com.ruoyi.purchase.mapper.PurchasePlanMapper; import com.ruoyi.purchase.service.IPurchaseOrderService; import com.ruoyi.system.domain.SysAttachFile; import com.ruoyi.system.domain.SysCompanyInformation; +import com.ruoyi.system.domain.SysSalesOrderChild; import com.ruoyi.system.domain.SysSupplier; import com.ruoyi.system.mapper.SysCompanyInformationMapper; import com.ruoyi.system.mapper.SysUserMapper; @@ -69,6 +70,7 @@ import java.net.URLEncoder; import java.text.SimpleDateFormat; import java.util.*; import java.util.concurrent.atomic.AtomicInteger; +import java.util.function.Function; import java.util.stream.Collectors; @@ -92,6 +94,9 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService @Autowired private PurchasePlanChildMapper purchasePlanChildMapper; + @Autowired + private PurchasePlanMapper purchasePlanMapper; + @Autowired private RedisCache redisCache; @@ -249,6 +254,13 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService List purchasePlanSelectSupplierVoList = addPurchaseOrder.getPurchasePlanSelectSupplierVoList(); List purchasePlanSelectMaterialVoList = addPurchaseOrder.getPurchasePlanSelectMaterialVoList(); + //先不判断处理本次占用库存数 + //判断本次采购数 + boolean anyNullThisPurchaseNum = purchasePlanSelectMaterialVoList.stream().anyMatch(item -> item.getThisPurchaseNum() == null); + if (anyNullThisPurchaseNum) { + throw new BusinessException("请填写本次采购数量"); + } + PurchaseOrder purchaseOrder = new PurchaseOrder(); purchaseOrder.setPurchaseOrderCode(redisCache.generateBillNo("CG")); purchaseOrder.setPurchasePlanCode(purchasePlanOne.getPurchasePlanCodes()); @@ -270,6 +282,11 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService purchaseOrder.setCreateTime(new Date()); purchaseOrder.setCreateBy(loginName); + //处理采购计划子表 + List purchasePlanChildList = updatePurchasePlanChildByAddPurchaseOrder(addPurchaseOrder); + + //处理采购计划主表 + updatePurchasePlanByAddPurchaseOrder(addPurchaseOrder,purchasePlanChildList); buildPurchaseChild(purchasePlanSelectMaterialVoList, purchaseOrder); int result = purchaseOrderMapper.insertPurchaseOrder(purchaseOrder); @@ -279,6 +296,181 @@ public class PurchaseOrderServiceImpl implements IPurchaseOrderService return result; } + //处理采购计划子表 + private List updatePurchasePlanChildByAddPurchaseOrder(AddPurchaseOrder addPurchaseOrder) { + + + List purchasePlanChildren = new ArrayList<>(); + + //暂时不处理共享库存占用总数和作废数 + List purchasePlanSelectMaterialVoList = addPurchaseOrder.getPurchasePlanSelectMaterialVoList(); + + //收集前端传入的所有的物料号 + List collectMaterialNo = purchasePlanSelectMaterialVoList.stream().map(PurchasePlanSelectMaterialVo::getMaterialNo).collect(Collectors.toList()); + + PurchasePlanOne purchasePlanOne = addPurchaseOrder.getPurchasePlanOne(); + String purchasePlanCodes = purchasePlanOne.getPurchasePlanCodes(); + //得到本次采购的所有采购计划单号 + List purchasePlanCodeList = new ArrayList<>(); + + if (StringUtils.isNotEmpty(purchasePlanCodes)){ + String[] splitSalesOrderCode = purchasePlanCodes.split(","); + purchasePlanCodeList = Arrays.asList(splitSalesOrderCode); + } + + for (String purchasePlanCode : purchasePlanCodeList) { + PurchasePlanChild purchasePlanChild = new PurchasePlanChild(); + purchasePlanChild.setPurchasePlanCode(purchasePlanCode); + + } + + List allPurchasePlanChildList = purchasePlanChildMapper.selectPurchasePlanChildPlanCodeList(purchasePlanCodeList); + + // 过滤 allPurchasePlanChildList,只保留和前端 collectMaterialNo 相等的数据 + List oldPurchasePlanChildList = allPurchasePlanChildList.stream() + .filter(child -> collectMaterialNo.contains(child.getMaterialNo())) + .collect(Collectors.toList()); + + + // List collectPurchasePlanChildId = purchasePlanSelectMaterialVoList.stream().map(PurchasePlanSelectMaterialVo::getPurchasePlanChildId).collect(Collectors.toList()); + + //List oldPurchasePlanChildList = purchasePlanChildMapper.selectBatchPurchasePlanChildByIdList(collectPurchasePlanChildId); + + // 将旧数据按物料编号分组 + Map> oldDataGroupedByMaterialNo = oldPurchasePlanChildList.stream() + .collect(Collectors.groupingBy(PurchasePlanChild ::getMaterialNo)); + // 当前时间 + Date now = new Date(); + + for (PurchasePlanSelectMaterialVo purchasePlanSelectMaterialVo : purchasePlanSelectMaterialVoList) { + String materialNo = purchasePlanSelectMaterialVo.getMaterialNo(); + // Integer thisPurchaseNum = purchasePlanSelectMaterialVo.getThisPurchaseNum(); + + // 获取旧数据中相同物料编号的数据 + List oldChildren = oldDataGroupedByMaterialNo.get(materialNo); + + if (oldChildren != null && !oldChildren.isEmpty()) { + // 按照 订单创建时间 远离当前时间排序 + oldChildren.sort(Comparator.comparing(oldChild -> -Math.abs(now.getTime() - oldChild.getCreateTime().getTime()))); + + for (PurchasePlanChild oldChild : oldChildren) { + + Integer thisPurchaseNum = purchasePlanSelectMaterialVo.getThisPurchaseNum(); + //本次采购数也是实际采购数 + oldChild.setActualPurchaseNum(thisPurchaseNum); + //待采购数 + Integer purchaseNum = oldChild.getPurchaseNum(); + if (purchaseNum >= thisPurchaseNum){ + purchaseNum = purchaseNum - thisPurchaseNum; + oldChild.setPurchaseNum(purchaseNum); + }else { + throw new BusinessException("本次采购数量不能大于待采购数量"); + } + + /* + * 部分申请:0<(实际采购数+共享库存占用数+作废数)<计划采购数;可添加采购订单 + * 全部申请:0<(实际采购数+共享库存占用数+作废数)=计划采购数,作废数<计划采购数;不可添加采购订单 + * */ + //计划采购数 + Integer planPurchaseNum = oldChild.getPlanPurchaseNum(); + if (thisPurchaseNum < planPurchaseNum){ + oldChild.setPurchasePlanStatus("1");//部分申请 + } + if (thisPurchaseNum.equals(planPurchaseNum)){ + oldChild.setPurchasePlanStatus("2");//全部申请 + } + oldChild.setUpdateTime(new Date()); + oldChild.setUpdateBy(ShiroUtils.getLoginName()); + oldChild.setThisPurchaseNum(thisPurchaseNum); + //收集更新后的子表数据 + purchasePlanChildren.add(oldChild); + int result = purchasePlanChildMapper.updatePurchasePlanChild(oldChild); + if (result <= 0){ + throw new BusinessException("更新采购计划子表数据失败"); + } + // 更新完成后,跳出循环 + break; + } + } + } + return purchasePlanChildren; + } + + //处理采购计划主表 + private void updatePurchasePlanByAddPurchaseOrder(AddPurchaseOrder addPurchaseOrder,List purchasePlanChildList) { + + //本次出货的所有采购计划子表的数据,把purchasePlanChildList按照物料采购计划单号进行分组 + Map> groupedByPurchasePlanCode = purchasePlanChildList.stream() + .collect(Collectors.groupingBy(PurchasePlanChild::getPurchasePlanCode)); + + + PurchasePlanOne purchasePlanOne = addPurchaseOrder.getPurchasePlanOne(); + String purchasePlanCodes = purchasePlanOne.getPurchasePlanCodes(); + //得到本次采购的所有采购计划单号 + List purchasePlanCodeList = new ArrayList<>(); + + if (StringUtils.isNotEmpty(purchasePlanCodes)){ + String[] splitSalesOrderCode = purchasePlanCodes.split(","); + purchasePlanCodeList = Arrays.asList(splitSalesOrderCode); + } + + //本次出货的所有采购计划单数据库中的数据 + List purchasePlans = purchasePlanMapper.selectPurchaseOrderByPlanCodeList(purchasePlanCodeList); + + // 创建一个 map 用于快速查找主表数据 + Map purchasePlanMap = purchasePlans.stream() + .collect(Collectors.toMap(PurchasePlan::getPurchasePlanCode, Function.identity())); + + + // 更新主表数据 + for (Map.Entry> entry : groupedByPurchasePlanCode.entrySet()) { + String purchasePlanCode = entry.getKey(); + List children = entry.getValue(); + + // 获取主表数据 + PurchasePlan purchasePlan = purchasePlanMap.get(purchasePlanCode); + if (purchasePlan != null) { + // 初始化 actualPurchaseSum + if (purchasePlan.getActualPurchaseSum() == null) { + purchasePlan.setActualPurchaseSum(0); + } + + // 累加 actualPurchaseSum + int thisPurchaseSum = children.stream() + .mapToInt(PurchasePlanChild::getThisPurchaseNum) + .sum(); + purchasePlan.setActualPurchaseSum(purchasePlan.getActualPurchaseSum() + thisPurchaseSum); + + // 更新 purchaseSum + int currentPurchaseSum = purchasePlan.getPurchaseSum(); + purchasePlan.setPurchaseSum(currentPurchaseSum - thisPurchaseSum); + + // 更新采购计划状态 + if (purchasePlan.getActualPurchaseSum() < purchasePlan.getPlanPurchaseSum()) { + purchasePlan.setPurchasePlanStatus("1"); + } else if (purchasePlan.getActualPurchaseSum().equals(purchasePlan.getPlanPurchaseSum())) { + purchasePlan.setPurchasePlanStatus("2"); + } + + // 更新其他字段 + purchasePlan.setUpdateTime(new Date()); + purchasePlan.setUpdateBy(ShiroUtils.getLoginName()); + + // 更新主表数据到数据库 + int result = purchasePlanMapper.updatePurchasePlan(purchasePlan); + if (result <= 0) { + throw new BusinessException("更新采购计划主表数据失败"); + } + } + } + + + } + + + + + //新增采购订单子表 private void buildPurchaseChild(List purchasePlanSelectMaterialVoList, PurchaseOrder purchaseOrder) { List purchaseOrderChildren = new ArrayList<>(); 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 3843065b..eb60c7e8 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 @@ -23,10 +23,7 @@ import com.ruoyi.purchase.domain.Vo.PurchasePlanSelectSupplierVo; import com.ruoyi.purchase.mapper.PurchasePlanChildMapper; import com.ruoyi.purchase.mapper.PurchaseQuoteChildMapper; import com.ruoyi.purchase.mapper.PurchaseQuoteMapper; -import com.ruoyi.system.domain.SysMakeOrder; -import com.ruoyi.system.domain.SysMakeorderBom; -import com.ruoyi.system.domain.SysSalesOrderChild; -import com.ruoyi.system.domain.SysSupplier; +import com.ruoyi.system.domain.*; import com.ruoyi.system.domain.Vo.SysSupplierVo; import com.ruoyi.system.mapper.SysMakeOrderMapper; import com.ruoyi.system.mapper.SysSalesOrderChildMapper; @@ -199,7 +196,59 @@ public class PurchasePlanServiceImpl implements IPurchasePlanService //采购计划子表数据 List purchasePlanChildList = purchasePlanChildMapper.selectPurchasePlanChildPlanCodeList(purchasePlanCodeList); - return purchasePlanChildList; + + + // 合并相同物料料号的数据 + Map mergedMap = purchasePlanChildList.stream() + .collect(Collectors.toMap( + PurchasePlanChild::getMaterialNo, + item -> item, + (existingItem, newItem) -> { + existingItem.setPurchaseNum( + (existingItem.getPurchaseNum() != null ? existingItem.getPurchaseNum() : 0) + + (newItem.getPurchaseNum() != null ? newItem.getPurchaseNum() : 0) + ); + existingItem.setSharedAvailableInventoryNum( + (existingItem.getSharedAvailableInventoryNum() != null ? existingItem.getSharedAvailableInventoryNum() : 0) + + (newItem.getSharedAvailableInventoryNum() != null ? newItem.getSharedAvailableInventoryNum() : 0) + ); + existingItem.setLatestQuoteRmb( + (existingItem.getLatestQuoteRmb() != null ? existingItem.getLatestQuoteRmb() : BigDecimal.ZERO) + .add(newItem.getLatestQuoteRmb() != null ? newItem.getLatestQuoteRmb() : BigDecimal.ZERO) + ); + existingItem.setMaterialNoRmbSum( + (existingItem.getMaterialNoRmbSum() != null ? existingItem.getMaterialNoRmbSum() : BigDecimal.ZERO) + .add(newItem.getMaterialNoRmbSum() != null ? newItem.getMaterialNoRmbSum() : BigDecimal.ZERO) + ); + existingItem.setMaterialRmbSum( + (existingItem.getMaterialRmbSum() != null ? existingItem.getMaterialRmbSum() : BigDecimal.ZERO) + .add(newItem.getMaterialRmbSum() != null ? newItem.getMaterialRmbSum() : BigDecimal.ZERO) + ); + return existingItem; + } + )); + + // 将合并后的数据转换为列表 + List mergedList = new ArrayList<>(mergedMap.values()); + + + + mergedList.forEach(item->{ +//字段(本次占用共享库存数):必填;默认为0,若共享可用库存数>0,则默认=共享可用库存数,可修改;需0<=本次占用共享库存数<=共享可用库存数 + if (item.getSharedAvailableInventoryNum() > 0){ + item.setSharedInventoryOccupancyNum(item.getSharedAvailableInventoryNum()); + }else { + item.setSharedInventoryOccupancyNum(0); + } + }); + //过滤掉待采购数量 <= 0的数据 + mergedList = mergedList.stream().filter(item->item.getPurchaseNum() > 0).collect(Collectors.toList()); + + //过滤掉采购计划状态为全部申请和全部作废的数据 2为全部申请、3为全部作废 + mergedList = mergedList.stream().filter(item->!item.getPurchasePlanStatus().equals("2") || !item.getPurchasePlanStatus().equals("3")).collect(Collectors.toList()); + + return mergedList; + } /** diff --git a/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml b/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml index 9ee0f947..70e4e011 100644 --- a/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/purchase/PurchasePlanChildMapper.xml @@ -64,6 +64,14 @@ + + insert into purchase_plan_child diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html index c67da9b1..e805f847 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/addPurchaseOrder.html @@ -558,6 +558,16 @@ animation-fill-mode: none; title: '本次占用共享库存数', field: 'sharedAvailableInventoryNum', editable: { + + //动态禁用行内编辑 + noEditFormatter: function(value, row, index){ + if (row.sharedInventoryOccupancyNum === 0){ + return "0"; + }else { + return false; + } + }, + validate: function(value) { if ($.trim(value) === '') { return '本次占用共享库存数不能为空'; @@ -604,8 +614,8 @@ animation-fill-mode: none; if (isNaN(value)) { return '请输入有效的数字'; } - if (value < 0) { - return '本次采购数不能小于0'; + if (value <= 0) { + return '本次采购数不能小于等于0'; } //不能为小数 if (value % 1 !== 0) { @@ -670,8 +680,8 @@ animation-fill-mode: none; //遍历选择的行,如果选择的行中sharedAvailableInventoryNum和thisPurchaseNum数据为空就进行提示 for (var i = 0; i < selectedRows.length; i++) { var row = selectedRows[i]; - if (!row.sharedAvailableInventoryNum || !row.thisPurchaseNum) { - $.modal.alertWarning('选择数据前请填写共享库存占用数和本次采购数进行合计'); + if (!row.thisPurchaseNum) { + $.modal.alertWarning('选择数据前请填写本次采购数进行合计'); return; } } diff --git a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html index 89a0b826..188ea481 100644 --- a/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html +++ b/ruoyi-admin/src/main/resources/templates/purchase/purchasePlan/purchasePlan.html @@ -164,37 +164,51 @@ ] }); }; - function addPurchaseOrder(){ + + //采购计划添加采购订单 + function addPurchaseOrder() { + // 采购计划状态为待申请 + const apply = "0"; + // 采购计划状态为部分申请 + const partApply = "1"; + var purchasePlanCodes = ""; var selections = $("#bootstrap-table").bootstrapTable("getSelections"); - if(selections.length === 0){ + + if (selections.length === 0) { $.modal.alertWarning("请选择采购计划单"); return; - }else{ - if(selections.length > 1 ){ - //·拼接采购计划单号 - for(let i=0;i 0) { + $.modal.alertWarning("所选采购计划单中包含状态不符合要求的采购计划单,只能选择状态为'待申请'或'部分申请'的采购计划单"); + return; + } + + // 拼接采购计划单号 + for (let i = 0; i < selections.length; i++) { + if (i === selections.length - 1) { + purchasePlanCodes += selections[i].purchasePlanCode; + } else { + purchasePlanCodes += selections[i].purchasePlanCode + ","; } } var url = prefix + "/addPurchaseOrder/" + purchasePlanCodes; $.modal.openOptions({ - title : "新增采购订单", + title: "新增采购订单", url: url, howButtonPanel: false, btn: ['关闭'], - yes: function(index, layero){ - $.modal.close(index);//使用layer.close(index);无效 + yes: function (index, layero) { + $.modal.close(index); // 使用layer.close(index);无效 }, - cancel: function(index, layero){ + cancel: function (index, layero) { $.modal.close(index); } });