Commit 89ae4e1c7400a1847f493a54a5f4455eba65407c
1 parent
6a2a05b3
✨ feat(mes): 重构生产入库单行相关逻辑,更新字段及接口
重命名和更新了生产入库单行的请求和响应对象,调整了字段名称以更好地反映业务逻辑。同时,优化了控制器中的相关方法,确保与新的数据结构一致。此变更旨在提升代码的可读性和维护性。
Showing
20 changed files
with
55 additions
and
1103 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productproduce/MesWmProductProduceController.java deleted
| 1 | -package cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce; | |
| 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.productproduce.vo.MesWmProductProducePageReqVO; | |
| 12 | -import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.MesWmProductProduceRespVO; | |
| 13 | -import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.MesWmProductProduceSaveReqVO; | |
| 14 | -import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkstationDO; | |
| 15 | -import cn.iocoder.yudao.module.mes.dal.dataobject.pro.process.MesProProcessDO; | |
| 16 | -import cn.iocoder.yudao.module.mes.dal.dataobject.pro.task.MesProTaskDO; | |
| 17 | -import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderDO; | |
| 18 | -import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceDO; | |
| 19 | -import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkstationService; | |
| 20 | -import cn.iocoder.yudao.module.mes.service.pro.process.MesProProcessService; | |
| 21 | -import cn.iocoder.yudao.module.mes.service.pro.task.MesProTaskService; | |
| 22 | -import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; | |
| 23 | -import cn.iocoder.yudao.module.mes.service.wm.productproduce.MesWmProductProduceService; | |
| 24 | -import io.swagger.v3.oas.annotations.Operation; | |
| 25 | -import io.swagger.v3.oas.annotations.Parameter; | |
| 26 | -import io.swagger.v3.oas.annotations.tags.Tag; | |
| 27 | -import jakarta.annotation.Resource; | |
| 28 | -import jakarta.servlet.http.HttpServletResponse; | |
| 29 | -import jakarta.validation.Valid; | |
| 30 | -import org.springframework.security.access.prepost.PreAuthorize; | |
| 31 | -import org.springframework.validation.annotation.Validated; | |
| 32 | -import org.springframework.web.bind.annotation.*; | |
| 33 | - | |
| 34 | -import java.io.IOException; | |
| 35 | -import java.util.Collections; | |
| 36 | -import java.util.List; | |
| 37 | -import java.util.Map; | |
| 38 | - | |
| 39 | -import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | |
| 40 | -import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | |
| 41 | -import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | |
| 42 | - | |
| 43 | -@Tag(name = "管理后台 - MES 生产入库单") | |
| 44 | -@RestController | |
| 45 | -@RequestMapping("/mes/wm/product-produce") | |
| 46 | -@Validated | |
| 47 | -public class MesWmProductProduceController { | |
| 48 | - | |
| 49 | - @Resource | |
| 50 | - private MesWmProductProduceService produceService; | |
| 51 | - @Resource | |
| 52 | - private MesMdWorkstationService workstationService; | |
| 53 | - @Resource | |
| 54 | - private MesProWorkOrderService workOrderService; | |
| 55 | - @Resource | |
| 56 | - private MesProProcessService processService; | |
| 57 | - @Resource | |
| 58 | - private MesProTaskService taskService; | |
| 59 | - | |
| 60 | - @PostMapping("/create") | |
| 61 | - @Operation(summary = "创建生产入库单") | |
| 62 | - @PreAuthorize("@ss.hasPermission('mes:wm-product-produce:create')") | |
| 63 | - public CommonResult<Long> createProductProduce(@Valid @RequestBody MesWmProductProduceSaveReqVO createReqVO) { | |
| 64 | - return success(produceService.createProductProduce(createReqVO)); | |
| 65 | - } | |
| 66 | - | |
| 67 | - @PutMapping("/update") | |
| 68 | - @Operation(summary = "修改生产入库单") | |
| 69 | - @PreAuthorize("@ss.hasPermission('mes:wm-product-produce:update')") | |
| 70 | - public CommonResult<Boolean> updateProductProduce(@Valid @RequestBody MesWmProductProduceSaveReqVO updateReqVO) { | |
| 71 | - produceService.updateProductProduce(updateReqVO); | |
| 72 | - return success(true); | |
| 73 | - } | |
| 74 | - | |
| 75 | - @DeleteMapping("/delete") | |
| 76 | - @Operation(summary = "删除生产入库单") | |
| 77 | - @Parameter(name = "id", description = "编号", required = true) | |
| 78 | - @PreAuthorize("@ss.hasPermission('mes:wm-product-produce:delete')") | |
| 79 | - public CommonResult<Boolean> deleteProductProduce(@RequestParam("id") Long id) { | |
| 80 | - produceService.deleteProductProduce(id); | |
| 81 | - return success(true); | |
| 82 | - } | |
| 83 | - | |
| 84 | - @GetMapping("/get") | |
| 85 | - @Operation(summary = "获得生产入库单") | |
| 86 | - @Parameter(name = "id", description = "编号", required = true, example = "1024") | |
| 87 | - @PreAuthorize("@ss.hasPermission('mes:wm-product-produce:query')") | |
| 88 | - public CommonResult<MesWmProductProduceRespVO> getProductProduce(@RequestParam("id") Long id) { | |
| 89 | - MesWmProductProduceDO produce = produceService.getProductProduce(id); | |
| 90 | - if (produce == null) { | |
| 91 | - return success(null); | |
| 92 | - } | |
| 93 | - return success(buildRespVOList(Collections.singletonList(produce)).get(0)); | |
| 94 | - } | |
| 95 | - | |
| 96 | - @GetMapping("/page") | |
| 97 | - @Operation(summary = "获得生产入库单分页") | |
| 98 | - @PreAuthorize("@ss.hasPermission('mes:wm-product-produce:query')") | |
| 99 | - public CommonResult<PageResult<MesWmProductProduceRespVO>> getProductProducePage( | |
| 100 | - @Valid MesWmProductProducePageReqVO pageReqVO) { | |
| 101 | - PageResult<MesWmProductProduceDO> pageResult = produceService.getProductProducePage(pageReqVO); | |
| 102 | - return success(new PageResult<>(buildRespVOList(pageResult.getList()), pageResult.getTotal())); | |
| 103 | - } | |
| 104 | - | |
| 105 | - @GetMapping("/export-excel") | |
| 106 | - @Operation(summary = "导出生产入库单 Excel") | |
| 107 | - @PreAuthorize("@ss.hasPermission('mes:wm-product-produce:export')") | |
| 108 | - @ApiAccessLog(operateType = EXPORT) | |
| 109 | - public void exportProductProduceExcel(@Valid MesWmProductProducePageReqVO pageReqVO, | |
| 110 | - HttpServletResponse response) throws IOException { | |
| 111 | - pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | |
| 112 | - PageResult<MesWmProductProduceDO> pageResult = produceService.getProductProducePage(pageReqVO); | |
| 113 | - ExcelUtils.write(response, "生产入库单.xls", "数据", MesWmProductProduceRespVO.class, | |
| 114 | - buildRespVOList(pageResult.getList())); | |
| 115 | - } | |
| 116 | - | |
| 117 | - @PutMapping("/finish") | |
| 118 | - @Operation(summary = "完成生产入库单") | |
| 119 | - @Parameter(name = "id", description = "编号", required = true) | |
| 120 | - @PreAuthorize("@ss.hasPermission('mes:wm-product-produce:update-status')") | |
| 121 | - public CommonResult<Boolean> finishProductProduce(@RequestParam("id") Long id) { | |
| 122 | - produceService.finishProductProduce(id); | |
| 123 | - return success(true); | |
| 124 | - } | |
| 125 | - | |
| 126 | - @PutMapping("/cancel") | |
| 127 | - @Operation(summary = "取消生产入库单") | |
| 128 | - @Parameter(name = "id", description = "编号", required = true) | |
| 129 | - @PreAuthorize("@ss.hasPermission('mes:wm-product-produce:update-status')") | |
| 130 | - public CommonResult<Boolean> cancelProductProduce(@RequestParam("id") Long id) { | |
| 131 | - produceService.cancelProductProduce(id); | |
| 132 | - return success(true); | |
| 133 | - } | |
| 134 | - | |
| 135 | - @GetMapping("/check-quantity") | |
| 136 | - @Operation(summary = "校验生产入库单数量", description = "校验每行明细数量之和是否等于行入库数量") | |
| 137 | - @Parameter(name = "id", description = "编号", required = true) | |
| 138 | - @PreAuthorize("@ss.hasPermission('mes:wm-product-produce:query')") | |
| 139 | - public CommonResult<Boolean> checkProductProduceQuantity(@RequestParam("id") Long id) { | |
| 140 | - return success(produceService.checkProductProduceQuantity(id)); | |
| 141 | - } | |
| 142 | - | |
| 143 | - // ==================== 拼接 VO ==================== | |
| 144 | - | |
| 145 | - private List<MesWmProductProduceRespVO> buildRespVOList(List<MesWmProductProduceDO> list) { | |
| 146 | - if (CollUtil.isEmpty(list)) { | |
| 147 | - return Collections.emptyList(); | |
| 148 | - } | |
| 149 | - // 1. 获得关联数据 | |
| 150 | - Map<Long, MesMdWorkstationDO> workstationMap = workstationService.getWorkstationMap( | |
| 151 | - convertSet(list, MesWmProductProduceDO::getWorkstationId)); | |
| 152 | - Map<Long, MesProWorkOrderDO> workOrderMap = workOrderService.getWorkOrderMap( | |
| 153 | - convertSet(list, MesWmProductProduceDO::getWorkOrderId)); | |
| 154 | - Map<Long, MesProProcessDO> processMap = processService.getProcessMap( | |
| 155 | - convertSet(list, MesWmProductProduceDO::getProcessId)); | |
| 156 | - Map<Long, MesProTaskDO> taskMap = taskService.getTaskMap( | |
| 157 | - convertSet(list, MesWmProductProduceDO::getTaskId)); | |
| 158 | - // 2. 构建结果 | |
| 159 | - return BeanUtils.toBean(list, MesWmProductProduceRespVO.class, vo -> { | |
| 160 | - // 2.1 填充工作站名称 | |
| 161 | - MapUtils.findAndThen(workstationMap, vo.getWorkstationId(), | |
| 162 | - workstation -> vo.setWorkstationName(workstation.getName())); | |
| 163 | - // 2.2 填充工单编号 | |
| 164 | - MapUtils.findAndThen(workOrderMap, vo.getWorkOrderId(), | |
| 165 | - workOrder -> vo.setWorkOrderCode(workOrder.getCode())); | |
| 166 | - // 2.3 填充工序名称 | |
| 167 | - MapUtils.findAndThen(processMap, vo.getProcessId(), | |
| 168 | - process -> vo.setProcessName(process.getName())); | |
| 169 | - // 2.4 填充任务编号 | |
| 170 | - MapUtils.findAndThen(taskMap, vo.getTaskId(), | |
| 171 | - task -> vo.setTaskCode(task.getCode())); | |
| 172 | - }); | |
| 173 | - } | |
| 174 | - | |
| 175 | -} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productproduce/MesWmProductProduceDetailController.java deleted
| 1 | -package cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce; | |
| 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.productproduce.vo.detail.MesWmProductProduceDetailRespVO; | |
| 8 | -import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.detail.MesWmProductProduceDetailSaveReqVO; | |
| 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.productproduce.MesWmProductProduceDetailDO; | |
| 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.productproduce.MesWmProductProduceDetailService; | |
| 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/product-produce-detail") | |
| 40 | -@Validated | |
| 41 | -public class MesWmProductProduceDetailController { | |
| 42 | - | |
| 43 | - @Resource | |
| 44 | - private MesWmProductProduceDetailService produceDetailService; | |
| 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-product-produce:create')") | |
| 64 | - public CommonResult<Long> createProductProduceDetail(@Valid @RequestBody MesWmProductProduceDetailSaveReqVO createReqVO) { | |
| 65 | - return success(produceDetailService.createProductProduceDetail(createReqVO)); | |
| 66 | - } | |
| 67 | - | |
| 68 | - @PutMapping("/update") | |
| 69 | - @Operation(summary = "修改生产入库明细") | |
| 70 | - @PreAuthorize("@ss.hasPermission('mes:wm-product-produce:update')") | |
| 71 | - public CommonResult<Boolean> updateProductProduceDetail(@Valid @RequestBody MesWmProductProduceDetailSaveReqVO updateReqVO) { | |
| 72 | - produceDetailService.updateProductProduceDetail(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-product-produce:delete')") | |
| 80 | - public CommonResult<Boolean> deleteProductProduceDetail(@RequestParam("id") Long id) { | |
| 81 | - produceDetailService.deleteProductProduceDetail(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-product-produce:query')") | |
| 89 | - public CommonResult<MesWmProductProduceDetailRespVO> getProductProduceDetail(@RequestParam("id") Long id) { | |
| 90 | - MesWmProductProduceDetailDO detail = produceDetailService.getProductProduceDetail(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-product-produce:query')") | |
| 101 | - public CommonResult<List<MesWmProductProduceDetailRespVO>> getProductProduceDetailListByLineId( | |
| 102 | - @RequestParam("lineId") Long lineId) { | |
| 103 | - List<MesWmProductProduceDetailDO> list = produceDetailService.getProductProduceDetailListByLineId(lineId); | |
| 104 | - return success(buildRespVOList(list)); | |
| 105 | - } | |
| 106 | - | |
| 107 | - // ==================== 拼接 VO ==================== | |
| 108 | - | |
| 109 | - private List<MesWmProductProduceDetailRespVO> buildRespVOList(List<MesWmProductProduceDetailDO> list) { | |
| 110 | - if (CollUtil.isEmpty(list)) { | |
| 111 | - return Collections.emptyList(); | |
| 112 | - } | |
| 113 | - // 1. 获得关联数据 | |
| 114 | - Map<Long, MesMdItemDO> itemMap = itemService.getItemMap( | |
| 115 | - convertSet(list, MesWmProductProduceDetailDO::getItemId)); | |
| 116 | - Map<Long, MesMdUnitMeasureDO> unitMeasureMap = unitMeasureService.getUnitMeasureMap( | |
| 117 | - convertSet(itemMap.values(), MesMdItemDO::getUnitMeasureId)); | |
| 118 | - Map<Long, MesWmWarehouseDO> warehouseMap = warehouseService.getWarehouseMap( | |
| 119 | - convertSet(list, MesWmProductProduceDetailDO::getWarehouseId)); | |
| 120 | - Map<Long, MesWmWarehouseLocationDO> locationMap = locationService.getWarehouseLocationMap( | |
| 121 | - convertSet(list, MesWmProductProduceDetailDO::getLocationId)); | |
| 122 | - Map<Long, MesWmWarehouseAreaDO> areaMap = areaService.getWarehouseAreaMap( | |
| 123 | - convertSet(list, MesWmProductProduceDetailDO::getAreaId)); | |
| 124 | - // 2. 构建结果 | |
| 125 | - return BeanUtils.toBean(list, MesWmProductProduceDetailRespVO.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/productproduce/MesWmProductProduceLineController.java
| ... | ... | @@ -5,9 +5,8 @@ import cn.iocoder.yudao.framework.common.pojo.CommonResult; |
| 5 | 5 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 6 | 6 | import cn.iocoder.yudao.framework.common.util.collection.MapUtils; |
| 7 | 7 | import cn.iocoder.yudao.framework.common.util.object.BeanUtils; |
| 8 | -import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.line.MesWmProductProduceLinePageReqVO; | |
| 9 | -import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.line.MesWmProductProduceLineRespVO; | |
| 10 | -import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.line.MesWmProductProduceLineSaveReqVO; | |
| 8 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.MesWmProductProduceLinePageReqVO; | |
| 9 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.MesWmProductProduceLineRespVO; | |
| 11 | 10 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; |
| 12 | 11 | import cn.iocoder.yudao.module.mes.dal.dataobject.md.unitmeasure.MesMdUnitMeasureDO; |
| 13 | 12 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceLineDO; |
| ... | ... | @@ -15,13 +14,14 @@ import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; |
| 15 | 14 | import cn.iocoder.yudao.module.mes.service.md.unitmeasure.MesMdUnitMeasureService; |
| 16 | 15 | import cn.iocoder.yudao.module.mes.service.wm.productproduce.MesWmProductProduceLineService; |
| 17 | 16 | import io.swagger.v3.oas.annotations.Operation; |
| 18 | -import io.swagger.v3.oas.annotations.Parameter; | |
| 19 | 17 | import io.swagger.v3.oas.annotations.tags.Tag; |
| 20 | 18 | import jakarta.annotation.Resource; |
| 21 | 19 | import jakarta.validation.Valid; |
| 22 | 20 | import org.springframework.security.access.prepost.PreAuthorize; |
| 23 | 21 | import org.springframework.validation.annotation.Validated; |
| 24 | -import org.springframework.web.bind.annotation.*; | |
| 22 | +import org.springframework.web.bind.annotation.GetMapping; | |
| 23 | +import org.springframework.web.bind.annotation.RequestMapping; | |
| 24 | +import org.springframework.web.bind.annotation.RestController; | |
| 25 | 25 | |
| 26 | 26 | import java.util.Collections; |
| 27 | 27 | import java.util.List; |
| ... | ... | @@ -37,69 +37,22 @@ import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils. |
| 37 | 37 | public class MesWmProductProduceLineController { |
| 38 | 38 | |
| 39 | 39 | @Resource |
| 40 | - private MesWmProductProduceLineService produceLineService; | |
| 41 | - | |
| 40 | + private MesWmProductProduceLineService productProduceLineService; | |
| 42 | 41 | @Resource |
| 43 | 42 | private MesMdItemService itemService; |
| 44 | - | |
| 45 | 43 | @Resource |
| 46 | 44 | private MesMdUnitMeasureService unitMeasureService; |
| 47 | 45 | |
| 48 | - @PostMapping("/create") | |
| 49 | - @Operation(summary = "创建生产入库单行") | |
| 50 | - @PreAuthorize("@ss.hasPermission('mes:wm-product-produce:create')") | |
| 51 | - public CommonResult<Long> createProductProduceLine(@Valid @RequestBody MesWmProductProduceLineSaveReqVO createReqVO) { | |
| 52 | - return success(produceLineService.createProductProduceLine(createReqVO)); | |
| 53 | - } | |
| 54 | - | |
| 55 | - @PutMapping("/update") | |
| 56 | - @Operation(summary = "修改生产入库单行") | |
| 57 | - @PreAuthorize("@ss.hasPermission('mes:wm-product-produce:update')") | |
| 58 | - public CommonResult<Boolean> updateProductProduceLine(@Valid @RequestBody MesWmProductProduceLineSaveReqVO updateReqVO) { | |
| 59 | - produceLineService.updateProductProduceLine(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-product-produce:delete')") | |
| 67 | - public CommonResult<Boolean> deleteProductProduceLine(@RequestParam("id") Long id) { | |
| 68 | - produceLineService.deleteProductProduceLine(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-product-produce:query')") | |
| 76 | - public CommonResult<MesWmProductProduceLineRespVO> getProductProduceLine(@RequestParam("id") Long id) { | |
| 77 | - MesWmProductProduceLineDO line = produceLineService.getProductProduceLine(id); | |
| 78 | - if (line == null) { | |
| 79 | - return success(null); | |
| 80 | - } | |
| 81 | - return success(buildRespVOList(Collections.singletonList(line)).get(0)); | |
| 82 | - } | |
| 83 | - | |
| 84 | 46 | @GetMapping("/page") |
| 85 | 47 | @Operation(summary = "获得生产入库单行分页") |
| 86 | 48 | @PreAuthorize("@ss.hasPermission('mes:wm-product-produce:query')") |
| 87 | 49 | public CommonResult<PageResult<MesWmProductProduceLineRespVO>> getProductProduceLinePage( |
| 88 | 50 | @Valid MesWmProductProduceLinePageReqVO pageReqVO) { |
| 89 | - PageResult<MesWmProductProduceLineDO> pageResult = produceLineService.getProductProduceLinePage(pageReqVO); | |
| 51 | + PageResult<MesWmProductProduceLineDO> pageResult = productProduceLineService.getProductProduceLinePage( | |
| 52 | + pageReqVO); | |
| 90 | 53 | return success(new PageResult<>(buildRespVOList(pageResult.getList()), pageResult.getTotal())); |
| 91 | 54 | } |
| 92 | 55 | |
| 93 | - @GetMapping("/list-by-produce") | |
| 94 | - @Operation(summary = "获得生产入库单行列表(按入库单编号)") | |
| 95 | - @Parameter(name = "produceId", description = "入库单编号", required = true, example = "1024") | |
| 96 | - @PreAuthorize("@ss.hasPermission('mes:wm-product-produce:query')") | |
| 97 | - public CommonResult<List<MesWmProductProduceLineRespVO>> getProductProduceLineListByProduceId( | |
| 98 | - @RequestParam("produceId") Long produceId) { | |
| 99 | - List<MesWmProductProduceLineDO> list = produceLineService.getProductProduceLineListByProduceId(produceId); | |
| 100 | - return success(buildRespVOList(list)); | |
| 101 | - } | |
| 102 | - | |
| 103 | 56 | // ==================== 拼接 VO ==================== |
| 104 | 57 | |
| 105 | 58 | private List<MesWmProductProduceLineRespVO> buildRespVOList(List<MesWmProductProduceLineDO> list) { | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productproduce/vo/line/MesWmProductProduceLinePageReqVO.java renamed to yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productproduce/vo/MesWmProductProduceLinePageReqVO.java
| 1 | -package cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.line; | |
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo; | |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageParam; |
| 4 | 4 | import io.swagger.v3.oas.annotations.media.Schema; |
| ... | ... | @@ -13,8 +13,8 @@ import lombok.ToString; |
| 13 | 13 | @ToString(callSuper = true) |
| 14 | 14 | public class MesWmProductProduceLinePageReqVO extends PageParam { |
| 15 | 15 | |
| 16 | - @Schema(description = "入库单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 17 | - @NotNull(message = "入库单编号不能为空") | |
| 18 | - private Long produceId; | |
| 16 | + @Schema(description = "报工单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 17 | + @NotNull(message = "报工单编号不能为空") | |
| 18 | + private Long feedbackId; | |
| 19 | 19 | |
| 20 | 20 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productproduce/vo/line/MesWmProductProduceLineRespVO.java renamed to yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productproduce/vo/MesWmProductProduceLineRespVO.java
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productproduce/vo/MesWmProductProducePageReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.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 MesWmProductProducePageReqVO extends PageParam { | |
| 17 | - | |
| 18 | - @Schema(description = "生产工单ID", example = "1") | |
| 19 | - private Long workOrderId; | |
| 20 | - | |
| 21 | - @Schema(description = "工作站ID", example = "1") | |
| 22 | - private Long workstationId; | |
| 23 | - | |
| 24 | - @Schema(description = "工序ID", example = "1") | |
| 25 | - private Long processId; | |
| 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[] produceDate; | |
| 33 | - | |
| 34 | -} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productproduce/vo/MesWmProductProduceRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.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 MesWmProductProduceRespVO { | |
| 11 | - | |
| 12 | - @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 13 | - private Long id; | |
| 14 | - | |
| 15 | - @Schema(description = "生产工单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 16 | - private Long workOrderId; | |
| 17 | - | |
| 18 | - @Schema(description = "生产工单编号", example = "WO20250226001") | |
| 19 | - private String workOrderCode; | |
| 20 | - | |
| 21 | - @Schema(description = "报工单 ID", example = "1") | |
| 22 | - private Long feedbackId; | |
| 23 | - | |
| 24 | - @Schema(description = "生产任务 ID", example = "1") | |
| 25 | - private Long taskId; | |
| 26 | - | |
| 27 | - @Schema(description = "生产任务编号", example = "TASK20250226001") | |
| 28 | - private String taskCode; | |
| 29 | - | |
| 30 | - @Schema(description = "工作站 ID", example = "1") | |
| 31 | - private Long workstationId; | |
| 32 | - | |
| 33 | - @Schema(description = "工作站名称", example = "装配工作站") | |
| 34 | - private String workstationName; | |
| 35 | - | |
| 36 | - @Schema(description = "工序 ID", example = "1") | |
| 37 | - private Long processId; | |
| 38 | - | |
| 39 | - @Schema(description = "工序名称", example = "组装工序") | |
| 40 | - private String processName; | |
| 41 | - | |
| 42 | - @Schema(description = "入库日期") | |
| 43 | - private LocalDateTime produceDate; | |
| 44 | - | |
| 45 | - @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") | |
| 46 | - private Integer status; | |
| 47 | - | |
| 48 | - @Schema(description = "备注", example = "备注") | |
| 49 | - private String remark; | |
| 50 | - | |
| 51 | - @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | |
| 52 | - private LocalDateTime createTime; | |
| 53 | - | |
| 54 | -} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productproduce/vo/MesWmProductProduceSaveReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo; | |
| 2 | - | |
| 3 | -import io.swagger.v3.oas.annotations.media.Schema; | |
| 4 | -import jakarta.validation.constraints.NotNull; | |
| 5 | -import lombok.Data; | |
| 6 | - | |
| 7 | -import java.time.LocalDateTime; | |
| 8 | - | |
| 9 | -@Schema(description = "管理后台 - MES 生产入库单新增/修改 Request VO") | |
| 10 | -@Data | |
| 11 | -public class MesWmProductProduceSaveReqVO { | |
| 12 | - | |
| 13 | - @Schema(description = "编号", example = "1024") | |
| 14 | - private Long id; | |
| 15 | - | |
| 16 | - @Schema(description = "生产工单 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 17 | - @NotNull(message = "生产工单 ID 不能为空") | |
| 18 | - private Long workOrderId; | |
| 19 | - | |
| 20 | - @Schema(description = "报工单 ID", example = "1") | |
| 21 | - private Long feedbackId; | |
| 22 | - | |
| 23 | - @Schema(description = "生产任务 ID", example = "1") | |
| 24 | - private Long taskId; | |
| 25 | - | |
| 26 | - @Schema(description = "工作站 ID", example = "1") | |
| 27 | - private Long workstationId; | |
| 28 | - | |
| 29 | - @Schema(description = "工序 ID", example = "1") | |
| 30 | - private Long processId; | |
| 31 | - | |
| 32 | - @Schema(description = "入库日期") | |
| 33 | - private LocalDateTime produceDate; | |
| 34 | - | |
| 35 | - @Schema(description = "备注", example = "备注") | |
| 36 | - private String remark; | |
| 37 | - | |
| 38 | -} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productproduce/vo/detail/MesWmProductProduceDetailRespVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.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 MesWmProductProduceDetailRespVO { | |
| 12 | - | |
| 13 | - @Schema(description = "编号", example = "1") | |
| 14 | - private Long id; | |
| 15 | - | |
| 16 | - @Schema(description = "入库单编号", example = "1") | |
| 17 | - private Long produceId; | |
| 18 | - | |
| 19 | - @Schema(description = "行编号", example = "1") | |
| 20 | - private Long lineId; | |
| 21 | - | |
| 22 | - @Schema(description = "物料编号", example = "1") | |
| 23 | - private Long itemId; | |
| 24 | - | |
| 25 | - @Schema(description = "物料编码", example = "ITEM001") | |
| 26 | - private String itemCode; | |
| 27 | - | |
| 28 | - @Schema(description = "物料名称", example = "螺丝") | |
| 29 | - private String itemName; | |
| 30 | - | |
| 31 | - @Schema(description = "规格型号", example = "M8*20") | |
| 32 | - private String specification; | |
| 33 | - | |
| 34 | - @Schema(description = "计量单位名称", example = "个") | |
| 35 | - private String unitMeasureName; | |
| 36 | - | |
| 37 | - @Schema(description = "入库数量", example = "300.00") | |
| 38 | - private BigDecimal quantity; | |
| 39 | - | |
| 40 | - @Schema(description = "批次编号", example = "1") | |
| 41 | - private Long batchId; | |
| 42 | - | |
| 43 | - @Schema(description = "批次号", example = "BATCH20260101001") | |
| 44 | - private String batchCode; | |
| 45 | - | |
| 46 | - @Schema(description = "仓库编号", example = "1") | |
| 47 | - private Long warehouseId; | |
| 48 | - | |
| 49 | - @Schema(description = "仓库名称", example = "成品仓库") | |
| 50 | - private String warehouseName; | |
| 51 | - | |
| 52 | - @Schema(description = "库区编号", example = "1") | |
| 53 | - private Long locationId; | |
| 54 | - | |
| 55 | - @Schema(description = "库区名称", example = "A区") | |
| 56 | - private String locationName; | |
| 57 | - | |
| 58 | - @Schema(description = "库位编号", example = "1") | |
| 59 | - private Long areaId; | |
| 60 | - | |
| 61 | - @Schema(description = "库位名称", example = "A01") | |
| 62 | - private String areaName; | |
| 63 | - | |
| 64 | - @Schema(description = "备注", example = "备注") | |
| 65 | - private String remark; | |
| 66 | - | |
| 67 | - @Schema(description = "创建时间") | |
| 68 | - private LocalDateTime createTime; | |
| 69 | - | |
| 70 | -} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/productproduce/vo/detail/MesWmProductProduceDetailSaveReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.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 MesWmProductProduceDetailSaveReqVO { | |
| 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 produceId; | |
| 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/productproduce/vo/line/MesWmProductProduceLineSaveReqVO.java deleted
| 1 | -package cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.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 | -import java.time.LocalDateTime; | |
| 10 | - | |
| 11 | -@Schema(description = "管理后台 - MES 生产入库单行 Save Request VO") | |
| 12 | -@Data | |
| 13 | -public class MesWmProductProduceLineSaveReqVO { | |
| 14 | - | |
| 15 | - @Schema(description = "行ID", example = "1") | |
| 16 | - private Long id; | |
| 17 | - | |
| 18 | - @Schema(description = "入库单ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 19 | - @NotNull(message = "入库单ID不能为空") | |
| 20 | - private Long produceId; | |
| 21 | - | |
| 22 | - @Schema(description = "报工单 ID", example = "1") | |
| 23 | - private Long feedbackId; | |
| 24 | - | |
| 25 | - @Schema(description = "物料ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | |
| 26 | - @NotNull(message = "物料ID不能为空") | |
| 27 | - private Long itemId; | |
| 28 | - | |
| 29 | - @Schema(description = "入库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00") | |
| 30 | - @NotNull(message = "入库数量不能为空") | |
| 31 | - @DecimalMin(value = "0", inclusive = false, message = "入库数量必须大于 0") | |
| 32 | - private BigDecimal quantity; | |
| 33 | - | |
| 34 | - @Schema(description = "批次ID", example = "1") | |
| 35 | - private Long batchId; | |
| 36 | - | |
| 37 | - @Schema(description = "批次号", example = "BATCH20260101001") | |
| 38 | - private String batchCode; | |
| 39 | - | |
| 40 | - @Schema(description = "有效期") | |
| 41 | - private LocalDateTime expireDate; | |
| 42 | - | |
| 43 | - @Schema(description = "批号", example = "LOT001") | |
| 44 | - private String lotNumber; | |
| 45 | - | |
| 46 | - @Schema(description = "质检状态", example = "1") | |
| 47 | - private Integer qualityStatus; | |
| 48 | - | |
| 49 | - @Schema(description = "备注", example = "备注") | |
| 50 | - private String remark; | |
| 51 | - | |
| 52 | -} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/wm/productproduce/MesWmProductProduceDetailMapper.java
| ... | ... | @@ -18,12 +18,4 @@ public interface MesWmProductProduceDetailMapper extends BaseMapperX<MesWmProduc |
| 18 | 18 | return selectList(MesWmProductProduceDetailDO::getLineId, lineId); |
| 19 | 19 | } |
| 20 | 20 | |
| 21 | - default List<MesWmProductProduceDetailDO> selectListByProduceId(Long produceId) { | |
| 22 | - return selectList(MesWmProductProduceDetailDO::getProduceId, produceId); | |
| 23 | - } | |
| 24 | - | |
| 25 | - default void deleteByProduceId(Long produceId) { | |
| 26 | - delete(MesWmProductProduceDetailDO::getProduceId, produceId); | |
| 27 | - } | |
| 28 | - | |
| 29 | 21 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/wm/productproduce/MesWmProductProduceLineMapper.java
| ... | ... | @@ -3,7 +3,7 @@ package cn.iocoder.yudao.module.mes.dal.mysql.wm.productproduce; |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | 4 | import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; |
| 5 | 5 | import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | -import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.line.MesWmProductProduceLinePageReqVO; | |
| 6 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.MesWmProductProduceLinePageReqVO; | |
| 7 | 7 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceLineDO; |
| 8 | 8 | import org.apache.ibatis.annotations.Mapper; |
| 9 | 9 | |
| ... | ... | @@ -19,7 +19,7 @@ public interface MesWmProductProduceLineMapper extends BaseMapperX<MesWmProductP |
| 19 | 19 | |
| 20 | 20 | default PageResult<MesWmProductProduceLineDO> selectPage(MesWmProductProduceLinePageReqVO reqVO) { |
| 21 | 21 | return selectPage(reqVO, new LambdaQueryWrapperX<MesWmProductProduceLineDO>() |
| 22 | - .eqIfPresent(MesWmProductProduceLineDO::getProduceId, reqVO.getProduceId()) | |
| 22 | + .eqIfPresent(MesWmProductProduceLineDO::getFeedbackId, reqVO.getFeedbackId()) | |
| 23 | 23 | .orderByDesc(MesWmProductProduceLineDO::getId)); |
| 24 | 24 | } |
| 25 | 25 | |
| ... | ... | @@ -27,10 +27,6 @@ public interface MesWmProductProduceLineMapper extends BaseMapperX<MesWmProductP |
| 27 | 27 | return selectList(MesWmProductProduceLineDO::getProduceId, produceId); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | - default void deleteByProduceId(Long produceId) { | |
| 31 | - delete(MesWmProductProduceLineDO::getProduceId, produceId); | |
| 32 | - } | |
| 33 | - | |
| 34 | 30 | default List<MesWmProductProduceLineDO> selectListByFeedbackId(Long feedbackId) { |
| 35 | 31 | return selectList(MesWmProductProduceLineDO::getFeedbackId, feedbackId); |
| 36 | 32 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/wm/productproduce/MesWmProductProduceMapper.java
| 1 | 1 | package cn.iocoder.yudao.module.mes.dal.mysql.wm.productproduce; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | 3 | 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.productproduce.vo.MesWmProductProducePageReqVO; | |
| 7 | 4 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceDO; |
| 8 | 5 | import org.apache.ibatis.annotations.Mapper; |
| 9 | 6 | |
| ... | ... | @@ -15,14 +12,4 @@ import org.apache.ibatis.annotations.Mapper; |
| 15 | 12 | @Mapper |
| 16 | 13 | public interface MesWmProductProduceMapper extends BaseMapperX<MesWmProductProduceDO> { |
| 17 | 14 | |
| 18 | - default PageResult<MesWmProductProduceDO> selectPage(MesWmProductProducePageReqVO reqVO) { | |
| 19 | - return selectPage(reqVO, new LambdaQueryWrapperX<MesWmProductProduceDO>() | |
| 20 | - .eqIfPresent(MesWmProductProduceDO::getWorkOrderId, reqVO.getWorkOrderId()) | |
| 21 | - .eqIfPresent(MesWmProductProduceDO::getWorkstationId, reqVO.getWorkstationId()) | |
| 22 | - .eqIfPresent(MesWmProductProduceDO::getProcessId, reqVO.getProcessId()) | |
| 23 | - .eqIfPresent(MesWmProductProduceDO::getStatus, reqVO.getStatus()) | |
| 24 | - .betweenIfPresent(MesWmProductProduceDO::getProduceDate, reqVO.getProduceDate()) | |
| 25 | - .orderByDesc(MesWmProductProduceDO::getId)); | |
| 26 | - } | |
| 27 | - | |
| 28 | 15 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/productproduce/MesWmProductProduceDetailService.java
| 1 | 1 | package cn.iocoder.yudao.module.mes.service.wm.productproduce; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.detail.MesWmProductProduceDetailSaveReqVO; | |
| 4 | 3 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceDetailDO; |
| 5 | -import jakarta.validation.Valid; | |
| 6 | 4 | |
| 7 | 5 | import java.util.List; |
| 8 | 6 | |
| ... | ... | @@ -12,34 +10,11 @@ import java.util.List; |
| 12 | 10 | public interface MesWmProductProduceDetailService { |
| 13 | 11 | |
| 14 | 12 | /** |
| 15 | - * 创建生产入库明细 | |
| 13 | + * 创建生产入库明细(内部使用) | |
| 16 | 14 | * |
| 17 | - * @param createReqVO 创建信息 | |
| 18 | - * @return 编号 | |
| 15 | + * @param detail 明细数据 | |
| 19 | 16 | */ |
| 20 | - Long createProductProduceDetail(@Valid MesWmProductProduceDetailSaveReqVO createReqVO); | |
| 21 | - | |
| 22 | - /** | |
| 23 | - * 更新生产入库明细 | |
| 24 | - * | |
| 25 | - * @param updateReqVO 更新信息 | |
| 26 | - */ | |
| 27 | - void updateProductProduceDetail(@Valid MesWmProductProduceDetailSaveReqVO updateReqVO); | |
| 28 | - | |
| 29 | - /** | |
| 30 | - * 删除生产入库明细 | |
| 31 | - * | |
| 32 | - * @param id 编号 | |
| 33 | - */ | |
| 34 | - void deleteProductProduceDetail(Long id); | |
| 35 | - | |
| 36 | - /** | |
| 37 | - * 获得生产入库明细 | |
| 38 | - * | |
| 39 | - * @param id 编号 | |
| 40 | - * @return 生产入库明细 | |
| 41 | - */ | |
| 42 | - MesWmProductProduceDetailDO getProductProduceDetail(Long id); | |
| 17 | + void createProductProduceDetail(MesWmProductProduceDetailDO detail); | |
| 43 | 18 | |
| 44 | 19 | /** |
| 45 | 20 | * 根据行ID获取明细列表 |
| ... | ... | @@ -49,19 +24,4 @@ public interface MesWmProductProduceDetailService { |
| 49 | 24 | */ |
| 50 | 25 | List<MesWmProductProduceDetailDO> getProductProduceDetailListByLineId(Long lineId); |
| 51 | 26 | |
| 52 | - /** | |
| 53 | - * 根据入库单ID获取明细列表 | |
| 54 | - * | |
| 55 | - * @param produceId 入库单ID | |
| 56 | - * @return 明细列表 | |
| 57 | - */ | |
| 58 | - List<MesWmProductProduceDetailDO> getProductProduceDetailListByProduceId(Long produceId); | |
| 59 | - | |
| 60 | - /** | |
| 61 | - * 根据入库单ID删除明细 | |
| 62 | - * | |
| 63 | - * @param produceId 入库单ID | |
| 64 | - */ | |
| 65 | - void deleteProductProduceDetailByProduceId(Long produceId); | |
| 66 | - | |
| 67 | 27 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/productproduce/MesWmProductProduceDetailServiceImpl.java
| 1 | 1 | package cn.iocoder.yudao.module.mes.service.wm.productproduce; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 4 | -import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.detail.MesWmProductProduceDetailSaveReqVO; | |
| 5 | 3 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceDetailDO; |
| 6 | 4 | import cn.iocoder.yudao.module.mes.dal.mysql.wm.productproduce.MesWmProductProduceDetailMapper; |
| 7 | 5 | import jakarta.annotation.Resource; |
| 8 | -import org.springframework.context.annotation.Lazy; | |
| 9 | 6 | import org.springframework.stereotype.Service; |
| 10 | 7 | import org.springframework.validation.annotation.Validated; |
| 11 | 8 | |
| 12 | 9 | import java.util.List; |
| 13 | 10 | |
| 14 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 15 | -import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.WM_PRODUCT_PRODUCE_DETAIL_NOT_EXISTS; | |
| 16 | - | |
| 17 | 11 | /** |
| 18 | 12 | * MES 生产入库明细 Service 实现类 |
| 19 | 13 | */ |
| ... | ... | @@ -22,67 +16,16 @@ import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.WM_PRODUCT_PR |
| 22 | 16 | public class MesWmProductProduceDetailServiceImpl implements MesWmProductProduceDetailService { |
| 23 | 17 | |
| 24 | 18 | @Resource |
| 25 | - private MesWmProductProduceDetailMapper produceDetailMapper; | |
| 26 | - | |
| 27 | - @Resource | |
| 28 | - @Lazy | |
| 29 | - private MesWmProductProduceLineService produceLineService; | |
| 30 | - | |
| 31 | - @Override | |
| 32 | - public Long createProductProduceDetail(MesWmProductProduceDetailSaveReqVO createReqVO) { | |
| 33 | - // 校验父数据存在 | |
| 34 | - produceLineService.validateProductProduceLineExists(createReqVO.getLineId()); | |
| 35 | - | |
| 36 | - // 插入 | |
| 37 | - MesWmProductProduceDetailDO detail = BeanUtils.toBean(createReqVO, MesWmProductProduceDetailDO.class); | |
| 38 | - produceDetailMapper.insert(detail); | |
| 39 | - return detail.getId(); | |
| 40 | - } | |
| 41 | - | |
| 42 | - @Override | |
| 43 | - public void updateProductProduceDetail(MesWmProductProduceDetailSaveReqVO updateReqVO) { | |
| 44 | - // 校验存在 | |
| 45 | - validateProductProduceDetailExists(updateReqVO.getId()); | |
| 46 | - // 校验父数据存在 | |
| 47 | - produceLineService.validateProductProduceLineExists(updateReqVO.getLineId()); | |
| 48 | - | |
| 49 | - // 更新 | |
| 50 | - MesWmProductProduceDetailDO updateObj = BeanUtils.toBean(updateReqVO, MesWmProductProduceDetailDO.class); | |
| 51 | - produceDetailMapper.updateById(updateObj); | |
| 52 | - } | |
| 19 | + private MesWmProductProduceDetailMapper productProduceDetailMapper; | |
| 53 | 20 | |
| 54 | 21 | @Override |
| 55 | - public void deleteProductProduceDetail(Long id) { | |
| 56 | - // 校验存在 | |
| 57 | - validateProductProduceDetailExists(id); | |
| 58 | - // 删除 | |
| 59 | - produceDetailMapper.deleteById(id); | |
| 60 | - } | |
| 61 | - | |
| 62 | - @Override | |
| 63 | - public MesWmProductProduceDetailDO getProductProduceDetail(Long id) { | |
| 64 | - return produceDetailMapper.selectById(id); | |
| 22 | + public void createProductProduceDetail(MesWmProductProduceDetailDO detail) { | |
| 23 | + productProduceDetailMapper.insert(detail); | |
| 65 | 24 | } |
| 66 | 25 | |
| 67 | 26 | @Override |
| 68 | 27 | public List<MesWmProductProduceDetailDO> getProductProduceDetailListByLineId(Long lineId) { |
| 69 | - return produceDetailMapper.selectListByLineId(lineId); | |
| 70 | - } | |
| 71 | - | |
| 72 | - @Override | |
| 73 | - public List<MesWmProductProduceDetailDO> getProductProduceDetailListByProduceId(Long produceId) { | |
| 74 | - return produceDetailMapper.selectListByProduceId(produceId); | |
| 75 | - } | |
| 76 | - | |
| 77 | - @Override | |
| 78 | - public void deleteProductProduceDetailByProduceId(Long produceId) { | |
| 79 | - produceDetailMapper.deleteByProduceId(produceId); | |
| 80 | - } | |
| 81 | - | |
| 82 | - private void validateProductProduceDetailExists(Long id) { | |
| 83 | - if (produceDetailMapper.selectById(id) == null) { | |
| 84 | - throw exception(WM_PRODUCT_PRODUCE_DETAIL_NOT_EXISTS); | |
| 85 | - } | |
| 28 | + return productProduceDetailMapper.selectListByLineId(lineId); | |
| 86 | 29 | } |
| 87 | 30 | |
| 88 | 31 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/productproduce/MesWmProductProduceLineService.java
| 1 | 1 | package cn.iocoder.yudao.module.mes.service.wm.productproduce; |
| 2 | 2 | |
| 3 | 3 | import cn.iocoder.yudao.framework.common.pojo.PageResult; |
| 4 | -import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.line.MesWmProductProduceLinePageReqVO; | |
| 5 | -import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.line.MesWmProductProduceLineSaveReqVO; | |
| 4 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.MesWmProductProduceLinePageReqVO; | |
| 6 | 5 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceLineDO; |
| 7 | -import jakarta.validation.Valid; | |
| 8 | 6 | |
| 9 | 7 | import java.util.List; |
| 10 | 8 | |
| ... | ... | @@ -14,72 +12,34 @@ import java.util.List; |
| 14 | 12 | public interface MesWmProductProduceLineService { |
| 15 | 13 | |
| 16 | 14 | /** |
| 17 | - * 创建生产入库单行 | |
| 15 | + * 创建生产入库单行(内部使用) | |
| 18 | 16 | * |
| 19 | - * @param createReqVO 创建信息 | |
| 20 | - * @return 编号 | |
| 17 | + * @param line 行数据 | |
| 21 | 18 | */ |
| 22 | - Long createProductProduceLine(@Valid MesWmProductProduceLineSaveReqVO createReqVO); | |
| 19 | + void createProductProduceLine(MesWmProductProduceLineDO line); | |
| 23 | 20 | |
| 24 | 21 | /** |
| 25 | - * 更新生产入库单行 | |
| 22 | + * 根据入库单 ID 获取行列表 | |
| 26 | 23 | * |
| 27 | - * @param updateReqVO 更新信息 | |
| 28 | - */ | |
| 29 | - void updateProductProduceLine(@Valid MesWmProductProduceLineSaveReqVO updateReqVO); | |
| 30 | - | |
| 31 | - /** | |
| 32 | - * 删除生产入库单行 | |
| 33 | - * | |
| 34 | - * @param id 编号 | |
| 35 | - */ | |
| 36 | - void deleteProductProduceLine(Long id); | |
| 37 | - | |
| 38 | - /** | |
| 39 | - * 获得生产入库单行 | |
| 40 | - * | |
| 41 | - * @param id 编号 | |
| 42 | - * @return 生产入库单行 | |
| 43 | - */ | |
| 44 | - MesWmProductProduceLineDO getProductProduceLine(Long id); | |
| 45 | - | |
| 46 | - /** | |
| 47 | - * 获得生产入库单行分页 | |
| 48 | - * | |
| 49 | - * @param pageReqVO 分页查询 | |
| 50 | - * @return 生产入库单行分页 | |
| 51 | - */ | |
| 52 | - PageResult<MesWmProductProduceLineDO> getProductProduceLinePage(MesWmProductProduceLinePageReqVO pageReqVO); | |
| 53 | - | |
| 54 | - /** | |
| 55 | - * 根据入库单ID获取行列表 | |
| 56 | - * | |
| 57 | - * @param produceId 入库单ID | |
| 24 | + * @param produceId 入库单 ID | |
| 58 | 25 | * @return 行列表 |
| 59 | 26 | */ |
| 60 | 27 | List<MesWmProductProduceLineDO> getProductProduceLineListByProduceId(Long produceId); |
| 61 | 28 | |
| 62 | 29 | /** |
| 63 | - * 根据入库单ID删除行 | |
| 64 | - * | |
| 65 | - * @param produceId 入库单ID | |
| 66 | - */ | |
| 67 | - void deleteProductProduceLineByProduceId(Long produceId); | |
| 68 | - | |
| 69 | - /** | |
| 70 | - * 校验生产入库单行是否存在 | |
| 30 | + * 根据报工记录 ID 获取行列表 | |
| 71 | 31 | * |
| 72 | - * @param id 编号 | |
| 73 | - * @return 生产入库单行 | |
| 32 | + * @param feedbackId 报工记录 ID | |
| 33 | + * @return 行列表 | |
| 74 | 34 | */ |
| 75 | - MesWmProductProduceLineDO validateProductProduceLineExists(Long id); | |
| 35 | + List<MesWmProductProduceLineDO> getProductProduceLineListByFeedbackId(Long feedbackId); | |
| 76 | 36 | |
| 77 | 37 | /** |
| 78 | - * 根据报工记录ID获取行列表 | |
| 38 | + * 获得生产入库单行分页 | |
| 79 | 39 | * |
| 80 | - * @param feedbackId 报工记录ID | |
| 81 | - * @return 行列表 | |
| 40 | + * @param pageReqVO 分页查询参数 | |
| 41 | + * @return 行分页列表 | |
| 82 | 42 | */ |
| 83 | - List<MesWmProductProduceLineDO> getProductProduceLineListByFeedbackId(Long feedbackId); | |
| 43 | + PageResult<MesWmProductProduceLineDO> getProductProduceLinePage(MesWmProductProduceLinePageReqVO pageReqVO); | |
| 84 | 44 | |
| 85 | 45 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/productproduce/MesWmProductProduceLineServiceImpl.java
| 1 | 1 | package cn.iocoder.yudao.module.mes.service.wm.productproduce; |
| 2 | 2 | |
| 3 | 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.productproduce.vo.line.MesWmProductProduceLinePageReqVO; | |
| 6 | -import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.line.MesWmProductProduceLineSaveReqVO; | |
| 4 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.MesWmProductProduceLinePageReqVO; | |
| 7 | 5 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceLineDO; |
| 8 | 6 | import cn.iocoder.yudao.module.mes.dal.mysql.wm.productproduce.MesWmProductProduceLineMapper; |
| 9 | -import cn.iocoder.yudao.module.mes.service.md.item.MesMdItemService; | |
| 10 | 7 | import jakarta.annotation.Resource; |
| 11 | -import org.springframework.context.annotation.Lazy; | |
| 12 | 8 | import org.springframework.stereotype.Service; |
| 13 | 9 | import org.springframework.validation.annotation.Validated; |
| 14 | 10 | |
| 15 | 11 | import java.util.List; |
| 16 | 12 | |
| 17 | -import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | |
| 18 | -import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.WM_PRODUCT_PRODUCE_LINE_NOT_EXISTS; | |
| 19 | - | |
| 20 | 13 | /** |
| 21 | 14 | * MES 生产入库单行 Service 实现类 |
| 22 | 15 | */ |
| ... | ... | @@ -25,81 +18,26 @@ import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.WM_PRODUCT_PR |
| 25 | 18 | public class MesWmProductProduceLineServiceImpl implements MesWmProductProduceLineService { |
| 26 | 19 | |
| 27 | 20 | @Resource |
| 28 | - private MesWmProductProduceLineMapper produceLineMapper; | |
| 29 | - | |
| 30 | - @Resource | |
| 31 | - @Lazy | |
| 32 | - private MesWmProductProduceService produceService; | |
| 33 | - @Resource | |
| 34 | - private MesMdItemService itemService; | |
| 21 | + private MesWmProductProduceLineMapper productProduceLineMapper; | |
| 35 | 22 | |
| 36 | 23 | @Override |
| 37 | - public Long createProductProduceLine(MesWmProductProduceLineSaveReqVO createReqVO) { | |
| 38 | - // 校验父数据存在 | |
| 39 | - produceService.validateProductProduceExists(createReqVO.getProduceId()); | |
| 40 | - // 校验物料存在 | |
| 41 | - itemService.validateItemExists(createReqVO.getItemId()); | |
| 42 | - | |
| 43 | - // 插入 | |
| 44 | - MesWmProductProduceLineDO line = BeanUtils.toBean(createReqVO, MesWmProductProduceLineDO.class); | |
| 45 | - produceLineMapper.insert(line); | |
| 46 | - return line.getId(); | |
| 47 | - } | |
| 48 | - | |
| 49 | - @Override | |
| 50 | - public void updateProductProduceLine(MesWmProductProduceLineSaveReqVO updateReqVO) { | |
| 51 | - // 校验存在 | |
| 52 | - validateProductProduceLineExists(updateReqVO.getId()); | |
| 53 | - // 校验父数据存在 | |
| 54 | - produceService.validateProductProduceExists(updateReqVO.getProduceId()); | |
| 55 | - // 校验物料存在 | |
| 56 | - itemService.validateItemExists(updateReqVO.getItemId()); | |
| 57 | - | |
| 58 | - // 更新 | |
| 59 | - MesWmProductProduceLineDO updateObj = BeanUtils.toBean(updateReqVO, MesWmProductProduceLineDO.class); | |
| 60 | - produceLineMapper.updateById(updateObj); | |
| 61 | - } | |
| 62 | - | |
| 63 | - @Override | |
| 64 | - public void deleteProductProduceLine(Long id) { | |
| 65 | - // 校验存在 | |
| 66 | - validateProductProduceLineExists(id); | |
| 67 | - // 删除 | |
| 68 | - produceLineMapper.deleteById(id); | |
| 69 | - } | |
| 70 | - | |
| 71 | - @Override | |
| 72 | - public MesWmProductProduceLineDO getProductProduceLine(Long id) { | |
| 73 | - return produceLineMapper.selectById(id); | |
| 74 | - } | |
| 75 | - | |
| 76 | - @Override | |
| 77 | - public PageResult<MesWmProductProduceLineDO> getProductProduceLinePage(MesWmProductProduceLinePageReqVO pageReqVO) { | |
| 78 | - return produceLineMapper.selectPage(pageReqVO); | |
| 24 | + public void createProductProduceLine(MesWmProductProduceLineDO line) { | |
| 25 | + productProduceLineMapper.insert(line); | |
| 79 | 26 | } |
| 80 | 27 | |
| 81 | 28 | @Override |
| 82 | 29 | public List<MesWmProductProduceLineDO> getProductProduceLineListByProduceId(Long produceId) { |
| 83 | - return produceLineMapper.selectListByProduceId(produceId); | |
| 30 | + return productProduceLineMapper.selectListByProduceId(produceId); | |
| 84 | 31 | } |
| 85 | 32 | |
| 86 | 33 | @Override |
| 87 | - public void deleteProductProduceLineByProduceId(Long produceId) { | |
| 88 | - produceLineMapper.deleteByProduceId(produceId); | |
| 89 | - } | |
| 90 | - | |
| 91 | - @Override | |
| 92 | - public MesWmProductProduceLineDO validateProductProduceLineExists(Long id) { | |
| 93 | - MesWmProductProduceLineDO line = produceLineMapper.selectById(id); | |
| 94 | - if (line == null) { | |
| 95 | - throw exception(WM_PRODUCT_PRODUCE_LINE_NOT_EXISTS); | |
| 96 | - } | |
| 97 | - return line; | |
| 34 | + public List<MesWmProductProduceLineDO> getProductProduceLineListByFeedbackId(Long feedbackId) { | |
| 35 | + return productProduceLineMapper.selectListByFeedbackId(feedbackId); | |
| 98 | 36 | } |
| 99 | 37 | |
| 100 | 38 | @Override |
| 101 | - public List<MesWmProductProduceLineDO> getProductProduceLineListByFeedbackId(Long feedbackId) { | |
| 102 | - return produceLineMapper.selectListByFeedbackId(feedbackId); | |
| 39 | + public PageResult<MesWmProductProduceLineDO> getProductProduceLinePage(MesWmProductProduceLinePageReqVO pageReqVO) { | |
| 40 | + return productProduceLineMapper.selectPage(pageReqVO); | |
| 103 | 41 | } |
| 104 | 42 | |
| 105 | 43 | } | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/productproduce/MesWmProductProduceService.java
| 1 | 1 | package cn.iocoder.yudao.module.mes.service.wm.productproduce; |
| 2 | 2 | |
| 3 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 4 | -import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.MesWmProductProducePageReqVO; | |
| 5 | -import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.MesWmProductProduceSaveReqVO; | |
| 6 | 3 | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.feedback.MesProFeedbackDO; |
| 7 | 4 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceDO; |
| 8 | -import jakarta.validation.Valid; | |
| 9 | 5 | |
| 10 | 6 | /** |
| 11 | 7 | * MES 生产入库单 Service 接口 |
| ... | ... | @@ -13,44 +9,6 @@ import jakarta.validation.Valid; |
| 13 | 9 | public interface MesWmProductProduceService { |
| 14 | 10 | |
| 15 | 11 | /** |
| 16 | - * 创建生产入库单 | |
| 17 | - * | |
| 18 | - * @param createReqVO 创建信息 | |
| 19 | - * @return 编号 | |
| 20 | - */ | |
| 21 | - Long createProductProduce(@Valid MesWmProductProduceSaveReqVO createReqVO); | |
| 22 | - | |
| 23 | - /** | |
| 24 | - * 修改生产入库单 | |
| 25 | - * | |
| 26 | - * @param updateReqVO 修改信息 | |
| 27 | - */ | |
| 28 | - void updateProductProduce(@Valid MesWmProductProduceSaveReqVO updateReqVO); | |
| 29 | - | |
| 30 | - /** | |
| 31 | - * 删除生产入库单 | |
| 32 | - * | |
| 33 | - * @param id 编号 | |
| 34 | - */ | |
| 35 | - void deleteProductProduce(Long id); | |
| 36 | - | |
| 37 | - /** | |
| 38 | - * 获得生产入库单 | |
| 39 | - * | |
| 40 | - * @param id 编号 | |
| 41 | - * @return 生产入库单 | |
| 42 | - */ | |
| 43 | - MesWmProductProduceDO getProductProduce(Long id); | |
| 44 | - | |
| 45 | - /** | |
| 46 | - * 获得生产入库单分页 | |
| 47 | - * | |
| 48 | - * @param pageReqVO 分页参数 | |
| 49 | - * @return 生产入库单分页 | |
| 50 | - */ | |
| 51 | - PageResult<MesWmProductProduceDO> getProductProducePage(MesWmProductProducePageReqVO pageReqVO); | |
| 52 | - | |
| 53 | - /** | |
| 54 | 12 | * 校验生产入库单是否存在 |
| 55 | 13 | * |
| 56 | 14 | * @param id 编号 |
| ... | ... | @@ -66,21 +24,6 @@ public interface MesWmProductProduceService { |
| 66 | 24 | void finishProductProduce(Long id); |
| 67 | 25 | |
| 68 | 26 | /** |
| 69 | - * 取消生产入库单(非已完成/已取消状态 → 已取消) | |
| 70 | - * | |
| 71 | - * @param id 编号 | |
| 72 | - */ | |
| 73 | - void cancelProductProduce(Long id); | |
| 74 | - | |
| 75 | - /** | |
| 76 | - * 校验生产入库单的数量:每行明细数量之和是否等于行入库数量 | |
| 77 | - * | |
| 78 | - * @param id 编号 | |
| 79 | - * @return 是否全部一致 | |
| 80 | - */ | |
| 81 | - Boolean checkProductProduceQuantity(Long id); | |
| 82 | - | |
| 83 | - /** | |
| 84 | 27 | * 根据报工记录,自动生成产品产出单(头 + 行 + 明细) |
| 85 | 28 | * |
| 86 | 29 | * @param feedback 报工记录 | ... | ... |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/productproduce/MesWmProductProduceServiceImpl.java
| ... | ... | @@ -3,25 +3,17 @@ package cn.iocoder.yudao.module.mes.service.wm.productproduce; |
| 3 | 3 | import cn.hutool.core.collection.CollUtil; |
| 4 | 4 | import cn.hutool.core.util.ObjUtil; |
| 5 | 5 | import cn.hutool.core.util.ObjectUtil; |
| 6 | -import cn.iocoder.yudao.framework.common.pojo.PageResult; | |
| 7 | 6 | import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; |
| 8 | -import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | |
| 9 | -import cn.iocoder.yudao.framework.common.util.object.ObjectUtils; | |
| 10 | 7 | import cn.iocoder.yudao.module.mes.controller.admin.wm.batch.vo.MesWmBatchGenerateReqVO; |
| 11 | -import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.MesWmProductProducePageReqVO; | |
| 12 | -import cn.iocoder.yudao.module.mes.controller.admin.wm.productproduce.vo.MesWmProductProduceSaveReqVO; | |
| 13 | 8 | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.feedback.MesProFeedbackDO; |
| 14 | 9 | import cn.iocoder.yudao.module.mes.dal.dataobject.pro.workorder.MesProWorkOrderDO; |
| 15 | 10 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.batch.MesWmBatchDO; |
| 16 | 11 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceDetailDO; |
| 17 | 12 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceDO; |
| 18 | 13 | import cn.iocoder.yudao.module.mes.dal.dataobject.wm.productproduce.MesWmProductProduceLineDO; |
| 19 | -import cn.iocoder.yudao.module.mes.dal.mysql.wm.productproduce.MesWmProductProduceDetailMapper; | |
| 20 | -import cn.iocoder.yudao.module.mes.dal.mysql.wm.productproduce.MesWmProductProduceLineMapper; | |
| 21 | 14 | import cn.iocoder.yudao.module.mes.dal.mysql.wm.productproduce.MesWmProductProduceMapper; |
| 22 | 15 | import cn.iocoder.yudao.module.mes.enums.wm.MesWmProductProduceStatusEnum; |
| 23 | 16 | import cn.iocoder.yudao.module.mes.enums.wm.MesWmQualityStatusEnum; |
| 24 | -import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkstationService; | |
| 25 | 17 | import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderService; |
| 26 | 18 | import cn.iocoder.yudao.module.mes.service.wm.batch.MesWmBatchService; |
| 27 | 19 | import jakarta.annotation.Resource; |
| ... | ... | @@ -46,19 +38,11 @@ public class MesWmProductProduceServiceImpl implements MesWmProductProduceServic |
| 46 | 38 | |
| 47 | 39 | @Resource |
| 48 | 40 | private MesWmProductProduceMapper productProduceMapper; |
| 49 | - // TODO @芋艿:需要优化,不要直接调用对方的 mapper | |
| 50 | - @Resource | |
| 51 | - private MesWmProductProduceLineMapper produceLineMapper; | |
| 52 | - // TODO @芋艿:需要优化,不要直接调用对方的 mapper | |
| 53 | - @Resource | |
| 54 | - private MesWmProductProduceDetailMapper produceDetailMapper; | |
| 55 | 41 | |
| 56 | 42 | @Resource |
| 57 | - private MesWmProductProduceLineService produceLineService; | |
| 58 | - @Resource | |
| 59 | - private MesWmProductProduceDetailService produceDetailService; | |
| 43 | + private MesWmProductProduceLineService productProduceLineService; | |
| 60 | 44 | @Resource |
| 61 | - private MesMdWorkstationService workstationService; | |
| 45 | + private MesWmProductProduceDetailService productProduceDetailService; | |
| 62 | 46 | @Resource |
| 63 | 47 | private MesProWorkOrderService workOrderService; |
| 64 | 48 | @Resource |
| ... | ... | @@ -66,78 +50,19 @@ public class MesWmProductProduceServiceImpl implements MesWmProductProduceServic |
| 66 | 50 | |
| 67 | 51 | @Override |
| 68 | 52 | @Transactional(rollbackFor = Exception.class) |
| 69 | - public Long createProductProduce(MesWmProductProduceSaveReqVO createReqVO) { | |
| 70 | - // 1. 校验关联数据 | |
| 71 | - if (createReqVO.getWorkOrderId() != null) { | |
| 72 | - workOrderService.validateWorkOrderExists(createReqVO.getWorkOrderId()); | |
| 73 | - } | |
| 74 | - if (createReqVO.getWorkstationId() != null) { | |
| 75 | - workstationService.validateWorkstationExists(createReqVO.getWorkstationId()); | |
| 76 | - } | |
| 77 | - | |
| 78 | - // 2. 插入主表 | |
| 79 | - MesWmProductProduceDO produce = BeanUtils.toBean(createReqVO, MesWmProductProduceDO.class); | |
| 80 | - produce.setStatus(MesWmProductProduceStatusEnum.PREPARE.getStatus()); | |
| 81 | - productProduceMapper.insert(produce); | |
| 82 | - return produce.getId(); | |
| 83 | - } | |
| 84 | - | |
| 85 | - @Override | |
| 86 | - @Transactional(rollbackFor = Exception.class) | |
| 87 | - public void updateProductProduce(MesWmProductProduceSaveReqVO updateReqVO) { | |
| 88 | - // 1.1 校验存在 + 准备中状态 | |
| 89 | - validateProductProduceExistsAndPrepare(updateReqVO.getId()); | |
| 90 | - // 1.2 校验关联数据 | |
| 91 | - if (updateReqVO.getWorkOrderId() != null) { | |
| 92 | - workOrderService.validateWorkOrderExists(updateReqVO.getWorkOrderId()); | |
| 93 | - } | |
| 94 | - if (updateReqVO.getWorkstationId() != null) { | |
| 95 | - workstationService.validateWorkstationExists(updateReqVO.getWorkstationId()); | |
| 96 | - } | |
| 97 | - | |
| 98 | - // 2. 更新主表 | |
| 99 | - MesWmProductProduceDO updateObj = BeanUtils.toBean(updateReqVO, MesWmProductProduceDO.class); | |
| 100 | - productProduceMapper.updateById(updateObj); | |
| 101 | - } | |
| 102 | - | |
| 103 | - @Override | |
| 104 | - @Transactional(rollbackFor = Exception.class) | |
| 105 | - public void deleteProductProduce(Long id) { | |
| 106 | - // 1. 校验存在 + 准备中状态 | |
| 107 | - validateProductProduceExistsAndPrepare(id); | |
| 108 | - | |
| 109 | - // 2.1 级联删除明细 | |
| 110 | - produceDetailService.deleteProductProduceDetailByProduceId(id); | |
| 111 | - // 2.2 级联删除行 | |
| 112 | - produceLineService.deleteProductProduceLineByProduceId(id); | |
| 113 | - // 2.3 删除主表 | |
| 114 | - productProduceMapper.deleteById(id); | |
| 115 | - } | |
| 116 | - | |
| 117 | - @Override | |
| 118 | - public MesWmProductProduceDO getProductProduce(Long id) { | |
| 119 | - return productProduceMapper.selectById(id); | |
| 120 | - } | |
| 121 | - | |
| 122 | - @Override | |
| 123 | - public PageResult<MesWmProductProduceDO> getProductProducePage(MesWmProductProducePageReqVO pageReqVO) { | |
| 124 | - return productProduceMapper.selectPage(pageReqVO); | |
| 125 | - } | |
| 126 | - | |
| 127 | - @Override | |
| 128 | - @Transactional(rollbackFor = Exception.class) | |
| 129 | 53 | public void finishProductProduce(Long id) { |
| 130 | 54 | // 1.1 校验存在 + 草稿状态 |
| 131 | 55 | validateProductProduceExistsAndPrepare(id); |
| 132 | 56 | // 1.2 校验至少有一条行 |
| 133 | - List<MesWmProductProduceLineDO> lines = produceLineService.getProductProduceLineListByProduceId(id); | |
| 57 | + List<MesWmProductProduceLineDO> lines = productProduceLineService.getProductProduceLineListByProduceId(id); | |
| 134 | 58 | if (CollUtil.isEmpty(lines)) { |
| 135 | 59 | throw exception(WM_PRODUCT_PRODUCE_NO_LINE); |
| 136 | 60 | } |
| 137 | 61 | |
| 138 | 62 | // 2. 校验每行明细数量之和等于行数量 |
| 139 | 63 | for (MesWmProductProduceLineDO line : lines) { |
| 140 | - List<MesWmProductProduceDetailDO> details = produceDetailService.getProductProduceDetailListByLineId(line.getId()); | |
| 64 | + List<MesWmProductProduceDetailDO> details = productProduceDetailService.getProductProduceDetailListByLineId( | |
| 65 | + line.getId()); | |
| 141 | 66 | BigDecimal totalDetailQty = CollectionUtils.getSumValue(details, |
| 142 | 67 | MesWmProductProduceDetailDO::getQuantity, BigDecimal::add, BigDecimal.ZERO); |
| 143 | 68 | if (line.getQuantity() != null && totalDetailQty.compareTo(line.getQuantity()) != 0) { |
| ... | ... | @@ -154,37 +79,6 @@ public class MesWmProductProduceServiceImpl implements MesWmProductProduceServic |
| 154 | 79 | |
| 155 | 80 | @Override |
| 156 | 81 | @Transactional(rollbackFor = Exception.class) |
| 157 | - public void cancelProductProduce(Long id) { | |
| 158 | - // 1. 校验存在 | |
| 159 | - MesWmProductProduceDO produce = validateProductProduceExists(id); | |
| 160 | - // 已完成和已取消不允许取消 | |
| 161 | - if (ObjectUtils.equalsAny(produce.getStatus(), | |
| 162 | - MesWmProductProduceStatusEnum.FINISHED.getStatus(), | |
| 163 | - MesWmProductProduceStatusEnum.CANCELED.getStatus())) { | |
| 164 | - throw exception(WM_PRODUCT_PRODUCE_CANCEL_NOT_ALLOWED); | |
| 165 | - } | |
| 166 | - | |
| 167 | - // 2. 取消 | |
| 168 | - productProduceMapper.updateById(new MesWmProductProduceDO() | |
| 169 | - .setId(id).setStatus(MesWmProductProduceStatusEnum.CANCELED.getStatus())); | |
| 170 | - } | |
| 171 | - | |
| 172 | - @Override | |
| 173 | - public Boolean checkProductProduceQuantity(Long id) { | |
| 174 | - List<MesWmProductProduceLineDO> lines = produceLineService.getProductProduceLineListByProduceId(id); | |
| 175 | - for (MesWmProductProduceLineDO line : lines) { | |
| 176 | - List<MesWmProductProduceDetailDO> details = produceDetailService.getProductProduceDetailListByLineId(line.getId()); | |
| 177 | - BigDecimal totalDetailQty = CollectionUtils.getSumValue(details, | |
| 178 | - MesWmProductProduceDetailDO::getQuantity, BigDecimal::add, BigDecimal.ZERO); | |
| 179 | - if (line.getQuantity() != null && totalDetailQty.compareTo(line.getQuantity()) != 0) { | |
| 180 | - return false; | |
| 181 | - } | |
| 182 | - } | |
| 183 | - return true; | |
| 184 | - } | |
| 185 | - | |
| 186 | - @Override | |
| 187 | - @Transactional(rollbackFor = Exception.class) | |
| 188 | 82 | public MesWmProductProduceDO generateProductProduce(MesProFeedbackDO feedback, boolean checkFlag) { |
| 189 | 83 | // 0. 查询关联的工单(用于获取 clientId 等信息) |
| 190 | 84 | MesProWorkOrderDO workOrder = workOrderService.getWorkOrder(feedback.getWorkOrderId()); |
| ... | ... | @@ -217,7 +111,7 @@ public class MesWmProductProduceServiceImpl implements MesWmProductProduceServic |
| 217 | 111 | // 3.1 需要检验:创建一条行(质量状态=待检验),不生成明细 |
| 218 | 112 | MesWmProductProduceLineDO line = buildProduceLine(produce, feedback, batchId, batchCode, |
| 219 | 113 | feedback.getFeedbackQuantity(), MesWmQualityStatusEnum.PENDING.getStatus()); |
| 220 | - produceLineMapper.insert(line); | |
| 114 | + productProduceLineService.createProductProduceLine(line); | |
| 221 | 115 | // TODO @芋艿:先不生成明细行,等待检验完成时,再根据行的质量状态生成明细行 |
| 222 | 116 | } else { |
| 223 | 117 | // 3.2 无需检验:按合格品/不合格品各生成一行 + 明细 |
| ... | ... | @@ -227,19 +121,19 @@ public class MesWmProductProduceServiceImpl implements MesWmProductProduceServic |
| 227 | 121 | if (unqualifiedQty.compareTo(BigDecimal.ZERO) > 0) { |
| 228 | 122 | MesWmProductProduceLineDO unqualifiedLine = buildProduceLine(produce, feedback, batchId, batchCode, |
| 229 | 123 | unqualifiedQty, MesWmQualityStatusEnum.FAIL.getStatus()); |
| 230 | - produceLineMapper.insert(unqualifiedLine); | |
| 124 | + productProduceLineService.createProductProduceLine(unqualifiedLine); | |
| 231 | 125 | MesWmProductProduceDetailDO unqualifiedDetail = buildProduceDetail(produce, feedback, batchId, batchCode, |
| 232 | 126 | unqualifiedLine.getId(), unqualifiedQty); |
| 233 | - produceDetailMapper.insert(unqualifiedDetail); | |
| 127 | + productProduceDetailService.createProductProduceDetail(unqualifiedDetail); | |
| 234 | 128 | } |
| 235 | 129 | // 3.2.2 合格品行 + 明细 |
| 236 | 130 | if (qualifiedQty.compareTo(BigDecimal.ZERO) > 0) { |
| 237 | 131 | MesWmProductProduceLineDO qualifiedLine = buildProduceLine(produce, feedback, batchId, batchCode, |
| 238 | 132 | qualifiedQty, MesWmQualityStatusEnum.PASS.getStatus()); |
| 239 | - produceLineMapper.insert(qualifiedLine); | |
| 133 | + productProduceLineService.createProductProduceLine(qualifiedLine); | |
| 240 | 134 | MesWmProductProduceDetailDO qualifiedDetail = buildProduceDetail(produce, feedback, batchId, batchCode, |
| 241 | 135 | qualifiedLine.getId(), qualifiedQty); |
| 242 | - produceDetailMapper.insert(qualifiedDetail); | |
| 136 | + productProduceDetailService.createProductProduceDetail(qualifiedDetail); | |
| 243 | 137 | } |
| 244 | 138 | } |
| 245 | 139 | return produce; |
| ... | ... | @@ -288,5 +182,4 @@ public class MesWmProductProduceServiceImpl implements MesWmProductProduceServic |
| 288 | 182 | return produce; |
| 289 | 183 | } |
| 290 | 184 | |
| 291 | - | |
| 292 | 185 | } | ... | ... |