diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/api/plan/OrderPlanApiImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/api/plan/OrderPlanApiImpl.java index 885619c97..555997b25 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/api/plan/OrderPlanApiImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/api/plan/OrderPlanApiImpl.java @@ -22,6 +22,8 @@ import com.cf.imes.module.executor.dal.dataobject.orderItem.OrderItemDO; import com.cf.imes.module.executor.dal.dataobject.orderParts.OrderPartsDO; import com.cf.imes.module.executor.dal.dataobject.ordermodel.OrderModelDO; 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.remainplaten.RemainPlateDO; import com.cf.imes.module.executor.dal.mysql.goods.GoodsMapper; import com.cf.imes.module.executor.dal.mysql.order.OrderMapper; @@ -30,6 +32,7 @@ import com.cf.imes.module.executor.dal.mysql.orderGroup.OrderGroupMapper; import com.cf.imes.module.executor.dal.mysql.orderItem.OrderItemMapper; import com.cf.imes.module.executor.dal.mysql.orderParts.OrderPartsMapper; 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.PlateMapper; import com.cf.imes.module.executor.dal.mysql.remainplaten.RemainPlateMapper; import com.fasterxml.jackson.databind.JsonNode; @@ -42,6 +45,7 @@ import java.io.IOException; import java.math.BigDecimal; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; import java.util.List; import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.INTERNAL_SERVER_ERROR; @@ -87,6 +91,8 @@ public class OrderPlanApiImpl implements OrderPlanApi{ @Resource private OrderPartsMapper orderPartsMapper; + @Resource + private PlanItemMapper planItemMapper; @Resource private ElasticsearchClient elasticsearchClient; @@ -122,16 +128,27 @@ public class OrderPlanApiImpl implements OrderPlanApi{ @Override public CommonResult getOrder(Long orderId) { - List planIds = goodsMapper.selectNoPlanOrders(orderId, getUserOrganId()); + List plateDOS = plateMapper.selectNoCutPlateByPlateId(Collections.singletonList(orderId), getUserOrganId()); - List planList = planIds.stream().filter(f -> f == 0).toList(); - - if(planIds.isEmpty() || !planList.isEmpty()){ + if(CollUtil.isNotEmpty(plateDOS)){ return CommonResult.success(false); } - List planIdList = planMapper.selectPLanList(planIds, getUserOrganId()); - return CommonResult.success(planIdList.isEmpty()); + List planItemDOS = planItemMapper.selectOrderPlanList(orderId, getUserOrganId()); + + if(CollUtil.isNotEmpty(planItemDOS)){ + + List planIds = planItemDOS.stream().map(PlanItemDO::getPlanId).distinct().toList(); + + List planDOS = planMapper.selectPLanList(planIds,getUserOrganId()); + + if(CollUtil.isEmpty(planDOS)){ + return CommonResult.success(true); + } + + } + + return CommonResult.success(false); } diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/PlanPageReqVO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/PlanPageReqVO.java index 95827a517..92465507a 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/PlanPageReqVO.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/PlanPageReqVO.java @@ -43,6 +43,9 @@ public class PlanPageReqVO extends PageParam { private List status; + @Schema(description = "是否已投产") + private Boolean isScheduled; + @Schema(description = "机台 ID", example = "16707") private Long machineId; 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 f7c5d3e6e..90672f235 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 @@ -29,6 +29,9 @@ public class PlanRespVO { @ExcelProperty("排单状态:0 新单,1 板材已申请,2 开料中,3 已开料") private Integer status; + @Schema(description = "是否已投产") + private Boolean isScheduled; + @Schema(description = "板材过滤条件") private String filter; diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/PlanSaveReqVO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/PlanSaveReqVO.java index 183445095..981c28a75 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/PlanSaveReqVO.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/controller/admin/plan/vo/PlanSaveReqVO.java @@ -27,6 +27,8 @@ public class PlanSaveReqVO { @PlanStatusValid private Integer status; + @Schema(description = "是否已投产") + private Boolean isScheduled; @Schema(description = "需要进行排单的板材信息") private SavePlanPlateList savePlanPlateList; diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/dataobject/plan/PlanDO.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/dataobject/plan/PlanDO.java index b88c34d69..a56a42260 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/dataobject/plan/PlanDO.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/dataobject/plan/PlanDO.java @@ -43,6 +43,11 @@ public class PlanDO extends BaseDO { */ private Integer status; + /** + * 是否已投产:0未投产,1已投产 + */ + private Boolean isScheduled; + /** * 板材过滤条件 */ diff --git a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plan/PlanMapper.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plan/PlanMapper.java index e6cedc353..078afc5c7 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plan/PlanMapper.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/dal/mysql/plan/PlanMapper.java @@ -30,6 +30,7 @@ public interface PlanMapper extends BaseMapperX { return selectJoinPage(reqVO, PlanDO.class, new MPJLambdaWrapperX() .eq(PlanDO::getDeleted,false) .eq(PlanDO::getOrganId,getUserOrganId()) + .eqIfPresent(PlanDO::getIsScheduled,reqVO.getIsScheduled()) .eqIfPresent(PlanDO::getId, reqVO.getId()) .eqIfPresent(PlanDO::getSort, reqVO.getSort()) .eqIfPresent(PlanDO::getType, reqVO.getType()) @@ -52,6 +53,7 @@ public interface PlanMapper extends BaseMapperX { return selectPage(reqVO, new LambdaQueryWrapperX() .eq(PlanDO::getDeleted,false) .eq(PlanDO::getOrganId,getUserOrganId()) + .eqIfPresent(PlanDO::getIsScheduled,reqVO.getIsScheduled()) .eqIfPresent(PlanDO::getId, reqVO.getId()) .eqIfPresent(PlanDO::getSort, reqVO.getSort()) .eqIfPresent(PlanDO::getType, reqVO.getType()) 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 e421037c6..890f6cb85 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 @@ -51,4 +51,15 @@ public interface PlanItemMapper extends BaseMapperX { List selectNoOrderGoodsIdList(@Param(Constants.WRAPPER) Wrapper wrapper); List selectPlanIncrementPlate(@Param("noPlanIds") List noPlanIds,@Param("organId") Long organId); + + + default List selectOrderPlanList(Long orderId,Long organId) { + return selectList( new LambdaQueryWrapperX() + .eq(PlanItemDO::getOrganId, organId) + .eq(PlanItemDO::getOrderId,orderId) + .select(PlanItemDO::getPlanId)); + } + + + } \ 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/optimizeplan/OptimizePlanServiceImpl.java b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/optimizeplan/OptimizePlanServiceImpl.java index 2d6b77e45..e725966fa 100644 --- a/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/optimizeplan/OptimizePlanServiceImpl.java +++ b/cf-module-prod-executor/cf-module-prod-executor-biz/src/main/java/com/cf/imes/module/executor/service/optimizeplan/OptimizePlanServiceImpl.java @@ -402,7 +402,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService { List goodsNo = respVO.getGoodsNo(); Integer cutedType = respVO.getCutedType(); - if(goodsIds.isEmpty()){ + if(goodsIds.isEmpty() || goodsNo.isEmpty()){ return; } 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 ad49c3389..f854b5f89 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 @@ -166,7 +166,8 @@ public class PlanServiceImpl implements PlanService { List planItemDOS = new ArrayList<>(); - SavePlanPlateList savePlanPlateList = createReqVO.getSavePlanPlateList(); + SavePlanPlateList savePlanPlateList = Optional.ofNullable(createReqVO.getSavePlanPlateList()).orElseThrow(()-> new ServiceException(PLAN_PLATE_DATA_ERROR)); + if (Boolean.TRUE.equals(createReqVO.getIsMix())) { @@ -330,7 +331,7 @@ public class PlanServiceImpl implements PlanService { }else { - planDO.setStatus(updateReqVO.getStatus()); + planDO.setIsScheduled(updateReqVO.getIsScheduled()); planMapper.updateById(planDO); } diff --git a/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java b/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java index ee406e45f..5888a3581 100644 --- a/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java +++ b/cf-module-system/cf-module-system-api/src/main/java/com/cf/imes/module/system/enums/ErrorCodeConstants.java @@ -339,6 +339,7 @@ public class ErrorCodeConstants { public static final ErrorCode THIS_PROCESS_CONFIG_DATA_ERROR = new ErrorCode(1_002_041_032, "当前选择的加工方案组配置有误,请选择其他方案组或重新配置该方案组"); public static final ErrorCode CREAT_PLAN_PLATE_DATA_ERROR = new ErrorCode(1_002_041_033, "当前板材已有小板创建板材,请重新查询生产单信息再创建"); public static final ErrorCode UPDATE_NO_PLAN_PLATE_DATA_ERROR = new ErrorCode(1_002_041_034, "当前排单无开料板,无法取消开料,请重新尝试"); + public static final ErrorCode PLAN_PLATE_DATA_ERROR = new ErrorCode(1_002_041_035, "当前排单没有选择板材数据,请进行选择"); //=========== 应用信息 1-002-037-000 ============