Commit 19c82843d4dbaa1e5bb9972a16fe13e14a136780
1 parent
79ca5751
✨ feat(mes): 更新外协入库单状态枚举及相关逻辑
调整外协入库单状态枚举的描述,增加对应方法的注释以提高代码可读性。同时,修改提交逻辑以根据质检状态动态路由到待检验或待上架状态,优化了入库单的处理流程。
Showing
2 changed files
with
36 additions
and
23 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/enums/wm/MesWmOutsourceReceiptStatusEnum.java
| 1 | package cn.iocoder.yudao.module.mes.enums.wm; | 1 | package cn.iocoder.yudao.module.mes.enums.wm; |
| 2 | 2 | ||
| 3 | import cn.iocoder.yudao.framework.common.core.ArrayValuable; | 3 | import cn.iocoder.yudao.framework.common.core.ArrayValuable; |
| 4 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.outsourcereceipt.vo.MesWmOutsourceReceiptSaveReqVO; | ||
| 4 | import cn.iocoder.yudao.module.mes.enums.MesOrderStatusConstants; | 5 | import cn.iocoder.yudao.module.mes.enums.MesOrderStatusConstants; |
| 6 | +import cn.iocoder.yudao.module.mes.service.wm.outsourcereceipt.MesWmOutsourceReceiptService; | ||
| 5 | import lombok.AllArgsConstructor; | 7 | import lombok.AllArgsConstructor; |
| 6 | import lombok.Getter; | 8 | import lombok.Getter; |
| 7 | 9 | ||
| 8 | import java.util.Arrays; | 10 | import java.util.Arrays; |
| 9 | 11 | ||
| 10 | /** | 12 | /** |
| 11 | - * MES 委外收货单状态枚举 | 13 | + * MES 外协入库单状态枚举 |
| 14 | + * | ||
| 15 | + * 对应字典 mes_wm_outsource_receipt_status | ||
| 12 | * | 16 | * |
| 13 | * @author 芋道源码 | 17 | * @author 芋道源码 |
| 14 | */ | 18 | */ |
| @@ -16,25 +20,40 @@ import java.util.Arrays; | @@ -16,25 +20,40 @@ import java.util.Arrays; | ||
| 16 | @AllArgsConstructor | 20 | @AllArgsConstructor |
| 17 | public enum MesWmOutsourceReceiptStatusEnum implements ArrayValuable<Integer> { | 21 | public enum MesWmOutsourceReceiptStatusEnum implements ArrayValuable<Integer> { |
| 18 | 22 | ||
| 19 | - // TODO @AI:需要 @对应的状态;参考 /Users/yunai/Java/yudao-all-in-one/ruoyi-vue-pro/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/enums/wm/MesWmMiscIssueStatusEnum.java 里的逻辑; | ||
| 20 | /** | 23 | /** |
| 21 | - * 准备中 | 24 | + * 草稿 |
| 25 | + * | ||
| 26 | + * 对应方法:{@link MesWmOutsourceReceiptService#createOutsourceReceipt(MesWmOutsourceReceiptSaveReqVO)} | ||
| 27 | + */ | ||
| 28 | + PREPARE(MesOrderStatusConstants.PREPARE, "草稿"), | ||
| 29 | + /** | ||
| 30 | + * 待检验(已确认,等待质检) | ||
| 31 | + * | ||
| 32 | + * 对应方法:{@link MesWmOutsourceReceiptService#submitOutsourceReceipt(Long)} | ||
| 22 | */ | 33 | */ |
| 23 | - PREPARE(MesOrderStatusConstants.PREPARE, "准备中"), | 34 | + CONFIRMED(MesOrderStatusConstants.CONFIRMED, "待检验"), |
| 24 | /** | 35 | /** |
| 25 | - * 审批中 | 36 | + * 待上架(检验完成,等待仓库上架) |
| 37 | + * | ||
| 38 | + * 对应方法:{@link MesWmOutsourceReceiptService#submitOutsourceReceipt(Long)} | ||
| 26 | */ | 39 | */ |
| 27 | - APPROVING(MesOrderStatusConstants.APPROVING, "审批中"), | 40 | + APPROVING(MesOrderStatusConstants.APPROVING, "待上架"), |
| 28 | /** | 41 | /** |
| 29 | - * 已审批 | 42 | + * 待执行入库(上架完成,等待执行入库操作) |
| 43 | + * | ||
| 44 | + * 对应方法:{@link MesWmOutsourceReceiptService#stockOutsourceReceipt(Long)} | ||
| 30 | */ | 45 | */ |
| 31 | - APPROVED(MesOrderStatusConstants.APPROVED, "已审批"), | 46 | + APPROVED(MesOrderStatusConstants.APPROVED, "待执行入库"), |
| 32 | /** | 47 | /** |
| 33 | - * 已完成 | 48 | + * 已完成(入库执行完成,库存已更新) |
| 49 | + * | ||
| 50 | + * 对应方法:{@link MesWmOutsourceReceiptService#finishOutsourceReceipt(Long)} | ||
| 34 | */ | 51 | */ |
| 35 | FINISHED(MesOrderStatusConstants.FINISHED, "已完成"), | 52 | FINISHED(MesOrderStatusConstants.FINISHED, "已完成"), |
| 36 | /** | 53 | /** |
| 37 | * 已取消 | 54 | * 已取消 |
| 55 | + * | ||
| 56 | + * 对应方法:{@link MesWmOutsourceReceiptService#cancelOutsourceReceipt(Long)} | ||
| 38 | */ | 57 | */ |
| 39 | CANCELED(MesOrderStatusConstants.CANCELLED, "已取消"); | 58 | CANCELED(MesOrderStatusConstants.CANCELLED, "已取消"); |
| 40 | 59 |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/outsourcereceipt/MesWmOutsourceReceiptServiceImpl.java
| @@ -14,12 +14,11 @@ import cn.iocoder.yudao.module.mes.dal.mysql.wm.outsourcereceipt.MesWmOutsourceR | @@ -14,12 +14,11 @@ import cn.iocoder.yudao.module.mes.dal.mysql.wm.outsourcereceipt.MesWmOutsourceR | ||
| 14 | import cn.iocoder.yudao.module.mes.dal.mysql.wm.outsourcereceipt.MesWmOutsourceReceiptLineMapper; | 14 | import cn.iocoder.yudao.module.mes.dal.mysql.wm.outsourcereceipt.MesWmOutsourceReceiptLineMapper; |
| 15 | import cn.iocoder.yudao.module.mes.dal.mysql.wm.outsourcereceipt.MesWmOutsourceReceiptMapper; | 15 | import cn.iocoder.yudao.module.mes.dal.mysql.wm.outsourcereceipt.MesWmOutsourceReceiptMapper; |
| 16 | import cn.iocoder.yudao.module.mes.enums.wm.MesWmOutsourceReceiptStatusEnum; | 16 | import cn.iocoder.yudao.module.mes.enums.wm.MesWmOutsourceReceiptStatusEnum; |
| 17 | +import cn.iocoder.yudao.module.mes.enums.wm.MesWmQualityStatusEnum; | ||
| 17 | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; | 18 | import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| 18 | import cn.iocoder.yudao.module.mes.service.md.vendor.MesMdVendorService; | 19 | import cn.iocoder.yudao.module.mes.service.md.vendor.MesMdVendorService; |
| 19 | import cn.iocoder.yudao.module.mes.service.wm.materialstock.MesWmMaterialStockService; | 20 | import cn.iocoder.yudao.module.mes.service.wm.materialstock.MesWmMaterialStockService; |
| 20 | import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseAreaService; | 21 | import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseAreaService; |
| 21 | -import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseLocationService; | ||
| 22 | -import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseService; | ||
| 23 | import jakarta.annotation.Resource; | 22 | import jakarta.annotation.Resource; |
| 24 | import org.springframework.stereotype.Service; | 23 | import org.springframework.stereotype.Service; |
| 25 | import org.springframework.transaction.annotation.Transactional; | 24 | import org.springframework.transaction.annotation.Transactional; |
| @@ -56,12 +55,6 @@ public class MesWmOutsourceReceiptServiceImpl implements MesWmOutsourceReceiptSe | @@ -56,12 +55,6 @@ public class MesWmOutsourceReceiptServiceImpl implements MesWmOutsourceReceiptSe | ||
| 56 | private MesMdItemService itemService; | 55 | private MesMdItemService itemService; |
| 57 | 56 | ||
| 58 | @Resource | 57 | @Resource |
| 59 | - private MesWmWarehouseService warehouseService; | ||
| 60 | - | ||
| 61 | - @Resource | ||
| 62 | - private MesWmWarehouseLocationService warehouseLocationService; | ||
| 63 | - | ||
| 64 | - @Resource | ||
| 65 | private MesWmWarehouseAreaService warehouseAreaService; | 58 | private MesWmWarehouseAreaService warehouseAreaService; |
| 66 | 59 | ||
| 67 | @Override | 60 | @Override |
| @@ -125,14 +118,15 @@ public class MesWmOutsourceReceiptServiceImpl implements MesWmOutsourceReceiptSe | @@ -125,14 +118,15 @@ public class MesWmOutsourceReceiptServiceImpl implements MesWmOutsourceReceiptSe | ||
| 125 | if (CollUtil.isEmpty(lines)) { | 118 | if (CollUtil.isEmpty(lines)) { |
| 126 | throw exception(WM_OUTSOURCE_RECEIPT_NO_LINE); | 119 | throw exception(WM_OUTSOURCE_RECEIPT_NO_LINE); |
| 127 | } | 120 | } |
| 128 | - // 校验物料存在 | ||
| 129 | - for (MesWmOutsourceReceiptLineDO line : lines) { | ||
| 130 | - itemService.validateItemExists(line.getItemId()); | ||
| 131 | - } | ||
| 132 | 121 | ||
| 133 | - // 提交(草稿 → 审批中) | 122 | + // 检查是否有待检验的行 |
| 123 | + boolean hasPendingQc = CollUtil.contains(lines, | ||
| 124 | + line -> MesWmQualityStatusEnum.PENDING.getStatus().equals(line.getQualityStatus())); | ||
| 125 | + // 根据质检状态,路由到待检验或待上架 | ||
| 126 | + Integer targetStatus = hasPendingQc ? MesWmOutsourceReceiptStatusEnum.CONFIRMED.getStatus() | ||
| 127 | + : MesWmOutsourceReceiptStatusEnum.APPROVING.getStatus(); | ||
| 134 | outsourceReceiptMapper.updateById(new MesWmOutsourceReceiptDO() | 128 | outsourceReceiptMapper.updateById(new MesWmOutsourceReceiptDO() |
| 135 | - .setId(id).setStatus(MesWmOutsourceReceiptStatusEnum.APPROVING.getStatus())); | 129 | + .setId(id).setStatus(targetStatus)); |
| 136 | } | 130 | } |
| 137 | 131 | ||
| 138 | @Override | 132 | @Override |