Commit 911ddc37558336f6b4577532c52ce009c2bff276
1 parent
b5b79b96
✨ feat(mes): 添加杂项入库单及行相关请求和响应 VO
Showing
19 changed files
with
1205 additions
and
0 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/miscreceipt/MesWmMiscReceiptController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | ||
| 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.object.BeanUtils; | ||
| 7 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 8 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt.vo.MesWmMiscReceiptPageReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt.vo.MesWmMiscReceiptRespVO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt.vo.MesWmMiscReceiptSaveReqVO; | ||
| 11 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.miscreceipt.MesWmMiscReceiptDO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.service.wm.miscreceipt.MesWmMiscReceiptService; | ||
| 13 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 14 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 15 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 16 | +import jakarta.annotation.Resource; | ||
| 17 | +import jakarta.servlet.http.HttpServletResponse; | ||
| 18 | +import jakarta.validation.Valid; | ||
| 19 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 20 | +import org.springframework.validation.annotation.Validated; | ||
| 21 | +import org.springframework.web.bind.annotation.*; | ||
| 22 | + | ||
| 23 | +import java.io.IOException; | ||
| 24 | +import java.util.List; | ||
| 25 | + | ||
| 26 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||
| 27 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 28 | + | ||
| 29 | +/** | ||
| 30 | + * MES 杂项入库单 Controller | ||
| 31 | + * | ||
| 32 | + * @author 芋道源码 | ||
| 33 | + */ | ||
| 34 | +@Tag(name = "管理后台 - MES 杂项入库单") | ||
| 35 | +@RestController | ||
| 36 | +@RequestMapping("/mes/wm/misc-receipt") | ||
| 37 | +@Validated | ||
| 38 | +public class MesWmMiscReceiptController { | ||
| 39 | + | ||
| 40 | + @Resource | ||
| 41 | + private MesWmMiscReceiptService miscReceiptService; | ||
| 42 | + | ||
| 43 | + @PostMapping("/create") | ||
| 44 | + @Operation(summary = "创建杂项入库单") | ||
| 45 | + @PreAuthorize("@ss.hasPermission('mes:wm:misc-receipt:create')") | ||
| 46 | + public CommonResult<Long> createMiscReceipt(@Valid @RequestBody MesWmMiscReceiptSaveReqVO createReqVO) { | ||
| 47 | + return success(miscReceiptService.createMiscReceipt(createReqVO)); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + @PutMapping("/update") | ||
| 51 | + @Operation(summary = "修改杂项入库单") | ||
| 52 | + @PreAuthorize("@ss.hasPermission('mes:wm:misc-receipt:update')") | ||
| 53 | + public CommonResult<Boolean> updateMiscReceipt(@Valid @RequestBody MesWmMiscReceiptSaveReqVO updateReqVO) { | ||
| 54 | + miscReceiptService.updateMiscReceipt(updateReqVO); | ||
| 55 | + return success(true); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + @DeleteMapping("/delete") | ||
| 59 | + @Operation(summary = "删除杂项入库单") | ||
| 60 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 61 | + @PreAuthorize("@ss.hasPermission('mes:wm:misc-receipt:delete')") | ||
| 62 | + public CommonResult<Boolean> deleteMiscReceipt(@RequestParam("id") Long id) { | ||
| 63 | + miscReceiptService.deleteMiscReceipt(id); | ||
| 64 | + return success(true); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @GetMapping("/get") | ||
| 68 | + @Operation(summary = "获得杂项入库单") | ||
| 69 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 70 | + @PreAuthorize("@ss.hasPermission('mes:wm:misc-receipt:query')") | ||
| 71 | + public CommonResult<MesWmMiscReceiptRespVO> getMiscReceipt(@RequestParam("id") Long id) { | ||
| 72 | + MesWmMiscReceiptDO receipt = miscReceiptService.getMiscReceipt(id); | ||
| 73 | + return success(BeanUtils.toBean(receipt, MesWmMiscReceiptRespVO.class)); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + @GetMapping("/page") | ||
| 77 | + @Operation(summary = "获得杂项入库单分页") | ||
| 78 | + @PreAuthorize("@ss.hasPermission('mes:wm:misc-receipt:query')") | ||
| 79 | + public CommonResult<PageResult<MesWmMiscReceiptRespVO>> getMiscReceiptPage(@Valid MesWmMiscReceiptPageReqVO pageReqVO) { | ||
| 80 | + PageResult<MesWmMiscReceiptDO> pageResult = miscReceiptService.getMiscReceiptPage(pageReqVO); | ||
| 81 | + return success(BeanUtils.toBean(pageResult, MesWmMiscReceiptRespVO.class)); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | + @PutMapping("/submit") | ||
| 85 | + @Operation(summary = "提交审批") | ||
| 86 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 87 | + @PreAuthorize("@ss.hasPermission('mes:wm:misc-receipt:submit')") | ||
| 88 | + public CommonResult<Boolean> submitMiscReceipt(@RequestParam("id") Long id) { | ||
| 89 | + miscReceiptService.submitMiscReceipt(id); | ||
| 90 | + return success(true); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + @PutMapping("/finish") | ||
| 94 | + @Operation(summary = "执行入库") | ||
| 95 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 96 | + @PreAuthorize("@ss.hasPermission('mes:wm:misc-receipt:finish')") | ||
| 97 | + public CommonResult<Boolean> finishMiscReceipt(@RequestParam("id") Long id) { | ||
| 98 | + miscReceiptService.finishMiscReceipt(id); | ||
| 99 | + return success(true); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + @PutMapping("/cancel") | ||
| 103 | + @Operation(summary = "取消杂项入库单") | ||
| 104 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 105 | + @PreAuthorize("@ss.hasPermission('mes:wm:misc-receipt:cancel')") | ||
| 106 | + public CommonResult<Boolean> cancelMiscReceipt(@RequestParam("id") Long id) { | ||
| 107 | + miscReceiptService.cancelMiscReceipt(id); | ||
| 108 | + return success(true); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | + @GetMapping("/export-excel") | ||
| 112 | + @Operation(summary = "导出杂项入库单 Excel") | ||
| 113 | + @PreAuthorize("@ss.hasPermission('mes:wm:misc-receipt:export')") | ||
| 114 | + @ApiAccessLog(operateType = EXPORT) | ||
| 115 | + public void exportMiscReceiptExcel(@Valid MesWmMiscReceiptPageReqVO pageReqVO, | ||
| 116 | + HttpServletResponse response) throws IOException { | ||
| 117 | + pageReqVO.setPageSize(Integer.MAX_VALUE); | ||
| 118 | + List<MesWmMiscReceiptDO> list = miscReceiptService.getMiscReceiptPage(pageReqVO).getList(); | ||
| 119 | + ExcelUtils.write(response, "杂项入库单.xls", "数据", MesWmMiscReceiptRespVO.class, | ||
| 120 | + BeanUtils.toBean(list, MesWmMiscReceiptRespVO.class)); | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/miscreceipt/MesWmMiscReceiptLineController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 5 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt.vo.line.MesWmMiscReceiptLineRespVO; | ||
| 6 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt.vo.line.MesWmMiscReceiptLineSaveReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.miscreceipt.MesWmMiscReceiptLineDO; | ||
| 8 | +import cn.iocoder.yudao.module.mes.service.wm.miscreceipt.MesWmMiscReceiptLineService; | ||
| 9 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 10 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 11 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 12 | +import jakarta.annotation.Resource; | ||
| 13 | +import jakarta.validation.Valid; | ||
| 14 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 15 | +import org.springframework.validation.annotation.Validated; | ||
| 16 | +import org.springframework.web.bind.annotation.*; | ||
| 17 | + | ||
| 18 | +import java.util.List; | ||
| 19 | + | ||
| 20 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 21 | + | ||
| 22 | +/** | ||
| 23 | + * MES 杂项入库单行 Controller | ||
| 24 | + */ | ||
| 25 | +@Tag(name = "管理后台 - MES 杂项入库单行") | ||
| 26 | +@RestController | ||
| 27 | +@RequestMapping("/mes/wm/misc-receipt-line") | ||
| 28 | +@Validated | ||
| 29 | +public class MesWmMiscReceiptLineController { | ||
| 30 | + | ||
| 31 | + @Resource | ||
| 32 | + private MesWmMiscReceiptLineService miscReceiptLineService; | ||
| 33 | + | ||
| 34 | + @PostMapping("/create") | ||
| 35 | + @Operation(summary = "创建杂项入库单行") | ||
| 36 | + @PreAuthorize("@ss.hasPermission('mes:wm:misc-receipt:create')") | ||
| 37 | + public CommonResult<Long> createMiscReceiptLine(@Valid @RequestBody MesWmMiscReceiptLineSaveReqVO createReqVO) { | ||
| 38 | + return success(miscReceiptLineService.createMiscReceiptLine(createReqVO)); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + @PutMapping("/update") | ||
| 42 | + @Operation(summary = "修改杂项入库单行") | ||
| 43 | + @PreAuthorize("@ss.hasPermission('mes:wm:misc-receipt:update')") | ||
| 44 | + public CommonResult<Boolean> updateMiscReceiptLine(@Valid @RequestBody MesWmMiscReceiptLineSaveReqVO updateReqVO) { | ||
| 45 | + miscReceiptLineService.updateMiscReceiptLine(updateReqVO); | ||
| 46 | + return success(true); | ||
| 47 | + } | ||
| 48 | + | ||
| 49 | + @DeleteMapping("/delete") | ||
| 50 | + @Operation(summary = "删除杂项入库单行") | ||
| 51 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 52 | + @PreAuthorize("@ss.hasPermission('mes:wm:misc-receipt:delete')") | ||
| 53 | + public CommonResult<Boolean> deleteMiscReceiptLine(@RequestParam("id") Long id) { | ||
| 54 | + miscReceiptLineService.deleteMiscReceiptLine(id); | ||
| 55 | + return success(true); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + @GetMapping("/get") | ||
| 59 | + @Operation(summary = "获得杂项入库单行") | ||
| 60 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 61 | + @PreAuthorize("@ss.hasPermission('mes:wm:misc-receipt:query')") | ||
| 62 | + public CommonResult<MesWmMiscReceiptLineRespVO> getMiscReceiptLine(@RequestParam("id") Long id) { | ||
| 63 | + MesWmMiscReceiptLineDO line = miscReceiptLineService.getMiscReceiptLine(id); | ||
| 64 | + return success(BeanUtils.toBean(line, MesWmMiscReceiptLineRespVO.class)); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @GetMapping("/list-by-receipt-id") | ||
| 68 | + @Operation(summary = "获得杂项入库单行列表") | ||
| 69 | + @Parameter(name = "receiptId", description = "入库单编号", required = true, example = "1024") | ||
| 70 | + @PreAuthorize("@ss.hasPermission('mes:wm:misc-receipt:query')") | ||
| 71 | + public CommonResult<List<MesWmMiscReceiptLineRespVO>> getMiscReceiptLineListByReceiptId(@RequestParam("receiptId") Long receiptId) { | ||
| 72 | + List<MesWmMiscReceiptLineDO> list = miscReceiptLineService.getMiscReceiptLineListByReceiptId(receiptId); | ||
| 73 | + return success(BeanUtils.toBean(list, MesWmMiscReceiptLineRespVO.class)); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/miscreceipt/vo/MesWmMiscReceiptPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt.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 MesWmMiscReceiptPageReqVO extends PageParam { | ||
| 19 | + | ||
| 20 | + @Schema(description = "入库单编码", example = "MR2026030001") | ||
| 21 | + private String code; | ||
| 22 | + | ||
| 23 | + @Schema(description = "入库单名称", example = "退料入库单") | ||
| 24 | + private String name; | ||
| 25 | + | ||
| 26 | + @Schema(description = "杂项类型", example = "RETURN") | ||
| 27 | + private String type; | ||
| 28 | + | ||
| 29 | + @Schema(description = "状态", example = "0") | ||
| 30 | + private Integer status; | ||
| 31 | + | ||
| 32 | + @Schema(description = "入库日期") | ||
| 33 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 34 | + private LocalDateTime[] receiptDate; | ||
| 35 | + | ||
| 36 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/miscreceipt/vo/MesWmMiscReceiptRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt.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 MesWmMiscReceiptRespVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "编号", example = "1024") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | + @Schema(description = "入库单编码", example = "MR2026030001") | ||
| 16 | + private String code; | ||
| 17 | + | ||
| 18 | + @Schema(description = "入库单名称", example = "退料入库单") | ||
| 19 | + private String name; | ||
| 20 | + | ||
| 21 | + @Schema(description = "杂项类型", example = "RETURN") | ||
| 22 | + private String type; | ||
| 23 | + | ||
| 24 | + @Schema(description = "来源单据 ID", example = "1") | ||
| 25 | + private Long sourceDocId; | ||
| 26 | + | ||
| 27 | + @Schema(description = "来源单据编码", example = "WO2026030001") | ||
| 28 | + private String sourceDocCode; | ||
| 29 | + | ||
| 30 | + @Schema(description = "来源单据类型", example = "WORK_ORDER") | ||
| 31 | + private String sourceDocType; | ||
| 32 | + | ||
| 33 | + @Schema(description = "入库日期") | ||
| 34 | + private LocalDateTime receiptDate; | ||
| 35 | + | ||
| 36 | + @Schema(description = "状态", example = "0") | ||
| 37 | + private Integer status; | ||
| 38 | + | ||
| 39 | + @Schema(description = "备注", example = "备注") | ||
| 40 | + private String remark; | ||
| 41 | + | ||
| 42 | + @Schema(description = "创建时间") | ||
| 43 | + private LocalDateTime createTime; | ||
| 44 | + | ||
| 45 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/miscreceipt/vo/MesWmMiscReceiptSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt.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 | +// TODO @AI:字段的必传,需要对齐下前端; | ||
| 11 | +@Schema(description = "管理后台 - MES 杂项入库单新增/修改 Request VO") | ||
| 12 | +@Data | ||
| 13 | +public class MesWmMiscReceiptSaveReqVO { | ||
| 14 | + | ||
| 15 | + @Schema(description = "编号", example = "1024") | ||
| 16 | + private Long id; | ||
| 17 | + | ||
| 18 | + @Schema(description = "入库单编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "MR2026030001") | ||
| 19 | + @NotEmpty(message = "入库单编码不能为空") | ||
| 20 | + private String code; | ||
| 21 | + | ||
| 22 | + @Schema(description = "入库单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "退料入库单") | ||
| 23 | + @NotEmpty(message = "入库单名称不能为空") | ||
| 24 | + private String name; | ||
| 25 | + | ||
| 26 | + @Schema(description = "杂项类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "RETURN") | ||
| 27 | + @NotEmpty(message = "杂项类型不能为空") | ||
| 28 | + private String type; | ||
| 29 | + | ||
| 30 | + @Schema(description = "来源单据 ID", example = "1") | ||
| 31 | + private Long sourceDocId; | ||
| 32 | + | ||
| 33 | + @Schema(description = "来源单据编码", example = "WO2026030001") | ||
| 34 | + private String sourceDocCode; | ||
| 35 | + | ||
| 36 | + @Schema(description = "来源单据类型", example = "WORK_ORDER") | ||
| 37 | + private String sourceDocType; | ||
| 38 | + | ||
| 39 | + @Schema(description = "入库日期", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 40 | + @NotNull(message = "入库日期不能为空") | ||
| 41 | + private LocalDateTime receiptDate; | ||
| 42 | + | ||
| 43 | + @Schema(description = "备注", example = "备注") | ||
| 44 | + private String remark; | ||
| 45 | + | ||
| 46 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/miscreceipt/vo/line/MesWmMiscReceiptLinePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt.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 MesWmMiscReceiptLinePageReqVO extends PageParam { | ||
| 15 | + | ||
| 16 | + @Schema(description = "入库单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 17 | + @NotNull(message = "入库单编号不能为空") | ||
| 18 | + private Long receiptId; | ||
| 19 | + | ||
| 20 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/miscreceipt/vo/line/MesWmMiscReceiptLineRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt.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 MesWmMiscReceiptLineRespVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "编号", example = "1024") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "入库单编号", example = "1") | ||
| 17 | + private Long receiptId; | ||
| 18 | + | ||
| 19 | + @Schema(description = "物料编号", example = "1") | ||
| 20 | + private Long itemId; | ||
| 21 | + | ||
| 22 | + @Schema(description = "入库数量", example = "100.00") | ||
| 23 | + private BigDecimal quantity; | ||
| 24 | + | ||
| 25 | + @Schema(description = "批次号", example = "BATCH20260301") | ||
| 26 | + private String batchCode; | ||
| 27 | + | ||
| 28 | + @Schema(description = "仓库编号", example = "1") | ||
| 29 | + private Long warehouseId; | ||
| 30 | + | ||
| 31 | + @Schema(description = "库区编号", example = "1") | ||
| 32 | + private Long locationId; | ||
| 33 | + | ||
| 34 | + @Schema(description = "库位编号", example = "1") | ||
| 35 | + private Long areaId; | ||
| 36 | + | ||
| 37 | + @Schema(description = "生产日期") | ||
| 38 | + private LocalDateTime productionDate; | ||
| 39 | + | ||
| 40 | + @Schema(description = "有效期") | ||
| 41 | + private LocalDateTime expireDate; | ||
| 42 | + | ||
| 43 | + @Schema(description = "生产批号", example = "PROD20260301") | ||
| 44 | + private String productionBatchNumber; | ||
| 45 | + | ||
| 46 | + @Schema(description = "备注", example = "备注") | ||
| 47 | + private String remark; | ||
| 48 | + | ||
| 49 | + @Schema(description = "创建时间") | ||
| 50 | + private LocalDateTime createTime; | ||
| 51 | + | ||
| 52 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/wm/miscreceipt/vo/line/MesWmMiscReceiptLineSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt.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 MesWmMiscReceiptLineSaveReqVO { | ||
| 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 = "100.00") | ||
| 26 | + @NotNull(message = "入库数量不能为空") | ||
| 27 | + private BigDecimal quantity; | ||
| 28 | + | ||
| 29 | + @Schema(description = "批次号", example = "BATCH20260301") | ||
| 30 | + private String batchCode; | ||
| 31 | + | ||
| 32 | + @Schema(description = "仓库编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 33 | + @NotNull(message = "仓库不能为空") | ||
| 34 | + private Long warehouseId; | ||
| 35 | + | ||
| 36 | + @Schema(description = "库区编号", example = "1") | ||
| 37 | + private Long locationId; | ||
| 38 | + | ||
| 39 | + @Schema(description = "库位编号", example = "1") | ||
| 40 | + private Long areaId; | ||
| 41 | + | ||
| 42 | + @Schema(description = "生产日期") | ||
| 43 | + private LocalDateTime productionDate; | ||
| 44 | + | ||
| 45 | + @Schema(description = "有效期") | ||
| 46 | + private LocalDateTime expireDate; | ||
| 47 | + | ||
| 48 | + @Schema(description = "生产批号", example = "PROD20260301") | ||
| 49 | + private String productionBatchNumber; | ||
| 50 | + | ||
| 51 | + @Schema(description = "备注", example = "备注") | ||
| 52 | + private String remark; | ||
| 53 | + | ||
| 54 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/wm/miscreceipt/MesWmMiscReceiptDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.dal.dataobject.wm.miscreceipt; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 4 | +import cn.iocoder.yudao.module.mes.enums.wm.MesWmMiscReceiptStatusEnum; | ||
| 5 | +import cn.iocoder.yudao.module.mes.enums.wm.MesWmMiscReceiptTypeEnum; | ||
| 6 | +import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 7 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 8 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 9 | +import lombok.*; | ||
| 10 | + | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | + | ||
| 13 | +/** | ||
| 14 | + * MES 杂项入库单 DO | ||
| 15 | + * | ||
| 16 | + * @author 芋道源码 | ||
| 17 | + */ | ||
| 18 | +@TableName("mes_wm_misc_receipt") | ||
| 19 | +@KeySequence("mes_wm_misc_receipt_seq") | ||
| 20 | +@Data | ||
| 21 | +@EqualsAndHashCode(callSuper = true) | ||
| 22 | +@ToString(callSuper = true) | ||
| 23 | +@Builder | ||
| 24 | +@NoArgsConstructor | ||
| 25 | +@AllArgsConstructor | ||
| 26 | +public class MesWmMiscReceiptDO extends BaseDO { | ||
| 27 | + | ||
| 28 | + /** | ||
| 29 | + * 编号 | ||
| 30 | + */ | ||
| 31 | + @TableId | ||
| 32 | + private Long id; | ||
| 33 | + /** | ||
| 34 | + * 入库单编码 | ||
| 35 | + */ | ||
| 36 | + private String code; | ||
| 37 | + /** | ||
| 38 | + * 入库单名称 | ||
| 39 | + */ | ||
| 40 | + private String name; | ||
| 41 | + /** | ||
| 42 | + * 杂项类型 | ||
| 43 | + * | ||
| 44 | + * 枚举 {@link MesWmMiscReceiptTypeEnum} | ||
| 45 | + */ | ||
| 46 | + private String type; | ||
| 47 | + // TODO @芋艿:后续看看怎么跟进; | ||
| 48 | + /** | ||
| 49 | + * 来源单据 ID | ||
| 50 | + */ | ||
| 51 | + private Long sourceDocId; | ||
| 52 | + /** | ||
| 53 | + * 来源单据编码 | ||
| 54 | + */ | ||
| 55 | + private String sourceDocCode; | ||
| 56 | + /** | ||
| 57 | + * 来源单据类型 | ||
| 58 | + */ | ||
| 59 | + private String sourceDocType; | ||
| 60 | + /** | ||
| 61 | + * 入库日期 | ||
| 62 | + */ | ||
| 63 | + private LocalDateTime receiptDate; | ||
| 64 | + /** | ||
| 65 | + * 状态 | ||
| 66 | + * | ||
| 67 | + * 枚举 {@link MesWmMiscReceiptStatusEnum} | ||
| 68 | + */ | ||
| 69 | + private Integer status; | ||
| 70 | + /** | ||
| 71 | + * 备注 | ||
| 72 | + */ | ||
| 73 | + private String remark; | ||
| 74 | + | ||
| 75 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/wm/miscreceipt/MesWmMiscReceiptLineDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.dal.dataobject.wm.miscreceipt; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 4 | +import cn.iocoder.yudao.module.mes.dal.dataobject.md.item.MesMdItemDO; | ||
| 5 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseAreaDO; | ||
| 6 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseDO; | ||
| 7 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.warehouse.MesWmWarehouseLocationDO; | ||
| 8 | +import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 9 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 10 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 11 | +import lombok.*; | ||
| 12 | + | ||
| 13 | +import java.math.BigDecimal; | ||
| 14 | +import java.time.LocalDateTime; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * MES 杂项入库单行 DO | ||
| 18 | + * | ||
| 19 | + * @author 芋道源码 | ||
| 20 | + */ | ||
| 21 | +@TableName("mes_wm_misc_receipt_line") | ||
| 22 | +@KeySequence("mes_wm_misc_receipt_line_seq") | ||
| 23 | +@Data | ||
| 24 | +@EqualsAndHashCode(callSuper = true) | ||
| 25 | +@ToString(callSuper = true) | ||
| 26 | +@Builder | ||
| 27 | +@NoArgsConstructor | ||
| 28 | +@AllArgsConstructor | ||
| 29 | +public class MesWmMiscReceiptLineDO extends BaseDO { | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 编号 | ||
| 33 | + */ | ||
| 34 | + @TableId | ||
| 35 | + private Long id; | ||
| 36 | + /** | ||
| 37 | + * 入库单编号 | ||
| 38 | + * | ||
| 39 | + * 关联 {@link MesWmMiscReceiptDO#getId()} | ||
| 40 | + */ | ||
| 41 | + private Long receiptId; | ||
| 42 | + /** | ||
| 43 | + * 物料编号 | ||
| 44 | + * | ||
| 45 | + * 关联 {@link MesMdItemDO#getId()} | ||
| 46 | + */ | ||
| 47 | + private Long itemId; | ||
| 48 | + /** | ||
| 49 | + * 入库数量 | ||
| 50 | + */ | ||
| 51 | + private BigDecimal quantity; | ||
| 52 | + /** | ||
| 53 | + * 批次号 | ||
| 54 | + */ | ||
| 55 | + private String batchCode; | ||
| 56 | + /** | ||
| 57 | + * 仓库编号 | ||
| 58 | + * | ||
| 59 | + * 关联 {@link MesWmWarehouseDO#getId()} | ||
| 60 | + */ | ||
| 61 | + private Long warehouseId; | ||
| 62 | + /** | ||
| 63 | + * 库区编号 | ||
| 64 | + * | ||
| 65 | + * 关联 {@link MesWmWarehouseLocationDO#getId()} | ||
| 66 | + */ | ||
| 67 | + private Long locationId; | ||
| 68 | + /** | ||
| 69 | + * 库位编号 | ||
| 70 | + * | ||
| 71 | + * 关联 {@link MesWmWarehouseAreaDO#getId()} | ||
| 72 | + */ | ||
| 73 | + private Long areaId; | ||
| 74 | + /** | ||
| 75 | + * 生产日期(暂不使用) | ||
| 76 | + */ | ||
| 77 | + private LocalDateTime productionDate; | ||
| 78 | + /** | ||
| 79 | + * 有效期(暂不使用) | ||
| 80 | + */ | ||
| 81 | + private LocalDateTime expireDate; | ||
| 82 | + /** | ||
| 83 | + * 生产批号(暂不使用) | ||
| 84 | + */ | ||
| 85 | + private String productionBatchNumber; | ||
| 86 | + /** | ||
| 87 | + * 备注 | ||
| 88 | + */ | ||
| 89 | + private String remark; | ||
| 90 | + | ||
| 91 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/wm/miscreceipt/MesWmMiscReceiptLineMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.dal.mysql.wm.miscreceipt; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 5 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.miscreceipt.MesWmMiscReceiptLineDO; | ||
| 6 | +import org.apache.ibatis.annotations.Mapper; | ||
| 7 | + | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * MES 杂项入库单行 Mapper | ||
| 12 | + * | ||
| 13 | + * @author 芋道源码 | ||
| 14 | + */ | ||
| 15 | +@Mapper | ||
| 16 | +public interface MesWmMiscReceiptLineMapper extends BaseMapperX<MesWmMiscReceiptLineDO> { | ||
| 17 | + | ||
| 18 | + default List<MesWmMiscReceiptLineDO> selectListByReceiptId(Long receiptId) { | ||
| 19 | + return selectList(new LambdaQueryWrapperX<MesWmMiscReceiptLineDO>() | ||
| 20 | + .eq(MesWmMiscReceiptLineDO::getReceiptId, receiptId) | ||
| 21 | + .orderByAsc(MesWmMiscReceiptLineDO::getId)); | ||
| 22 | + } | ||
| 23 | + | ||
| 24 | + default int deleteByReceiptId(Long receiptId) { | ||
| 25 | + return delete(new LambdaQueryWrapperX<MesWmMiscReceiptLineDO>() | ||
| 26 | + .eq(MesWmMiscReceiptLineDO::getReceiptId, receiptId)); | ||
| 27 | + } | ||
| 28 | + | ||
| 29 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/wm/miscreceipt/MesWmMiscReceiptMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.dal.mysql.wm.miscreceipt; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 5 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 6 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt.vo.MesWmMiscReceiptPageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.miscreceipt.MesWmMiscReceiptDO; | ||
| 8 | +import org.apache.ibatis.annotations.Mapper; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * MES 杂项入库单 Mapper | ||
| 12 | + * | ||
| 13 | + * @author 芋道源码 | ||
| 14 | + */ | ||
| 15 | +@Mapper | ||
| 16 | +public interface MesWmMiscReceiptMapper extends BaseMapperX<MesWmMiscReceiptDO> { | ||
| 17 | + | ||
| 18 | + default PageResult<MesWmMiscReceiptDO> selectPage(MesWmMiscReceiptPageReqVO reqVO) { | ||
| 19 | + return selectPage(reqVO, new LambdaQueryWrapperX<MesWmMiscReceiptDO>() | ||
| 20 | + .likeIfPresent(MesWmMiscReceiptDO::getCode, reqVO.getCode()) | ||
| 21 | + .likeIfPresent(MesWmMiscReceiptDO::getName, reqVO.getName()) | ||
| 22 | + .eqIfPresent(MesWmMiscReceiptDO::getType, reqVO.getType()) | ||
| 23 | + .eqIfPresent(MesWmMiscReceiptDO::getStatus, reqVO.getStatus()) | ||
| 24 | + .betweenIfPresent(MesWmMiscReceiptDO::getReceiptDate, reqVO.getReceiptDate()) | ||
| 25 | + .orderByDesc(MesWmMiscReceiptDO::getId)); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + default MesWmMiscReceiptDO selectByCode(String code) { | ||
| 29 | + return selectOne(MesWmMiscReceiptDO::getCode, code); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/wm/outsourcereceipt/MesWmOutsourceReceiptLineMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.dal.mysql.wm.outsourcereceipt; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX; | ||
| 4 | +import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX; | ||
| 5 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.outsourcereceipt.MesWmOutsourceReceiptLineDO; | ||
| 6 | +import org.apache.ibatis.annotations.Mapper; | ||
| 7 | + | ||
| 8 | +import java.util.List; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * MES 外协入库单行 Mapper | ||
| 12 | + */ | ||
| 13 | +@Mapper | ||
| 14 | +public interface MesWmOutsourceReceiptLineMapper extends BaseMapperX<MesWmOutsourceReceiptLineDO> { | ||
| 15 | + | ||
| 16 | + default List<MesWmOutsourceReceiptLineDO> selectListByReceiptId(Long receiptId) { | ||
| 17 | + return selectList(new LambdaQueryWrapperX<MesWmOutsourceReceiptLineDO>() | ||
| 18 | + .eq(MesWmOutsourceReceiptLineDO::getReceiptId, receiptId) | ||
| 19 | + .orderByAsc(MesWmOutsourceReceiptLineDO::getId)); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + default int deleteByReceiptId(Long receiptId) { | ||
| 23 | + return delete(new LambdaQueryWrapperX<MesWmOutsourceReceiptLineDO>() | ||
| 24 | + .eq(MesWmOutsourceReceiptLineDO::getReceiptId, receiptId)); | ||
| 25 | + } | ||
| 26 | + | ||
| 27 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/enums/wm/MesWmMiscReceiptStatusEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.enums.wm; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.core.ArrayValuable; | ||
| 4 | +import cn.iocoder.yudao.module.mes.enums.MesOrderStatusConstants; | ||
| 5 | +import lombok.AllArgsConstructor; | ||
| 6 | +import lombok.Getter; | ||
| 7 | + | ||
| 8 | +import java.util.Arrays; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * MES 杂项入库单状态枚举 | ||
| 12 | + * | ||
| 13 | + * @author 芋道源码 | ||
| 14 | + */ | ||
| 15 | +@Getter | ||
| 16 | +@AllArgsConstructor | ||
| 17 | +public enum MesWmMiscReceiptStatusEnum implements ArrayValuable<Integer> { | ||
| 18 | + | ||
| 19 | + /** | ||
| 20 | + * 草稿 | ||
| 21 | + */ | ||
| 22 | + PREPARE(MesOrderStatusConstants.PREPARE, "草稿"), | ||
| 23 | + /** | ||
| 24 | + * 已审批 | ||
| 25 | + */ | ||
| 26 | + APPROVED(MesOrderStatusConstants.APPROVED, "已审批"), | ||
| 27 | + /** | ||
| 28 | + * 已完成 | ||
| 29 | + */ | ||
| 30 | + FINISHED(MesOrderStatusConstants.FINISHED, "已完成"), | ||
| 31 | + /** | ||
| 32 | + * 已取消 | ||
| 33 | + */ | ||
| 34 | + CANCELED(MesOrderStatusConstants.CANCELLED, "已取消"); | ||
| 35 | + | ||
| 36 | + public static final Integer[] ARRAYS = Arrays.stream(values()).map(MesWmMiscReceiptStatusEnum::getStatus).toArray(Integer[]::new); | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 状态值 | ||
| 40 | + */ | ||
| 41 | + private final Integer status; | ||
| 42 | + /** | ||
| 43 | + * 状态名 | ||
| 44 | + */ | ||
| 45 | + private final String name; | ||
| 46 | + | ||
| 47 | + @Override | ||
| 48 | + public Integer[] array() { | ||
| 49 | + return ARRAYS; | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/enums/wm/MesWmMiscReceiptTypeEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.enums.wm; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.core.ArrayValuable; | ||
| 4 | +import lombok.AllArgsConstructor; | ||
| 5 | +import lombok.Getter; | ||
| 6 | + | ||
| 7 | +import java.util.Arrays; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * MES 杂项入库类型枚举 | ||
| 11 | + * | ||
| 12 | + * @author 芋道源码 | ||
| 13 | + */ | ||
| 14 | +@Getter | ||
| 15 | +@AllArgsConstructor | ||
| 16 | +public enum MesWmMiscReceiptTypeEnum implements ArrayValuable<String> { | ||
| 17 | + | ||
| 18 | + RETURN("RETURN", "退料入库"), | ||
| 19 | + ADJUST("ADJUST", "调整入库"), | ||
| 20 | + TRANSFER("TRANSFER", "调拨入库"), | ||
| 21 | + OTHER("OTHER", "其他入库"); | ||
| 22 | + | ||
| 23 | + public static final String[] ARRAYS = Arrays.stream(values()).map(MesWmMiscReceiptTypeEnum::getType).toArray(String[]::new); | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 类型值 | ||
| 27 | + */ | ||
| 28 | + private final String type; | ||
| 29 | + /** | ||
| 30 | + * 类型名 | ||
| 31 | + */ | ||
| 32 | + private final String name; | ||
| 33 | + | ||
| 34 | + @Override | ||
| 35 | + public String[] array() { | ||
| 36 | + return ARRAYS; | ||
| 37 | + } | ||
| 38 | + | ||
| 39 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/miscreceipt/MesWmMiscReceiptLineService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.service.wm.miscreceipt; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt.vo.line.MesWmMiscReceiptLineSaveReqVO; | ||
| 4 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.miscreceipt.MesWmMiscReceiptLineDO; | ||
| 5 | +import jakarta.validation.Valid; | ||
| 6 | + | ||
| 7 | +import java.util.List; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * MES 杂项入库单行 Service 接口 | ||
| 11 | + */ | ||
| 12 | +public interface MesWmMiscReceiptLineService { | ||
| 13 | + | ||
| 14 | + /** | ||
| 15 | + * 创建杂项入库单行 | ||
| 16 | + * | ||
| 17 | + * @param createReqVO 创建信息 | ||
| 18 | + * @return 编号 | ||
| 19 | + */ | ||
| 20 | + Long createMiscReceiptLine(@Valid MesWmMiscReceiptLineSaveReqVO createReqVO); | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 修改杂项入库单行 | ||
| 24 | + * | ||
| 25 | + * @param updateReqVO 修改信息 | ||
| 26 | + */ | ||
| 27 | + void updateMiscReceiptLine(@Valid MesWmMiscReceiptLineSaveReqVO updateReqVO); | ||
| 28 | + | ||
| 29 | + /** | ||
| 30 | + * 删除杂项入库单行 | ||
| 31 | + * | ||
| 32 | + * @param id 编号 | ||
| 33 | + */ | ||
| 34 | + void deleteMiscReceiptLine(Long id); | ||
| 35 | + | ||
| 36 | + /** | ||
| 37 | + * 获得杂项入库单行 | ||
| 38 | + * | ||
| 39 | + * @param id 编号 | ||
| 40 | + * @return 杂项入库单行 | ||
| 41 | + */ | ||
| 42 | + MesWmMiscReceiptLineDO getMiscReceiptLine(Long id); | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 获得杂项入库单行列表 | ||
| 46 | + * | ||
| 47 | + * @param receiptId 入库单编号 | ||
| 48 | + * @return 杂项入库单行列表 | ||
| 49 | + */ | ||
| 50 | + List<MesWmMiscReceiptLineDO> getMiscReceiptLineListByReceiptId(Long receiptId); | ||
| 51 | + | ||
| 52 | + /** | ||
| 53 | + * 校验杂项入库单行存在 | ||
| 54 | + * | ||
| 55 | + * @param id 编号 | ||
| 56 | + * @return 杂项入库单行 | ||
| 57 | + */ | ||
| 58 | + MesWmMiscReceiptLineDO validateMiscReceiptLineExists(Long id); | ||
| 59 | + | ||
| 60 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/miscreceipt/MesWmMiscReceiptLineServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.service.wm.miscreceipt; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 4 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt.vo.line.MesWmMiscReceiptLineSaveReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.miscreceipt.MesWmMiscReceiptLineDO; | ||
| 6 | +import cn.iocoder.yudao.module.mes.dal.mysql.wm.miscreceipt.MesWmMiscReceiptLineMapper; | ||
| 7 | +import jakarta.annotation.Resource; | ||
| 8 | +import org.springframework.stereotype.Service; | ||
| 9 | +import org.springframework.validation.annotation.Validated; | ||
| 10 | + | ||
| 11 | +import java.util.List; | ||
| 12 | + | ||
| 13 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 14 | +import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.WM_MISC_RECEIPT_LINE_NOT_EXISTS; | ||
| 15 | + | ||
| 16 | +/** | ||
| 17 | + * MES 杂项入库单行 Service 实现类 | ||
| 18 | + */ | ||
| 19 | +@Service | ||
| 20 | +@Validated | ||
| 21 | +public class MesWmMiscReceiptLineServiceImpl implements MesWmMiscReceiptLineService { | ||
| 22 | + | ||
| 23 | + @Resource | ||
| 24 | + private MesWmMiscReceiptLineMapper miscReceiptLineMapper; | ||
| 25 | + | ||
| 26 | + @Override | ||
| 27 | + public Long createMiscReceiptLine(MesWmMiscReceiptLineSaveReqVO createReqVO) { | ||
| 28 | + // 插入 | ||
| 29 | + MesWmMiscReceiptLineDO line = BeanUtils.toBean(createReqVO, MesWmMiscReceiptLineDO.class); | ||
| 30 | + miscReceiptLineMapper.insert(line); | ||
| 31 | + return line.getId(); | ||
| 32 | + } | ||
| 33 | + | ||
| 34 | + @Override | ||
| 35 | + public void updateMiscReceiptLine(MesWmMiscReceiptLineSaveReqVO updateReqVO) { | ||
| 36 | + // 校验存在 | ||
| 37 | + validateMiscReceiptLineExists(updateReqVO.getId()); | ||
| 38 | + | ||
| 39 | + // 更新 | ||
| 40 | + MesWmMiscReceiptLineDO updateObj = BeanUtils.toBean(updateReqVO, MesWmMiscReceiptLineDO.class); | ||
| 41 | + miscReceiptLineMapper.updateById(updateObj); | ||
| 42 | + } | ||
| 43 | + | ||
| 44 | + @Override | ||
| 45 | + public void deleteMiscReceiptLine(Long id) { | ||
| 46 | + // 校验存在 | ||
| 47 | + validateMiscReceiptLineExists(id); | ||
| 48 | + | ||
| 49 | + // 删除 | ||
| 50 | + miscReceiptLineMapper.deleteById(id); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @Override | ||
| 54 | + public MesWmMiscReceiptLineDO getMiscReceiptLine(Long id) { | ||
| 55 | + return miscReceiptLineMapper.selectById(id); | ||
| 56 | + } | ||
| 57 | + | ||
| 58 | + @Override | ||
| 59 | + public List<MesWmMiscReceiptLineDO> getMiscReceiptLineListByReceiptId(Long receiptId) { | ||
| 60 | + return miscReceiptLineMapper.selectListByReceiptId(receiptId); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @Override | ||
| 64 | + public MesWmMiscReceiptLineDO validateMiscReceiptLineExists(Long id) { | ||
| 65 | + MesWmMiscReceiptLineDO line = miscReceiptLineMapper.selectById(id); | ||
| 66 | + if (line == null) { | ||
| 67 | + throw exception(WM_MISC_RECEIPT_LINE_NOT_EXISTS); | ||
| 68 | + } | ||
| 69 | + return line; | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/miscreceipt/MesWmMiscReceiptService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.service.wm.miscreceipt; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt.vo.MesWmMiscReceiptPageReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt.vo.MesWmMiscReceiptSaveReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.miscreceipt.MesWmMiscReceiptDO; | ||
| 7 | +import jakarta.validation.Valid; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * MES 杂项入库单 Service 接口 | ||
| 11 | + * | ||
| 12 | + * @author 芋道源码 | ||
| 13 | + */ | ||
| 14 | +public interface MesWmMiscReceiptService { | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * 创建杂项入库单 | ||
| 18 | + * | ||
| 19 | + * @param createReqVO 创建信息 | ||
| 20 | + * @return 编号 | ||
| 21 | + */ | ||
| 22 | + Long createMiscReceipt(@Valid MesWmMiscReceiptSaveReqVO createReqVO); | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 修改杂项入库单 | ||
| 26 | + * | ||
| 27 | + * @param updateReqVO 修改信息 | ||
| 28 | + */ | ||
| 29 | + void updateMiscReceipt(@Valid MesWmMiscReceiptSaveReqVO updateReqVO); | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 删除杂项入库单(级联删除行) | ||
| 33 | + * | ||
| 34 | + * @param id 编号 | ||
| 35 | + */ | ||
| 36 | + void deleteMiscReceipt(Long id); | ||
| 37 | + | ||
| 38 | + /** | ||
| 39 | + * 获得杂项入库单 | ||
| 40 | + * | ||
| 41 | + * @param id 编号 | ||
| 42 | + * @return 杂项入库单 | ||
| 43 | + */ | ||
| 44 | + MesWmMiscReceiptDO getMiscReceipt(Long id); | ||
| 45 | + | ||
| 46 | + /** | ||
| 47 | + * 获得杂项入库单分页 | ||
| 48 | + * | ||
| 49 | + * @param pageReqVO 分页参数 | ||
| 50 | + * @return 杂项入库单分页 | ||
| 51 | + */ | ||
| 52 | + PageResult<MesWmMiscReceiptDO> getMiscReceiptPage(MesWmMiscReceiptPageReqVO pageReqVO); | ||
| 53 | + | ||
| 54 | + /** | ||
| 55 | + * 提交审批(草稿 → 已审批) | ||
| 56 | + * | ||
| 57 | + * @param id 编号 | ||
| 58 | + */ | ||
| 59 | + void submitMiscReceipt(Long id); | ||
| 60 | + | ||
| 61 | + /** | ||
| 62 | + * 执行入库(已审批 → 已完成),更新库存台账 | ||
| 63 | + * | ||
| 64 | + * @param id 编号 | ||
| 65 | + */ | ||
| 66 | + void finishMiscReceipt(Long id); | ||
| 67 | + | ||
| 68 | + /** | ||
| 69 | + * 取消杂项入库单(草稿/已审批 → 已取消) | ||
| 70 | + * | ||
| 71 | + * @param id 编号 | ||
| 72 | + */ | ||
| 73 | + void cancelMiscReceipt(Long id); | ||
| 74 | + | ||
| 75 | + /** | ||
| 76 | + * 校验杂项入库单存在 | ||
| 77 | + * | ||
| 78 | + * @param id 编号 | ||
| 79 | + * @return 杂项入库单 | ||
| 80 | + */ | ||
| 81 | + MesWmMiscReceiptDO validateMiscReceiptExists(Long id); | ||
| 82 | + | ||
| 83 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/wm/miscreceipt/MesWmMiscReceiptServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.service.wm.miscreceipt; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.hutool.core.util.ObjUtil; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 7 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt.vo.MesWmMiscReceiptPageReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.mes.controller.admin.wm.miscreceipt.vo.MesWmMiscReceiptSaveReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.miscreceipt.MesWmMiscReceiptDO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.dal.dataobject.wm.miscreceipt.MesWmMiscReceiptLineDO; | ||
| 11 | +import cn.iocoder.yudao.module.mes.dal.mysql.wm.miscreceipt.MesWmMiscReceiptLineMapper; | ||
| 12 | +import cn.iocoder.yudao.module.mes.dal.mysql.wm.miscreceipt.MesWmMiscReceiptMapper; | ||
| 13 | +import cn.iocoder.yudao.module.mes.enums.wm.MesWmMiscReceiptStatusEnum; | ||
| 14 | +import cn.iocoder.yudao.module.mes.service.wm.materialstock.MesWmMaterialStockService; | ||
| 15 | +import jakarta.annotation.Resource; | ||
| 16 | +import lombok.extern.slf4j.Slf4j; | ||
| 17 | +import org.springframework.stereotype.Service; | ||
| 18 | +import org.springframework.transaction.annotation.Transactional; | ||
| 19 | +import org.springframework.validation.annotation.Validated; | ||
| 20 | + | ||
| 21 | +import java.math.BigDecimal; | ||
| 22 | +import java.util.List; | ||
| 23 | + | ||
| 24 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 25 | +import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; | ||
| 26 | + | ||
| 27 | +/** | ||
| 28 | + * MES 杂项入库单 Service 实现类 | ||
| 29 | + */ | ||
| 30 | +@Service | ||
| 31 | +@Validated | ||
| 32 | +@Slf4j | ||
| 33 | +public class MesWmMiscReceiptServiceImpl implements MesWmMiscReceiptService { | ||
| 34 | + | ||
| 35 | + @Resource | ||
| 36 | + private MesWmMiscReceiptMapper miscReceiptMapper; | ||
| 37 | + | ||
| 38 | + @Resource | ||
| 39 | + private MesWmMiscReceiptLineMapper miscReceiptLineMapper; | ||
| 40 | + | ||
| 41 | + @Resource | ||
| 42 | + private MesWmMaterialStockService materialStockService; | ||
| 43 | + | ||
| 44 | + @Override | ||
| 45 | + public Long createMiscReceipt(MesWmMiscReceiptSaveReqVO createReqVO) { | ||
| 46 | + // 校验编码唯一 | ||
| 47 | + validateCodeUnique(null, createReqVO.getCode()); | ||
| 48 | + | ||
| 49 | + // 插入 | ||
| 50 | + MesWmMiscReceiptDO receipt = BeanUtils.toBean(createReqVO, MesWmMiscReceiptDO.class); | ||
| 51 | + receipt.setStatus(MesWmMiscReceiptStatusEnum.PREPARE.getStatus()); | ||
| 52 | + miscReceiptMapper.insert(receipt); | ||
| 53 | + return receipt.getId(); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @Override | ||
| 57 | + public void updateMiscReceipt(MesWmMiscReceiptSaveReqVO updateReqVO) { | ||
| 58 | + // 校验存在 + 草稿状态 | ||
| 59 | + validateMiscReceiptExistsAndPrepare(updateReqVO.getId()); | ||
| 60 | + // 校验编码唯一 | ||
| 61 | + validateCodeUnique(updateReqVO.getId(), updateReqVO.getCode()); | ||
| 62 | + | ||
| 63 | + // 更新 | ||
| 64 | + MesWmMiscReceiptDO updateObj = BeanUtils.toBean(updateReqVO, MesWmMiscReceiptDO.class); | ||
| 65 | + miscReceiptMapper.updateById(updateObj); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @Override | ||
| 69 | + @Transactional(rollbackFor = Exception.class) | ||
| 70 | + public void deleteMiscReceipt(Long id) { | ||
| 71 | + // 校验存在 + 草稿状态 | ||
| 72 | + validateMiscReceiptExistsAndPrepare(id); | ||
| 73 | + | ||
| 74 | + // 级联删除行 | ||
| 75 | + miscReceiptLineMapper.deleteByReceiptId(id); | ||
| 76 | + // 删除主表 | ||
| 77 | + miscReceiptMapper.deleteById(id); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @Override | ||
| 81 | + public MesWmMiscReceiptDO getMiscReceipt(Long id) { | ||
| 82 | + return miscReceiptMapper.selectById(id); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + @Override | ||
| 86 | + public PageResult<MesWmMiscReceiptDO> getMiscReceiptPage(MesWmMiscReceiptPageReqVO pageReqVO) { | ||
| 87 | + return miscReceiptMapper.selectPage(pageReqVO); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + @Override | ||
| 91 | + @Transactional(rollbackFor = Exception.class) | ||
| 92 | + public void submitMiscReceipt(Long id) { | ||
| 93 | + // 校验存在 + 草稿状态 | ||
| 94 | + validateMiscReceiptExistsAndPrepare(id); | ||
| 95 | + // 校验至少有一条行 | ||
| 96 | + List<MesWmMiscReceiptLineDO> lines = miscReceiptLineMapper.selectListByReceiptId(id); | ||
| 97 | + if (CollUtil.isEmpty(lines)) { | ||
| 98 | + throw exception(WM_MISC_RECEIPT_NO_LINE); | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | + // 校验行数据完整性 | ||
| 102 | + // TODO @AI:不用做这块的校验; | ||
| 103 | + for (MesWmMiscReceiptLineDO line : lines) { | ||
| 104 | + if (line.getWarehouseId() == null) { | ||
| 105 | + throw exception(WM_MISC_RECEIPT_WAREHOUSE_REQUIRED); | ||
| 106 | + } | ||
| 107 | + if (line.getQuantity() == null || line.getQuantity().compareTo(BigDecimal.ZERO) <= 0) { | ||
| 108 | + throw exception(WM_MISC_RECEIPT_QUANTITY_INVALID); | ||
| 109 | + } | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + // 提交审批(草稿 → 已审批) | ||
| 113 | + miscReceiptMapper.updateById(new MesWmMiscReceiptDO() | ||
| 114 | + .setId(id).setStatus(MesWmMiscReceiptStatusEnum.APPROVED.getStatus())); | ||
| 115 | + } | ||
| 116 | + | ||
| 117 | + @Override | ||
| 118 | + @Transactional(rollbackFor = Exception.class) | ||
| 119 | + public void finishMiscReceipt(Long id) { | ||
| 120 | + // 校验存在 | ||
| 121 | + MesWmMiscReceiptDO receipt = validateMiscReceiptExists(id); | ||
| 122 | + if (ObjUtil.notEqual(MesWmMiscReceiptStatusEnum.APPROVED.getStatus(), receipt.getStatus())) { | ||
| 123 | + throw exception(WM_MISC_RECEIPT_STATUS_NOT_APPROVED); | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + // 遍历所有行,更新库存台账 | ||
| 127 | + // TODO @芋艿:后续对齐下; | ||
| 128 | + // TODO @AI:这里有编译报错; | ||
| 129 | + List<MesWmMiscReceiptLineDO> lines = miscReceiptLineMapper.selectListByReceiptId(id); | ||
| 130 | + for (MesWmMiscReceiptLineDO line : lines) { | ||
| 131 | + materialStockService.increaseStock( | ||
| 132 | + line.getItemId(), | ||
| 133 | + line.getWarehouseId(), | ||
| 134 | + line.getLocationId(), | ||
| 135 | + line.getAreaId(), | ||
| 136 | + line.getBatchCode(), | ||
| 137 | + null, // vendorId 传 null(杂项入库无供应商) | ||
| 138 | + line.getQuantity() | ||
| 139 | + ); | ||
| 140 | + } | ||
| 141 | + | ||
| 142 | + // 执行入库(已审批 → 已完成) | ||
| 143 | + miscReceiptMapper.updateById(new MesWmMiscReceiptDO() | ||
| 144 | + .setId(id).setStatus(MesWmMiscReceiptStatusEnum.FINISHED.getStatus())); | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + @Override | ||
| 148 | + @Transactional(rollbackFor = Exception.class) | ||
| 149 | + public void cancelMiscReceipt(Long id) { | ||
| 150 | + // 校验存在 | ||
| 151 | + MesWmMiscReceiptDO receipt = validateMiscReceiptExists(id); | ||
| 152 | + | ||
| 153 | + // 已完成和已取消状态不允许取消 | ||
| 154 | + if (ObjUtil.equal(MesWmMiscReceiptStatusEnum.FINISHED.getStatus(), receipt.getStatus()) | ||
| 155 | + || ObjUtil.equal(MesWmMiscReceiptStatusEnum.CANCELED.getStatus(), receipt.getStatus())) { | ||
| 156 | + throw exception(WM_MISC_RECEIPT_CANCEL_NOT_ALLOWED); | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + // 取消 | ||
| 160 | + miscReceiptMapper.updateById(new MesWmMiscReceiptDO() | ||
| 161 | + .setId(id).setStatus(MesWmMiscReceiptStatusEnum.CANCELED.getStatus())); | ||
| 162 | + } | ||
| 163 | + | ||
| 164 | + @Override | ||
| 165 | + public MesWmMiscReceiptDO validateMiscReceiptExists(Long id) { | ||
| 166 | + MesWmMiscReceiptDO receipt = miscReceiptMapper.selectById(id); | ||
| 167 | + if (receipt == null) { | ||
| 168 | + throw exception(WM_MISC_RECEIPT_NOT_EXISTS); | ||
| 169 | + } | ||
| 170 | + return receipt; | ||
| 171 | + } | ||
| 172 | + | ||
| 173 | + // ==================== 私有方法 ==================== | ||
| 174 | + | ||
| 175 | + private void validateCodeUnique(Long id, String code) { | ||
| 176 | + MesWmMiscReceiptDO receipt = miscReceiptMapper.selectByCode(code); | ||
| 177 | + if (receipt == null) { | ||
| 178 | + return; | ||
| 179 | + } | ||
| 180 | + if (id == null || ObjUtil.notEqual(id, receipt.getId())) { | ||
| 181 | + throw exception(WM_MISC_RECEIPT_CODE_DUPLICATE); | ||
| 182 | + } | ||
| 183 | + } | ||
| 184 | + | ||
| 185 | + private MesWmMiscReceiptDO validateMiscReceiptExistsAndPrepare(Long id) { | ||
| 186 | + MesWmMiscReceiptDO receipt = validateMiscReceiptExists(id); | ||
| 187 | + if (ObjUtil.notEqual(MesWmMiscReceiptStatusEnum.PREPARE.getStatus(), receipt.getStatus())) { | ||
| 188 | + throw exception(WM_MISC_RECEIPT_STATUS_NOT_PREPARE); | ||
| 189 | + } | ||
| 190 | + return receipt; | ||
| 191 | + } | ||
| 192 | + | ||
| 193 | +} |