Commit ce7b88c2fd5c312e15f3baaf8c3682551dc1ecd4
1 parent
8591cb9e
✨ feat(mes): 增强领料出库单功能,新增客户信息和行数据校验
Showing
7 changed files
with
37 additions
and
7 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productissue/MesWmProductIssueController.java
| ... | ... | @@ -11,9 +11,11 @@ import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; |
| 11 | 11 | import cn.iocoder.yudao.module.mes.controller.admin.wm.productissue.vo.MesWmProductIssuePageReqVO; |
| 12 | 12 | import cn.iocoder.yudao.module.mes.controller.admin.wm.productissue.vo.MesWmProductIssueRespVO; |
| 13 | 13 | import cn.iocoder.yudao.module.mes.controller.admin.wm.productissue.vo.MesWmProductIssueSaveReqVO; |
| 14 | +import cn.iocoder.yudao.module.mes.dal.dataobject.md.client.MesMdClientDO; | |
| 14 | 15 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationDO; |
| 15 | 16 | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderDO; |
| 16 | 17 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productissue.MesWmProductIssueDO; |
| 18 | +import cn.iocoder.yudao.module.mes.service.md.client.MesMdClientService; | |
| 17 | 19 | import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkstationService; |
| 18 | 20 | import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; |
| 19 | 21 | import cn.iocoder.yudao.module.mes.service.wm.productissue.MesWmProductIssueService; |
| ... | ... | @@ -48,6 +50,8 @@ public class MesWmProductIssueController { |
| 48 | 50 | private MesMdWorkstationService workstationService; |
| 49 | 51 | @Resource |
| 50 | 52 | private MesProWorkOrderService workOrderService; |
| 53 | + @Resource | |
| 54 | + private MesMdClientService clientService; | |
| 51 | 55 | |
| 52 | 56 | @PostMapping("/create") |
| 53 | 57 | @Operation(summary = "创建领料出库单") |
| ... | ... | @@ -161,14 +165,17 @@ public class MesWmProductIssueController { |
| 161 | 165 | convertSet(list, MesWmProductIssueDO::getWorkstationId)); |
| 162 | 166 | Map<Long, MesProWorkOrderDO> workOrderMap = workOrderService.getWorkOrderMap( |
| 163 | 167 | convertSet(list, MesWmProductIssueDO::getWorkOrderId)); |
| 168 | + Map<Long, MesMdClientDO> clientMap = clientService.getClientMap( | |
| 169 | + convertSet(workOrderMap.values(), MesProWorkOrderDO::getClientId)); | |
| 164 | 170 | // 2. 构建结果 |
| 165 | 171 | return BeanUtils.toBean(list, MesWmProductIssueRespVO.class, vo -> { |
| 166 | - // 2.1 填充工作站名称 | |
| 167 | 172 | MapUtils.findAndThen(workstationMap, vo.getWorkstationId(), |
| 168 | 173 | workstation -> vo.setWorkstationName(workstation.getName())); |
| 169 | - // 2.2 填充工单编号 | |
| 170 | - MapUtils.findAndThen(workOrderMap, vo.getWorkOrderId(), | |
| 171 | - workOrder -> vo.setWorkOrderCode(workOrder.getCode())); | |
| 174 | + MapUtils.findAndThen(workOrderMap, vo.getWorkOrderId(), workOrder -> { | |
| 175 | + vo.setWorkOrderCode(workOrder.getCode()); | |
| 176 | + MapUtils.findAndThen(clientMap, workOrder.getClientId(), client -> | |
| 177 | + vo.setClientCode(client.getCode()).setClientName(client.getName())); | |
| 178 | + }); | |
| 172 | 179 | }); |
| 173 | 180 | } |
| 174 | 181 | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productissue/vo/MesWmProductIssueRespVO.java
| ... | ... | @@ -30,12 +30,15 @@ public class MesWmProductIssueRespVO { |
| 30 | 30 | @Schema(description = "工作站名称", example = "装配工作站") |
| 31 | 31 | private String workstationName; |
| 32 | 32 | |
| 33 | + @Schema(description = "客户编号", example = "C001") | |
| 34 | + private String clientCode; | |
| 35 | + | |
| 36 | + @Schema(description = "客户名称", example = "某某客户") | |
| 37 | + private String clientName; | |
| 38 | + | |
| 33 | 39 | @Schema(description = "生产任务 ID", example = "1") |
| 34 | 40 | private Long taskId; |
| 35 | 41 | |
| 36 | - @Schema(description = "客户 ID", example = "1") | |
| 37 | - private Long clientId; | |
| 38 | - | |
| 39 | 42 | @Schema(description = "领料日期") |
| 40 | 43 | private LocalDateTime issueDate; |
| 41 | 44 | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productissue/vo/detail/MesWmProductIssueDetailSaveReqVO.java
| 1 | 1 | package cn.iocoder.yudao.module.mes.controller.admin.wm.productissue.vo.detail; |
| 2 | 2 | |
| 3 | 3 | import io.swagger.v3.oas.annotations.media.Schema; |
| 4 | +import jakarta.validation.constraints.DecimalMin; | |
| 4 | 5 | import jakarta.validation.constraints.NotNull; |
| 5 | 6 | import lombok.Data; |
| 6 | 7 | |
| ... | ... | @@ -27,6 +28,7 @@ public class MesWmProductIssueDetailSaveReqVO { |
| 27 | 28 | |
| 28 | 29 | @Schema(description = "领料数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "300.00") |
| 29 | 30 | @NotNull(message = "领料数量不能为空") |
| 31 | + @DecimalMin(value = "0", inclusive = false, message = "领料数量必须大于 0") | |
| 30 | 32 | private BigDecimal quantity; |
| 31 | 33 | |
| 32 | 34 | @Schema(description = "批次编号", example = "1") | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/wm/productissue/MesWmProductIssueDetailMapper.java
| ... | ... | @@ -24,4 +24,8 @@ public interface MesWmProductIssueDetailMapper extends BaseMapperX<MesWmProductI |
| 24 | 24 | delete(MesWmProductIssueDetailDO::getIssueId, issueId); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | + default void deleteByLineId(Long lineId) { | |
| 28 | + delete(MesWmProductIssueDetailDO::getLineId, lineId); | |
| 29 | + } | |
| 30 | + | |
| 27 | 31 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/wm/productissue/MesWmProductIssueMapper.java
| ... | ... | @@ -24,4 +24,8 @@ public interface MesWmProductIssueMapper extends BaseMapperX<MesWmProductIssueDO |
| 24 | 24 | .orderByDesc(MesWmProductIssueDO::getId)); |
| 25 | 25 | } |
| 26 | 26 | |
| 27 | + default MesWmProductIssueDO selectByCode(String code) { | |
| 28 | + return selectOne(MesWmProductIssueDO::getCode, code); | |
| 29 | + } | |
| 30 | + | |
| 27 | 31 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/enums/ErrorCodeConstants.java
| ... | ... | @@ -426,7 +426,9 @@ public interface ErrorCodeConstants { |
| 426 | 426 | ErrorCode WM_PRODUCT_ISSUE_CANCEL_NOT_ALLOWED = new ErrorCode(1_040_708_006, "生产领料出库单已完成或已取消,无法取消"); |
| 427 | 427 | ErrorCode WM_PRODUCT_ISSUE_LINE_NOT_EXISTS = new ErrorCode(1_040_708_100, "生产领料出库单行不存在"); |
| 428 | 428 | ErrorCode WM_PRODUCT_ISSUE_LINE_ITEM_NOT_IN_BOM = new ErrorCode(1_040_708_101, "当前物料不在生产工单的 BOM 物料清单中"); |
| 429 | + ErrorCode WM_PRODUCT_ISSUE_CODE_DUPLICATE = new ErrorCode(1_040_708_102, "领料出库单编码已存在"); | |
| 429 | 430 | ErrorCode WM_PRODUCT_ISSUE_DETAIL_NOT_EXISTS = new ErrorCode(1_040_708_200, "生产领料出库单明细不存在"); |
| 431 | + ErrorCode WM_PRODUCT_ISSUE_DETAIL_ITEM_MISMATCH = new ErrorCode(1_040_708_201, "拣货明细的物料与领料单行的物料不一致"); | |
| 430 | 432 | |
| 431 | 433 | // ========== MES 仓库管理-生产入库单(1-040-709-000) ========== |
| 432 | 434 | ErrorCode WM_PRODUCT_PRODUCE_NOT_EXISTS = new ErrorCode(1_040_709_000, "生产入库单不存在"); | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/productissue/MesWmProductIssueService.java
| ... | ... | @@ -58,6 +58,14 @@ public interface MesWmProductIssueService { |
| 58 | 58 | MesWmProductIssueDO validateProductIssueExists(Long id); |
| 59 | 59 | |
| 60 | 60 | /** |
| 61 | + * 校验领料出库单存在且为准备中状态 | |
| 62 | + * | |
| 63 | + * @param id 编号 | |
| 64 | + * @return 领料出库单 | |
| 65 | + */ | |
| 66 | + MesWmProductIssueDO validateProductIssueExistsAndPrepare(Long id); | |
| 67 | + | |
| 68 | + /** | |
| 61 | 69 | * 提交领料出库单(草稿 → 待拣货) |
| 62 | 70 | * |
| 63 | 71 | * @param id 编号 | ... | ... |