From a774c92cd2026f180ec91f5c5212e5d0176162b3 Mon Sep 17 00:00:00 2001 From: gaoqr <13665037151@163.com> Date: Wed, 3 Jun 2026 10:09:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E5=B7=B2=E6=8E=92=E8=AE=A2?= =?UTF-8?q?=E5=8D=95=E5=B8=A6=E5=AE=9E=E9=99=85=E6=8E=92=E5=8D=95=E6=9D=BF?= =?UTF-8?q?=E6=9D=90=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/admin/plan/vo/PlanRespVO.java | 5 +- .../dal/mysql/plate/PlateGoodMapper.java | 14 +++++ .../service/plan/PlanServiceImpl.java | 63 ++++++++++++++++++- .../mapper/planitem/PlanItemMapper.xml | 14 +---- 4 files changed, 81 insertions(+), 15 deletions(-) diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/PlanRespVO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/PlanRespVO.java index acc2ec196..4e9f592b0 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/PlanRespVO.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/PlanRespVO.java @@ -57,9 +57,12 @@ public class PlanRespVO { @Schema(description = "排单对应的订单的信息", requiredMode = Schema.RequiredMode.REQUIRED) private List orderList; - @Schema(description = "板材信息列表-大板信息", requiredMode = Schema.RequiredMode.REQUIRED) + @Schema(description = "板材信息列表-拆单大板信息", requiredMode = Schema.RequiredMode.REQUIRED) private List plateInfoList; + @Schema(description = "混单实际选择大板信息") + private PlateInfoVO actualPlanGoodsInfo; + @Schema(description = "备注", requiredMode = Schema.RequiredMode.REQUIRED, example = "你说的对") @ExcelProperty("备注") private String remark; diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plate/PlateGoodMapper.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plate/PlateGoodMapper.java index 148d3e5cd..2b46c946e 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plate/PlateGoodMapper.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plate/PlateGoodMapper.java @@ -1,6 +1,7 @@ package com.cf.imes.module.executor.dal.mysql.plate; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.cf.imes.framework.common.enums.DeletedCodeEnum; import com.cf.imes.framework.common.pojo.PageResult; import com.cf.imes.framework.mybatis.core.mapper.BaseMapperX; import com.cf.imes.framework.mybatis.core.query.LambdaQueryWrapperX; @@ -184,4 +185,17 @@ public interface PlateGoodMapper extends BaseMapperX { * @return */ List> getOrgAttrGroup(@Param("organId") Long organId); + + + /** + * 根据商品编号查询板材信息 + * + * @param goodsIdList + * @return + */ + default List selectGoodsListByGoodsId(@Param("goodsIds") List goodsIdList) { + return selectList(new LambdaQueryWrapperX() + .eq(PlateGoodDO::getDeleted, DeletedCodeEnum.NOT_DELETED.getStatus()) + .in(PlateGoodDO::getGoodsId, goodsIdList)); + } } 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 2c8e5e04b..21808a6c5 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 @@ -43,6 +43,7 @@ import com.cf.imes.module.executor.dal.dataobject.ordercomponent.OrderComponentD import com.cf.imes.module.executor.dal.dataobject.plan.PlanDO; import com.cf.imes.module.executor.dal.dataobject.planitem.PlanItemDO; import com.cf.imes.module.executor.dal.dataobject.plate.PlateDO; +import com.cf.imes.module.executor.dal.dataobject.plate.PlateGoodDO; import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper; import com.cf.imes.module.executor.dal.mysql.order.OrderMapper; import com.cf.imes.module.executor.dal.mysql.orderBody.OrderBodyMapper; @@ -51,6 +52,7 @@ import com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemMapper; import com.cf.imes.module.executor.dal.mysql.ordercomponent.OrderComponentMapper; import com.cf.imes.module.executor.dal.mysql.plan.PlanMapper; import com.cf.imes.module.executor.dal.mysql.planitem.PlanItemMapper; +import com.cf.imes.module.executor.dal.mysql.plate.PlateGoodMapper; import com.cf.imes.module.executor.dal.mysql.plate.PlateMapper; import com.cf.imes.module.executor.dal.mysql.remainplaten.RemainPlateMapper; import com.cf.imes.module.executor.enums.ErrorCodeConstants; @@ -94,6 +96,9 @@ public class PlanServiceImpl implements PlanService { @Resource private GoodsMapper goodsMapper; + @Resource + private PlateGoodMapper plateGoodMapper; + @Resource private PlanItemMapper planItemMapper; @@ -401,7 +406,38 @@ public class PlanServiceImpl implements PlanService { } - List planIds = planDOPageResult.getRecords().stream().map(PlanDO::getId).toList(); + + List records = planDOPageResult.getRecords(); + + // planId:goodsDO的对应关系 + Map planGoodsMap = new HashMap<>(); + + List mixedPlans = records.stream() + .filter(p -> ObjectUtil.equals(PlanTypeEnum.MIXEDORDERPLAN.getType(), p.getType())) + .toList(); + + if (CollUtil.isNotEmpty(mixedPlans)) { + + List goodsIds = mixedPlans.stream() + .map(PlanDO::getGoodsId) + .distinct() + .toList(); + + // 查询需要的板材信息 + List goodsDOS = plateGoodMapper.selectGoodsListByGoodsId(goodsIds); + + Map goodsMap = goodsDOS.stream() + .collect(Collectors.toMap( + PlateGoodDO::getGoodsId, + Function.identity() + )); + + for (PlanDO plan : mixedPlans) { + planGoodsMap.put(plan.getId(), goodsMap.get(plan.getGoodsId())); + } + } + + List planIds = records.stream().map(PlanDO::getId).toList(); // 查询排单对应的大板板材信息以及 统计小板数量和面积 @@ -411,12 +447,14 @@ public class PlanServiceImpl implements PlanService { List planOrderRespVOS = orderMapper.selectPlanOrderList(planIds, getUserOrganId()); - List planRespVOPageResult = BeanUtils.toBean(planDOPageResult.getRecords(), PlanRespVO.class); + List planRespVOPageResult = BeanUtils.toBean(records, PlanRespVO.class); planRespVOPageResult.forEach(e -> { - // 大板信息列表 + // 拆单大板信息列表 e.setPlateInfoList(getPlateInfoList(e.getId(), plateInfoVOS)); + // 混单实际选择大板信息列表 + getMixedPlanGoodsInfo(e, planGoodsMap); // 未优化小板数量 e.setUnOptimizePlateCount(e.getPlateNum() - e.getOptimizedPlateNum()); // 订单信息 @@ -1111,6 +1149,25 @@ public class PlanServiceImpl implements PlanService { return planDOS; } + /** + * 设置混单的实际排单选择大板信息 + * + * @param planRespVO + * @param planGoodsMap + */ + private void getMixedPlanGoodsInfo(PlanRespVO planRespVO, Map planGoodsMap) { + if (ObjectUtil.equals(planRespVO.getType(), PlanTypeEnum.MIXEDORDERPLAN.getType())) { + PlateInfoVO actualPlateInfoVO = new PlateInfoVO(); + PlateGoodDO goodsDO = planGoodsMap.get(planRespVO.getId()); + if (ObjectUtil.isNotNull(goodsDO)) { + actualPlateInfoVO.setMaterial(goodsDO.getMaterial()); + actualPlateInfoVO.setColor(goodsDO.getColor()); + actualPlateInfoVO.setThickness(BigDecimal.valueOf(goodsDO.getThickness())); + planRespVO.setActualPlanGoodsInfo(actualPlateInfoVO); + } + } + } + // 板材信息列表 private List getPlateInfoList(Long planId, List infoVOList) { return infoVOList.stream() 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 bedbb5bd0..c2408cd8e 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 @@ -203,16 +203,11 @@