This commit is contained in:
lym
2025-01-14 16:08:47 +08:00
30 changed files with 138 additions and 357 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);
}
@@ -1,5 +1,6 @@
package com.cf.imes.module.executor.controller.admin.order;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.incrementer.IdentifierGenerator;
import com.cf.imes.framework.common.exception.ServiceException;
@@ -381,10 +382,10 @@ public class OrderController {
}
// 进行判断,为空,写入时出现了错误,数据库数据回滚,此时删除 ES 里的数据
OrderDO order = orderMapper.selectById(orderDO.getId());
if (order == null) {
orderInputProcessor.deleteByOrderId(orderDO.getId(), ORDER_PLATE_MODEL);
orderInputProcessor.deleteByOrderId(orderDO.getId(), ORDER_PLATE_MODEL_COMPRESS);
if (ObjectUtil.isNotNull(orderDO) && ObjectUtil.isNotNull(orderMapper.selectById(orderDO.getId()))) {
Long deleteOrderId = orderDO.getId();
orderInputProcessor.deleteByOrderId(deleteOrderId, ORDER_PLATE_MODEL);
orderInputProcessor.deleteByOrderId(deleteOrderId, ORDER_PLATE_MODEL_COMPRESS);
}
} finally {
@@ -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);
}
@@ -1,5 +1,7 @@
package com.cf.imes.module.executor.util.fileConversion.admin.files.xml;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.alibaba.nacos.common.utils.StringUtils;
@@ -793,12 +795,7 @@ public class XmlTypeRealize {
Map<String, OrderGroupDO> groupInfos,
Map<String, Map<String, BasePosition>> boxBasePositionMap,
Map<String, BasePosition> roomBasePositions) {
if (blockXmlVOS != null && blockXmlVOS.getBlockXmlVOList() == null || blockXmlVOS.getBlockXmlVOList().isEmpty()) {
}
if (blockXmlVOS != null && blockXmlVOS.getBlockXmlVOList() != null && !blockXmlVOS.getBlockXmlVOList().isEmpty()) {
if (ObjectUtil.isNotNull(blockXmlVOS) && CollUtil.isNotEmpty(blockXmlVOS.getBlockXmlVOList())) {
for (BlockXmlVO blockXmlVO : blockXmlVOS.getBlockXmlVOList()) {
long plateNo = idWorker.nextId();