Commit 8a04f0ba459e92ae358e6d6f17d4776b7397e8cd
1 parent
f9de4d95
✨ feat(mes): 添加生产退料单及明细相关功能
新增生产退料单、退料单行及退料明细的请求和响应对象,完善相关的服务和映射接口,支持生产退料单的创建、更新和查询功能。
Showing
33 changed files
with
2276 additions
and
0 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/returnissue/MesWmReturnIssueController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 7 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 8 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||
| 9 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 10 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 11 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.MesWmReturnIssuePageReqVO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.MesWmReturnIssueRespVO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.MesWmReturnIssueSaveReqVO; | ||
| 14 | +import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationDO; | ||
| 15 | +import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderDO; | ||
| 16 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueDO; | ||
| 17 | +import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkstationService; | ||
| 18 | +import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; | ||
| 19 | +import cn.iocoder.yudao.module.mes.service.wm.returnissue.MesWmReturnIssueService; | ||
| 20 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 21 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 22 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 23 | +import jakarta.annotation.Resource; | ||
| 24 | +import jakarta.servlet.http.HttpServletResponse; | ||
| 25 | +import jakarta.validation.Valid; | ||
| 26 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 27 | +import org.springframework.validation.annotation.Validated; | ||
| 28 | +import org.springframework.web.bind.annotation.*; | ||
| 29 | + | ||
| 30 | +import java.io.IOException; | ||
| 31 | +import java.util.Collections; | ||
| 32 | +import java.util.List; | ||
| 33 | +import java.util.Map; | ||
| 34 | + | ||
| 35 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||
| 36 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 37 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||
| 38 | + | ||
| 39 | +@Tag(name = "管理后台 - MES 生产退料单") | ||
| 40 | +@RestController | ||
| 41 | +@RequestMapping("/mes/wm/return-issue") | ||
| 42 | +@Validated | ||
| 43 | +public class MesWmReturnIssueController { | ||
| 44 | + | ||
| 45 | + @Resource | ||
| 46 | + private MesWmReturnIssueService issueService; | ||
| 47 | + @Resource | ||
| 48 | + private MesMdWorkstationService workstationService; | ||
| 49 | + @Resource | ||
| 50 | + private MesProWorkOrderService workOrderService; | ||
| 51 | + | ||
| 52 | + @PostMapping("/create") | ||
| 53 | + @Operation(summary = "创建生产退料单") | ||
| 54 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:create')") | ||
| 55 | + public CommonResult<Long> createReturnIssue(@Valid @RequestBody MesWmReturnIssueSaveReqVO createReqVO) { | ||
| 56 | + return success(issueService.createReturnIssue(createReqVO)); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @PutMapping("/update") | ||
| 60 | + @Operation(summary = "修改生产退料单") | ||
| 61 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:update')") | ||
| 62 | + public CommonResult<Boolean> updateReturnIssue(@Valid @RequestBody MesWmReturnIssueSaveReqVO updateReqVO) { | ||
| 63 | + issueService.updateReturnIssue(updateReqVO); | ||
| 64 | + return success(true); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @DeleteMapping("/delete") | ||
| 68 | + @Operation(summary = "删除生产退料单") | ||
| 69 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 70 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:delete')") | ||
| 71 | + public CommonResult<Boolean> deleteReturnIssue(@RequestParam("id") Long id) { | ||
| 72 | + issueService.deleteReturnIssue(id); | ||
| 73 | + return success(true); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + @GetMapping("/get") | ||
| 77 | + @Operation(summary = "获得生产退料单") | ||
| 78 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 79 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:query')") | ||
| 80 | + public CommonResult<MesWmReturnIssueRespVO> getReturnIssue(@RequestParam("id") Long id) { | ||
| 81 | + MesWmReturnIssueDO issue = issueService.getReturnIssue(id); | ||
| 82 | + if (issue == null) { | ||
| 83 | + return success(null); | ||
| 84 | + } | ||
| 85 | + return success(buildRespVOList(Collections.singletonList(issue)).get(0)); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + @GetMapping("/page") | ||
| 89 | + @Operation(summary = "获得生产退料单分页") | ||
| 90 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:query')") | ||
| 91 | + public CommonResult<PageResult<MesWmReturnIssueRespVO>> getReturnIssuePage( | ||
| 92 | + @Valid MesWmReturnIssuePageReqVO pageReqVO) { | ||
| 93 | + PageResult<MesWmReturnIssueDO> pageResult = issueService.getReturnIssuePage(pageReqVO); | ||
| 94 | + return success(new PageResult<>(buildRespVOList(pageResult.getList()), pageResult.getTotal())); | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + @GetMapping("/export-excel") | ||
| 98 | + @Operation(summary = "导出生产退料单 Excel") | ||
| 99 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:export')") | ||
| 100 | + @ApiAccessLog(operateType = EXPORT) | ||
| 101 | + public void exportReturnIssueExcel(@Valid MesWmReturnIssuePageReqVO pageReqVO, | ||
| 102 | + HttpServletResponse response) throws IOException { | ||
| 103 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 104 | + PageResult<MesWmReturnIssueDO> pageResult = issueService.getReturnIssuePage(pageReqVO); | ||
| 105 | + ExcelUtils.write(response, "生产退料单.xls", "数据", MesWmReturnIssueRespVO.class, | ||
| 106 | + buildRespVOList(pageResult.getList())); | ||
| 107 | + } | ||
| 108 | + | ||
| 109 | + @PutMapping("/finish") | ||
| 110 | + @Operation(summary = "完成生产退料单") | ||
| 111 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 112 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:execute')") | ||
| 113 | + public CommonResult<Boolean> finishReturnIssue(@RequestParam("id") Long id) { | ||
| 114 | + issueService.finishReturnIssue(id); | ||
| 115 | + return success(true); | ||
| 116 | + } | ||
| 117 | + | ||
| 118 | + @PutMapping("/submit") | ||
| 119 | + @Operation(summary = "提交生产退料单") | ||
| 120 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 121 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:update')") | ||
| 122 | + public CommonResult<Boolean> submitReturnIssue(@RequestParam("id") Long id) { | ||
| 123 | + issueService.submitReturnIssue(id); | ||
| 124 | + return success(true); | ||
| 125 | + } | ||
| 126 | + | ||
| 127 | + @PutMapping("/stock") | ||
| 128 | + @Operation(summary = "入库上架") | ||
| 129 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 130 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:update')") | ||
| 131 | + public CommonResult<Boolean> stockReturnIssue(@RequestParam("id") Long id) { | ||
| 132 | + issueService.stockReturnIssue(id); | ||
| 133 | + return success(true); | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + @PutMapping("/cancel") | ||
| 137 | + @Operation(summary = "取消生产退料单") | ||
| 138 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 139 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:update')") | ||
| 140 | + public CommonResult<Boolean> cancelReturnIssue(@RequestParam("id") Long id) { | ||
| 141 | + issueService.cancelReturnIssue(id); | ||
| 142 | + return success(true); | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | + @GetMapping("/check-quantity") | ||
| 146 | + @Operation(summary = "校验生产退料单数量", description = "校验每行明细数量之和是否等于行退料数量") | ||
| 147 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 148 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:query')") | ||
| 149 | + public CommonResult<Boolean> checkReturnIssueQuantity(@RequestParam("id") Long id) { | ||
| 150 | + return success(issueService.checkReturnIssueQuantity(id)); | ||
| 151 | + } | ||
| 152 | + | ||
| 153 | + // ==================== 拼接 VO ==================== | ||
| 154 | + | ||
| 155 | + private List<MesWmReturnIssueRespVO> buildRespVOList(List<MesWmReturnIssueDO> list) { | ||
| 156 | + if (CollUtil.isEmpty(list)) { | ||
| 157 | + return Collections.emptyList(); | ||
| 158 | + } | ||
| 159 | + // 1. 获得关联数据 | ||
| 160 | + Map<Long, MesMdWorkstationDO> workstationMap = workstationService.getWorkstationMap( | ||
| 161 | + convertSet(list, MesWmReturnIssueDO::getWorkstationId)); | ||
| 162 | + Map<Long, MesProWorkOrderDO> workOrderMap = workOrderService.getWorkOrderMap( | ||
| 163 | + convertSet(list, MesWmReturnIssueDO::getWorkOrderId)); | ||
| 164 | + // 2. 构建结果 | ||
| 165 | + return BeanUtils.toBean(list, MesWmReturnIssueRespVO.class, vo -> { | ||
| 166 | + // 2.1 填充工作站名称 | ||
| 167 | + MapUtils.findAndThen(workstationMap, vo.getWorkstationId(), | ||
| 168 | + workstation -> vo.setWorkstationName(workstation.getName())); | ||
| 169 | + // 2.2 填充工单编号 | ||
| 170 | + MapUtils.findAndThen(workOrderMap, vo.getWorkOrderId(), | ||
| 171 | + workOrder -> vo.setWorkOrderCode(workOrder.getCode())); | ||
| 172 | + }); | ||
| 173 | + } | ||
| 174 | + | ||
| 175 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/returnissue/MesWmReturnIssueDetailController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 5 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||
| 6 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 7 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.detail.MesWmReturnIssueDetailRespVO; | ||
| 8 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.detail.MesWmReturnIssueDetailSaveReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; | ||
| 11 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueDetailDO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseAreaDO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseDO; | ||
| 14 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseLocationDO; | ||
| 15 | +import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; | ||
| 16 | +import cn.iocoder.yudao.module.mes.service.md.unitmeasure.MesMdUnitMeasureService; | ||
| 17 | +import cn.iocoder.yudao.module.mes.service.wm.returnissue.MesWmReturnIssueDetailService; | ||
| 18 | +import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseAreaService; | ||
| 19 | +import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseLocationService; | ||
| 20 | +import cn.iocoder.yudao.module.mes.service.wm.warehouse.MesWmWarehouseService; | ||
| 21 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 22 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 23 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 24 | +import jakarta.annotation.Resource; | ||
| 25 | +import jakarta.validation.Valid; | ||
| 26 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 27 | +import org.springframework.validation.annotation.Validated; | ||
| 28 | +import org.springframework.web.bind.annotation.*; | ||
| 29 | + | ||
| 30 | +import java.util.Collections; | ||
| 31 | +import java.util.List; | ||
| 32 | +import java.util.Map; | ||
| 33 | + | ||
| 34 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 35 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||
| 36 | + | ||
| 37 | +@Tag(name = "管理后台 - MES 生产退料明细") | ||
| 38 | +@RestController | ||
| 39 | +@RequestMapping("/mes/wm/return-issue-detail") | ||
| 40 | +@Validated | ||
| 41 | +public class MesWmReturnIssueDetailController { | ||
| 42 | + | ||
| 43 | + @Resource | ||
| 44 | + private MesWmReturnIssueDetailService issueDetailService; | ||
| 45 | + | ||
| 46 | + @Resource | ||
| 47 | + private MesMdItemService itemService; | ||
| 48 | + | ||
| 49 | + @Resource | ||
| 50 | + private MesMdUnitMeasureService unitMeasureService; | ||
| 51 | + | ||
| 52 | + @Resource | ||
| 53 | + private MesWmWarehouseService warehouseService; | ||
| 54 | + | ||
| 55 | + @Resource | ||
| 56 | + private MesWmWarehouseLocationService locationService; | ||
| 57 | + | ||
| 58 | + @Resource | ||
| 59 | + private MesWmWarehouseAreaService areaService; | ||
| 60 | + | ||
| 61 | + @PostMapping("/create") | ||
| 62 | + @Operation(summary = "创建生产退料明细") | ||
| 63 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:create')") | ||
| 64 | + public CommonResult<Long> createReturnIssueDetail(@Valid @RequestBody MesWmReturnIssueDetailSaveReqVO createReqVO) { | ||
| 65 | + return success(issueDetailService.createReturnIssueDetail(createReqVO)); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @PutMapping("/update") | ||
| 69 | + @Operation(summary = "修改生产退料明细") | ||
| 70 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:update')") | ||
| 71 | + public CommonResult<Boolean> updateReturnIssueDetail(@Valid @RequestBody MesWmReturnIssueDetailSaveReqVO updateReqVO) { | ||
| 72 | + issueDetailService.updateReturnIssueDetail(updateReqVO); | ||
| 73 | + return success(true); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + @DeleteMapping("/delete") | ||
| 77 | + @Operation(summary = "删除生产退料明细") | ||
| 78 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 79 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:delete')") | ||
| 80 | + public CommonResult<Boolean> deleteReturnIssueDetail(@RequestParam("id") Long id) { | ||
| 81 | + issueDetailService.deleteReturnIssueDetail(id); | ||
| 82 | + return success(true); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + @GetMapping("/get") | ||
| 86 | + @Operation(summary = "获得生产退料明细") | ||
| 87 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 88 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:query')") | ||
| 89 | + public CommonResult<MesWmReturnIssueDetailRespVO> getReturnIssueDetail(@RequestParam("id") Long id) { | ||
| 90 | + MesWmReturnIssueDetailDO detail = issueDetailService.getReturnIssueDetail(id); | ||
| 91 | + if (detail == null) { | ||
| 92 | + return success(null); | ||
| 93 | + } | ||
| 94 | + return success(buildRespVOList(Collections.singletonList(detail)).get(0)); | ||
| 95 | + } | ||
| 96 | + | ||
| 97 | + @GetMapping("/list-by-line") | ||
| 98 | + @Operation(summary = "获得生产退料明细列表(按行编号)") | ||
| 99 | + @Parameter(name = "lineId", description = "行编号", required = true, example = "1024") | ||
| 100 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:query')") | ||
| 101 | + public CommonResult<List<MesWmReturnIssueDetailRespVO>> getReturnIssueDetailListByLineId( | ||
| 102 | + @RequestParam("lineId") Long lineId) { | ||
| 103 | + List<MesWmReturnIssueDetailDO> list = issueDetailService.getReturnIssueDetailListByLineId(lineId); | ||
| 104 | + return success(buildRespVOList(list)); | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | + // ==================== 拼接 VO ==================== | ||
| 108 | + | ||
| 109 | + private List<MesWmReturnIssueDetailRespVO> buildRespVOList(List<MesWmReturnIssueDetailDO> list) { | ||
| 110 | + if (CollUtil.isEmpty(list)) { | ||
| 111 | + return Collections.emptyList(); | ||
| 112 | + } | ||
| 113 | + // 1. 获得关联数据 | ||
| 114 | + Map<Long, MesMdItemDO> itemMap = itemService.getItemMap( | ||
| 115 | + convertSet(list, MesWmReturnIssueDetailDO::getItemId)); | ||
| 116 | + Map<Long, MesMdUnitMeasureDO> unitMeasureMap = unitMeasureService.getUnitMeasureMap( | ||
| 117 | + convertSet(itemMap.values(), MesMdItemDO::getUnitMeasureId)); | ||
| 118 | + Map<Long, MesWmWarehouseDO> warehouseMap = warehouseService.getWarehouseMap( | ||
| 119 | + convertSet(list, MesWmReturnIssueDetailDO::getWarehouseId)); | ||
| 120 | + Map<Long, MesWmWarehouseLocationDO> locationMap = locationService.getWarehouseLocationMap( | ||
| 121 | + convertSet(list, MesWmReturnIssueDetailDO::getLocationId)); | ||
| 122 | + Map<Long, MesWmWarehouseAreaDO> areaMap = areaService.getWarehouseAreaMap( | ||
| 123 | + convertSet(list, MesWmReturnIssueDetailDO::getAreaId)); | ||
| 124 | + // 2. 构建结果 | ||
| 125 | + return BeanUtils.toBean(list, MesWmReturnIssueDetailRespVO.class, vo -> { | ||
| 126 | + MapUtils.findAndThen(itemMap, vo.getItemId(), item -> { | ||
| 127 | + vo.setItemCode(item.getCode()).setItemName(item.getName()).setSpecification(item.getSpecification()); | ||
| 128 | + MapUtils.findAndThen(unitMeasureMap, item.getUnitMeasureId(), | ||
| 129 | + unitMeasure -> vo.setUnitMeasureName(unitMeasure.getName())); | ||
| 130 | + }); | ||
| 131 | + MapUtils.findAndThen(warehouseMap, vo.getWarehouseId(), | ||
| 132 | + warehouse -> vo.setWarehouseName(warehouse.getName())); | ||
| 133 | + MapUtils.findAndThen(locationMap, vo.getLocationId(), | ||
| 134 | + location -> vo.setLocationName(location.getName())); | ||
| 135 | + MapUtils.findAndThen(areaMap, vo.getAreaId(), | ||
| 136 | + area -> vo.setAreaName(area.getName())); | ||
| 137 | + }); | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/returnissue/MesWmReturnIssueLineController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||
| 7 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 8 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.line.MesWmReturnIssueLinePageReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.line.MesWmReturnIssueLineRespVO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.line.MesWmReturnIssueLineSaveReqVO; | ||
| 11 | +import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueLineDO; | ||
| 14 | +import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; | ||
| 15 | +import cn.iocoder.yudao.module.mes.service.md.unitmeasure.MesMdUnitMeasureService; | ||
| 16 | +import cn.iocoder.yudao.module.mes.service.wm.returnissue.MesWmReturnIssueLineService; | ||
| 17 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 18 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 19 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 20 | +import jakarta.annotation.Resource; | ||
| 21 | +import jakarta.validation.Valid; | ||
| 22 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 23 | +import org.springframework.validation.annotation.Validated; | ||
| 24 | +import org.springframework.web.bind.annotation.*; | ||
| 25 | + | ||
| 26 | +import java.util.Collections; | ||
| 27 | +import java.util.List; | ||
| 28 | +import java.util.Map; | ||
| 29 | + | ||
| 30 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 31 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||
| 32 | + | ||
| 33 | +@Tag(name = "管理后台 - MES 生产退料单行") | ||
| 34 | +@RestController | ||
| 35 | +@RequestMapping("/mes/wm/return-issue-line") | ||
| 36 | +@Validated | ||
| 37 | +public class MesWmReturnIssueLineController { | ||
| 38 | + | ||
| 39 | + @Resource | ||
| 40 | + private MesWmReturnIssueLineService issueLineService; | ||
| 41 | + | ||
| 42 | + @Resource | ||
| 43 | + private MesMdItemService itemService; | ||
| 44 | + | ||
| 45 | + @Resource | ||
| 46 | + private MesMdUnitMeasureService unitMeasureService; | ||
| 47 | + | ||
| 48 | + @PostMapping("/create") | ||
| 49 | + @Operation(summary = "创建生产退料单行") | ||
| 50 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:create')") | ||
| 51 | + public CommonResult<Long> createReturnIssueLine(@Valid @RequestBody MesWmReturnIssueLineSaveReqVO createReqVO) { | ||
| 52 | + return success(issueLineService.createReturnIssueLine(createReqVO)); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @PutMapping("/update") | ||
| 56 | + @Operation(summary = "修改生产退料单行") | ||
| 57 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:update')") | ||
| 58 | + public CommonResult<Boolean> updateReturnIssueLine(@Valid @RequestBody MesWmReturnIssueLineSaveReqVO updateReqVO) { | ||
| 59 | + issueLineService.updateReturnIssueLine(updateReqVO); | ||
| 60 | + return success(true); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @DeleteMapping("/delete") | ||
| 64 | + @Operation(summary = "删除生产退料单行") | ||
| 65 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 66 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:delete')") | ||
| 67 | + public CommonResult<Boolean> deleteReturnIssueLine(@RequestParam("id") Long id) { | ||
| 68 | + issueLineService.deleteReturnIssueLine(id); | ||
| 69 | + return success(true); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @GetMapping("/get") | ||
| 73 | + @Operation(summary = "获得生产退料单行") | ||
| 74 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 75 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:query')") | ||
| 76 | + public CommonResult<MesWmReturnIssueLineRespVO> getReturnIssueLine(@RequestParam("id") Long id) { | ||
| 77 | + MesWmReturnIssueLineDO line = issueLineService.getReturnIssueLine(id); | ||
| 78 | + if (line == null) { | ||
| 79 | + return success(null); | ||
| 80 | + } | ||
| 81 | + return success(buildRespVOList(Collections.singletonList(line)).get(0)); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + @GetMapping("/page") | ||
| 85 | + @Operation(summary = "获得生产退料单行分页") | ||
| 86 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:query')") | ||
| 87 | + public CommonResult<PageResult<MesWmReturnIssueLineRespVO>> getReturnIssueLinePage( | ||
| 88 | + @Valid MesWmReturnIssueLinePageReqVO pageReqVO) { | ||
| 89 | + PageResult<MesWmReturnIssueLineDO> pageResult = issueLineService.getReturnIssueLinePage(pageReqVO); | ||
| 90 | + return success(new PageResult<>(buildRespVOList(pageResult.getList()), pageResult.getTotal())); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + @GetMapping("/list-by-issue") | ||
| 94 | + @Operation(summary = "获得生产退料单行列表(按退料单编号)") | ||
| 95 | + @Parameter(name = "issueId", description = "退料单编号", required = true, example = "1024") | ||
| 96 | + @PreAuthorize("@ss.hasPermission('mes:wm-return-issue:query')") | ||
| 97 | + public CommonResult<List<MesWmReturnIssueLineRespVO>> getReturnIssueLineListByIssueId( | ||
| 98 | + @RequestParam("issueId") Long issueId) { | ||
| 99 | + List<MesWmReturnIssueLineDO> list = issueLineService.getReturnIssueLineListByIssueId(issueId); | ||
| 100 | + return success(buildRespVOList(list)); | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + // ==================== 拼接 VO ==================== | ||
| 104 | + | ||
| 105 | + private List<MesWmReturnIssueLineRespVO> buildRespVOList(List<MesWmReturnIssueLineDO> list) { | ||
| 106 | + if (CollUtil.isEmpty(list)) { | ||
| 107 | + return Collections.emptyList(); | ||
| 108 | + } | ||
| 109 | + // 1. 获得关联数据 | ||
| 110 | + Map<Long, MesMdItemDO> itemMap = itemService.getItemMap( | ||
| 111 | + convertSet(list, MesWmReturnIssueLineDO::getItemId)); | ||
| 112 | + Map<Long, MesMdUnitMeasureDO> unitMeasureMap = unitMeasureService.getUnitMeasureMap( | ||
| 113 | + convertSet(itemMap.values(), MesMdItemDO::getUnitMeasureId)); | ||
| 114 | + // 2. 构建结果 | ||
| 115 | + return BeanUtils.toBean(list, MesWmReturnIssueLineRespVO.class, vo -> { | ||
| 116 | + MapUtils.findAndThen(itemMap, vo.getItemId(), item -> { | ||
| 117 | + vo.setItemCode(item.getCode()).setItemName(item.getName()).setSpecification(item.getSpecification()); | ||
| 118 | + MapUtils.findAndThen(unitMeasureMap, item.getUnitMeasureId(), | ||
| 119 | + unitMeasure -> vo.setUnitMeasureName(unitMeasure.getName())); | ||
| 120 | + }); | ||
| 121 | + }); | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/returnissue/vo/MesWmReturnIssuePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import lombok.EqualsAndHashCode; | ||
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 8 | + | ||
| 9 | +import java.time.LocalDateTime; | ||
| 10 | + | ||
| 11 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 12 | + | ||
| 13 | +@Schema(description = "管理后台 - MES 生产退料单分页 Request VO") | ||
| 14 | +@Data | ||
| 15 | +@EqualsAndHashCode(callSuper = true) | ||
| 16 | +public class MesWmReturnIssuePageReqVO extends PageParam { | ||
| 17 | + | ||
| 18 | + @Schema(description = "退料单编号", example = "RI20250226001") | ||
| 19 | + private String code; | ||
| 20 | + | ||
| 21 | + @Schema(description = "退料单名称", example = "生产退料") | ||
| 22 | + private String name; | ||
| 23 | + | ||
| 24 | + @Schema(description = "工作站 ID", example = "1") | ||
| 25 | + private Long workstationId; | ||
| 26 | + | ||
| 27 | + @Schema(description = "生产工单 ID", example = "1") | ||
| 28 | + private Long workOrderId; | ||
| 29 | + | ||
| 30 | + @Schema(description = "退料类型", example = "RMR") | ||
| 31 | + private String returnType; | ||
| 32 | + | ||
| 33 | + @Schema(description = "状态", example = "0") | ||
| 34 | + private Integer status; | ||
| 35 | + | ||
| 36 | + @Schema(description = "退料日期范围") | ||
| 37 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 38 | + private LocalDateTime[] returnDate; | ||
| 39 | + | ||
| 40 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/returnissue/vo/MesWmReturnIssueRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.time.LocalDateTime; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - MES 生产退料单 Response VO") | ||
| 9 | +@Data | ||
| 10 | +public class MesWmReturnIssueRespVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | + @Schema(description = "退料单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "RI20250226001") | ||
| 16 | + private String code; | ||
| 17 | + | ||
| 18 | + @Schema(description = "退料单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "生产退料") | ||
| 19 | + private String name; | ||
| 20 | + | ||
| 21 | + @Schema(description = "生产工单 ID", example = "1") | ||
| 22 | + private Long workOrderId; | ||
| 23 | + | ||
| 24 | + @Schema(description = "生产工单编号", example = "WO20250226001") | ||
| 25 | + private String workOrderCode; | ||
| 26 | + | ||
| 27 | + @Schema(description = "工作站 ID", example = "1") | ||
| 28 | + private Long workstationId; | ||
| 29 | + | ||
| 30 | + @Schema(description = "工作站名称", example = "装配工作站") | ||
| 31 | + private String workstationName; | ||
| 32 | + | ||
| 33 | + @Schema(description = "退料类型", example = "RMR") | ||
| 34 | + private String returnType; | ||
| 35 | + | ||
| 36 | + @Schema(description = "退料日期") | ||
| 37 | + private LocalDateTime returnDate; | ||
| 38 | + | ||
| 39 | + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | ||
| 40 | + private Integer status; | ||
| 41 | + | ||
| 42 | + @Schema(description = "备注", example = "备注") | ||
| 43 | + private String remark; | ||
| 44 | + | ||
| 45 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 46 | + private LocalDateTime createTime; | ||
| 47 | + | ||
| 48 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/returnissue/vo/MesWmReturnIssueSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.NotBlank; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | + | ||
| 9 | +// TODO @AI:需要检查下,哪些是必传字段。然后校验下; | ||
| 10 | +@Schema(description = "管理后台 - MES 生产退料单新增/修改 Request VO") | ||
| 11 | +@Data | ||
| 12 | +public class MesWmReturnIssueSaveReqVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "编号", example = "1024") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + @Schema(description = "退料单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "RI20250226001") | ||
| 18 | + @NotBlank(message = "退料单编号不能为空") | ||
| 19 | + private String code; | ||
| 20 | + | ||
| 21 | + @Schema(description = "退料单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "生产退料") | ||
| 22 | + @NotBlank(message = "退料单名称不能为空") | ||
| 23 | + private String name; | ||
| 24 | + | ||
| 25 | + @Schema(description = "生产工单 ID", example = "1") | ||
| 26 | + private Long workOrderId; | ||
| 27 | + | ||
| 28 | + @Schema(description = "工作站 ID", example = "1") | ||
| 29 | + private Long workstationId; | ||
| 30 | + | ||
| 31 | + @Schema(description = "退料类型", example = "RMR") | ||
| 32 | + private String returnType; | ||
| 33 | + | ||
| 34 | + @Schema(description = "退料日期") | ||
| 35 | + private LocalDateTime returnDate; | ||
| 36 | + | ||
| 37 | + @Schema(description = "备注", example = "备注") | ||
| 38 | + private String remark; | ||
| 39 | + | ||
| 40 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/returnissue/vo/detail/MesWmReturnIssueDetailRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.detail; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | + | ||
| 9 | +@Schema(description = "管理后台 - MES 生产退料明细 Response VO") | ||
| 10 | +@Data | ||
| 11 | +public class MesWmReturnIssueDetailRespVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "编号", example = "1") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "退料单编号", example = "1") | ||
| 17 | + private Long issueId; | ||
| 18 | + | ||
| 19 | + @Schema(description = "行编号", example = "1") | ||
| 20 | + private Long lineId; | ||
| 21 | + | ||
| 22 | + @Schema(description = "库存记录编号", example = "1") | ||
| 23 | + private Long materialStockId; | ||
| 24 | + | ||
| 25 | + @Schema(description = "物料编号", example = "1") | ||
| 26 | + private Long itemId; | ||
| 27 | + | ||
| 28 | + @Schema(description = "物料编码", example = "ITEM001") | ||
| 29 | + private String itemCode; | ||
| 30 | + | ||
| 31 | + @Schema(description = "物料名称", example = "螺丝") | ||
| 32 | + private String itemName; | ||
| 33 | + | ||
| 34 | + @Schema(description = "规格型号", example = "M8*20") | ||
| 35 | + private String specification; | ||
| 36 | + | ||
| 37 | + @Schema(description = "计量单位名称", example = "个") | ||
| 38 | + private String unitMeasureName; | ||
| 39 | + | ||
| 40 | + @Schema(description = "退料数量", example = "300.00") | ||
| 41 | + private BigDecimal quantity; | ||
| 42 | + | ||
| 43 | + @Schema(description = "批次编号", example = "1") | ||
| 44 | + private Long batchId; | ||
| 45 | + | ||
| 46 | + @Schema(description = "批次号", example = "BATCH20260101001") | ||
| 47 | + private String batchCode; | ||
| 48 | + | ||
| 49 | + @Schema(description = "仓库编号", example = "1") | ||
| 50 | + private Long warehouseId; | ||
| 51 | + | ||
| 52 | + @Schema(description = "仓库名称", example = "原材料仓库") | ||
| 53 | + private String warehouseName; | ||
| 54 | + | ||
| 55 | + @Schema(description = "库区编号", example = "1") | ||
| 56 | + private Long locationId; | ||
| 57 | + | ||
| 58 | + @Schema(description = "库区名称", example = "A区") | ||
| 59 | + private String locationName; | ||
| 60 | + | ||
| 61 | + @Schema(description = "库位编号", example = "1") | ||
| 62 | + private Long areaId; | ||
| 63 | + | ||
| 64 | + @Schema(description = "库位名称", example = "A01") | ||
| 65 | + private String areaName; | ||
| 66 | + | ||
| 67 | + @Schema(description = "备注", example = "备注") | ||
| 68 | + private String remark; | ||
| 69 | + | ||
| 70 | + @Schema(description = "创建时间") | ||
| 71 | + private LocalDateTime createTime; | ||
| 72 | + | ||
| 73 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/returnissue/vo/detail/MesWmReturnIssueDetailSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.detail; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.NotNull; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import java.math.BigDecimal; | ||
| 8 | + | ||
| 9 | +@Schema(description = "管理后台 - MES 生产退料明细新增/修改 Request VO") | ||
| 10 | +@Data | ||
| 11 | +public class MesWmReturnIssueDetailSaveReqVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "编号", example = "1024") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "退料单行编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 17 | + @NotNull(message = "退料单行编号不能为空") | ||
| 18 | + private Long lineId; | ||
| 19 | + | ||
| 20 | + @Schema(description = "退料单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 21 | + @NotNull(message = "退料单编号不能为空") | ||
| 22 | + private Long issueId; | ||
| 23 | + | ||
| 24 | + @Schema(description = "物料编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 25 | + @NotNull(message = "物料编号不能为空") | ||
| 26 | + private Long itemId; | ||
| 27 | + | ||
| 28 | + @Schema(description = "退料数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "300.00") | ||
| 29 | + @NotNull(message = "退料数量不能为空") | ||
| 30 | + private BigDecimal quantity; | ||
| 31 | + | ||
| 32 | + @Schema(description = "批次编号", example = "1") | ||
| 33 | + private Long batchId; | ||
| 34 | + | ||
| 35 | + @Schema(description = "批次号", example = "BATCH20260101001") | ||
| 36 | + private String batchCode; | ||
| 37 | + | ||
| 38 | + @Schema(description = "仓库编号", example = "1") | ||
| 39 | + private Long warehouseId; | ||
| 40 | + | ||
| 41 | + @Schema(description = "库区编号", example = "1") | ||
| 42 | + private Long locationId; | ||
| 43 | + | ||
| 44 | + @Schema(description = "库位编号", example = "1") | ||
| 45 | + private Long areaId; | ||
| 46 | + | ||
| 47 | + @Schema(description = "备注", example = "备注") | ||
| 48 | + private String remark; | ||
| 49 | + | ||
| 50 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/returnissue/vo/line/MesWmReturnIssueLinePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.line; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import jakarta.validation.constraints.NotNull; | ||
| 6 | +import lombok.Data; | ||
| 7 | +import lombok.EqualsAndHashCode; | ||
| 8 | +import lombok.ToString; | ||
| 9 | + | ||
| 10 | +@Schema(description = "管理后台 - MES 生产退料单行分页 Request VO") | ||
| 11 | +@Data | ||
| 12 | +@EqualsAndHashCode(callSuper = true) | ||
| 13 | +@ToString(callSuper = true) | ||
| 14 | +public class MesWmReturnIssueLinePageReqVO extends PageParam { | ||
| 15 | + | ||
| 16 | + @Schema(description = "退料单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 17 | + @NotNull(message = "退料单编号不能为空") | ||
| 18 | + private Long issueId; | ||
| 19 | + | ||
| 20 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/returnissue/vo/line/MesWmReturnIssueLineRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.line; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | + | ||
| 9 | +@Schema(description = "管理后台 - MES 生产退料单行 Response VO") | ||
| 10 | +@Data | ||
| 11 | +public class MesWmReturnIssueLineRespVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "行 ID", example = "1") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "退料单 ID", example = "1") | ||
| 17 | + private Long issueId; | ||
| 18 | + | ||
| 19 | + @Schema(description = "物料 ID", example = "1") | ||
| 20 | + private Long itemId; | ||
| 21 | + | ||
| 22 | + @Schema(description = "物料编码", example = "M001") | ||
| 23 | + private String itemCode; | ||
| 24 | + | ||
| 25 | + @Schema(description = "物料名称", example = "钢板") | ||
| 26 | + private String itemName; | ||
| 27 | + | ||
| 28 | + @Schema(description = "规格型号", example = "10mm*100mm") | ||
| 29 | + private String specification; | ||
| 30 | + | ||
| 31 | + @Schema(description = "计量单位名称", example = "千克") | ||
| 32 | + private String unitMeasureName; | ||
| 33 | + | ||
| 34 | + @Schema(description = "退料数量", example = "100.00") | ||
| 35 | + private BigDecimal quantity; | ||
| 36 | + | ||
| 37 | + @Schema(description = "批次 ID", example = "1") | ||
| 38 | + private Long batchId; | ||
| 39 | + | ||
| 40 | + @Schema(description = "是否需要质检", example = "false") | ||
| 41 | + private Boolean qcFlag; | ||
| 42 | + | ||
| 43 | + @Schema(description = "质量状态", example = "0") | ||
| 44 | + private Integer qualityStatus; | ||
| 45 | + | ||
| 46 | + @Schema(description = "过程检验单 ID", example = "1") | ||
| 47 | + private Long ipqcId; | ||
| 48 | + | ||
| 49 | + @Schema(description = "备注", example = "备注") | ||
| 50 | + private String remark; | ||
| 51 | + | ||
| 52 | + @Schema(description = "创建时间") | ||
| 53 | + private LocalDateTime createTime; | ||
| 54 | + | ||
| 55 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/returnissue/vo/line/MesWmReturnIssueLineSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.line; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.DecimalMin; | ||
| 5 | +import jakarta.validation.constraints.NotNull; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | + | ||
| 10 | +@Schema(description = "管理后台 - MES 生产退料单行 Save Request VO") | ||
| 11 | +@Data | ||
| 12 | +public class MesWmReturnIssueLineSaveReqVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "行 ID", example = "1") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + @Schema(description = "退料单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 18 | + @NotNull(message = "退料单 ID 不能为空") | ||
| 19 | + private Long issueId; | ||
| 20 | + | ||
| 21 | + @Schema(description = "物料 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 22 | + @NotNull(message = "物料 ID 不能为空") | ||
| 23 | + private Long itemId; | ||
| 24 | + | ||
| 25 | + @Schema(description = "退料数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") | ||
| 26 | + @NotNull(message = "退料数量不能为空") | ||
| 27 | + @DecimalMin(value = "0", inclusive = false, message = "退料数量必须大于 0") | ||
| 28 | + private BigDecimal quantity; | ||
| 29 | + | ||
| 30 | + @Schema(description = "批次 ID", example = "1") | ||
| 31 | + private Long batchId; | ||
| 32 | + | ||
| 33 | + @Schema(description = "是否需要质检", example = "false") | ||
| 34 | + private Boolean qcFlag; | ||
| 35 | + | ||
| 36 | + @Schema(description = "备注", example = "备注") | ||
| 37 | + private String remark; | ||
| 38 | + | ||
| 39 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/returnvendor/vo/MesWmReturnVendorPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.returnvendor.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import lombok.EqualsAndHashCode; | ||
| 7 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 8 | + | ||
| 9 | +import java.time.LocalDateTime; | ||
| 10 | + | ||
| 11 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 12 | + | ||
| 13 | +@Schema(description = "管理后台 - MES 供应商退货单分页 Request VO") | ||
| 14 | +@Data | ||
| 15 | +@EqualsAndHashCode(callSuper = true) | ||
| 16 | +public class MesWmReturnVendorPageReqVO extends PageParam { | ||
| 17 | + | ||
| 18 | + @Schema(description = "退货单编号", example = "RV20250226001") | ||
| 19 | + private String code; | ||
| 20 | + | ||
| 21 | + @Schema(description = "退货单名称", example = "供应商退货") | ||
| 22 | + private String name; | ||
| 23 | + | ||
| 24 | + @Schema(description = "供应商 ID", example = "1") | ||
| 25 | + private Long vendorId; | ||
| 26 | + | ||
| 27 | + @Schema(description = "状态", example = "10") | ||
| 28 | + private Integer status; | ||
| 29 | + | ||
| 30 | + @Schema(description = "退货日期范围") | ||
| 31 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 32 | + private LocalDateTime[] returnDate; | ||
| 33 | + | ||
| 34 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/returnvendor/vo/MesWmReturnVendorRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.returnvendor.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.time.LocalDateTime; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - MES 供应商退货单 Response VO") | ||
| 9 | +@Data | ||
| 10 | +public class MesWmReturnVendorRespVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | + @Schema(description = "退货单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "RV20250226001") | ||
| 16 | + private String code; | ||
| 17 | + | ||
| 18 | + @Schema(description = "退货单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "供应商退货") | ||
| 19 | + private String name; | ||
| 20 | + | ||
| 21 | + @Schema(description = "采购订单编号", example = "PO20250226001") | ||
| 22 | + private String purchaseOrderCode; | ||
| 23 | + | ||
| 24 | + @Schema(description = "供应商 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 25 | + private Long vendorId; | ||
| 26 | + | ||
| 27 | + @Schema(description = "供应商名称", example = "XX供应商") | ||
| 28 | + private String vendorName; | ||
| 29 | + | ||
| 30 | + @Schema(description = "供应商简称", example = "XX") | ||
| 31 | + private String vendorNickname; | ||
| 32 | + | ||
| 33 | + @Schema(description = "批次号", example = "BATCH001") | ||
| 34 | + private String batchCode; | ||
| 35 | + | ||
| 36 | + @Schema(description = "退货日期") | ||
| 37 | + private LocalDateTime returnDate; | ||
| 38 | + | ||
| 39 | + @Schema(description = "退货原因", example = "质量不合格") | ||
| 40 | + private String returnReason; | ||
| 41 | + | ||
| 42 | + @Schema(description = "物流单号", example = "SF1234567890") | ||
| 43 | + private String transportCode; | ||
| 44 | + | ||
| 45 | + @Schema(description = "物流联系电话", example = "13800138000") | ||
| 46 | + private String transportTelephone; | ||
| 47 | + | ||
| 48 | + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") | ||
| 49 | + private Integer status; | ||
| 50 | + | ||
| 51 | + @Schema(description = "备注", example = "备注") | ||
| 52 | + private String remark; | ||
| 53 | + | ||
| 54 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 55 | + private LocalDateTime createTime; | ||
| 56 | + | ||
| 57 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/returnvendor/vo/MesWmReturnVendorSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.returnvendor.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.NotBlank; | ||
| 5 | +import jakarta.validation.constraints.NotNull; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | + | ||
| 10 | +@Schema(description = "管理后台 - MES 供应商退货单新增/修改 Request VO") | ||
| 11 | +@Data | ||
| 12 | +public class MesWmReturnVendorSaveReqVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "编号", example = "1024") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + @Schema(description = "退货单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "RV20250226001") | ||
| 18 | + @NotBlank(message = "退货单编号不能为空") | ||
| 19 | + private String code; | ||
| 20 | + | ||
| 21 | + @Schema(description = "退货单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "供应商退货") | ||
| 22 | + @NotBlank(message = "退货单名称不能为空") | ||
| 23 | + private String name; | ||
| 24 | + | ||
| 25 | + @Schema(description = "采购订单编号", example = "PO20250226001") | ||
| 26 | + private String purchaseOrderCode; | ||
| 27 | + | ||
| 28 | + @Schema(description = "供应商 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 29 | + @NotNull(message = "供应商 ID 不能为空") | ||
| 30 | + private Long vendorId; | ||
| 31 | + | ||
| 32 | + @Schema(description = "批次号", example = "BATCH001") | ||
| 33 | + private String batchCode; | ||
| 34 | + | ||
| 35 | + @Schema(description = "退货日期", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 36 | + @NotNull(message = "退货日期不能为空") | ||
| 37 | + private LocalDateTime returnDate; | ||
| 38 | + | ||
| 39 | + @Schema(description = "退货原因", example = "质量不合格") | ||
| 40 | + private String returnReason; | ||
| 41 | + | ||
| 42 | + @Schema(description = "物流单号", example = "SF1234567890") | ||
| 43 | + private String transportCode; | ||
| 44 | + | ||
| 45 | + @Schema(description = "物流联系电话", example = "13800138000") | ||
| 46 | + private String transportTelephone; | ||
| 47 | + | ||
| 48 | + @Schema(description = "备注", example = "备注") | ||
| 49 | + private String remark; | ||
| 50 | + | ||
| 51 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/returnvendor/vo/detail/MesWmReturnVendorDetailRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.returnvendor.vo.detail; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | + | ||
| 9 | +@Schema(description = "管理后台 - MES 供应商退货明细 Response VO") | ||
| 10 | +@Data | ||
| 11 | +public class MesWmReturnVendorDetailRespVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "编号", example = "1") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "退货单编号", example = "1") | ||
| 17 | + private Long returnId; | ||
| 18 | + | ||
| 19 | + @Schema(description = "行编号", example = "1") | ||
| 20 | + private Long lineId; | ||
| 21 | + | ||
| 22 | + @Schema(description = "库存记录编号", example = "1") | ||
| 23 | + private Long materialStockId; | ||
| 24 | + | ||
| 25 | + @Schema(description = "物料编号", example = "1") | ||
| 26 | + private Long itemId; | ||
| 27 | + | ||
| 28 | + @Schema(description = "物料编码", example = "ITEM001") | ||
| 29 | + private String itemCode; | ||
| 30 | + | ||
| 31 | + @Schema(description = "物料名称", example = "螺丝") | ||
| 32 | + private String itemName; | ||
| 33 | + | ||
| 34 | + @Schema(description = "规格型号", example = "M8*20") | ||
| 35 | + private String specification; | ||
| 36 | + | ||
| 37 | + @Schema(description = "计量单位名称", example = "个") | ||
| 38 | + private String unitMeasureName; | ||
| 39 | + | ||
| 40 | + @Schema(description = "退货数量", example = "300.00") | ||
| 41 | + private BigDecimal quantity; | ||
| 42 | + | ||
| 43 | + @Schema(description = "批次编号", example = "1") | ||
| 44 | + private Long batchId; | ||
| 45 | + | ||
| 46 | + @Schema(description = "批次号", example = "BATCH20260101001") | ||
| 47 | + private String batchCode; | ||
| 48 | + | ||
| 49 | + @Schema(description = "仓库编号", example = "1") | ||
| 50 | + private Long warehouseId; | ||
| 51 | + | ||
| 52 | + @Schema(description = "仓库名称", example = "原材料仓库") | ||
| 53 | + private String warehouseName; | ||
| 54 | + | ||
| 55 | + @Schema(description = "库区编号", example = "1") | ||
| 56 | + private Long locationId; | ||
| 57 | + | ||
| 58 | + @Schema(description = "库区名称", example = "A区") | ||
| 59 | + private String locationName; | ||
| 60 | + | ||
| 61 | + @Schema(description = "库位编号", example = "1") | ||
| 62 | + private Long areaId; | ||
| 63 | + | ||
| 64 | + @Schema(description = "库位名称", example = "A01") | ||
| 65 | + private String areaName; | ||
| 66 | + | ||
| 67 | + @Schema(description = "备注", example = "备注") | ||
| 68 | + private String remark; | ||
| 69 | + | ||
| 70 | + @Schema(description = "创建时间") | ||
| 71 | + private LocalDateTime createTime; | ||
| 72 | + | ||
| 73 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/returnvendor/vo/detail/MesWmReturnVendorDetailSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.returnvendor.vo.detail; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.NotNull; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import java.math.BigDecimal; | ||
| 8 | + | ||
| 9 | +@Schema(description = "管理后台 - MES 供应商退货明细新增/修改 Request VO") | ||
| 10 | +@Data | ||
| 11 | +public class MesWmReturnVendorDetailSaveReqVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "编号", example = "1024") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "退货单行编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 17 | + @NotNull(message = "退货单行编号不能为空") | ||
| 18 | + private Long lineId; | ||
| 19 | + | ||
| 20 | + @Schema(description = "退货单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 21 | + @NotNull(message = "退货单编号不能为空") | ||
| 22 | + private Long returnId; | ||
| 23 | + | ||
| 24 | + @Schema(description = "物料编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 25 | + @NotNull(message = "物料编号不能为空") | ||
| 26 | + private Long itemId; | ||
| 27 | + | ||
| 28 | + @Schema(description = "退货数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "300.00") | ||
| 29 | + @NotNull(message = "退货数量不能为空") | ||
| 30 | + private BigDecimal quantity; | ||
| 31 | + | ||
| 32 | + @Schema(description = "批次编号", example = "1") | ||
| 33 | + private Long batchId; | ||
| 34 | + | ||
| 35 | + @Schema(description = "批次号", example = "BATCH20260101001") | ||
| 36 | + private String batchCode; | ||
| 37 | + | ||
| 38 | + @Schema(description = "仓库编号", example = "1") | ||
| 39 | + private Long warehouseId; | ||
| 40 | + | ||
| 41 | + @Schema(description = "库区编号", example = "1") | ||
| 42 | + private Long locationId; | ||
| 43 | + | ||
| 44 | + @Schema(description = "库位编号", example = "1") | ||
| 45 | + private Long areaId; | ||
| 46 | + | ||
| 47 | + @Schema(description = "备注", example = "备注") | ||
| 48 | + private String remark; | ||
| 49 | + | ||
| 50 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/returnvendor/vo/line/MesWmReturnVendorLinePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.returnvendor.vo.line; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import jakarta.validation.constraints.NotNull; | ||
| 6 | +import lombok.Data; | ||
| 7 | +import lombok.EqualsAndHashCode; | ||
| 8 | +import lombok.ToString; | ||
| 9 | + | ||
| 10 | +@Schema(description = "管理后台 - MES 供应商退货单行分页 Request VO") | ||
| 11 | +@Data | ||
| 12 | +@EqualsAndHashCode(callSuper = true) | ||
| 13 | +@ToString(callSuper = true) | ||
| 14 | +public class MesWmReturnVendorLinePageReqVO extends PageParam { | ||
| 15 | + | ||
| 16 | + @Schema(description = "退货单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 17 | + @NotNull(message = "退货单编号不能为空") | ||
| 18 | + private Long returnId; | ||
| 19 | + | ||
| 20 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/returnvendor/vo/line/MesWmReturnVendorLineRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.returnvendor.vo.line; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | + | ||
| 9 | +@Schema(description = "管理后台 - MES 供应商退货单行 Response VO") | ||
| 10 | +@Data | ||
| 11 | +public class MesWmReturnVendorLineRespVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "行ID", example = "1") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "退货单ID", example = "1") | ||
| 17 | + private Long returnId; | ||
| 18 | + | ||
| 19 | + @Schema(description = "物料ID", example = "1") | ||
| 20 | + private Long itemId; | ||
| 21 | + | ||
| 22 | + @Schema(description = "物料编码", example = "M001") | ||
| 23 | + private String itemCode; | ||
| 24 | + | ||
| 25 | + @Schema(description = "物料名称", example = "钢板") | ||
| 26 | + private String itemName; | ||
| 27 | + | ||
| 28 | + @Schema(description = "规格型号", example = "10mm*100mm") | ||
| 29 | + private String specification; | ||
| 30 | + | ||
| 31 | + @Schema(description = "计量单位名称", example = "千克") | ||
| 32 | + private String unitMeasureName; | ||
| 33 | + | ||
| 34 | + @Schema(description = "退货数量", example = "100.00") | ||
| 35 | + private BigDecimal quantity; | ||
| 36 | + | ||
| 37 | + @Schema(description = "批次ID", example = "1") | ||
| 38 | + private Long batchId; | ||
| 39 | + | ||
| 40 | + @Schema(description = "备注", example = "备注") | ||
| 41 | + private String remark; | ||
| 42 | + | ||
| 43 | + @Schema(description = "创建时间") | ||
| 44 | + private LocalDateTime createTime; | ||
| 45 | + | ||
| 46 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/returnvendor/vo/line/MesWmReturnVendorLineSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.returnvendor.vo.line; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.DecimalMin; | ||
| 5 | +import jakarta.validation.constraints.NotNull; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | + | ||
| 10 | +@Schema(description = "管理后台 - MES 供应商退货单行 Save Request VO") | ||
| 11 | +@Data | ||
| 12 | +public class MesWmReturnVendorLineSaveReqVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "行ID", example = "1") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + @Schema(description = "退货单ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 18 | + @NotNull(message = "退货单ID不能为空") | ||
| 19 | + private Long returnId; | ||
| 20 | + | ||
| 21 | + @Schema(description = "物料ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 22 | + @NotNull(message = "物料ID不能为空") | ||
| 23 | + private Long itemId; | ||
| 24 | + | ||
| 25 | + @Schema(description = "退货数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") | ||
| 26 | + @NotNull(message = "退货数量不能为空") | ||
| 27 | + @DecimalMin(value = "0", inclusive = false, message = "退货数量必须大于 0") | ||
| 28 | + private BigDecimal quantity; | ||
| 29 | + | ||
| 30 | + @Schema(description = "批次ID", example = "1") | ||
| 31 | + private Long batchId; | ||
| 32 | + | ||
| 33 | + @Schema(description = "备注", example = "备注") | ||
| 34 | + private String remark; | ||
| 35 | + | ||
| 36 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/wm/returnissue/MesWmReturnIssueDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 4 | +import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationDO; | ||
| 5 | +import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderDO; | ||
| 6 | +import cn.iocoder.yudao.module.mes.enums.wm.MesWmReturnIssueStatusEnum; | ||
| 7 | +import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 8 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 9 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 10 | +import lombok.*; | ||
| 11 | + | ||
| 12 | +import java.time.LocalDateTime; | ||
| 13 | + | ||
| 14 | +/** | ||
| 15 | + * MES 生产退料单 DO | ||
| 16 | + */ | ||
| 17 | +@TableName("mes_wm_return_issue") | ||
| 18 | +@KeySequence("mes_wm_return_issue_seq") | ||
| 19 | +@Data | ||
| 20 | +@EqualsAndHashCode(callSuper = true) | ||
| 21 | +@ToString(callSuper = true) | ||
| 22 | +@Builder | ||
| 23 | +@NoArgsConstructor | ||
| 24 | +@AllArgsConstructor | ||
| 25 | +public class MesWmReturnIssueDO extends BaseDO { | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 编号 | ||
| 29 | + */ | ||
| 30 | + @TableId | ||
| 31 | + private Long id; | ||
| 32 | + /** | ||
| 33 | + * 退料单编号 | ||
| 34 | + */ | ||
| 35 | + private String code; | ||
| 36 | + /** | ||
| 37 | + * 退料单名称 | ||
| 38 | + */ | ||
| 39 | + private String name; | ||
| 40 | + /** | ||
| 41 | + * 生产工单 ID | ||
| 42 | + * | ||
| 43 | + * 关联 {@link MesProWorkOrderDO#getId()} | ||
| 44 | + */ | ||
| 45 | + private Long workOrderId; | ||
| 46 | + /** | ||
| 47 | + * 工作站 ID | ||
| 48 | + * | ||
| 49 | + * 关联 {@link MesMdWorkstationDO#getId()} | ||
| 50 | + */ | ||
| 51 | + private Long workstationId; | ||
| 52 | + // TODO @AI:可以改成 type 字段;简化; | ||
| 53 | + /** | ||
| 54 | + * 退料类型 | ||
| 55 | + * | ||
| 56 | + * 字典 {@link cn.iocoder.yudao.module.mes.enums.DictTypeConstants#MES_WM_RETURN_ISSUE_TYPE} | ||
| 57 | + */ | ||
| 58 | + private String returnType; | ||
| 59 | + /** | ||
| 60 | + * 退料日期 | ||
| 61 | + */ | ||
| 62 | + private LocalDateTime returnDate; | ||
| 63 | + /** | ||
| 64 | + * 状态 | ||
| 65 | + * | ||
| 66 | + * 枚举 {@link MesWmReturnIssueStatusEnum} | ||
| 67 | + */ | ||
| 68 | + private Integer status; | ||
| 69 | + /** | ||
| 70 | + * 备注 | ||
| 71 | + */ | ||
| 72 | + private String remark; | ||
| 73 | + | ||
| 74 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/wm/returnissue/MesWmReturnIssueDetailDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 4 | +import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; | ||
| 5 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.materialstock.MesWmMaterialStockDO; | ||
| 6 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseAreaDO; | ||
| 7 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseDO; | ||
| 8 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseLocationDO; | ||
| 9 | +import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 10 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 11 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 12 | +import lombok.*; | ||
| 13 | + | ||
| 14 | +import java.math.BigDecimal; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * MES 生产退料明细 DO | ||
| 18 | + */ | ||
| 19 | +@TableName("mes_wm_return_issue_detail") | ||
| 20 | +@KeySequence("mes_wm_return_issue_detail_seq") | ||
| 21 | +@Data | ||
| 22 | +@EqualsAndHashCode(callSuper = true) | ||
| 23 | +@ToString(callSuper = true) | ||
| 24 | +@Builder | ||
| 25 | +@NoArgsConstructor | ||
| 26 | +@AllArgsConstructor | ||
| 27 | +public class MesWmReturnIssueDetailDO extends BaseDO { | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 编号 | ||
| 31 | + */ | ||
| 32 | + @TableId | ||
| 33 | + private Long id; | ||
| 34 | + /** | ||
| 35 | + * 退料单 ID | ||
| 36 | + * | ||
| 37 | + * 关联 {@link MesWmReturnIssueDO#getId()} | ||
| 38 | + */ | ||
| 39 | + private Long issueId; | ||
| 40 | + /** | ||
| 41 | + * 行 ID | ||
| 42 | + * | ||
| 43 | + * 关联 {@link MesWmReturnIssueLineDO#getId()} | ||
| 44 | + */ | ||
| 45 | + private Long lineId; | ||
| 46 | + /** | ||
| 47 | + * 库存记录 ID | ||
| 48 | + * | ||
| 49 | + * 关联 {@link MesWmMaterialStockDO#getId()} | ||
| 50 | + */ | ||
| 51 | + private Long materialStockId; | ||
| 52 | + /** | ||
| 53 | + * 物料 ID | ||
| 54 | + * | ||
| 55 | + * 关联 {@link MesMdItemDO#getId()} | ||
| 56 | + */ | ||
| 57 | + private Long itemId; | ||
| 58 | + /** | ||
| 59 | + * 退料数量 | ||
| 60 | + */ | ||
| 61 | + private BigDecimal quantity; | ||
| 62 | + /** | ||
| 63 | + * 批次 ID | ||
| 64 | + */ | ||
| 65 | + private Long batchId; | ||
| 66 | + /** | ||
| 67 | + * 批次号 | ||
| 68 | + */ | ||
| 69 | + private String batchCode; | ||
| 70 | + /** | ||
| 71 | + * 仓库 ID | ||
| 72 | + * | ||
| 73 | + * 关联 {@link MesWmWarehouseDO#getId()} | ||
| 74 | + */ | ||
| 75 | + private Long warehouseId; | ||
| 76 | + /** | ||
| 77 | + * 库区 ID | ||
| 78 | + * | ||
| 79 | + * 关联 {@link MesWmWarehouseLocationDO#getId()} | ||
| 80 | + */ | ||
| 81 | + private Long locationId; | ||
| 82 | + /** | ||
| 83 | + * 库位 ID | ||
| 84 | + * | ||
| 85 | + * 关联 {@link MesWmWarehouseAreaDO#getId()} | ||
| 86 | + */ | ||
| 87 | + private Long areaId; | ||
| 88 | + /** | ||
| 89 | + * 备注 | ||
| 90 | + */ | ||
| 91 | + private String remark; | ||
| 92 | + | ||
| 93 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/wm/returnissue/MesWmReturnIssueLineDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 4 | +import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 6 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 7 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 8 | +import lombok.*; | ||
| 9 | + | ||
| 10 | +import java.math.BigDecimal; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * MES 生产退料单行 DO | ||
| 14 | + */ | ||
| 15 | +@TableName("mes_wm_return_issue_line") | ||
| 16 | +@KeySequence("mes_wm_return_issue_line_seq") | ||
| 17 | +@Data | ||
| 18 | +@EqualsAndHashCode(callSuper = true) | ||
| 19 | +@ToString(callSuper = true) | ||
| 20 | +@Builder | ||
| 21 | +@NoArgsConstructor | ||
| 22 | +@AllArgsConstructor | ||
| 23 | +public class MesWmReturnIssueLineDO extends BaseDO { | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 编号 | ||
| 27 | + */ | ||
| 28 | + @TableId | ||
| 29 | + private Long id; | ||
| 30 | + /** | ||
| 31 | + * 退料单 ID | ||
| 32 | + * | ||
| 33 | + * 关联 {@link MesWmReturnIssueDO#getId()} | ||
| 34 | + */ | ||
| 35 | + private Long issueId; | ||
| 36 | + /** | ||
| 37 | + * 库存记录 ID | ||
| 38 | + */ | ||
| 39 | + private Long materialStockId; | ||
| 40 | + /** | ||
| 41 | + * 物料 ID | ||
| 42 | + * | ||
| 43 | + * 关联 {@link MesMdItemDO#getId()} | ||
| 44 | + */ | ||
| 45 | + private Long itemId; | ||
| 46 | + /** | ||
| 47 | + * 退料数量 | ||
| 48 | + */ | ||
| 49 | + private BigDecimal quantity; | ||
| 50 | + /** | ||
| 51 | + * 批次 ID | ||
| 52 | + */ | ||
| 53 | + private Long batchId; | ||
| 54 | + /** | ||
| 55 | + * 过程检验单 ID | ||
| 56 | + */ | ||
| 57 | + private Long ipqcId; | ||
| 58 | + /** | ||
| 59 | + * 是否需要质检 | ||
| 60 | + */ | ||
| 61 | + private Boolean qcFlag; | ||
| 62 | + // TODO @AI:额外加个枚举类; | ||
| 63 | + // TODO @芋艿:是这些么? | ||
| 64 | + /** | ||
| 65 | + * 质量状态 | ||
| 66 | + * | ||
| 67 | + * 字典 {@link cn.iocoder.yudao.module.mes.enums.DictTypeConstants#MES_WM_QUALITY_STATUS} | ||
| 68 | + */ | ||
| 69 | + private Integer qualityStatus; | ||
| 70 | + /** | ||
| 71 | + * 备注 | ||
| 72 | + */ | ||
| 73 | + private String remark; | ||
| 74 | + | ||
| 75 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/wm/returnissue/MesWmReturnIssueDetailMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.dal.mysql.wm.returnissue; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 4 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueDetailDO; | ||
| 5 | +import org.apache.ibatis.annotations.Mapper; | ||
| 6 | + | ||
| 7 | +import java.util.List; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * MES 生产退料明细 Mapper | ||
| 11 | + */ | ||
| 12 | +@Mapper | ||
| 13 | +public interface MesWmReturnIssueDetailMapper extends BaseMapperX<MesWmReturnIssueDetailDO> { | ||
| 14 | + | ||
| 15 | + default List<MesWmReturnIssueDetailDO> selectListByLineId(Long lineId) { | ||
| 16 | + return selectList(MesWmReturnIssueDetailDO::getLineId, lineId); | ||
| 17 | + } | ||
| 18 | + | ||
| 19 | + default List<MesWmReturnIssueDetailDO> selectListByIssueId(Long issueId) { | ||
| 20 | + return selectList(MesWmReturnIssueDetailDO::getIssueId, issueId); | ||
| 21 | + } | ||
| 22 | + | ||
| 23 | + default void deleteByIssueId(Long issueId) { | ||
| 24 | + delete(MesWmReturnIssueDetailDO::getIssueId, issueId); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/wm/returnissue/MesWmReturnIssueLineMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.dal.mysql.wm.returnissue; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 6 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.line.MesWmReturnIssueLinePageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueLineDO; | ||
| 8 | +import org.apache.ibatis.annotations.Mapper; | ||
| 9 | + | ||
| 10 | +import java.util.List; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * MES 生产退料单行 Mapper | ||
| 14 | + */ | ||
| 15 | +@Mapper | ||
| 16 | +public interface MesWmReturnIssueLineMapper extends BaseMapperX<MesWmReturnIssueLineDO> { | ||
| 17 | + | ||
| 18 | + default PageResult<MesWmReturnIssueLineDO> selectPage(MesWmReturnIssueLinePageReqVO reqVO) { | ||
| 19 | + return selectPage(reqVO, new LambdaQueryWrapperX<MesWmReturnIssueLineDO>() | ||
| 20 | + .eqIfPresent(MesWmReturnIssueLineDO::getIssueId, reqVO.getIssueId()) | ||
| 21 | + .orderByDesc(MesWmReturnIssueLineDO::getId)); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + default List<MesWmReturnIssueLineDO> selectListByIssueId(Long issueId) { | ||
| 25 | + return selectList(MesWmReturnIssueLineDO::getIssueId, issueId); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + default void deleteByIssueId(Long issueId) { | ||
| 29 | + delete(MesWmReturnIssueLineDO::getIssueId, issueId); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/wm/returnissue/MesWmReturnIssueMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.dal.mysql.wm.returnissue; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 6 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.MesWmReturnIssuePageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueDO; | ||
| 8 | +import org.apache.ibatis.annotations.Mapper; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * MES 生产退料单 Mapper | ||
| 12 | + */ | ||
| 13 | +@Mapper | ||
| 14 | +public interface MesWmReturnIssueMapper extends BaseMapperX<MesWmReturnIssueDO> { | ||
| 15 | + | ||
| 16 | + default PageResult<MesWmReturnIssueDO> selectPage(MesWmReturnIssuePageReqVO reqVO) { | ||
| 17 | + return selectPage(reqVO, new LambdaQueryWrapperX<MesWmReturnIssueDO>() | ||
| 18 | + .likeIfPresent(MesWmReturnIssueDO::getCode, reqVO.getCode()) | ||
| 19 | + .likeIfPresent(MesWmReturnIssueDO::getName, reqVO.getName()) | ||
| 20 | + .eqIfPresent(MesWmReturnIssueDO::getWorkstationId, reqVO.getWorkstationId()) | ||
| 21 | + .eqIfPresent(MesWmReturnIssueDO::getWorkOrderId, reqVO.getWorkOrderId()) | ||
| 22 | + .eqIfPresent(MesWmReturnIssueDO::getReturnType, reqVO.getReturnType()) | ||
| 23 | + .eqIfPresent(MesWmReturnIssueDO::getStatus, reqVO.getStatus()) | ||
| 24 | + .betweenIfPresent(MesWmReturnIssueDO::getReturnDate, reqVO.getReturnDate()) | ||
| 25 | + .orderByDesc(MesWmReturnIssueDO::getId)); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/enums/wm/MesWmReturnIssueStatusEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.enums.wm; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.core.ArrayValuable; | ||
| 4 | +import cn.iocoder.yudao.module.mes.enums.MesOrderStatusConstants; | ||
| 5 | +import lombok.AllArgsConstructor; | ||
| 6 | +import lombok.Getter; | ||
| 7 | + | ||
| 8 | +import java.util.Arrays; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * MES 生产退料单状态枚举 | ||
| 12 | + * | ||
| 13 | + * @author 芋道源码 | ||
| 14 | + */ | ||
| 15 | +@Getter | ||
| 16 | +@AllArgsConstructor | ||
| 17 | +public enum MesWmReturnIssueStatusEnum implements ArrayValuable<Integer> { | ||
| 18 | + | ||
| 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/MesWmArrivalNoticeStatusEnum.java 增加注释 | ||
| 20 | + /** | ||
| 21 | + * 草稿 | ||
| 22 | + */ | ||
| 23 | + PREPARE(MesOrderStatusConstants.PREPARE, "草稿"), | ||
| 24 | + /** | ||
| 25 | + * 待入库(已提交,等待仓库上架入库) | ||
| 26 | + */ | ||
| 27 | + APPROVING(MesOrderStatusConstants.APPROVING, "待入库"), | ||
| 28 | + /** | ||
| 29 | + * 已入库(上架完成,等待最终确认) | ||
| 30 | + */ | ||
| 31 | + APPROVED(MesOrderStatusConstants.APPROVED, "已入库"), | ||
| 32 | + /** | ||
| 33 | + * 已完成 | ||
| 34 | + */ | ||
| 35 | + FINISHED(MesOrderStatusConstants.FINISHED, "已完成"), | ||
| 36 | + /** | ||
| 37 | + * 已取消 | ||
| 38 | + */ | ||
| 39 | + CANCELED(MesOrderStatusConstants.CANCELLED, "已取消"); | ||
| 40 | + | ||
| 41 | + public static final Integer[] ARRAYS = Arrays.stream(values()).map(MesWmReturnIssueStatusEnum::getStatus).toArray(Integer[]::new); | ||
| 42 | + | ||
| 43 | + /** | ||
| 44 | + * 状态值 | ||
| 45 | + */ | ||
| 46 | + private final Integer status; | ||
| 47 | + /** | ||
| 48 | + * 状态名 | ||
| 49 | + */ | ||
| 50 | + private final String name; | ||
| 51 | + | ||
| 52 | + @Override | ||
| 53 | + public Integer[] array() { | ||
| 54 | + return ARRAYS; | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/enums/wm/MesWmReturnVendorStatusEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.enums.wm; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.core.ArrayValuable; | ||
| 4 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnvendor.vo.MesWmReturnVendorSaveReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.mes.enums.MesOrderStatusConstants; | ||
| 6 | +import cn.iocoder.yudao.module.mes.service.wm.returnvendor.MesWmReturnVendorService; | ||
| 7 | +import lombok.AllArgsConstructor; | ||
| 8 | +import lombok.Getter; | ||
| 9 | + | ||
| 10 | +import java.util.Arrays; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * MES 供应商退货单状态枚举 | ||
| 14 | + * | ||
| 15 | + * @author 芋道源码 | ||
| 16 | + */ | ||
| 17 | +@Getter | ||
| 18 | +@AllArgsConstructor | ||
| 19 | +public enum MesWmReturnVendorStatusEnum implements ArrayValuable<Integer> { | ||
| 20 | + | ||
| 21 | + /** | ||
| 22 | + * 草稿 | ||
| 23 | + * | ||
| 24 | + * 对应方法:{@link MesWmReturnVendorService#createReturnVendor(MesWmReturnVendorSaveReqVO)} | ||
| 25 | + */ | ||
| 26 | + PREPARE(MesOrderStatusConstants.PREPARE, "草稿"), | ||
| 27 | + /** | ||
| 28 | + * 待拣货 | ||
| 29 | + * | ||
| 30 | + * 对应方法:{@link MesWmReturnVendorService#submitReturnVendor(Long)} | ||
| 31 | + */ | ||
| 32 | + APPROVING(MesOrderStatusConstants.APPROVING, "待拣货"), | ||
| 33 | + /** | ||
| 34 | + * 待执行退货 | ||
| 35 | + * | ||
| 36 | + * 对应方法:{@link MesWmReturnVendorService#stockReturnVendor(Long)} | ||
| 37 | + */ | ||
| 38 | + APPROVED(MesOrderStatusConstants.APPROVED, "待执行退货"), | ||
| 39 | + /** | ||
| 40 | + * 已完成 | ||
| 41 | + * | ||
| 42 | + * 对应方法:{@link MesWmReturnVendorService#finishReturnVendor(Long)} | ||
| 43 | + */ | ||
| 44 | + FINISHED(MesOrderStatusConstants.FINISHED, "已完成"), | ||
| 45 | + /** | ||
| 46 | + * 已取消 | ||
| 47 | + * | ||
| 48 | + * 对应方法:{@link MesWmReturnVendorService#cancelReturnVendor(Long)} | ||
| 49 | + */ | ||
| 50 | + CANCELED(MesOrderStatusConstants.CANCELLED, "已取消"); | ||
| 51 | + | ||
| 52 | + public static final Integer[] ARRAYS = Arrays.stream(values()).map(MesWmReturnVendorStatusEnum::getStatus).toArray(Integer[]::new); | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 状态值 | ||
| 56 | + */ | ||
| 57 | + private final Integer status; | ||
| 58 | + /** | ||
| 59 | + * 状态名 | ||
| 60 | + */ | ||
| 61 | + private final String name; | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public Integer[] array() { | ||
| 65 | + return ARRAYS; | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/returnissue/MesWmReturnIssueDetailService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.service.wm.returnissue; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.detail.MesWmReturnIssueDetailSaveReqVO; | ||
| 4 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueDetailDO; | ||
| 5 | +import jakarta.validation.Valid; | ||
| 6 | + | ||
| 7 | +import java.util.List; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * MES 生产退料明细 Service 接口 | ||
| 11 | + */ | ||
| 12 | +public interface MesWmReturnIssueDetailService { | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * 创建生产退料明细 | ||
| 16 | + * | ||
| 17 | + * @param createReqVO 创建信息 | ||
| 18 | + * @return 编号 | ||
| 19 | + */ | ||
| 20 | + Long createReturnIssueDetail(@Valid MesWmReturnIssueDetailSaveReqVO createReqVO); | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 更新生产退料明细 | ||
| 24 | + * | ||
| 25 | + * @param updateReqVO 更新信息 | ||
| 26 | + */ | ||
| 27 | + void updateReturnIssueDetail(@Valid MesWmReturnIssueDetailSaveReqVO updateReqVO); | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 删除生产退料明细 | ||
| 31 | + * | ||
| 32 | + * @param id 编号 | ||
| 33 | + */ | ||
| 34 | + void deleteReturnIssueDetail(Long id); | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 获得生产退料明细 | ||
| 38 | + * | ||
| 39 | + * @param id 编号 | ||
| 40 | + * @return 生产退料明细 | ||
| 41 | + */ | ||
| 42 | + MesWmReturnIssueDetailDO getReturnIssueDetail(Long id); | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 根据行 ID 获取明细列表 | ||
| 46 | + * | ||
| 47 | + * @param lineId 行 ID | ||
| 48 | + * @return 明细列表 | ||
| 49 | + */ | ||
| 50 | + List<MesWmReturnIssueDetailDO> getReturnIssueDetailListByLineId(Long lineId); | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * 根据退料单 ID 获取明细列表 | ||
| 54 | + * | ||
| 55 | + * @param issueId 退料单 ID | ||
| 56 | + * @return 明细列表 | ||
| 57 | + */ | ||
| 58 | + List<MesWmReturnIssueDetailDO> getReturnIssueDetailListByIssueId(Long issueId); | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * 根据退料单 ID 删除明细 | ||
| 62 | + * | ||
| 63 | + * @param issueId 退料单 ID | ||
| 64 | + */ | ||
| 65 | + void deleteReturnIssueDetailByIssueId(Long issueId); | ||
| 66 | + | ||
| 67 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/returnissue/MesWmReturnIssueDetailServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.service.wm.returnissue; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 4 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.detail.MesWmReturnIssueDetailSaveReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueDetailDO; | ||
| 6 | +import cn.iocoder.yudao.module.mes.dal.mysql.wm.returnissue.MesWmReturnIssueDetailMapper; | ||
| 7 | +import jakarta.annotation.Resource; | ||
| 8 | +import org.springframework.context.annotation.Lazy; | ||
| 9 | +import org.springframework.stereotype.Service; | ||
| 10 | +import org.springframework.validation.annotation.Validated; | ||
| 11 | + | ||
| 12 | +import java.util.List; | ||
| 13 | + | ||
| 14 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 15 | +import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.WM_RETURN_ISSUE_DETAIL_NOT_EXISTS; | ||
| 16 | + | ||
| 17 | +/** | ||
| 18 | + * MES 生产退料明细 Service 实现类 | ||
| 19 | + */ | ||
| 20 | +@Service | ||
| 21 | +@Validated | ||
| 22 | +public class MesWmReturnIssueDetailServiceImpl implements MesWmReturnIssueDetailService { | ||
| 23 | + | ||
| 24 | + @Resource | ||
| 25 | + private MesWmReturnIssueDetailMapper issueDetailMapper; | ||
| 26 | + | ||
| 27 | + @Resource | ||
| 28 | + @Lazy | ||
| 29 | + private MesWmReturnIssueLineService issueLineService; | ||
| 30 | + | ||
| 31 | + @Override | ||
| 32 | + public Long createReturnIssueDetail(MesWmReturnIssueDetailSaveReqVO createReqVO) { | ||
| 33 | + // 校验父数据存在 | ||
| 34 | + issueLineService.validateReturnIssueLineExists(createReqVO.getLineId()); | ||
| 35 | + // TODO @AI:校验物料存在 | ||
| 36 | + | ||
| 37 | + // 插入 | ||
| 38 | + MesWmReturnIssueDetailDO detail = BeanUtils.toBean(createReqVO, MesWmReturnIssueDetailDO.class); | ||
| 39 | + issueDetailMapper.insert(detail); | ||
| 40 | + return detail.getId(); | ||
| 41 | + } | ||
| 42 | + | ||
| 43 | + @Override | ||
| 44 | + public void updateReturnIssueDetail(MesWmReturnIssueDetailSaveReqVO updateReqVO) { | ||
| 45 | + // 校验存在 | ||
| 46 | + validateReturnIssueDetailExists(updateReqVO.getId()); | ||
| 47 | + // 校验父数据存在 | ||
| 48 | + issueLineService.validateReturnIssueLineExists(updateReqVO.getLineId()); | ||
| 49 | + // TODO @AI:校验物料存在 | ||
| 50 | + | ||
| 51 | + // 更新 | ||
| 52 | + MesWmReturnIssueDetailDO updateObj = BeanUtils.toBean(updateReqVO, MesWmReturnIssueDetailDO.class); | ||
| 53 | + issueDetailMapper.updateById(updateObj); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @Override | ||
| 57 | + public void deleteReturnIssueDetail(Long id) { | ||
| 58 | + // 校验存在 | ||
| 59 | + validateReturnIssueDetailExists(id); | ||
| 60 | + // 删除 | ||
| 61 | + issueDetailMapper.deleteById(id); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @Override | ||
| 65 | + public MesWmReturnIssueDetailDO getReturnIssueDetail(Long id) { | ||
| 66 | + return issueDetailMapper.selectById(id); | ||
| 67 | + } | ||
| 68 | + | ||
| 69 | + @Override | ||
| 70 | + public List<MesWmReturnIssueDetailDO> getReturnIssueDetailListByLineId(Long lineId) { | ||
| 71 | + return issueDetailMapper.selectListByLineId(lineId); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + @Override | ||
| 75 | + public List<MesWmReturnIssueDetailDO> getReturnIssueDetailListByIssueId(Long issueId) { | ||
| 76 | + return issueDetailMapper.selectListByIssueId(issueId); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + @Override | ||
| 80 | + public void deleteReturnIssueDetailByIssueId(Long issueId) { | ||
| 81 | + issueDetailMapper.deleteByIssueId(issueId); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + private void validateReturnIssueDetailExists(Long id) { | ||
| 85 | + if (issueDetailMapper.selectById(id) == null) { | ||
| 86 | + throw exception(WM_RETURN_ISSUE_DETAIL_NOT_EXISTS); | ||
| 87 | + } | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/returnissue/MesWmReturnIssueLineService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.service.wm.returnissue; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.line.MesWmReturnIssueLinePageReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.line.MesWmReturnIssueLineSaveReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueLineDO; | ||
| 7 | +import jakarta.validation.Valid; | ||
| 8 | + | ||
| 9 | +import java.util.List; | ||
| 10 | + | ||
| 11 | +/** | ||
| 12 | + * MES 生产退料单行 Service 接口 | ||
| 13 | + */ | ||
| 14 | +public interface MesWmReturnIssueLineService { | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * 创建生产退料单行 | ||
| 18 | + * | ||
| 19 | + * @param createReqVO 创建信息 | ||
| 20 | + * @return 编号 | ||
| 21 | + */ | ||
| 22 | + Long createReturnIssueLine(@Valid MesWmReturnIssueLineSaveReqVO createReqVO); | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 更新生产退料单行 | ||
| 26 | + * | ||
| 27 | + * @param updateReqVO 更新信息 | ||
| 28 | + */ | ||
| 29 | + void updateReturnIssueLine(@Valid MesWmReturnIssueLineSaveReqVO updateReqVO); | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 删除生产退料单行 | ||
| 33 | + * | ||
| 34 | + * @param id 编号 | ||
| 35 | + */ | ||
| 36 | + void deleteReturnIssueLine(Long id); | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 获得生产退料单行 | ||
| 40 | + * | ||
| 41 | + * @param id 编号 | ||
| 42 | + * @return 生产退料单行 | ||
| 43 | + */ | ||
| 44 | + MesWmReturnIssueLineDO getReturnIssueLine(Long id); | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 获得生产退料单行分页 | ||
| 48 | + * | ||
| 49 | + * @param pageReqVO 分页查询 | ||
| 50 | + * @return 生产退料单行分页 | ||
| 51 | + */ | ||
| 52 | + PageResult<MesWmReturnIssueLineDO> getReturnIssueLinePage(MesWmReturnIssueLinePageReqVO pageReqVO); | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 根据退料单 ID 获取行列表 | ||
| 56 | + * | ||
| 57 | + * @param issueId 退料单 ID | ||
| 58 | + * @return 行列表 | ||
| 59 | + */ | ||
| 60 | + List<MesWmReturnIssueLineDO> getReturnIssueLineListByIssueId(Long issueId); | ||
| 61 | + | ||
| 62 | + /** | ||
| 63 | + * 根据退料单 ID 删除行 | ||
| 64 | + * | ||
| 65 | + * @param issueId 退料单 ID | ||
| 66 | + */ | ||
| 67 | + void deleteReturnIssueLineByIssueId(Long issueId); | ||
| 68 | + | ||
| 69 | + /** | ||
| 70 | + * 校验生产退料单行是否存在 | ||
| 71 | + * | ||
| 72 | + * @param id 编号 | ||
| 73 | + * @return 生产退料单行 | ||
| 74 | + */ | ||
| 75 | + MesWmReturnIssueLineDO validateReturnIssueLineExists(Long id); | ||
| 76 | + | ||
| 77 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/returnissue/MesWmReturnIssueLineServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.service.wm.returnissue; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 5 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.line.MesWmReturnIssueLinePageReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.line.MesWmReturnIssueLineSaveReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueDO; | ||
| 8 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueLineDO; | ||
| 9 | +import cn.iocoder.yudao.module.mes.dal.mysql.wm.returnissue.MesWmReturnIssueLineMapper; | ||
| 10 | +import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; | ||
| 11 | +import jakarta.annotation.Resource; | ||
| 12 | +import org.springframework.context.annotation.Lazy; | ||
| 13 | +import org.springframework.stereotype.Service; | ||
| 14 | +import org.springframework.validation.annotation.Validated; | ||
| 15 | + | ||
| 16 | +import java.util.List; | ||
| 17 | + | ||
| 18 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 19 | +import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.WM_RETURN_ISSUE_LINE_NOT_EXISTS; | ||
| 20 | + | ||
| 21 | +/** | ||
| 22 | + * MES 生产退料单行 Service 实现类 | ||
| 23 | + */ | ||
| 24 | +@Service | ||
| 25 | +@Validated | ||
| 26 | +public class MesWmReturnIssueLineServiceImpl implements MesWmReturnIssueLineService { | ||
| 27 | + | ||
| 28 | + @Resource | ||
| 29 | + private MesWmReturnIssueLineMapper issueLineMapper; | ||
| 30 | + | ||
| 31 | + @Resource | ||
| 32 | + @Lazy | ||
| 33 | + private MesWmReturnIssueService issueService; | ||
| 34 | + @Resource | ||
| 35 | + private MesMdItemService itemService; | ||
| 36 | + | ||
| 37 | + @Override | ||
| 38 | + public Long createReturnIssueLine(MesWmReturnIssueLineSaveReqVO createReqVO) { | ||
| 39 | + // 校验父数据存在 | ||
| 40 | + MesWmReturnIssueDO issue = issueService.validateReturnIssueExists(createReqVO.getIssueId()); | ||
| 41 | + // 校验物料存在 | ||
| 42 | + itemService.validateItemExists(createReqVO.getItemId()); | ||
| 43 | + | ||
| 44 | + // 插入 | ||
| 45 | + MesWmReturnIssueLineDO line = BeanUtils.toBean(createReqVO, MesWmReturnIssueLineDO.class); | ||
| 46 | + // 质量状态自动赋值 | ||
| 47 | + // TODO @AI:这里需要在 review 下 @芋艿; | ||
| 48 | + if (Boolean.TRUE.equals(createReqVO.getQcFlag())) { | ||
| 49 | + line.setQualityStatus(0); // 待检 | ||
| 50 | + } else if ("RMR".equals(issue.getReturnType())) { | ||
| 51 | + line.setQualityStatus(1); // 合格(余料退回直接合格) | ||
| 52 | + } else { | ||
| 53 | + line.setQualityStatus(2); // 不合格 | ||
| 54 | + } | ||
| 55 | + issueLineMapper.insert(line); | ||
| 56 | + return line.getId(); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @Override | ||
| 60 | + public void updateReturnIssueLine(MesWmReturnIssueLineSaveReqVO updateReqVO) { | ||
| 61 | + // 校验存在 | ||
| 62 | + validateReturnIssueLineExists(updateReqVO.getId()); | ||
| 63 | + // 校验父数据存在 | ||
| 64 | + issueService.validateReturnIssueExists(updateReqVO.getIssueId()); | ||
| 65 | + // 校验物料存在 | ||
| 66 | + itemService.validateItemExists(updateReqVO.getItemId()); | ||
| 67 | + | ||
| 68 | + // 更新 | ||
| 69 | + MesWmReturnIssueLineDO updateObj = BeanUtils.toBean(updateReqVO, MesWmReturnIssueLineDO.class); | ||
| 70 | + issueLineMapper.updateById(updateObj); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + @Override | ||
| 74 | + public void deleteReturnIssueLine(Long id) { | ||
| 75 | + // 校验存在 | ||
| 76 | + validateReturnIssueLineExists(id); | ||
| 77 | + // 删除 | ||
| 78 | + issueLineMapper.deleteById(id); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @Override | ||
| 82 | + public MesWmReturnIssueLineDO getReturnIssueLine(Long id) { | ||
| 83 | + return issueLineMapper.selectById(id); | ||
| 84 | + } | ||
| 85 | + | ||
| 86 | + @Override | ||
| 87 | + public PageResult<MesWmReturnIssueLineDO> getReturnIssueLinePage(MesWmReturnIssueLinePageReqVO pageReqVO) { | ||
| 88 | + return issueLineMapper.selectPage(pageReqVO); | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + @Override | ||
| 92 | + public List<MesWmReturnIssueLineDO> getReturnIssueLineListByIssueId(Long issueId) { | ||
| 93 | + return issueLineMapper.selectListByIssueId(issueId); | ||
| 94 | + } | ||
| 95 | + | ||
| 96 | + @Override | ||
| 97 | + public void deleteReturnIssueLineByIssueId(Long issueId) { | ||
| 98 | + issueLineMapper.deleteByIssueId(issueId); | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + @Override | ||
| 102 | + public MesWmReturnIssueLineDO validateReturnIssueLineExists(Long id) { | ||
| 103 | + MesWmReturnIssueLineDO line = issueLineMapper.selectById(id); | ||
| 104 | + if (line == null) { | ||
| 105 | + throw exception(WM_RETURN_ISSUE_LINE_NOT_EXISTS); | ||
| 106 | + } | ||
| 107 | + return line; | ||
| 108 | + } | ||
| 109 | + | ||
| 110 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/returnissue/MesWmReturnIssueService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.service.wm.returnissue; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.MesWmReturnIssuePageReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.MesWmReturnIssueSaveReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueDO; | ||
| 7 | +import jakarta.validation.Valid; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * MES 生产退料单 Service 接口 | ||
| 11 | + */ | ||
| 12 | +public interface MesWmReturnIssueService { | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * 创建生产退料单 | ||
| 16 | + * | ||
| 17 | + * @param createReqVO 创建信息 | ||
| 18 | + * @return 编号 | ||
| 19 | + */ | ||
| 20 | + Long createReturnIssue(@Valid MesWmReturnIssueSaveReqVO createReqVO); | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 修改生产退料单 | ||
| 24 | + * | ||
| 25 | + * @param updateReqVO 修改信息 | ||
| 26 | + */ | ||
| 27 | + void updateReturnIssue(@Valid MesWmReturnIssueSaveReqVO updateReqVO); | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 删除生产退料单 | ||
| 31 | + * | ||
| 32 | + * @param id 编号 | ||
| 33 | + */ | ||
| 34 | + void deleteReturnIssue(Long id); | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 获得生产退料单 | ||
| 38 | + * | ||
| 39 | + * @param id 编号 | ||
| 40 | + * @return 生产退料单 | ||
| 41 | + */ | ||
| 42 | + MesWmReturnIssueDO getReturnIssue(Long id); | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 获得生产退料单分页 | ||
| 46 | + * | ||
| 47 | + * @param pageReqVO 分页参数 | ||
| 48 | + * @return 生产退料单分页 | ||
| 49 | + */ | ||
| 50 | + PageResult<MesWmReturnIssueDO> getReturnIssuePage(MesWmReturnIssuePageReqVO pageReqVO); | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * 校验生产退料单是否存在 | ||
| 54 | + * | ||
| 55 | + * @param id 编号 | ||
| 56 | + * @return 生产退料单 | ||
| 57 | + */ | ||
| 58 | + MesWmReturnIssueDO validateReturnIssueExists(Long id); | ||
| 59 | + | ||
| 60 | + /** | ||
| 61 | + * 提交生产退料单(草稿 → 待入库) | ||
| 62 | + * | ||
| 63 | + * @param id 编号 | ||
| 64 | + */ | ||
| 65 | + void submitReturnIssue(Long id); | ||
| 66 | + | ||
| 67 | + /** | ||
| 68 | + * 入库上架(待入库 → 已入库) | ||
| 69 | + * | ||
| 70 | + * @param id 编号 | ||
| 71 | + */ | ||
| 72 | + void stockReturnIssue(Long id); | ||
| 73 | + | ||
| 74 | + /** | ||
| 75 | + * 完成退料(已入库 → 已完成),更新库存台账 | ||
| 76 | + * | ||
| 77 | + * @param id 编号 | ||
| 78 | + */ | ||
| 79 | + void finishReturnIssue(Long id); | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * 取消生产退料单(任意非已完成/已取消状态 → 已取消) | ||
| 83 | + * | ||
| 84 | + * @param id 编号 | ||
| 85 | + */ | ||
| 86 | + void cancelReturnIssue(Long id); | ||
| 87 | + | ||
| 88 | + /** | ||
| 89 | + * 校验生产退料单的数量:每行明细数量之和是否等于行退料数量 | ||
| 90 | + * | ||
| 91 | + * @param id 编号 | ||
| 92 | + * @return 是否全部一致 | ||
| 93 | + */ | ||
| 94 | + Boolean checkReturnIssueQuantity(Long id); | ||
| 95 | + | ||
| 96 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/returnissue/MesWmReturnIssueServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.service.wm.returnissue; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.hutool.core.util.ObjUtil; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | +import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; | ||
| 7 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 8 | +import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | ||
| 9 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.MesWmReturnIssuePageReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.returnissue.vo.MesWmReturnIssueSaveReqVO; | ||
| 11 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueDetailDO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueDO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.returnissue.MesWmReturnIssueLineDO; | ||
| 14 | +import cn.iocoder.yudao.module.mes.dal.mysql.wm.returnissue.MesWmReturnIssueMapper; | ||
| 15 | +import cn.iocoder.yudao.module.mes.enums.wm.MesWmReturnIssueStatusEnum; | ||
| 16 | +import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkstationService; | ||
| 17 | +import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; | ||
| 18 | +import jakarta.annotation.Resource; | ||
| 19 | +import org.springframework.stereotype.Service; | ||
| 20 | +import org.springframework.transaction.annotation.Transactional; | ||
| 21 | +import org.springframework.validation.annotation.Validated; | ||
| 22 | + | ||
| 23 | +import java.math.BigDecimal; | ||
| 24 | +import java.util.List; | ||
| 25 | + | ||
| 26 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 27 | +import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; | ||
| 28 | + | ||
| 29 | +/** | ||
| 30 | + * MES 生产退料单 Service 实现类 | ||
| 31 | + */ | ||
| 32 | +@Service | ||
| 33 | +@Validated | ||
| 34 | +public class MesWmReturnIssueServiceImpl implements MesWmReturnIssueService { | ||
| 35 | + | ||
| 36 | + @Resource | ||
| 37 | + private MesWmReturnIssueMapper issueMapper; | ||
| 38 | + | ||
| 39 | + @Resource | ||
| 40 | + private MesWmReturnIssueLineService issueLineService; | ||
| 41 | + @Resource | ||
| 42 | + private MesWmReturnIssueDetailService issueDetailService; | ||
| 43 | + @Resource | ||
| 44 | + private MesMdWorkstationService workstationService; | ||
| 45 | + @Resource | ||
| 46 | + private MesProWorkOrderService workOrderService; | ||
| 47 | + | ||
| 48 | + @Override | ||
| 49 | + @Transactional(rollbackFor = Exception.class) | ||
| 50 | + public Long createReturnIssue(MesWmReturnIssueSaveReqVO createReqVO) { | ||
| 51 | + // 1. 校验关联数据(workOrderId 非必填) | ||
| 52 | + if (createReqVO.getWorkOrderId() != null) { | ||
| 53 | + workOrderService.validateWorkOrderExists(createReqVO.getWorkOrderId()); | ||
| 54 | + } | ||
| 55 | + if (createReqVO.getWorkstationId() != null) { | ||
| 56 | + workstationService.validateWorkstationExists(createReqVO.getWorkstationId()); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + // 2. 插入主表 | ||
| 60 | + MesWmReturnIssueDO issue = BeanUtils.toBean(createReqVO, MesWmReturnIssueDO.class); | ||
| 61 | + issue.setStatus(MesWmReturnIssueStatusEnum.PREPARE.getStatus()); | ||
| 62 | + issueMapper.insert(issue); | ||
| 63 | + return issue.getId(); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @Override | ||
| 67 | + @Transactional(rollbackFor = Exception.class) | ||
| 68 | + public void updateReturnIssue(MesWmReturnIssueSaveReqVO updateReqVO) { | ||
| 69 | + // 1.1 校验存在 + 准备中状态 | ||
| 70 | + validateReturnIssueExistsAndPrepare(updateReqVO.getId()); | ||
| 71 | + // 1.2 校验关联数据 | ||
| 72 | + if (updateReqVO.getWorkOrderId() != null) { | ||
| 73 | + workOrderService.validateWorkOrderExists(updateReqVO.getWorkOrderId()); | ||
| 74 | + } | ||
| 75 | + if (updateReqVO.getWorkstationId() != null) { | ||
| 76 | + workstationService.validateWorkstationExists(updateReqVO.getWorkstationId()); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + // 2. 更新主表 | ||
| 80 | + MesWmReturnIssueDO updateObj = BeanUtils.toBean(updateReqVO, MesWmReturnIssueDO.class); | ||
| 81 | + issueMapper.updateById(updateObj); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + @Override | ||
| 85 | + @Transactional(rollbackFor = Exception.class) | ||
| 86 | + public void deleteReturnIssue(Long id) { | ||
| 87 | + // 1. 校验存在 + 准备中状态 | ||
| 88 | + validateReturnIssueExistsAndPrepare(id); | ||
| 89 | + | ||
| 90 | + // 2.1 级联删除明细 | ||
| 91 | + issueDetailService.deleteReturnIssueDetailByIssueId(id); | ||
| 92 | + // 2.2 级联删除行 | ||
| 93 | + issueLineService.deleteReturnIssueLineByIssueId(id); | ||
| 94 | + // 2.3 删除主表 | ||
| 95 | + issueMapper.deleteById(id); | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + @Override | ||
| 99 | + public MesWmReturnIssueDO getReturnIssue(Long id) { | ||
| 100 | + return issueMapper.selectById(id); | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + @Override | ||
| 104 | + public PageResult<MesWmReturnIssueDO> getReturnIssuePage(MesWmReturnIssuePageReqVO pageReqVO) { | ||
| 105 | + return issueMapper.selectPage(pageReqVO); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + @Override | ||
| 109 | + @Transactional(rollbackFor = Exception.class) | ||
| 110 | + public void submitReturnIssue(Long id) { | ||
| 111 | + // 校验存在 + 草稿状态 | ||
| 112 | + validateReturnIssueExistsAndPrepare(id); | ||
| 113 | + // 校验至少有一条行 | ||
| 114 | + List<MesWmReturnIssueLineDO> lines = issueLineService.getReturnIssueLineListByIssueId(id); | ||
| 115 | + if (CollUtil.isEmpty(lines)) { | ||
| 116 | + throw exception(WM_RETURN_ISSUE_NO_LINE); | ||
| 117 | + } | ||
| 118 | + | ||
| 119 | + // 提交(草稿 → 待入库) | ||
| 120 | + issueMapper.updateById(new MesWmReturnIssueDO() | ||
| 121 | + .setId(id).setStatus(MesWmReturnIssueStatusEnum.APPROVING.getStatus())); | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + @Override | ||
| 125 | + @Transactional(rollbackFor = Exception.class) | ||
| 126 | + public void stockReturnIssue(Long id) { | ||
| 127 | + // 校验存在 | ||
| 128 | + MesWmReturnIssueDO issue = validateReturnIssueExists(id); | ||
| 129 | + if (ObjUtil.notEqual(MesWmReturnIssueStatusEnum.APPROVING.getStatus(), issue.getStatus())) { | ||
| 130 | + throw exception(WM_RETURN_ISSUE_STATUS_INVALID); | ||
| 131 | + } | ||
| 132 | + // 入库上架(待入库 → 已入库) | ||
| 133 | + issueMapper.updateById(new MesWmReturnIssueDO() | ||
| 134 | + .setId(id).setStatus(MesWmReturnIssueStatusEnum.APPROVED.getStatus())); | ||
| 135 | + } | ||
| 136 | + | ||
| 137 | + @Override | ||
| 138 | + @Transactional(rollbackFor = Exception.class) | ||
| 139 | + public void finishReturnIssue(Long id) { | ||
| 140 | + // 校验存在 | ||
| 141 | + MesWmReturnIssueDO issue = validateReturnIssueExists(id); | ||
| 142 | + if (ObjUtil.notEqual(MesWmReturnIssueStatusEnum.APPROVED.getStatus(), issue.getStatus())) { | ||
| 143 | + throw exception(WM_RETURN_ISSUE_STATUS_INVALID); | ||
| 144 | + } | ||
| 145 | + | ||
| 146 | + // 遍历所有明细,更新库存台账(增加库存,与领料出库相反) | ||
| 147 | + // TODO @芋艿:【后续在弄】这里可能有点问题;缺少库存更新;后面在弄; | ||
| 148 | + List<MesWmReturnIssueDetailDO> details = issueDetailService.getReturnIssueDetailListByIssueId(id); | ||
| 149 | + for (MesWmReturnIssueDetailDO detail : details) { | ||
| 150 | + // materialStockService.increaseStock( | ||
| 151 | + // detail.getItemId(), detail.getWarehouseId(), detail.getLocationId(), detail.getAreaId(), | ||
| 152 | + // detail.getBatchId(), detail.getQuantity(), issue.getWorkOrderId(), null, null); | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | + // 更新退料单状态 | ||
| 156 | + issueMapper.updateById(new MesWmReturnIssueDO() | ||
| 157 | + .setId(id).setStatus(MesWmReturnIssueStatusEnum.FINISHED.getStatus())); | ||
| 158 | + } | ||
| 159 | + | ||
| 160 | + @Override | ||
| 161 | + @Transactional(rollbackFor = Exception.class) | ||
| 162 | + public void cancelReturnIssue(Long id) { | ||
| 163 | + // 校验存在 | ||
| 164 | + MesWmReturnIssueDO issue = validateReturnIssueExists(id); | ||
| 165 | + // 已完成和已取消不允许取消 | ||
| 166 | + if (ObjectUtils.equalsAny(issue.getStatus(), | ||
| 167 | + MesWmReturnIssueStatusEnum.FINISHED.getStatus(), | ||
| 168 | + MesWmReturnIssueStatusEnum.CANCELED.getStatus())) { | ||
| 169 | + throw exception(WM_RETURN_ISSUE_CANCEL_NOT_ALLOWED); | ||
| 170 | + } | ||
| 171 | + | ||
| 172 | + // 取消 | ||
| 173 | + issueMapper.updateById(new MesWmReturnIssueDO() | ||
| 174 | + .setId(id).setStatus(MesWmReturnIssueStatusEnum.CANCELED.getStatus())); | ||
| 175 | + } | ||
| 176 | + | ||
| 177 | + @Override | ||
| 178 | + public Boolean checkReturnIssueQuantity(Long id) { | ||
| 179 | + List<MesWmReturnIssueLineDO> lines = issueLineService.getReturnIssueLineListByIssueId(id); | ||
| 180 | + for (MesWmReturnIssueLineDO line : lines) { | ||
| 181 | + List<MesWmReturnIssueDetailDO> details = issueDetailService.getReturnIssueDetailListByLineId(line.getId()); | ||
| 182 | + BigDecimal totalDetailQty = CollectionUtils.getSumValue(details, | ||
| 183 | + MesWmReturnIssueDetailDO::getQuantity, BigDecimal::add, BigDecimal.ZERO); | ||
| 184 | + if (line.getQuantity() != null && totalDetailQty.compareTo(line.getQuantity()) != 0) { | ||
| 185 | + return false; | ||
| 186 | + } | ||
| 187 | + } | ||
| 188 | + return true; | ||
| 189 | + } | ||
| 190 | + | ||
| 191 | + @Override | ||
| 192 | + public MesWmReturnIssueDO validateReturnIssueExists(Long id) { | ||
| 193 | + MesWmReturnIssueDO issue = issueMapper.selectById(id); | ||
| 194 | + if (issue == null) { | ||
| 195 | + throw exception(WM_RETURN_ISSUE_NOT_EXISTS); | ||
| 196 | + } | ||
| 197 | + return issue; | ||
| 198 | + } | ||
| 199 | + | ||
| 200 | + /** | ||
| 201 | + * 校验生产退料单存在且为准备中状态 | ||
| 202 | + */ | ||
| 203 | + private MesWmReturnIssueDO validateReturnIssueExistsAndPrepare(Long id) { | ||
| 204 | + MesWmReturnIssueDO issue = validateReturnIssueExists(id); | ||
| 205 | + if (ObjUtil.notEqual(MesWmReturnIssueStatusEnum.PREPARE.getStatus(), issue.getStatus())) { | ||
| 206 | + throw exception(WM_RETURN_ISSUE_STATUS_INVALID); | ||
| 207 | + } | ||
| 208 | + return issue; | ||
| 209 | + } | ||
| 210 | + | ||
| 211 | +} |