排单投入生产逻辑更改

This commit is contained in:
liuzhaotian
2025-01-14 13:36:36 +08:00
parent bc6275bca3
commit 7344694252
10 changed files with 54 additions and 9 deletions
@@ -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<Boolean> getOrder(Long orderId) {
List<Long> planIds = goodsMapper.selectNoPlanOrders(orderId, getUserOrganId());
List<PlateDO> plateDOS = plateMapper.selectNoCutPlateByPlateId(Collections.singletonList(orderId), getUserOrganId());
List<Long> planList = planIds.stream().filter(f -> f == 0).toList();
if(planIds.isEmpty() || !planList.isEmpty()){
if(CollUtil.isNotEmpty(plateDOS)){
return CommonResult.success(false);
}
List<Long> planIdList = planMapper.selectPLanList(planIds, getUserOrganId());
return CommonResult.success(planIdList.isEmpty());
List<PlanItemDO> planItemDOS = planItemMapper.selectOrderPlanList(orderId, getUserOrganId());
if(CollUtil.isNotEmpty(planItemDOS)){
List<Long> planIds = planItemDOS.stream().map(PlanItemDO::getPlanId).distinct().toList();
List<Long> planDOS = planMapper.selectPLanList(planIds,getUserOrganId());
if(CollUtil.isEmpty(planDOS)){
return CommonResult.success(true);
}
}
return CommonResult.success(false);
}
@@ -43,6 +43,9 @@ public class PlanPageReqVO extends PageParam {
private List<Integer> status;
@Schema(description = "是否已投产")
private Boolean isScheduled;
@Schema(description = "机台 ID", example = "16707")
private Long machineId;
@@ -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;
@@ -27,6 +27,8 @@ public class PlanSaveReqVO {
@PlanStatusValid
private Integer status;
@Schema(description = "是否已投产")
private Boolean isScheduled;
@Schema(description = "需要进行排单的板材信息")
private SavePlanPlateList savePlanPlateList;
@@ -43,6 +43,11 @@ public class PlanDO extends BaseDO {
*/
private Integer status;
/**
* 是否已投产:0未投产,1已投产
*/
private Boolean isScheduled;
/**
* 板材过滤条件
*/
@@ -30,6 +30,7 @@ public interface PlanMapper extends BaseMapperX<PlanDO> {
return selectJoinPage(reqVO, PlanDO.class, new MPJLambdaWrapperX<PlanDO>()
.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<PlanDO> {
return selectPage(reqVO, new LambdaQueryWrapperX<PlanDO>()
.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())
@@ -51,4 +51,15 @@ public interface PlanItemMapper extends BaseMapperX<PlanItemDO> {
List<OrderGoodsResp> selectNoOrderGoodsIdList(@Param(Constants.WRAPPER) Wrapper<PlanItemDO> wrapper);
List<OrderPlateIds> selectPlanIncrementPlate(@Param("noPlanIds") List<Long> noPlanIds,@Param("organId") Long organId);
default List<PlanItemDO> selectOrderPlanList(Long orderId,Long organId) {
return selectList( new LambdaQueryWrapperX<PlanItemDO>()
.eq(PlanItemDO::getOrganId, organId)
.eq(PlanItemDO::getOrderId,orderId)
.select(PlanItemDO::getPlanId));
}
}
@@ -402,7 +402,7 @@ public class OptimizePlanServiceImpl implements OptimizePlanService {
List<Integer> goodsNo = respVO.getGoodsNo();
Integer cutedType = respVO.getCutedType();
if(goodsIds.isEmpty()){
if(goodsIds.isEmpty() || goodsNo.isEmpty()){
return;
}
@@ -166,7 +166,8 @@ public class PlanServiceImpl implements PlanService {
List<PlanItemDO> 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);
}
@@ -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 ============