diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java index 23af88cfe..0e891fd6b 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/plate/PlateServiceImpl.java @@ -1056,11 +1056,6 @@ public class PlateServiceImpl implements PlateService { .eq(OrderItemDO::getOrderId, pageReqVO.getOrderId()) .inIfPresent(OrderItemDO::getBodyId, bodyIds) .inIfPresent(OrderItemDO::getGroupId, groupIds) - .and(wrapper -> - wrapper.ne(OrderItemDO::getGroupId, 0L) - .or() - .isNull(OrderItemDO::getGroupId) - ) .in(OrderItemDO::getPartsId, partsIds) .select(OrderItemDO::getPartsId, OrderItemDO::getBodyId, OrderItemDO::getCadViewId, OrderItemDO::getGroupId, OrderItemDO::getCompId, OrderItemDO::getNum) ); @@ -1069,11 +1064,6 @@ public class PlateServiceImpl implements PlateService { .eq(OrderItemTempDO::getOrderId, pageReqVO.getOrderId()) .inIfPresent(OrderItemTempDO::getBodyId, bodyIds) .inIfPresent(OrderItemTempDO::getGroupId, groupIds) - .and(wrapper -> - wrapper.ne(OrderItemTempDO::getGroupId, 0L) - .or() - .isNull(OrderItemTempDO::getGroupId) - ) .in(OrderItemTempDO::getPartsId, partsIds) .select(OrderItemTempDO::getPartsId, OrderItemTempDO::getBodyId, OrderItemTempDO::getCadViewId, OrderItemTempDO::getGroupId, OrderItemTempDO::getCompId, OrderItemTempDO::getNum) ); @@ -1092,6 +1082,9 @@ public class PlateServiceImpl implements PlateService { // 暂存 partsId:bodyId Map, Long> partsBodyIdMap = new HashMap<>(); + // 是否加工组入口 + boolean comFromGroup = CollUtil.isNotEmpty(groupIds); + for (OrderItemDO item : orderItemRelation) { Long partsId = item.getPartsId(); @@ -1112,8 +1105,14 @@ public class PlateServiceImpl implements PlateService { .add(item.getCompId()); } - // num 汇总 - if (item.getNum() != null) { + // num + if (item.getNum() != null && + ( + (comFromGroup && ObjectUtil.isNotNull(item.getGroupId()) && ObjectUtil.notEqual(item.getGroupId(), 0L)) //加工组入口 统计groupId不是空的 + || + (!comFromGroup && (ObjectUtil.equals(item.getGroupId(), 0L) || (ObjectUtil.isNull(item.getGroupId()) && ObjectUtil.isNull(item.getCompId())))) // 非加工组入口,统计groupId = 0(加工组汇总的数量) 或者 null+不是部件item的(没有加工组的数量) + ) + ) { partsNumMap.merge( pair, item.getNum(), diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/orderItem/OrderItemMapper.xml b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/orderItem/OrderItemMapper.xml index 97c2a98eb..9911005e6 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/orderItem/OrderItemMapper.xml +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/resources/mapper/orderItem/OrderItemMapper.xml @@ -105,7 +105,7 @@ RIGHT JOIN `order_parts` p ON i.organ_id = p.organ_id AND i.order_id = p.order_id AND i.parts_id = p.id RIGHT JOIN `order_body` ob ON i.organ_id = ob.organ_id AND i.order_id = ob.order_id AND i.body_id = ob.id - WHERE i.organ_id = #{organId} AND i.order_id = #{orderId} AND ob.deleted = #{deleted} AND (i.group_id is null or i.group_id = 0) AND p.category in + WHERE i.organ_id = #{organId} AND i.order_id = #{orderId} AND ob.deleted = #{deleted} AND ((i.group_id is null and i.comp_id is null) or i.group_id = 0) AND p.category in #{type} @@ -695,12 +695,19 @@ - - AND i.group_id IN - - #{groupId} - - + + + AND i.group_id IN + + #{groupId} + + + + + AND ((i.group_id is null and i.comp_id is null) or i.group_id = 0) + + + AND i.comp_id IN