From 90d5284486bc1e3339325519bab8335eb513e3d4 Mon Sep 17 00:00:00 2001 From: gaoqr <13665037151@163.com> Date: Wed, 10 Jun 2026 17:43:24 +0800 Subject: [PATCH] =?UTF-8?q?1=E3=80=81=E5=88=A0=E9=99=A4=E6=9F=9C=E4=BD=93?= =?UTF-8?q?=E5=AF=BC=E8=87=B4=E7=9A=84order=5Fgoods=E6=95=B0=E9=87=8F?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E4=BF=AE=E5=A4=8D=EF=BC=9B2=E3=80=81?= =?UTF-8?q?=E6=8E=92=E5=8D=95=E7=BB=9F=E8=AE=A1=E5=B0=8F=E6=9D=BF=E6=95=B0?= =?UTF-8?q?=E9=87=8F=E5=92=8C=E9=9D=A2=E7=A7=AF=E9=94=99=E8=AF=AF=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=EF=BC=9B3=E3=80=81=E8=AE=A2=E5=8D=95=E5=88=86?= =?UTF-8?q?=E7=BB=84=E6=8C=89=E6=88=BF=E9=97=B4=E6=9F=9C=E4=BD=93=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E6=9D=90=E8=B4=A8=E6=97=B6=E7=BC=BA=E5=B0=91=E9=9D=A2?= =?UTF-8?q?=E7=A7=AF=E4=BF=AE=E5=A4=8D=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/order/OrderServiceImpl.java | 2 +- .../service/plan/PlanServiceImpl.java | 35 ++++------ .../mapper/planitem/PlanItemMapper.xml | 70 ++++++++++++------- 3 files changed, 58 insertions(+), 49 deletions(-) diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java index 6faad87da..1f5a54b2c 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/order/OrderServiceImpl.java @@ -1572,7 +1572,7 @@ public class OrderServiceImpl implements OrderService { goodsMapper.updateDeletedById(orderId, goodsIdDeleted, organId); } - return goodsIdDeleted; + return goodsIds.stream().toList(); } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java index 40e5a6a26..e08fd8507 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plan/PlanServiceImpl.java @@ -201,7 +201,16 @@ public class PlanServiceImpl implements PlanService { createPlanAndPlateDataList(grouped, plateItemList, planDOS, processId, processName, loginUser, PlanTypeEnum.ORDERPLAN.getType()); } - + // 计算排单的数量和面积 + if (CollUtil.isNotEmpty(planDOS)) { + for (PlanDO planDO : planDOS) { + OrderPlanPlateNumAndAreaRespVO orderPlanPlateNumAndAreaRespVO = planItemMapper.selectPlanPlateNumAndArea(planDO.getId()); + if (ObjectUtil.isNotNull(orderPlanPlateNumAndAreaRespVO)) { + planDO.setPlateNum(orderPlanPlateNumAndAreaRespVO.getNum()); + planDO.setPlateArea(orderPlanPlateNumAndAreaRespVO.getArea()); + } + } + } // 增加排单 planMapper.insertBatch(planDOS); } @@ -1360,8 +1369,6 @@ public class PlanServiceImpl implements PlanService { for (Map.Entry> entry : groupedPlates.entrySet()) { Long orderGoodsId = entry.getKey(); List plates = entry.getValue(); - Integer plateNum = 0; - BigDecimal area = BigDecimal.ZERO; // 查询version GoodsDO goodsDO = goodsMapper.selectById(orderGoodsId); @@ -1391,16 +1398,6 @@ public class PlanServiceImpl implements PlanService { if (update == 0) { throw new ServiceException(ErrorCodeConstants.GOODS_PLATE_UPDATE_CONCURRENCY_ERROR, orderGoodsId); } - // 累计板件数量和面积 - plateNum += goodsPlateNumAndAreaPlanInfoNum; - area = area.add(goodsPlateNumAndAreaPlanInfoArea); - } - if (plateNum != 0) { - // 更新排单板件数量和面积 - planMapper.update(new LambdaUpdateWrapper() - .eq(PlanDO::getId, planId) - .set(PlanDO::getPlateNum, plateNum) - .set(PlanDO::getPlateArea, area)); } } @@ -1836,7 +1833,7 @@ public class PlanServiceImpl implements PlanService { .build(); // 更新板件排单id & 统计更新order_goods的数量和面积 - planDO.setPlateArea(computePlatePlanAndComputeOrderGoodsInfo(planId, goodsPlateIdMap)); + computePlatePlanAndComputeOrderGoodsInfo(planId, goodsPlateIdMap); planDOS.add(planDO); } @@ -1907,7 +1904,7 @@ public class PlanServiceImpl implements PlanService { .build(); // 更新板件排单id & 统计更新order_goods的数量和面积 - planDO.setPlateArea(computePlatePlanAndComputeOrderGoodsInfo(planId, goodsPlateIdMap)); + computePlatePlanAndComputeOrderGoodsInfo(planId, goodsPlateIdMap); planDOS.add(planDO); } // 统计更新orders的小板数量和面积 @@ -1920,8 +1917,7 @@ public class PlanServiceImpl implements PlanService { * @param planId * @param goodsPlateIdMap */ - public BigDecimal computePlatePlanAndComputeOrderGoodsInfo(Long planId, Map> goodsPlateIdMap) { - BigDecimal planArea = BigDecimal.ZERO; + public void computePlatePlanAndComputeOrderGoodsInfo(Long planId, Map> goodsPlateIdMap) { for (Map.Entry> entry : goodsPlateIdMap.entrySet()) { Long orderGoodsId = entry.getKey(); // 查询version @@ -1942,19 +1938,16 @@ public class PlanServiceImpl implements PlanService { int version = goodsDO.getVersion(); // 统计每个order_goods下的未排单面积,更新到order_goods中 OrderPlanPlateNumAndAreaRespVO goodsPlateNumAndAreaPlanInfo = goodsMapper.selectPlannedPlateNumAndArea(orderGoodsId); - BigDecimal plannedArea = goodsPlateNumAndAreaPlanInfo.getArea(); int update = goodsMapper.update(new LambdaUpdateWrapper() .eq(GoodsDO::getId, orderGoodsId) .eq(GoodsDO::getVersion, version) - .set(GoodsDO::getPlannedPlateArea, plannedArea) + .set(GoodsDO::getPlannedPlateArea, goodsPlateNumAndAreaPlanInfo.getArea()) .set(GoodsDO::getPlannedPlateNum, goodsPlateNumAndAreaPlanInfo.getNum()) .set(GoodsDO::getVersion, version + 1)); if (update == 0) { throw new ServiceException(ErrorCodeConstants.CREATE_PLAN_GOODS_UPDATE_CONCURRENCY_ERROR, orderGoodsId); } - planArea = planArea.add(plannedArea); } - return planArea; } /** diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/planitem/PlanItemMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/planitem/PlanItemMapper.xml index 0c1cf4b81..9335cbaab 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/planitem/PlanItemMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/planitem/PlanItemMapper.xml @@ -271,37 +271,53 @@