diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/planitem/PlanItemMapper.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/planitem/PlanItemMapper.java index 6ffd3c69d..0e3bbe032 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/planitem/PlanItemMapper.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/planitem/PlanItemMapper.java @@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Constants; import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; import com.cf.imes.module.executor.controller.admin.order.vo.order.LabelOrderPlateData; +import com.cf.imes.module.executor.controller.admin.order.vo.order.OrderPlanPlateNumAndAreaRespVO; import com.cf.imes.module.executor.controller.admin.plan.vo.*; import com.cf.imes.module.executor.dal.dataobject.order.OrderDO; import com.cf.imes.module.executor.dal.dataobject.planitem.PlanItemDO; @@ -105,4 +106,12 @@ public interface PlanItemMapper extends BaseMapperX { List selectPlanGoodsList(@Param("planId") Long planId, @Param("organId") Long organId); + /** + * 统计排单板件数量和面积 + * + * @param planId + * @return + */ + OrderPlanPlateNumAndAreaRespVO selectPlanPlateNumAndArea(@Param("planId") Long planId); + } \ No newline at end of file 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 d631f5f20..f0446c09d 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 @@ -1438,6 +1438,13 @@ public class PlanServiceImpl implements PlanService { } } + OrderPlanPlateNumAndAreaRespVO planPlateNumAndAreaRespVO = planItemMapper.selectPlanPlateNumAndArea(planId); + // 更新排单板件数量和面积 + planMapper.update(new LambdaUpdateWrapper() + .eq(PlanDO::getId, planId) + .set(PlanDO::getPlateNum, planPlateNumAndAreaRespVO.getNum()) + .set(PlanDO::getPlateArea, planPlateNumAndAreaRespVO.getArea())); + // 统计更新orders的小板数量和面积 computeOrderInfo(orderIds); } @@ -1454,8 +1461,6 @@ public class PlanServiceImpl implements PlanService { for (Map.Entry> entry : groupedPlates.entrySet()) { Long planId = entry.getKey(); List plates = entry.getValue(); - Integer plateNum = 0; - BigDecimal area = BigDecimal.ZERO; // 根据goodsId分组 Map> groupedPlatesByGoodsId = plates.stream().collect(Collectors.groupingBy(PlateDO::getGoodsId)); @@ -1493,18 +1498,13 @@ 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)); - } - + OrderPlanPlateNumAndAreaRespVO planPlateNumAndAreaRespVO = planItemMapper.selectPlanPlateNumAndArea(planId); + // 更新排单板件数量和面积 + planMapper.update(new LambdaUpdateWrapper() + .eq(PlanDO::getId, planId) + .set(PlanDO::getPlateNum, planPlateNumAndAreaRespVO.getNum()) + .set(PlanDO::getPlateArea, planPlateNumAndAreaRespVO.getArea())); } // 统计更新orders的小板数量和面积 @@ -2105,9 +2105,6 @@ public class PlanServiceImpl implements PlanService { throw new ServiceException(ErrorCodeConstants.CREATE_PLAN_ORDER_UPDATE_CONCURRENCY_ERROR, orderId); } } -// if (1 == 1) { -// throw new ServiceException(null); -// } } /** 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 ef7dd4296..2c309ee76 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 @@ -569,5 +569,11 @@ + \ No newline at end of file