| | |
| | | import cn.iocoder.yudao.module.mdm.api.item.dto.MdmItemRespDTO; |
| | | import cn.iocoder.yudao.module.mes.api.mps.MesProMpsApi; |
| | | import cn.iocoder.yudao.module.mes.api.mps.dto.MesProMpsCreateReqDTO; |
| | | import cn.iocoder.yudao.module.mes.api.mps.dto.MesProMpsRespDTO; |
| | | import cn.iocoder.yudao.module.system.api.storage.StorageAttachmentApi; |
| | | import cn.iocoder.yudao.module.system.api.user.AdminUserApi; |
| | | import jakarta.annotation.Resource; |
| | |
| | | @Validated |
| | | @Slf4j |
| | | public class ErpSaleOrderServiceImpl implements ErpSaleOrderService { |
| | | |
| | | /** |
| | | * MPS 状态:已取消(对应 MES 模块 MesProMpsStatusEnum.CANCELED 的值 3) |
| | | */ |
| | | private static final Integer MPS_STATUS_CANCELED = 3; |
| | | |
| | | @Resource |
| | | private ErpSaleOrderMapper saleOrderMapper; |
| | |
| | | if (item.getNeedProduction() == null || item.getNeedProduction() != 1) { |
| | | continue; |
| | | } |
| | | // 避免审批/反审批重复操作导致同一个销售订单号产生多条 MPS |
| | | MesProMpsRespDTO existingMps = mpsApi.getMpsBySaleOrderItemId(item.getId()); |
| | | if (existingMps != null && ObjectUtil.notEqual(existingMps.getStatus(), MPS_STATUS_CANCELED)) { |
| | | log.info("[createMpsForSaleOrder] 销售订单明细({}) 已存在 MPS({}),状态={},跳过创建", |
| | | item.getId(), existingMps.getId(), existingMps.getStatus()); |
| | | continue; |
| | | } |
| | | try { |
| | | Long mpsId = createMpsForSaleOrderItem(saleOrder, item); |
| | | if (mpsId != null) { |