Commit f7349fd6c8ac4dd790668c118772665dea885878
1 parent
6be8ab88
✨ feat(mes): 添加外协发料单行及明细相关功能和请求响应 VO
Showing
21 changed files
with
1368 additions
and
0 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/outsourceissue/MesWmOutsourceIssueController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue; | ||
| 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.outsourceissue.vo.MesWmOutsourceIssueExcelVO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue.vo.MesWmOutsourceIssuePageReqVO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue.vo.MesWmOutsourceIssueRespVO; | ||
| 14 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue.vo.MesWmOutsourceIssueSaveReqVO; | ||
| 15 | +import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; | ||
| 16 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.outsourceissue.MesWmOutsourceIssueDO; | ||
| 17 | +import cn.iocoder.yudao.module.mes.service.md.vendor.MesMdVendorService; | ||
| 18 | +import cn.iocoder.yudao.module.mes.service.wm.outsourceissue.MesWmOutsourceIssueService; | ||
| 19 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 20 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 21 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 22 | +import jakarta.annotation.Resource; | ||
| 23 | +import jakarta.servlet.http.HttpServletResponse; | ||
| 24 | +import jakarta.validation.Valid; | ||
| 25 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 26 | +import org.springframework.validation.annotation.Validated; | ||
| 27 | +import org.springframework.web.bind.annotation.*; | ||
| 28 | + | ||
| 29 | +import java.io.IOException; | ||
| 30 | +import java.util.Collections; | ||
| 31 | +import java.util.List; | ||
| 32 | +import java.util.Map; | ||
| 33 | + | ||
| 34 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||
| 35 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 36 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||
| 37 | + | ||
| 38 | +/** | ||
| 39 | + * MES 外协发料单 Controller | ||
| 40 | + * | ||
| 41 | + * @author 芋道源码 | ||
| 42 | + */ | ||
| 43 | +@Tag(name = "管理后台 - MES 外协发料单") | ||
| 44 | +@RestController | ||
| 45 | +@RequestMapping("/mes/wm/outsource-issue") | ||
| 46 | +@Validated | ||
| 47 | +public class MesWmOutsourceIssueController { | ||
| 48 | + | ||
| 49 | + @Resource | ||
| 50 | + private MesWmOutsourceIssueService outsourceIssueService; | ||
| 51 | + | ||
| 52 | + @Resource | ||
| 53 | + private MesMdVendorService vendorService; | ||
| 54 | + | ||
| 55 | + @PostMapping("/create") | ||
| 56 | + @Operation(summary = "创建外协发料单") | ||
| 57 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-issue:create')") | ||
| 58 | + public CommonResult<Long> createOutsourceIssue(@Valid @RequestBody MesWmOutsourceIssueSaveReqVO createReqVO) { | ||
| 59 | + return success(outsourceIssueService.createOutsourceIssue(createReqVO)); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @PutMapping("/update") | ||
| 63 | + @Operation(summary = "修改外协发料单") | ||
| 64 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-issue:update')") | ||
| 65 | + public CommonResult<Boolean> updateOutsourceIssue(@Valid @RequestBody MesWmOutsourceIssueSaveReqVO updateReqVO) { | ||
| 66 | + outsourceIssueService.updateOutsourceIssue(updateReqVO); | ||
| 67 | + return success(true); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + @DeleteMapping("/delete") | ||
| 71 | + @Operation(summary = "删除外协发料单") | ||
| 72 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 73 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-issue:delete')") | ||
| 74 | + public CommonResult<Boolean> deleteOutsourceIssue(@RequestParam("id") Long id) { | ||
| 75 | + outsourceIssueService.deleteOutsourceIssue(id); | ||
| 76 | + return success(true); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + @GetMapping("/get") | ||
| 80 | + @Operation(summary = "获得外协发料单") | ||
| 81 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 82 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-issue:query')") | ||
| 83 | + public CommonResult<MesWmOutsourceIssueRespVO> getOutsourceIssue(@RequestParam("id") Long id) { | ||
| 84 | + MesWmOutsourceIssueDO issue = outsourceIssueService.getOutsourceIssue(id); | ||
| 85 | + if (issue == null) { | ||
| 86 | + return success(null); | ||
| 87 | + } | ||
| 88 | + return success(buildRespVOList(Collections.singletonList(issue)).get(0)); | ||
| 89 | + } | ||
| 90 | + | ||
| 91 | + @GetMapping("/page") | ||
| 92 | + @Operation(summary = "获得外协发料单分页") | ||
| 93 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-issue:query')") | ||
| 94 | + public CommonResult<PageResult<MesWmOutsourceIssueRespVO>> getOutsourceIssuePage( | ||
| 95 | + @Valid MesWmOutsourceIssuePageReqVO pageReqVO) { | ||
| 96 | + PageResult<MesWmOutsourceIssueDO> pageResult = outsourceIssueService.getOutsourceIssuePage(pageReqVO); | ||
| 97 | + return success(new PageResult<>(buildRespVOList(pageResult.getList()), pageResult.getTotal())); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + @GetMapping("/export-excel") | ||
| 101 | + @Operation(summary = "导出外协发料单 Excel") | ||
| 102 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-issue:export')") | ||
| 103 | + @ApiAccessLog(operateType = EXPORT) | ||
| 104 | + public void exportOutsourceIssueExcel(@Valid MesWmOutsourceIssuePageReqVO pageReqVO, | ||
| 105 | + HttpServletResponse response) throws IOException { | ||
| 106 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 107 | + PageResult<MesWmOutsourceIssueDO> pageResult = outsourceIssueService.getOutsourceIssuePage(pageReqVO); | ||
| 108 | + ExcelUtils.write(response, "外协发料单.xls", "数据", MesWmOutsourceIssueExcelVO.class, | ||
| 109 | + BeanUtils.toBean(pageResult.getList(), MesWmOutsourceIssueExcelVO.class)); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + // TODO @AI:finish;改成这个接口;包括菜单、权限标识也是 | ||
| 113 | + @PutMapping("/execute") | ||
| 114 | + @Operation(summary = "执行外协发料出库") | ||
| 115 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 116 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-issue:execute')") | ||
| 117 | + public CommonResult<Boolean> executeOutsourceIssue(@RequestParam("id") Long id) { | ||
| 118 | + outsourceIssueService.executeOutsourceIssue(id); | ||
| 119 | + return success(true); | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | + // TODO @AI:需要有 checkQuantity 类似的接口; | ||
| 123 | + | ||
| 124 | + // ==================== 拼接 VO ==================== | ||
| 125 | + | ||
| 126 | + private List<MesWmOutsourceIssueRespVO> buildRespVOList(List<MesWmOutsourceIssueDO> list) { | ||
| 127 | + if (CollUtil.isEmpty(list)) { | ||
| 128 | + return Collections.emptyList(); | ||
| 129 | + } | ||
| 130 | + // 1. 获得关联数据 | ||
| 131 | + Map<Long, MesMdVendorDO> vendorMap = vendorService.getVendorMap( | ||
| 132 | + convertSet(list, MesWmOutsourceIssueDO::getVendorId)); | ||
| 133 | + // 2. 构建结果 | ||
| 134 | + return BeanUtils.toBean(list, MesWmOutsourceIssueRespVO.class, vo -> { | ||
| 135 | + MapUtils.findAndThen(vendorMap, vo.getVendorId(), vendor -> | ||
| 136 | + vo.setVendorCode(vendor.getCode()).setVendorName(vendor.getName())); | ||
| 137 | + }); | ||
| 138 | + } | ||
| 139 | + | ||
| 140 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/outsourceissue/MesWmOutsourceIssueDetailController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue; | ||
| 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.outsourceissue.vo.detail.MesWmOutsourceIssueDetailRespVO; | ||
| 8 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue.vo.detail.MesWmOutsourceIssueDetailSaveReqVO; | ||
| 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.outsourceissue.MesWmOutsourceIssueDetailDO; | ||
| 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.outsourceissue.MesWmOutsourceIssueDetailService; | ||
| 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 | +/** | ||
| 38 | + * MES 外协发料单明细 Controller | ||
| 39 | + * | ||
| 40 | + * @author 芋道源码 | ||
| 41 | + */ | ||
| 42 | +@Tag(name = "管理后台 - MES 外协发料单明细") | ||
| 43 | +@RestController | ||
| 44 | +@RequestMapping("/mes/wm/outsource-issue-detail") | ||
| 45 | +@Validated | ||
| 46 | +public class MesWmOutsourceIssueDetailController { | ||
| 47 | + | ||
| 48 | + @Resource | ||
| 49 | + private MesWmOutsourceIssueDetailService outsourceIssueDetailService; | ||
| 50 | + | ||
| 51 | + @Resource | ||
| 52 | + private MesMdItemService itemService; | ||
| 53 | + | ||
| 54 | + @Resource | ||
| 55 | + private MesMdUnitMeasureService unitMeasureService; | ||
| 56 | + | ||
| 57 | + @Resource | ||
| 58 | + private MesWmWarehouseService warehouseService; | ||
| 59 | + | ||
| 60 | + @Resource | ||
| 61 | + private MesWmWarehouseLocationService locationService; | ||
| 62 | + | ||
| 63 | + @Resource | ||
| 64 | + private MesWmWarehouseAreaService areaService; | ||
| 65 | + | ||
| 66 | + @PostMapping("/create") | ||
| 67 | + @Operation(summary = "创建外协发料单明细") | ||
| 68 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-issue:create')") | ||
| 69 | + public CommonResult<Long> createOutsourceIssueDetail(@Valid @RequestBody MesWmOutsourceIssueDetailSaveReqVO createReqVO) { | ||
| 70 | + return success(outsourceIssueDetailService.createOutsourceIssueDetail(createReqVO)); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + @PutMapping("/update") | ||
| 74 | + @Operation(summary = "修改外协发料单明细") | ||
| 75 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-issue:update')") | ||
| 76 | + public CommonResult<Boolean> updateOutsourceIssueDetail(@Valid @RequestBody MesWmOutsourceIssueDetailSaveReqVO updateReqVO) { | ||
| 77 | + outsourceIssueDetailService.updateOutsourceIssueDetail(updateReqVO); | ||
| 78 | + return success(true); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @DeleteMapping("/delete") | ||
| 82 | + @Operation(summary = "删除外协发料单明细") | ||
| 83 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 84 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-issue:delete')") | ||
| 85 | + public CommonResult<Boolean> deleteOutsourceIssueDetail(@RequestParam("id") Long id) { | ||
| 86 | + outsourceIssueDetailService.deleteOutsourceIssueDetail(id); | ||
| 87 | + return success(true); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + @GetMapping("/get") | ||
| 91 | + @Operation(summary = "获得外协发料单明细") | ||
| 92 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 93 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-issue:query')") | ||
| 94 | + public CommonResult<MesWmOutsourceIssueDetailRespVO> getOutsourceIssueDetail(@RequestParam("id") Long id) { | ||
| 95 | + MesWmOutsourceIssueDetailDO detail = outsourceIssueDetailService.getOutsourceIssueDetail(id); | ||
| 96 | + if (detail == null) { | ||
| 97 | + return success(null); | ||
| 98 | + } | ||
| 99 | + return success(buildRespVOList(Collections.singletonList(detail)).get(0)); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + @GetMapping("/list-by-line") | ||
| 103 | + @Operation(summary = "获得外协发料单明细列表(按行ID)") | ||
| 104 | + @Parameter(name = "lineId", description = "行ID", required = true, example = "1024") | ||
| 105 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-issue:query')") | ||
| 106 | + public CommonResult<List<MesWmOutsourceIssueDetailRespVO>> getOutsourceIssueDetailListByLineId( | ||
| 107 | + @RequestParam("lineId") Long lineId) { | ||
| 108 | + List<MesWmOutsourceIssueDetailDO> list = outsourceIssueDetailService.getOutsourceIssueDetailListByLineId(lineId); | ||
| 109 | + return success(buildRespVOList(list)); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + // ==================== 拼接 VO ==================== | ||
| 113 | + | ||
| 114 | + private List<MesWmOutsourceIssueDetailRespVO> buildRespVOList(List<MesWmOutsourceIssueDetailDO> list) { | ||
| 115 | + if (CollUtil.isEmpty(list)) { | ||
| 116 | + return Collections.emptyList(); | ||
| 117 | + } | ||
| 118 | + // 1. 获得关联数据 | ||
| 119 | + Map<Long, MesMdItemDO> itemMap = itemService.getItemMap( | ||
| 120 | + convertSet(list, MesWmOutsourceIssueDetailDO::getItemId)); | ||
| 121 | + Map<Long, MesMdUnitMeasureDO> unitMeasureMap = unitMeasureService.getUnitMeasureMap( | ||
| 122 | + convertSet(itemMap.values(), MesMdItemDO::getUnitMeasureId)); | ||
| 123 | + Map<Long, MesWmWarehouseDO> warehouseMap = warehouseService.getWarehouseMap( | ||
| 124 | + convertSet(list, MesWmOutsourceIssueDetailDO::getWarehouseId)); | ||
| 125 | + Map<Long, MesWmWarehouseLocationDO> locationMap = locationService.getWarehouseLocationMap( | ||
| 126 | + convertSet(list, MesWmOutsourceIssueDetailDO::getLocationId)); | ||
| 127 | + Map<Long, MesWmWarehouseAreaDO> areaMap = areaService.getWarehouseAreaMap( | ||
| 128 | + convertSet(list, MesWmOutsourceIssueDetailDO::getAreaId)); | ||
| 129 | + // 2. 构建结果 | ||
| 130 | + return BeanUtils.toBean(list, MesWmOutsourceIssueDetailRespVO.class, vo -> { | ||
| 131 | + MapUtils.findAndThen(itemMap, vo.getItemId(), item -> { | ||
| 132 | + vo.setItemCode(item.getCode()).setItemName(item.getName()).setSpecification(item.getSpecification()); | ||
| 133 | + MapUtils.findAndThen(unitMeasureMap, item.getUnitMeasureId(), | ||
| 134 | + unitMeasure -> vo.setUnitMeasureName(unitMeasure.getName())); | ||
| 135 | + }); | ||
| 136 | + MapUtils.findAndThen(warehouseMap, vo.getWarehouseId(), | ||
| 137 | + warehouse -> vo.setWarehouseName(warehouse.getName())); | ||
| 138 | + MapUtils.findAndThen(locationMap, vo.getLocationId(), | ||
| 139 | + location -> vo.setLocationName(location.getName())); | ||
| 140 | + MapUtils.findAndThen(areaMap, vo.getAreaId(), | ||
| 141 | + area -> vo.setAreaName(area.getName())); | ||
| 142 | + }); | ||
| 143 | + } | ||
| 144 | + | ||
| 145 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/outsourceissue/MesWmOutsourceIssueLineController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue; | ||
| 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.outsourceissue.vo.line.MesWmOutsourceIssueLinePageReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue.vo.line.MesWmOutsourceIssueLineRespVO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue.vo.line.MesWmOutsourceIssueLineSaveReqVO; | ||
| 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.outsourceissue.MesWmOutsourceIssueLineDO; | ||
| 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.outsourceissue.MesWmOutsourceIssueLineService; | ||
| 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 | +/** | ||
| 34 | + * MES 外协发料单行 Controller | ||
| 35 | + * | ||
| 36 | + * @author 芋道源码 | ||
| 37 | + */ | ||
| 38 | +@Tag(name = "管理后台 - MES 外协发料单行") | ||
| 39 | +@RestController | ||
| 40 | +@RequestMapping("/mes/wm/outsource-issue-line") | ||
| 41 | +@Validated | ||
| 42 | +public class MesWmOutsourceIssueLineController { | ||
| 43 | + | ||
| 44 | + @Resource | ||
| 45 | + private MesWmOutsourceIssueLineService outsourceIssueLineService; | ||
| 46 | + | ||
| 47 | + @Resource | ||
| 48 | + private MesMdItemService itemService; | ||
| 49 | + | ||
| 50 | + @Resource | ||
| 51 | + private MesMdUnitMeasureService unitMeasureService; | ||
| 52 | + | ||
| 53 | + @PostMapping("/create") | ||
| 54 | + @Operation(summary = "创建外协发料单行") | ||
| 55 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-issue:create')") | ||
| 56 | + public CommonResult<Long> createOutsourceIssueLine(@Valid @RequestBody MesWmOutsourceIssueLineSaveReqVO createReqVO) { | ||
| 57 | + return success(outsourceIssueLineService.createOutsourceIssueLine(createReqVO)); | ||
| 58 | + } | ||
| 59 | + | ||
| 60 | + @PutMapping("/update") | ||
| 61 | + @Operation(summary = "修改外协发料单行") | ||
| 62 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-issue:update')") | ||
| 63 | + public CommonResult<Boolean> updateOutsourceIssueLine(@Valid @RequestBody MesWmOutsourceIssueLineSaveReqVO updateReqVO) { | ||
| 64 | + outsourceIssueLineService.updateOutsourceIssueLine(updateReqVO); | ||
| 65 | + return success(true); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @DeleteMapping("/delete") | ||
| 69 | + @Operation(summary = "删除外协发料单行") | ||
| 70 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 71 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-issue:delete')") | ||
| 72 | + public CommonResult<Boolean> deleteOutsourceIssueLine(@RequestParam("id") Long id) { | ||
| 73 | + outsourceIssueLineService.deleteOutsourceIssueLine(id); | ||
| 74 | + return success(true); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | + @GetMapping("/get") | ||
| 78 | + @Operation(summary = "获得外协发料单行") | ||
| 79 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 80 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-issue:query')") | ||
| 81 | + public CommonResult<MesWmOutsourceIssueLineRespVO> getOutsourceIssueLine(@RequestParam("id") Long id) { | ||
| 82 | + MesWmOutsourceIssueLineDO line = outsourceIssueLineService.getOutsourceIssueLine(id); | ||
| 83 | + if (line == null) { | ||
| 84 | + return success(null); | ||
| 85 | + } | ||
| 86 | + return success(buildRespVOList(Collections.singletonList(line)).get(0)); | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + @GetMapping("/page") | ||
| 90 | + @Operation(summary = "获得外协发料单行分页") | ||
| 91 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-issue:query')") | ||
| 92 | + public CommonResult<PageResult<MesWmOutsourceIssueLineRespVO>> getOutsourceIssueLinePage( | ||
| 93 | + @Valid MesWmOutsourceIssueLinePageReqVO pageReqVO) { | ||
| 94 | + PageResult<MesWmOutsourceIssueLineDO> pageResult = outsourceIssueLineService.getOutsourceIssueLinePage(pageReqVO); | ||
| 95 | + return success(new PageResult<>(buildRespVOList(pageResult.getList()), pageResult.getTotal())); | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + @GetMapping("/list-by-issue-id") | ||
| 99 | + @Operation(summary = "获得外协发料单行列表") | ||
| 100 | + @Parameter(name = "issueId", description = "发料单ID", required = true, example = "1024") | ||
| 101 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-issue:query')") | ||
| 102 | + public CommonResult<List<MesWmOutsourceIssueLineRespVO>> getOutsourceIssueLineListByIssueId( | ||
| 103 | + @RequestParam("issueId") Long issueId) { | ||
| 104 | + List<MesWmOutsourceIssueLineDO> list = outsourceIssueLineService.getOutsourceIssueLineListByIssueId(issueId); | ||
| 105 | + return success(buildRespVOList(list)); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | + // ==================== 拼接 VO ==================== | ||
| 109 | + | ||
| 110 | + private List<MesWmOutsourceIssueLineRespVO> buildRespVOList(List<MesWmOutsourceIssueLineDO> list) { | ||
| 111 | + if (CollUtil.isEmpty(list)) { | ||
| 112 | + return Collections.emptyList(); | ||
| 113 | + } | ||
| 114 | + // 1. 获得关联数据 | ||
| 115 | + Map<Long, MesMdItemDO> itemMap = itemService.getItemMap( | ||
| 116 | + convertSet(list, MesWmOutsourceIssueLineDO::getItemId)); | ||
| 117 | + Map<Long, MesMdUnitMeasureDO> unitMeasureMap = unitMeasureService.getUnitMeasureMap( | ||
| 118 | + convertSet(itemMap.values(), MesMdItemDO::getUnitMeasureId)); | ||
| 119 | + // 2. 构建结果 | ||
| 120 | + return BeanUtils.toBean(list, MesWmOutsourceIssueLineRespVO.class, vo -> { | ||
| 121 | + MapUtils.findAndThen(itemMap, vo.getItemId(), item -> { | ||
| 122 | + vo.setItemCode(item.getCode()).setItemName(item.getName()).setSpecification(item.getSpecification()); | ||
| 123 | + MapUtils.findAndThen(unitMeasureMap, item.getUnitMeasureId(), | ||
| 124 | + unitMeasure -> vo.setUnitMeasureName(unitMeasure.getName())); | ||
| 125 | + }); | ||
| 126 | + }); | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/outsourceissue/vo/MesWmOutsourceIssueExcelVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue.vo; | ||
| 2 | + | ||
| 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | + | ||
| 10 | +@Schema(description = "管理后台 - MES 外协发料单 Excel VO") | ||
| 11 | +@Data | ||
| 12 | +@ExcelIgnoreUnannotated | ||
| 13 | +public class MesWmOutsourceIssueExcelVO { | ||
| 14 | + | ||
| 15 | + @ExcelProperty("发料单ID") | ||
| 16 | + private Long id; | ||
| 17 | + | ||
| 18 | + @ExcelProperty("发料单编号") | ||
| 19 | + private String code; | ||
| 20 | + | ||
| 21 | + @ExcelProperty("发料单名称") | ||
| 22 | + private String name; | ||
| 23 | + | ||
| 24 | + @ExcelProperty("供应商编码") | ||
| 25 | + private String vendorCode; | ||
| 26 | + | ||
| 27 | + @ExcelProperty("供应商名称") | ||
| 28 | + private String vendorName; | ||
| 29 | + | ||
| 30 | + @ExcelProperty("生产工单编码") | ||
| 31 | + private String workorderCode; | ||
| 32 | + | ||
| 33 | + @ExcelProperty("生产工单名称") | ||
| 34 | + private String workorderName; | ||
| 35 | + | ||
| 36 | + @ExcelProperty("发料日期") | ||
| 37 | + private LocalDateTime issueDate; | ||
| 38 | + | ||
| 39 | + @ExcelProperty("单据状态") | ||
| 40 | + private Integer status; | ||
| 41 | + | ||
| 42 | + @ExcelProperty("备注") | ||
| 43 | + private String remark; | ||
| 44 | + | ||
| 45 | + @ExcelProperty("创建时间") | ||
| 46 | + private LocalDateTime createTime; | ||
| 47 | + | ||
| 48 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/outsourceissue/vo/MesWmOutsourceIssuePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue.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 lombok.ToString; | ||
| 8 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 9 | + | ||
| 10 | +import java.time.LocalDateTime; | ||
| 11 | + | ||
| 12 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 13 | + | ||
| 14 | +@Schema(description = "管理后台 - MES 外协发料单分页 Request VO") | ||
| 15 | +@Data | ||
| 16 | +@EqualsAndHashCode(callSuper = true) | ||
| 17 | +@ToString(callSuper = true) | ||
| 18 | +public class MesWmOutsourceIssuePageReqVO extends PageParam { | ||
| 19 | + | ||
| 20 | + @Schema(description = "发料单编号", example = "WOS202603020001") | ||
| 21 | + private String code; | ||
| 22 | + | ||
| 23 | + @Schema(description = "发料单名称", example = "外协发料单001") | ||
| 24 | + private String name; | ||
| 25 | + | ||
| 26 | + @Schema(description = "供应商ID", example = "1") | ||
| 27 | + private Long vendorId; | ||
| 28 | + | ||
| 29 | + @Schema(description = "生产工单ID", example = "1") | ||
| 30 | + private Long workorderId; | ||
| 31 | + | ||
| 32 | + @Schema(description = "生产工单编码", example = "WO202603020001") | ||
| 33 | + private String workorderCode; | ||
| 34 | + | ||
| 35 | + @Schema(description = "发料日期") | ||
| 36 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 37 | + private LocalDateTime[] issueDate; | ||
| 38 | + | ||
| 39 | + @Schema(description = "单据状态", example = "0") | ||
| 40 | + private Integer status; | ||
| 41 | + | ||
| 42 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/outsourceissue/vo/MesWmOutsourceIssueRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue.vo; | ||
| 2 | + | ||
| 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | + | ||
| 10 | +@Schema(description = "管理后台 - MES 外协发料单 Response VO") | ||
| 11 | +@Data | ||
| 12 | +@ExcelIgnoreUnannotated | ||
| 13 | +public class MesWmOutsourceIssueRespVO { | ||
| 14 | + | ||
| 15 | + @Schema(description = "发料单ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 16 | + @ExcelProperty("发料单ID") | ||
| 17 | + private Long id; | ||
| 18 | + | ||
| 19 | + @Schema(description = "发料单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "WOS202603020001") | ||
| 20 | + @ExcelProperty("发料单编号") | ||
| 21 | + private String code; | ||
| 22 | + | ||
| 23 | + @Schema(description = "发料单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "外协发料单001") | ||
| 24 | + @ExcelProperty("发料单名称") | ||
| 25 | + private String name; | ||
| 26 | + | ||
| 27 | + @Schema(description = "供应商ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 28 | + private Long vendorId; | ||
| 29 | + | ||
| 30 | + @Schema(description = "供应商编码", example = "V001") | ||
| 31 | + @ExcelProperty("供应商编码") | ||
| 32 | + private String vendorCode; | ||
| 33 | + | ||
| 34 | + @Schema(description = "供应商名称", example = "供应商A") | ||
| 35 | + @ExcelProperty("供应商名称") | ||
| 36 | + private String vendorName; | ||
| 37 | + | ||
| 38 | + @Schema(description = "生产工单ID", example = "1") | ||
| 39 | + private Long workorderId; | ||
| 40 | + | ||
| 41 | + @Schema(description = "生产工单编码", example = "WO202603020001") | ||
| 42 | + @ExcelProperty("生产工单编码") | ||
| 43 | + private String workorderCode; | ||
| 44 | + | ||
| 45 | + @Schema(description = "生产工单名称", example = "生产工单001") | ||
| 46 | + @ExcelProperty("生产工单名称") | ||
| 47 | + private String workorderName; | ||
| 48 | + | ||
| 49 | + @Schema(description = "发料日期", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 50 | + @ExcelProperty("发料日期") | ||
| 51 | + private LocalDateTime issueDate; | ||
| 52 | + | ||
| 53 | + @Schema(description = "单据状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | ||
| 54 | + @ExcelProperty("单据状态") | ||
| 55 | + private Integer status; | ||
| 56 | + | ||
| 57 | + @Schema(description = "备注", example = "备注") | ||
| 58 | + @ExcelProperty("备注") | ||
| 59 | + private String remark; | ||
| 60 | + | ||
| 61 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 62 | + @ExcelProperty("创建时间") | ||
| 63 | + private LocalDateTime createTime; | ||
| 64 | + | ||
| 65 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/outsourceissue/vo/MesWmOutsourceIssueSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.NotEmpty; | ||
| 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 MesWmOutsourceIssueSaveReqVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "发料单ID", example = "1024") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + @Schema(description = "发料单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "WOS202603020001") | ||
| 18 | + @NotEmpty(message = "发料单编号不能为空") | ||
| 19 | + private String code; | ||
| 20 | + | ||
| 21 | + @Schema(description = "发料单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "外协发料单001") | ||
| 22 | + @NotEmpty(message = "发料单名称不能为空") | ||
| 23 | + private String name; | ||
| 24 | + | ||
| 25 | + @Schema(description = "供应商ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 26 | + @NotNull(message = "供应商ID不能为空") | ||
| 27 | + private Long vendorId; | ||
| 28 | + | ||
| 29 | + @Schema(description = "供应商编码", example = "V001") | ||
| 30 | + private String vendorCode; | ||
| 31 | + | ||
| 32 | + @Schema(description = "供应商名称", example = "供应商A") | ||
| 33 | + private String vendorName; | ||
| 34 | + | ||
| 35 | + @Schema(description = "生产工单ID", example = "1") | ||
| 36 | + private Long workorderId; | ||
| 37 | + | ||
| 38 | + @Schema(description = "生产工单编码", example = "WO202603020001") | ||
| 39 | + private String workorderCode; | ||
| 40 | + | ||
| 41 | + @Schema(description = "生产工单名称", example = "生产工单001") | ||
| 42 | + private String workorderName; | ||
| 43 | + | ||
| 44 | + @Schema(description = "发料日期", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 45 | + @NotNull(message = "发料日期不能为空") | ||
| 46 | + private LocalDateTime issueDate; | ||
| 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/outsourceissue/vo/detail/MesWmOutsourceIssueDetailRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue.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 MesWmOutsourceIssueDetailRespVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "明细ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "行ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 17 | + private Long lineId; | ||
| 18 | + | ||
| 19 | + @Schema(description = "发料单ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 20 | + private Long issueId; | ||
| 21 | + | ||
| 22 | + @Schema(description = "物料ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 23 | + private Long itemId; | ||
| 24 | + | ||
| 25 | + @Schema(description = "物料编码", example = "M001") | ||
| 26 | + private String itemCode; | ||
| 27 | + | ||
| 28 | + @Schema(description = "物料名称", example = "钢板") | ||
| 29 | + private String itemName; | ||
| 30 | + | ||
| 31 | + @Schema(description = "规格型号", example = "10mm*100mm") | ||
| 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 = "库存ID", example = "1") | ||
| 41 | + private Long materialStockId; | ||
| 42 | + | ||
| 43 | + @Schema(description = "批次ID", example = "1") | ||
| 44 | + private Long batchId; | ||
| 45 | + | ||
| 46 | + @Schema(description = "批次编码", example = "BATCH001") | ||
| 47 | + private String batchCode; | ||
| 48 | + | ||
| 49 | + @Schema(description = "仓库ID", example = "1") | ||
| 50 | + private Long warehouseId; | ||
| 51 | + | ||
| 52 | + @Schema(description = "仓库名称", example = "原料仓") | ||
| 53 | + private String warehouseName; | ||
| 54 | + | ||
| 55 | + @Schema(description = "库区ID", example = "1") | ||
| 56 | + private Long locationId; | ||
| 57 | + | ||
| 58 | + @Schema(description = "库区名称", example = "A 区") | ||
| 59 | + private String locationName; | ||
| 60 | + | ||
| 61 | + @Schema(description = "库位ID", example = "1") | ||
| 62 | + private Long areaId; | ||
| 63 | + | ||
| 64 | + @Schema(description = "库位名称", example = "A-01") | ||
| 65 | + private String areaName; | ||
| 66 | + | ||
| 67 | + @Schema(description = "备注", example = "备注") | ||
| 68 | + private String remark; | ||
| 69 | + | ||
| 70 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 71 | + private LocalDateTime createTime; | ||
| 72 | + | ||
| 73 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/outsourceissue/vo/detail/MesWmOutsourceIssueDetailSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue.vo.detail; | ||
| 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 外协发料单明细新增/修改 Request VO") | ||
| 11 | +@Data | ||
| 12 | +public class MesWmOutsourceIssueDetailSaveReqVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "明细ID", example = "1024") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + @Schema(description = "行ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 18 | + @NotNull(message = "行ID不能为空") | ||
| 19 | + private Long lineId; | ||
| 20 | + | ||
| 21 | + @Schema(description = "发料单ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 22 | + @NotNull(message = "发料单ID不能为空") | ||
| 23 | + private Long issueId; | ||
| 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 = "300.00") | ||
| 30 | + @NotNull(message = "数量不能为空") | ||
| 31 | + @DecimalMin(value = "0.01", message = "数量必须大于 0") | ||
| 32 | + private BigDecimal quantity; | ||
| 33 | + | ||
| 34 | + @Schema(description = "库存ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 35 | + @NotNull(message = "库存ID不能为空") | ||
| 36 | + private Long materialStockId; | ||
| 37 | + | ||
| 38 | + @Schema(description = "批次ID", example = "1") | ||
| 39 | + private Long batchId; | ||
| 40 | + | ||
| 41 | + @Schema(description = "仓库ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 42 | + @NotNull(message = "仓库ID不能为空") | ||
| 43 | + private Long warehouseId; | ||
| 44 | + | ||
| 45 | + @Schema(description = "库区ID", example = "1") | ||
| 46 | + private Long locationId; | ||
| 47 | + | ||
| 48 | + @Schema(description = "库位ID", example = "1") | ||
| 49 | + private Long areaId; | ||
| 50 | + | ||
| 51 | + @Schema(description = "备注", example = "备注") | ||
| 52 | + private String remark; | ||
| 53 | + | ||
| 54 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/outsourceissue/vo/line/MesWmOutsourceIssueLinePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue.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 MesWmOutsourceIssueLinePageReqVO extends PageParam { | ||
| 15 | + | ||
| 16 | + @Schema(description = "发料单ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 17 | + @NotNull(message = "发料单ID不能为空") | ||
| 18 | + private Long issueId; | ||
| 19 | + | ||
| 20 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/outsourceissue/vo/line/MesWmOutsourceIssueLineRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue.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 MesWmOutsourceIssueLineRespVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "行ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "发料单ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 17 | + private Long issueId; | ||
| 18 | + | ||
| 19 | + @Schema(description = "物料ID", requiredMode = Schema.RequiredMode.REQUIRED, 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 = "发料数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "500.00") | ||
| 35 | + private BigDecimal quantity; | ||
| 36 | + | ||
| 37 | + @Schema(description = "库存ID", example = "1") | ||
| 38 | + private Long materialStockId; | ||
| 39 | + | ||
| 40 | + @Schema(description = "批次ID", example = "1") | ||
| 41 | + private Long batchId; | ||
| 42 | + | ||
| 43 | + @Schema(description = "批次编码", example = "BATCH001") | ||
| 44 | + private String batchCode; | ||
| 45 | + | ||
| 46 | + @Schema(description = "备注", example = "备注") | ||
| 47 | + private String remark; | ||
| 48 | + | ||
| 49 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 50 | + private LocalDateTime createTime; | ||
| 51 | + | ||
| 52 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/outsourceissue/vo/line/MesWmOutsourceIssueLineSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourceissue.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 外协发料单行新增/修改 Request VO") | ||
| 11 | +@Data | ||
| 12 | +public class MesWmOutsourceIssueLineSaveReqVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "行ID", example = "1024") | ||
| 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 = "500.00") | ||
| 26 | + @NotNull(message = "发料数量不能为空") | ||
| 27 | + @DecimalMin(value = "0.01", message = "发料数量必须大于 0") | ||
| 28 | + private BigDecimal quantity; | ||
| 29 | + | ||
| 30 | + @Schema(description = "库存ID", example = "1") | ||
| 31 | + private Long materialStockId; | ||
| 32 | + | ||
| 33 | + @Schema(description = "批次ID", example = "1") | ||
| 34 | + private Long batchId; | ||
| 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/outsourcereceipt/MesWmOutsourceReceiptController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourcereceipt; | ||
| 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.outsourcereceipt.vo.MesWmOutsourceReceiptPageReqVO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.outsourcereceipt.vo.MesWmOutsourceReceiptRespVO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.outsourcereceipt.vo.MesWmOutsourceReceiptSaveReqVO; | ||
| 14 | +import cn.iocoder.yudao.module.mes.dal.dataobject.md.vendor.MesMdVendorDO; | ||
| 15 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.outsourcereceipt.MesWmOutsourceReceiptDO; | ||
| 16 | +import cn.iocoder.yudao.module.mes.service.md.vendor.MesMdVendorService; | ||
| 17 | +import cn.iocoder.yudao.module.mes.service.wm.outsourcereceipt.MesWmOutsourceReceiptService; | ||
| 18 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 19 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 20 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 21 | +import jakarta.annotation.Resource; | ||
| 22 | +import jakarta.servlet.http.HttpServletResponse; | ||
| 23 | +import jakarta.validation.Valid; | ||
| 24 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 25 | +import org.springframework.validation.annotation.Validated; | ||
| 26 | +import org.springframework.web.bind.annotation.*; | ||
| 27 | + | ||
| 28 | +import java.io.IOException; | ||
| 29 | +import java.util.Collections; | ||
| 30 | +import java.util.List; | ||
| 31 | +import java.util.Map; | ||
| 32 | + | ||
| 33 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||
| 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/outsource-receipt") | ||
| 40 | +@Validated | ||
| 41 | +public class MesWmOutsourceReceiptController { | ||
| 42 | + | ||
| 43 | + @Resource | ||
| 44 | + private MesWmOutsourceReceiptService outsourceReceiptService; | ||
| 45 | + | ||
| 46 | + @Resource | ||
| 47 | + private MesMdVendorService vendorService; | ||
| 48 | + | ||
| 49 | + @PostMapping("/create") | ||
| 50 | + @Operation(summary = "创建外协入库单") | ||
| 51 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-receipt:create')") | ||
| 52 | + public CommonResult<Long> createOutsourceReceipt(@Valid @RequestBody MesWmOutsourceReceiptSaveReqVO createReqVO) { | ||
| 53 | + return success(outsourceReceiptService.createOutsourceReceipt(createReqVO)); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @PutMapping("/update") | ||
| 57 | + @Operation(summary = "修改外协入库单") | ||
| 58 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-receipt:update')") | ||
| 59 | + public CommonResult<Boolean> updateOutsourceReceipt(@Valid @RequestBody MesWmOutsourceReceiptSaveReqVO updateReqVO) { | ||
| 60 | + outsourceReceiptService.updateOutsourceReceipt(updateReqVO); | ||
| 61 | + return success(true); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @DeleteMapping("/delete") | ||
| 65 | + @Operation(summary = "删除外协入库单") | ||
| 66 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 67 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-receipt:delete')") | ||
| 68 | + public CommonResult<Boolean> deleteOutsourceReceipt(@RequestParam("id") Long id) { | ||
| 69 | + outsourceReceiptService.deleteOutsourceReceipt(id); | ||
| 70 | + return success(true); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + @GetMapping("/get") | ||
| 74 | + @Operation(summary = "获得外协入库单") | ||
| 75 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 76 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-receipt:query')") | ||
| 77 | + public CommonResult<MesWmOutsourceReceiptRespVO> getOutsourceReceipt(@RequestParam("id") Long id) { | ||
| 78 | + MesWmOutsourceReceiptDO receipt = outsourceReceiptService.getOutsourceReceipt(id); | ||
| 79 | + if (receipt == null) { | ||
| 80 | + return success(null); | ||
| 81 | + } | ||
| 82 | + return success(buildRespVOList(Collections.singletonList(receipt)).get(0)); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + @GetMapping("/page") | ||
| 86 | + @Operation(summary = "获得外协入库单分页") | ||
| 87 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-receipt:query')") | ||
| 88 | + public CommonResult<PageResult<MesWmOutsourceReceiptRespVO>> getOutsourceReceiptPage( | ||
| 89 | + @Valid MesWmOutsourceReceiptPageReqVO pageReqVO) { | ||
| 90 | + PageResult<MesWmOutsourceReceiptDO> pageResult = outsourceReceiptService.getOutsourceReceiptPage(pageReqVO); | ||
| 91 | + return success(new PageResult<>(buildRespVOList(pageResult.getList()), pageResult.getTotal())); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + @GetMapping("/export-excel") | ||
| 95 | + @Operation(summary = "导出外协入库单 Excel") | ||
| 96 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-receipt:export')") | ||
| 97 | + @ApiAccessLog(operateType = EXPORT) | ||
| 98 | + public void exportOutsourceReceiptExcel(@Valid MesWmOutsourceReceiptPageReqVO pageReqVO, | ||
| 99 | + HttpServletResponse response) throws IOException { | ||
| 100 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 101 | + PageResult<MesWmOutsourceReceiptDO> pageResult = outsourceReceiptService.getOutsourceReceiptPage(pageReqVO); | ||
| 102 | + ExcelUtils.write(response, "外协入库单.xls", "数据", MesWmOutsourceReceiptRespVO.class, | ||
| 103 | + buildRespVOList(pageResult.getList())); | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + @PutMapping("/submit") | ||
| 107 | + @Operation(summary = "提交外协入库单") | ||
| 108 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 109 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-receipt:update')") | ||
| 110 | + public CommonResult<Boolean> submitOutsourceReceipt(@RequestParam("id") Long id) { | ||
| 111 | + outsourceReceiptService.submitOutsourceReceipt(id); | ||
| 112 | + return success(true); | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + @PutMapping("/stock") | ||
| 116 | + @Operation(summary = "执行上架") | ||
| 117 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 118 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-receipt:update')") | ||
| 119 | + public CommonResult<Boolean> stockOutsourceReceipt(@RequestParam("id") Long id) { | ||
| 120 | + outsourceReceiptService.stockOutsourceReceipt(id); | ||
| 121 | + return success(true); | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + @PutMapping("/finish") | ||
| 125 | + @Operation(summary = "完成入库") | ||
| 126 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 127 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-receipt:finish')") | ||
| 128 | + public CommonResult<Boolean> finishOutsourceReceipt(@RequestParam("id") Long id) { | ||
| 129 | + outsourceReceiptService.finishOutsourceReceipt(id); | ||
| 130 | + return success(true); | ||
| 131 | + } | ||
| 132 | + | ||
| 133 | + @PutMapping("/cancel") | ||
| 134 | + @Operation(summary = "取消外协入库单") | ||
| 135 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 136 | + @PreAuthorize("@ss.hasPermission('mes:wm-outsource-receipt:update')") | ||
| 137 | + public CommonResult<Boolean> cancelOutsourceReceipt(@RequestParam("id") Long id) { | ||
| 138 | + outsourceReceiptService.cancelOutsourceReceipt(id); | ||
| 139 | + return success(true); | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + // ==================== 拼接 VO ==================== | ||
| 143 | + | ||
| 144 | + private List<MesWmOutsourceReceiptRespVO> buildRespVOList(List<MesWmOutsourceReceiptDO> list) { | ||
| 145 | + if (CollUtil.isEmpty(list)) { | ||
| 146 | + return Collections.emptyList(); | ||
| 147 | + } | ||
| 148 | + // 1. 获得关联数据 | ||
| 149 | + Map<Long, MesMdVendorDO> vendorMap = vendorService.getVendorMap( | ||
| 150 | + convertSet(list, MesWmOutsourceReceiptDO::getVendorId)); | ||
| 151 | + // 2. 构建结果 | ||
| 152 | + return BeanUtils.toBean(list, MesWmOutsourceReceiptRespVO.class, vo -> { | ||
| 153 | + MapUtils.findAndThen(vendorMap, vo.getVendorId(), | ||
| 154 | + vendor -> vo.setVendorName(vendor.getName())); | ||
| 155 | + }); | ||
| 156 | + } | ||
| 157 | + | ||
| 158 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/outsourcereceipt/vo/MesWmOutsourceReceiptPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourcereceipt.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 lombok.ToString; | ||
| 8 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 9 | + | ||
| 10 | +import java.time.LocalDateTime; | ||
| 11 | + | ||
| 12 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 13 | + | ||
| 14 | +@Schema(description = "管理后台 - MES 外协入库单分页 Request VO") | ||
| 15 | +@Data | ||
| 16 | +@EqualsAndHashCode(callSuper = true) | ||
| 17 | +@ToString(callSuper = true) | ||
| 18 | +public class MesWmOutsourceReceiptPageReqVO extends PageParam { | ||
| 19 | + | ||
| 20 | + @Schema(description = "入库单编码", example = "OR2026030001") | ||
| 21 | + private String code; | ||
| 22 | + | ||
| 23 | + @Schema(description = "入库单名称", example = "外协加工入库单") | ||
| 24 | + private String name; | ||
| 25 | + | ||
| 26 | + @Schema(description = "供应商编号", example = "1") | ||
| 27 | + private Long vendorId; | ||
| 28 | + | ||
| 29 | + @Schema(description = "入库日期") | ||
| 30 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 31 | + private LocalDateTime[] receiptDate; | ||
| 32 | + | ||
| 33 | + @Schema(description = "状态", example = "0") | ||
| 34 | + private Integer status; | ||
| 35 | + | ||
| 36 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/outsourcereceipt/vo/MesWmOutsourceReceiptRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourcereceipt.vo; | ||
| 2 | + | ||
| 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 5 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 6 | +import lombok.Data; | ||
| 7 | + | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | + | ||
| 10 | +@Schema(description = "管理后台 - MES 外协入库单 Response VO") | ||
| 11 | +@Data | ||
| 12 | +@ExcelIgnoreUnannotated | ||
| 13 | +public class MesWmOutsourceReceiptRespVO { | ||
| 14 | + | ||
| 15 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 16 | + @ExcelProperty("编号") | ||
| 17 | + private Long id; | ||
| 18 | + | ||
| 19 | + @Schema(description = "入库单编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "OR2026030001") | ||
| 20 | + @ExcelProperty("入库单编码") | ||
| 21 | + private String code; | ||
| 22 | + | ||
| 23 | + @Schema(description = "入库单名称", example = "外协加工入库单") | ||
| 24 | + @ExcelProperty("入库单名称") | ||
| 25 | + private String name; | ||
| 26 | + | ||
| 27 | + @Schema(description = "外协工单编号", example = "1") | ||
| 28 | + private Long workorderId; | ||
| 29 | + | ||
| 30 | + @Schema(description = "外协工单编码", example = "WO20260301") | ||
| 31 | + @ExcelProperty("外协工单") | ||
| 32 | + private String workorderCode; | ||
| 33 | + | ||
| 34 | + @Schema(description = "供应商编号", example = "1") | ||
| 35 | + private Long vendorId; | ||
| 36 | + | ||
| 37 | + @Schema(description = "供应商名称", example = "某供应商") | ||
| 38 | + @ExcelProperty("供应商") | ||
| 39 | + private String vendorName; | ||
| 40 | + | ||
| 41 | + @Schema(description = "入库日期") | ||
| 42 | + @ExcelProperty("入库日期") | ||
| 43 | + private LocalDateTime receiptDate; | ||
| 44 | + | ||
| 45 | + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | ||
| 46 | + @ExcelProperty("状态") | ||
| 47 | + private Integer status; | ||
| 48 | + | ||
| 49 | + @Schema(description = "备注", example = "备注") | ||
| 50 | + @ExcelProperty("备注") | ||
| 51 | + private String remark; | ||
| 52 | + | ||
| 53 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 54 | + @ExcelProperty("创建时间") | ||
| 55 | + private LocalDateTime createTime; | ||
| 56 | + | ||
| 57 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/outsourcereceipt/vo/MesWmOutsourceReceiptSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourcereceipt.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.NotEmpty; | ||
| 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 MesWmOutsourceReceiptSaveReqVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "编号", example = "1024") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + @Schema(description = "入库单编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "OR2026030001") | ||
| 18 | + @NotEmpty(message = "入库单编码不能为空") | ||
| 19 | + private String code; | ||
| 20 | + | ||
| 21 | + @Schema(description = "入库单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "外协加工入库单") | ||
| 22 | + @NotEmpty(message = "入库单名称不能为空") | ||
| 23 | + private String name; | ||
| 24 | + | ||
| 25 | + @Schema(description = "外协工单编号", example = "1") | ||
| 26 | + private Long workorderId; | ||
| 27 | + | ||
| 28 | + @Schema(description = "供应商编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 29 | + @NotNull(message = "供应商不能为空") | ||
| 30 | + private Long vendorId; | ||
| 31 | + | ||
| 32 | + @Schema(description = "入库日期", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 33 | + @NotNull(message = "入库日期不能为空") | ||
| 34 | + private LocalDateTime receiptDate; | ||
| 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/outsourcereceipt/vo/detail/MesWmOutsourceReceiptDetailRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourcereceipt.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 MesWmOutsourceReceiptDetailRespVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "入库单行编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 17 | + private Long lineId; | ||
| 18 | + | ||
| 19 | + @Schema(description = "入库单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 20 | + private Long receiptId; | ||
| 21 | + | ||
| 22 | + @Schema(description = "物料编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 23 | + private Long itemId; | ||
| 24 | + | ||
| 25 | + @Schema(description = "物料编码", example = "M001") | ||
| 26 | + private String itemCode; | ||
| 27 | + | ||
| 28 | + @Schema(description = "物料名称", example = "加工件") | ||
| 29 | + private String itemName; | ||
| 30 | + | ||
| 31 | + @Schema(description = "规格型号", example = "10mm*100mm") | ||
| 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 = "1") | ||
| 44 | + private Long warehouseId; | ||
| 45 | + | ||
| 46 | + @Schema(description = "仓库名称", example = "成品仓") | ||
| 47 | + private String warehouseName; | ||
| 48 | + | ||
| 49 | + @Schema(description = "库区编号", example = "1") | ||
| 50 | + private Long locationId; | ||
| 51 | + | ||
| 52 | + @Schema(description = "库区名称", example = "A 区") | ||
| 53 | + private String locationName; | ||
| 54 | + | ||
| 55 | + @Schema(description = "库位编号", example = "1") | ||
| 56 | + private Long areaId; | ||
| 57 | + | ||
| 58 | + @Schema(description = "库位名称", example = "A-01") | ||
| 59 | + private String areaName; | ||
| 60 | + | ||
| 61 | + @Schema(description = "备注", example = "备注") | ||
| 62 | + private String remark; | ||
| 63 | + | ||
| 64 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 65 | + private LocalDateTime createTime; | ||
| 66 | + | ||
| 67 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/outsourcereceipt/vo/detail/MesWmOutsourceReceiptDetailSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourcereceipt.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 MesWmOutsourceReceiptDetailSaveReqVO { | ||
| 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 receiptId; | ||
| 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 = "1") | ||
| 36 | + private Long warehouseId; | ||
| 37 | + | ||
| 38 | + @Schema(description = "库区编号", example = "1") | ||
| 39 | + private Long locationId; | ||
| 40 | + | ||
| 41 | + @Schema(description = "库位编号", example = "1") | ||
| 42 | + private Long areaId; | ||
| 43 | + | ||
| 44 | + @Schema(description = "备注", example = "备注") | ||
| 45 | + private String remark; | ||
| 46 | + | ||
| 47 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/outsourcereceipt/vo/line/MesWmOutsourceReceiptLineRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourcereceipt.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 MesWmOutsourceReceiptLineRespVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "入库单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 17 | + private Long receiptId; | ||
| 18 | + | ||
| 19 | + @Schema(description = "物料编号", requiredMode = Schema.RequiredMode.REQUIRED, 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 = "500.00") | ||
| 35 | + private BigDecimal receivedQuantity; | ||
| 36 | + | ||
| 37 | + @Schema(description = "批次编号", example = "1") | ||
| 38 | + private Long batchId; | ||
| 39 | + | ||
| 40 | + @Schema(description = "生产日期") | ||
| 41 | + private LocalDateTime productionDate; | ||
| 42 | + | ||
| 43 | + @Schema(description = "有效期") | ||
| 44 | + private LocalDateTime expireDate; | ||
| 45 | + | ||
| 46 | + @Schema(description = "生产批号", example = "PB20260301") | ||
| 47 | + private String productionBatchNumber; | ||
| 48 | + | ||
| 49 | + @Schema(description = "备注", example = "备注") | ||
| 50 | + private String remark; | ||
| 51 | + | ||
| 52 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 53 | + private LocalDateTime createTime; | ||
| 54 | + | ||
| 55 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/outsourcereceipt/vo/line/MesWmOutsourceReceiptLineSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.outsourcereceipt.vo.line; | ||
| 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 | +import java.time.LocalDateTime; | ||
| 9 | + | ||
| 10 | +@Schema(description = "管理后台 - MES 外协入库单行新增/修改 Request VO") | ||
| 11 | +@Data | ||
| 12 | +public class MesWmOutsourceReceiptLineSaveReqVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "编号", example = "1024") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + @Schema(description = "入库单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 18 | + @NotNull(message = "入库单编号不能为空") | ||
| 19 | + private Long receiptId; | ||
| 20 | + | ||
| 21 | + @Schema(description = "物料编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 22 | + @NotNull(message = "物料编号不能为空") | ||
| 23 | + private Long itemId; | ||
| 24 | + | ||
| 25 | + @Schema(description = "入库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "500.00") | ||
| 26 | + @NotNull(message = "入库数量不能为空") | ||
| 27 | + private BigDecimal receivedQuantity; | ||
| 28 | + | ||
| 29 | + @Schema(description = "批次编号", example = "1") | ||
| 30 | + private Long batchId; | ||
| 31 | + | ||
| 32 | + @Schema(description = "批次编码", example = "BATCH20260301001") | ||
| 33 | + private String batchCode; | ||
| 34 | + | ||
| 35 | + @Schema(description = "生产日期") | ||
| 36 | + private LocalDateTime productionDate; | ||
| 37 | + | ||
| 38 | + @Schema(description = "有效期") | ||
| 39 | + private LocalDateTime expireDate; | ||
| 40 | + | ||
| 41 | + @Schema(description = "生产批号", example = "PB20260301") | ||
| 42 | + private String productionBatchNumber; | ||
| 43 | + | ||
| 44 | + @Schema(description = "备注", example = "备注") | ||
| 45 | + private String remark; | ||
| 46 | + | ||
| 47 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/outsourceissue/MesWmOutsourceIssueLineServiceImpl.java
| @@ -35,6 +35,8 @@ public class MesWmOutsourceIssueLineServiceImpl implements MesWmOutsourceIssueLi | @@ -35,6 +35,8 @@ public class MesWmOutsourceIssueLineServiceImpl implements MesWmOutsourceIssueLi | ||
| 35 | // TODO @AI:校验关联的 issueId; | 35 | // TODO @AI:校验关联的 issueId; |
| 36 | // TODO AI校验关联的 itemId; | 36 | // TODO AI校验关联的 itemId; |
| 37 | 37 | ||
| 38 | + // TODO @AI:wm 里面,有模块实现了 checkBom 类似的逻辑; | ||
| 39 | + | ||
| 38 | // 插入 | 40 | // 插入 |
| 39 | MesWmOutsourceIssueLineDO line = BeanUtils.toBean(createReqVO, MesWmOutsourceIssueLineDO.class); | 41 | MesWmOutsourceIssueLineDO line = BeanUtils.toBean(createReqVO, MesWmOutsourceIssueLineDO.class); |
| 40 | outsourceIssueLineMapper.insert(line); | 42 | outsourceIssueLineMapper.insert(line); |
| @@ -46,6 +48,8 @@ public class MesWmOutsourceIssueLineServiceImpl implements MesWmOutsourceIssueLi | @@ -46,6 +48,8 @@ public class MesWmOutsourceIssueLineServiceImpl implements MesWmOutsourceIssueLi | ||
| 46 | // TODO @AI:校验关联的 issueId; | 48 | // TODO @AI:校验关联的 issueId; |
| 47 | // TODO AI校验关联的 itemId; | 49 | // TODO AI校验关联的 itemId; |
| 48 | 50 | ||
| 51 | + // TODO @AI:wm 里面,有模块实现了 checkBom 类似的逻辑; | ||
| 52 | + | ||
| 49 | // 校验存在 | 53 | // 校验存在 |
| 50 | validateOutsourceIssueLineExists(updateReqVO.getId()); | 54 | validateOutsourceIssueLineExists(updateReqVO.getId()); |
| 51 | // 更新 | 55 | // 更新 |