Commit 4c5e307404fa4adea93c4c9ce65d2cb1d3a1f55a
1 parent
0a55adca
feat(mes): 新增 MES 点检保养方案相关功能,包括设备和项目的增删改查接口及数据模型
Showing
24 changed files
with
1522 additions
and
0 deletions
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkplan/MesDvCheckPlanController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan; | ||
| 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.PageParam; | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 7 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 8 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 9 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.MesDvCheckPlanPageReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.MesDvCheckPlanRespVO; | ||
| 11 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.MesDvCheckPlanSaveReqVO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.checkplan.MesDvCheckPlanDO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.service.dv.checkplan.MesDvCheckPlanService; | ||
| 14 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 15 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 16 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 17 | +import jakarta.annotation.Resource; | ||
| 18 | +import jakarta.servlet.http.HttpServletResponse; | ||
| 19 | +import jakarta.validation.Valid; | ||
| 20 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 21 | +import org.springframework.validation.annotation.Validated; | ||
| 22 | +import org.springframework.web.bind.annotation.*; | ||
| 23 | + | ||
| 24 | +import java.io.IOException; | ||
| 25 | +import java.util.List; | ||
| 26 | + | ||
| 27 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||
| 28 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 29 | + | ||
| 30 | +@Tag(name = "管理后台 - MES 点检保养方案") | ||
| 31 | +@RestController | ||
| 32 | +@RequestMapping("/mes/dv/check-plan") | ||
| 33 | +@Validated | ||
| 34 | +public class MesDvCheckPlanController { | ||
| 35 | + | ||
| 36 | + @Resource | ||
| 37 | + private MesDvCheckPlanService checkPlanService; | ||
| 38 | + | ||
| 39 | + @PostMapping("/create") | ||
| 40 | + @Operation(summary = "创建点检保养方案") | ||
| 41 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-plan:create')") | ||
| 42 | + public CommonResult<Long> createCheckPlan(@Valid @RequestBody MesDvCheckPlanSaveReqVO createReqVO) { | ||
| 43 | + return success(checkPlanService.createCheckPlan(createReqVO)); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @PutMapping("/update") | ||
| 47 | + @Operation(summary = "更新点检保养方案") | ||
| 48 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-plan:update')") | ||
| 49 | + public CommonResult<Boolean> updateCheckPlan(@Valid @RequestBody MesDvCheckPlanSaveReqVO updateReqVO) { | ||
| 50 | + checkPlanService.updateCheckPlan(updateReqVO); | ||
| 51 | + return success(true); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @PutMapping("/enable") | ||
| 55 | + @Operation(summary = "启用点检保养方案") | ||
| 56 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 57 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-plan:update')") | ||
| 58 | + public CommonResult<Boolean> enableCheckPlan(@RequestParam("id") Long id) { | ||
| 59 | + checkPlanService.enableCheckPlan(id); | ||
| 60 | + return success(true); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @PutMapping("/disable") | ||
| 64 | + @Operation(summary = "停用点检保养方案") | ||
| 65 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 66 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-plan:update')") | ||
| 67 | + public CommonResult<Boolean> disableCheckPlan(@RequestParam("id") Long id) { | ||
| 68 | + checkPlanService.disableCheckPlan(id); | ||
| 69 | + return success(true); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @DeleteMapping("/delete") | ||
| 73 | + @Operation(summary = "删除点检保养方案") | ||
| 74 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 75 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-plan:delete')") | ||
| 76 | + public CommonResult<Boolean> deleteCheckPlan(@RequestParam("id") Long id) { | ||
| 77 | + checkPlanService.deleteCheckPlan(id); | ||
| 78 | + return success(true); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @GetMapping("/get") | ||
| 82 | + @Operation(summary = "获得点检保养方案") | ||
| 83 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 84 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-plan:query')") | ||
| 85 | + public CommonResult<MesDvCheckPlanRespVO> getCheckPlan(@RequestParam("id") Long id) { | ||
| 86 | + MesDvCheckPlanDO checkPlan = checkPlanService.getCheckPlan(id); | ||
| 87 | + return success(BeanUtils.toBean(checkPlan, MesDvCheckPlanRespVO.class)); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + @GetMapping("/page") | ||
| 91 | + @Operation(summary = "获得点检保养方案分页") | ||
| 92 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-plan:query')") | ||
| 93 | + public CommonResult<PageResult<MesDvCheckPlanRespVO>> getCheckPlanPage(@Valid MesDvCheckPlanPageReqVO pageReqVO) { | ||
| 94 | + PageResult<MesDvCheckPlanDO> pageResult = checkPlanService.getCheckPlanPage(pageReqVO); | ||
| 95 | + return success(BeanUtils.toBean(pageResult, MesDvCheckPlanRespVO.class)); | ||
| 96 | + } | ||
| 97 | + | ||
| 98 | + @GetMapping("/export-excel") | ||
| 99 | + @Operation(summary = "导出点检保养方案 Excel") | ||
| 100 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-plan:export')") | ||
| 101 | + @ApiAccessLog(operateType = EXPORT) | ||
| 102 | + public void exportCheckPlanExcel(@Valid MesDvCheckPlanPageReqVO pageReqVO, | ||
| 103 | + HttpServletResponse response) throws IOException { | ||
| 104 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 105 | + List<MesDvCheckPlanDO> list = checkPlanService.getCheckPlanPage(pageReqVO).getList(); | ||
| 106 | + // 导出 Excel | ||
| 107 | + ExcelUtils.write(response, "点检保养方案.xls", "数据", MesDvCheckPlanRespVO.class, | ||
| 108 | + BeanUtils.toBean(list, MesDvCheckPlanRespVO.class)); | ||
| 109 | + } | ||
| 110 | + | ||
| 111 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkplan/MesDvCheckPlanMachineryController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan; | ||
| 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.CollectionUtils; | ||
| 6 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 7 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.machinery.MesDvCheckPlanMachineryRespVO; | ||
| 8 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.machinery.MesDvCheckPlanMachinerySaveReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.checkplan.MesDvCheckPlanMachineryDO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.machinery.MesDvMachineryDO; | ||
| 11 | +import cn.iocoder.yudao.module.mes.service.dv.checkplan.MesDvCheckPlanMachineryService; | ||
| 12 | +import cn.iocoder.yudao.module.mes.service.dv.machinery.MesDvMachineryService; | ||
| 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.validation.Valid; | ||
| 18 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 19 | +import org.springframework.validation.annotation.Validated; | ||
| 20 | +import org.springframework.web.bind.annotation.*; | ||
| 21 | + | ||
| 22 | +import java.util.List; | ||
| 23 | +import java.util.Map; | ||
| 24 | + | ||
| 25 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 26 | + | ||
| 27 | +@Tag(name = "管理后台 - MES 点检保养方案设备") | ||
| 28 | +@RestController | ||
| 29 | +@RequestMapping("/mes/dv/check-plan-machinery") | ||
| 30 | +@Validated | ||
| 31 | +public class MesDvCheckPlanMachineryController { | ||
| 32 | + | ||
| 33 | + @Resource | ||
| 34 | + private MesDvCheckPlanMachineryService checkPlanMachineryService; | ||
| 35 | + @Resource | ||
| 36 | + private MesDvMachineryService machineryService; | ||
| 37 | + | ||
| 38 | + @PostMapping("/create") | ||
| 39 | + @Operation(summary = "创建方案设备关联") | ||
| 40 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-plan:update')") | ||
| 41 | + public CommonResult<Long> createCheckPlanMachinery(@Valid @RequestBody MesDvCheckPlanMachinerySaveReqVO createReqVO) { | ||
| 42 | + return success(checkPlanMachineryService.createCheckPlanMachinery(createReqVO)); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @DeleteMapping("/delete") | ||
| 46 | + @Operation(summary = "删除方案设备关联") | ||
| 47 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 48 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-plan:update')") | ||
| 49 | + public CommonResult<Boolean> deleteCheckPlanMachinery(@RequestParam("id") Long id) { | ||
| 50 | + checkPlanMachineryService.deleteCheckPlanMachinery(id); | ||
| 51 | + return success(true); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @GetMapping("/list-by-plan") | ||
| 55 | + @Operation(summary = "获得指定方案的设备列表") | ||
| 56 | + @Parameter(name = "planId", description = "方案编号", required = true) | ||
| 57 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-plan:query')") | ||
| 58 | + public CommonResult<List<MesDvCheckPlanMachineryRespVO>> getCheckPlanMachineryListByPlan( | ||
| 59 | + @RequestParam("planId") Long planId) { | ||
| 60 | + List<MesDvCheckPlanMachineryDO> list = checkPlanMachineryService.getCheckPlanMachineryListByPlanId(planId); | ||
| 61 | + List<MesDvCheckPlanMachineryRespVO> respList = BeanUtils.toBean(list, MesDvCheckPlanMachineryRespVO.class); | ||
| 62 | + // TODO @AI:为空,直接 return; | ||
| 63 | + // 拼装设备编码/名称/品牌/规格 | ||
| 64 | + // TODO @AI:拆出来,放在 buildVO 那; | ||
| 65 | + if (CollUtil.isNotEmpty(respList)) { | ||
| 66 | + // TODO @AI:convertMap; | ||
| 67 | + List<Long> machineryIds = CollectionUtils.convertList(respList, MesDvCheckPlanMachineryRespVO::getMachineryId); | ||
| 68 | + // TODO @AI:这里暂时没实现; | ||
| 69 | + Map<Long, MesDvMachineryDO> machineryMap = machineryService.getMachineryMap(machineryIds); | ||
| 70 | + respList.forEach(resp -> { | ||
| 71 | + MesDvMachineryDO machinery = machineryMap.get(resp.getMachineryId()); | ||
| 72 | + if (machinery != null) { | ||
| 73 | + // TODO @AI:链式调用; | ||
| 74 | + resp.setMachineryCode(machinery.getCode()); | ||
| 75 | + resp.setMachineryName(machinery.getName()); | ||
| 76 | + resp.setMachineryBrand(machinery.getBrand()); | ||
| 77 | + resp.setMachinerySpec(machinery.getSpec()); | ||
| 78 | + } | ||
| 79 | + }); | ||
| 80 | + } | ||
| 81 | + return success(respList); | ||
| 82 | + } | ||
| 83 | + | ||
| 84 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkplan/MesDvCheckPlanSubjectController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan; | ||
| 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.CollectionUtils; | ||
| 6 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 7 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.subject.MesDvCheckPlanSubjectRespVO; | ||
| 8 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.subject.MesDvCheckPlanSubjectSaveReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.checkplan.MesDvCheckPlanSubjectDO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.subject.MesDvSubjectDO; | ||
| 11 | +import cn.iocoder.yudao.module.mes.service.dv.checkplan.MesDvCheckPlanSubjectService; | ||
| 12 | +import cn.iocoder.yudao.module.mes.service.dv.subject.MesDvSubjectService; | ||
| 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.validation.Valid; | ||
| 18 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 19 | +import org.springframework.validation.annotation.Validated; | ||
| 20 | +import org.springframework.web.bind.annotation.*; | ||
| 21 | + | ||
| 22 | +import java.util.List; | ||
| 23 | +import java.util.Map; | ||
| 24 | + | ||
| 25 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 26 | + | ||
| 27 | +@Tag(name = "管理后台 - MES 点检保养方案项目") | ||
| 28 | +@RestController | ||
| 29 | +@RequestMapping("/mes/dv/check-plan-subject") | ||
| 30 | +@Validated | ||
| 31 | +public class MesDvCheckPlanSubjectController { | ||
| 32 | + | ||
| 33 | + @Resource | ||
| 34 | + private MesDvCheckPlanSubjectService checkPlanSubjectService; | ||
| 35 | + @Resource | ||
| 36 | + private MesDvSubjectService subjectService; | ||
| 37 | + | ||
| 38 | + @PostMapping("/create") | ||
| 39 | + @Operation(summary = "创建方案项目关联") | ||
| 40 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-plan:update')") | ||
| 41 | + public CommonResult<Long> createCheckPlanSubject(@Valid @RequestBody MesDvCheckPlanSubjectSaveReqVO createReqVO) { | ||
| 42 | + return success(checkPlanSubjectService.createCheckPlanSubject(createReqVO)); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @DeleteMapping("/delete") | ||
| 46 | + @Operation(summary = "删除方案项目关联") | ||
| 47 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 48 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-plan:update')") | ||
| 49 | + public CommonResult<Boolean> deleteCheckPlanSubject(@RequestParam("id") Long id) { | ||
| 50 | + checkPlanSubjectService.deleteCheckPlanSubject(id); | ||
| 51 | + return success(true); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @GetMapping("/list-by-plan") | ||
| 55 | + @Operation(summary = "获得指定方案的项目列表") | ||
| 56 | + @Parameter(name = "planId", description = "方案编号", required = true) | ||
| 57 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-plan:query')") | ||
| 58 | + public CommonResult<List<MesDvCheckPlanSubjectRespVO>> getCheckPlanSubjectListByPlan( | ||
| 59 | + @RequestParam("planId") Long planId) { | ||
| 60 | + List<MesDvCheckPlanSubjectDO> list = checkPlanSubjectService.getCheckPlanSubjectListByPlanId(planId); | ||
| 61 | + List<MesDvCheckPlanSubjectRespVO> respList = BeanUtils.toBean(list, MesDvCheckPlanSubjectRespVO.class); | ||
| 62 | + // 拼装项目编码/名称/类型/内容/标准 | ||
| 63 | + // MesDvCheckPlanMachineryController.java 参考下里面的 todo; | ||
| 64 | + if (CollUtil.isNotEmpty(respList)) { | ||
| 65 | + List<Long> subjectIds = CollectionUtils.convertList(respList, MesDvCheckPlanSubjectRespVO::getSubjectId); | ||
| 66 | + Map<Long, MesDvSubjectDO> subjectMap = subjectService.getSubjectMap(subjectIds); | ||
| 67 | + respList.forEach(resp -> { | ||
| 68 | + MesDvSubjectDO subject = subjectMap.get(resp.getSubjectId()); | ||
| 69 | + if (subject != null) { | ||
| 70 | + resp.setSubjectCode(subject.getCode()); | ||
| 71 | + resp.setSubjectName(subject.getName()); | ||
| 72 | + resp.setSubjectType(subject.getType()); | ||
| 73 | + resp.setSubjectContent(subject.getContent()); | ||
| 74 | + resp.setSubjectStandard(subject.getStandard()); | ||
| 75 | + } | ||
| 76 | + }); | ||
| 77 | + } | ||
| 78 | + return success(respList); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkplan/vo/MesDvCheckPlanPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.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 MesDvCheckPlanPageReqVO extends PageParam { | ||
| 19 | + | ||
| 20 | + @Schema(description = "方案编码", example = "CHP001") | ||
| 21 | + private String code; | ||
| 22 | + | ||
| 23 | + @Schema(description = "方案名称", example = "注塑机") | ||
| 24 | + private String name; | ||
| 25 | + | ||
| 26 | + @Schema(description = "方案类型", example = "1") | ||
| 27 | + private Integer 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[] createTime; | ||
| 35 | + | ||
| 36 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkplan/vo/MesDvCheckPlanRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.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 MesDvCheckPlanRespVO { | ||
| 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 = "CHP001") | ||
| 20 | + @ExcelProperty("方案编码") | ||
| 21 | + private String code; | ||
| 22 | + | ||
| 23 | + @Schema(description = "方案名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "注塑机日检方案") | ||
| 24 | + @ExcelProperty("方案名称") | ||
| 25 | + private String name; | ||
| 26 | + | ||
| 27 | + @Schema(description = "方案类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 28 | + @ExcelProperty("方案类型") | ||
| 29 | + private Integer type; | ||
| 30 | + | ||
| 31 | + @Schema(description = "开始日期") | ||
| 32 | + @ExcelProperty("开始日期") | ||
| 33 | + private LocalDateTime startDate; | ||
| 34 | + | ||
| 35 | + @Schema(description = "结束日期") | ||
| 36 | + @ExcelProperty("结束日期") | ||
| 37 | + private LocalDateTime endDate; | ||
| 38 | + | ||
| 39 | + @Schema(description = "周期类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 40 | + @ExcelProperty("周期类型") | ||
| 41 | + private Integer cycleType; | ||
| 42 | + | ||
| 43 | + @Schema(description = "周期数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 44 | + @ExcelProperty("周期数量") | ||
| 45 | + private Integer cycleCount; | ||
| 46 | + | ||
| 47 | + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | ||
| 48 | + @ExcelProperty("状态") | ||
| 49 | + private Integer status; | ||
| 50 | + | ||
| 51 | + @Schema(description = "备注") | ||
| 52 | + @ExcelProperty("备注") | ||
| 53 | + private String remark; | ||
| 54 | + | ||
| 55 | + @Schema(description = "预留字段1") | ||
| 56 | + private String attribute1; | ||
| 57 | + | ||
| 58 | + @Schema(description = "预留字段2") | ||
| 59 | + private String attribute2; | ||
| 60 | + | ||
| 61 | + @Schema(description = "预留字段3") | ||
| 62 | + private Integer attribute3; | ||
| 63 | + | ||
| 64 | + @Schema(description = "预留字段4") | ||
| 65 | + private Integer attribute4; | ||
| 66 | + | ||
| 67 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 68 | + @ExcelProperty("创建时间") | ||
| 69 | + private LocalDateTime createTime; | ||
| 70 | + | ||
| 71 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkplan/vo/MesDvCheckPlanSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.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 MesDvCheckPlanSaveReqVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "编号", example = "1024") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + @Schema(description = "方案编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "CHP001") | ||
| 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 = "方案类型(1=设备点检,2=设备保养)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 26 | + @NotNull(message = "方案类型不能为空") | ||
| 27 | + private Integer type; | ||
| 28 | + | ||
| 29 | + @Schema(description = "开始日期") | ||
| 30 | + private LocalDateTime startDate; | ||
| 31 | + | ||
| 32 | + @Schema(description = "结束日期") | ||
| 33 | + private LocalDateTime endDate; | ||
| 34 | + | ||
| 35 | + @Schema(description = "周期类型(1=天,2=周,3=月,4=年)", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 36 | + @NotNull(message = "周期类型不能为空") | ||
| 37 | + private Integer cycleType; | ||
| 38 | + | ||
| 39 | + @Schema(description = "周期数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 40 | + @NotNull(message = "周期数量不能为空") | ||
| 41 | + private Integer cycleCount; | ||
| 42 | + | ||
| 43 | + @Schema(description = "状态", example = "0") | ||
| 44 | + private Integer status; | ||
| 45 | + | ||
| 46 | + @Schema(description = "备注") | ||
| 47 | + private String remark; | ||
| 48 | + | ||
| 49 | + @Schema(description = "预留字段1") | ||
| 50 | + private String attribute1; | ||
| 51 | + | ||
| 52 | + @Schema(description = "预留字段2") | ||
| 53 | + private String attribute2; | ||
| 54 | + | ||
| 55 | + @Schema(description = "预留字段3") | ||
| 56 | + private Integer attribute3; | ||
| 57 | + | ||
| 58 | + @Schema(description = "预留字段4") | ||
| 59 | + private Integer attribute4; | ||
| 60 | + | ||
| 61 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkplan/vo/machinery/MesDvCheckPlanMachineryRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.machinery; | ||
| 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 MesDvCheckPlanMachineryRespVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | + @Schema(description = "方案编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 16 | + private Long planId; | ||
| 17 | + | ||
| 18 | + @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 19 | + private Long machineryId; | ||
| 20 | + | ||
| 21 | + @Schema(description = "设备编码", example = "EQ001") | ||
| 22 | + private String machineryCode; | ||
| 23 | + | ||
| 24 | + @Schema(description = "设备名称", example = "注塑机A") | ||
| 25 | + private String machineryName; | ||
| 26 | + | ||
| 27 | + @Schema(description = "品牌", example = "海天") | ||
| 28 | + private String machineryBrand; | ||
| 29 | + | ||
| 30 | + @Schema(description = "规格型号", example = "HTF120") | ||
| 31 | + private String machinerySpec; | ||
| 32 | + | ||
| 33 | + @Schema(description = "备注") | ||
| 34 | + private String remark; | ||
| 35 | + | ||
| 36 | + @Schema(description = "预留字段1") | ||
| 37 | + private String attribute1; | ||
| 38 | + | ||
| 39 | + @Schema(description = "预留字段2") | ||
| 40 | + private String attribute2; | ||
| 41 | + | ||
| 42 | + @Schema(description = "预留字段3") | ||
| 43 | + private Integer attribute3; | ||
| 44 | + | ||
| 45 | + @Schema(description = "预留字段4") | ||
| 46 | + private Integer attribute4; | ||
| 47 | + | ||
| 48 | + @Schema(description = "创建时间") | ||
| 49 | + private LocalDateTime createTime; | ||
| 50 | + | ||
| 51 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkplan/vo/machinery/MesDvCheckPlanMachinerySaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.machinery; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.NotNull; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +@Schema(description = "管理后台 - MES 点检保养方案设备新增 Request VO") | ||
| 8 | +@Data | ||
| 9 | +public class MesDvCheckPlanMachinerySaveReqVO { | ||
| 10 | + | ||
| 11 | + @Schema(description = "编号", example = "1024") | ||
| 12 | + private Long id; | ||
| 13 | + | ||
| 14 | + @Schema(description = "方案编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 15 | + @NotNull(message = "方案编号不能为空") | ||
| 16 | + private Long planId; | ||
| 17 | + | ||
| 18 | + @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 19 | + @NotNull(message = "设备不能为空") | ||
| 20 | + private Long machineryId; | ||
| 21 | + | ||
| 22 | + @Schema(description = "备注") | ||
| 23 | + private String remark; | ||
| 24 | + | ||
| 25 | + @Schema(description = "预留字段1") | ||
| 26 | + private String attribute1; | ||
| 27 | + | ||
| 28 | + @Schema(description = "预留字段2") | ||
| 29 | + private String attribute2; | ||
| 30 | + | ||
| 31 | + @Schema(description = "预留字段3") | ||
| 32 | + private Integer attribute3; | ||
| 33 | + | ||
| 34 | + @Schema(description = "预留字段4") | ||
| 35 | + private Integer attribute4; | ||
| 36 | + | ||
| 37 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkplan/vo/subject/MesDvCheckPlanSubjectRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.subject; | ||
| 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 MesDvCheckPlanSubjectRespVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | + @Schema(description = "方案编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 16 | + private Long planId; | ||
| 17 | + | ||
| 18 | + @Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 19 | + private Long subjectId; | ||
| 20 | + | ||
| 21 | + @Schema(description = "项目编码", example = "CHK001") | ||
| 22 | + private String subjectCode; | ||
| 23 | + | ||
| 24 | + @Schema(description = "项目名称", example = "油温检查") | ||
| 25 | + private String subjectName; | ||
| 26 | + | ||
| 27 | + @Schema(description = "项目类型", example = "1") | ||
| 28 | + private Integer subjectType; | ||
| 29 | + | ||
| 30 | + @Schema(description = "项目内容", example = "检查油温是否正常") | ||
| 31 | + private String subjectContent; | ||
| 32 | + | ||
| 33 | + @Schema(description = "标准", example = "40-60°C") | ||
| 34 | + private String subjectStandard; | ||
| 35 | + | ||
| 36 | + @Schema(description = "备注") | ||
| 37 | + private String remark; | ||
| 38 | + | ||
| 39 | + @Schema(description = "预留字段1") | ||
| 40 | + private String attribute1; | ||
| 41 | + | ||
| 42 | + @Schema(description = "预留字段2") | ||
| 43 | + private String attribute2; | ||
| 44 | + | ||
| 45 | + @Schema(description = "预留字段3") | ||
| 46 | + private Integer attribute3; | ||
| 47 | + | ||
| 48 | + @Schema(description = "预留字段4") | ||
| 49 | + private Integer attribute4; | ||
| 50 | + | ||
| 51 | + @Schema(description = "创建时间") | ||
| 52 | + private LocalDateTime createTime; | ||
| 53 | + | ||
| 54 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkplan/vo/subject/MesDvCheckPlanSubjectSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.subject; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.NotNull; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +@Schema(description = "管理后台 - MES 点检保养方案项目新增 Request VO") | ||
| 8 | +@Data | ||
| 9 | +public class MesDvCheckPlanSubjectSaveReqVO { | ||
| 10 | + | ||
| 11 | + @Schema(description = "编号", example = "1024") | ||
| 12 | + private Long id; | ||
| 13 | + | ||
| 14 | + @Schema(description = "方案编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 15 | + @NotNull(message = "方案编号不能为空") | ||
| 16 | + private Long planId; | ||
| 17 | + | ||
| 18 | + @Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 19 | + @NotNull(message = "点检保养项目不能为空") | ||
| 20 | + private Long subjectId; | ||
| 21 | + | ||
| 22 | + @Schema(description = "备注") | ||
| 23 | + private String remark; | ||
| 24 | + | ||
| 25 | + @Schema(description = "预留字段1") | ||
| 26 | + private String attribute1; | ||
| 27 | + | ||
| 28 | + @Schema(description = "预留字段2") | ||
| 29 | + private String attribute2; | ||
| 30 | + | ||
| 31 | + @Schema(description = "预留字段3") | ||
| 32 | + private Integer attribute3; | ||
| 33 | + | ||
| 34 | + @Schema(description = "预留字段4") | ||
| 35 | + private Integer attribute4; | ||
| 36 | + | ||
| 37 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/dv/checkplan/MesDvCheckPlanDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.dal.dataobject.dv.checkplan; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 4 | +import cn.iocoder.yudao.module.mes.enums.dv.MesDvCheckPlanStatusEnum; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 6 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 7 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 8 | +import lombok.*; | ||
| 9 | + | ||
| 10 | +import java.time.LocalDateTime; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * MES 点检保养方案 DO | ||
| 14 | + * | ||
| 15 | + * @author 芋道源码 | ||
| 16 | + */ | ||
| 17 | +@TableName("mes_dv_check_plan") | ||
| 18 | +@KeySequence("mes_dv_check_plan_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。 | ||
| 19 | +@Data | ||
| 20 | +@EqualsAndHashCode(callSuper = true) | ||
| 21 | +@ToString(callSuper = true) | ||
| 22 | +@Builder | ||
| 23 | +@NoArgsConstructor | ||
| 24 | +@AllArgsConstructor | ||
| 25 | +public class MesDvCheckPlanDO extends BaseDO { | ||
| 26 | + | ||
| 27 | + /** | ||
| 28 | + * 编号 | ||
| 29 | + */ | ||
| 30 | + @TableId | ||
| 31 | + private Long id; | ||
| 32 | + /** | ||
| 33 | + * 方案编码 | ||
| 34 | + */ | ||
| 35 | + private String code; | ||
| 36 | + /** | ||
| 37 | + * 方案名称 | ||
| 38 | + */ | ||
| 39 | + private String name; | ||
| 40 | + // TODO @AI:需要在 dict constants 里枚举下,然后 @过去 | ||
| 41 | + /** | ||
| 42 | + * 方案类型 | ||
| 43 | + * | ||
| 44 | + * 字典类型 mes_dv_subject_type(1=设备点检,2=设备保养) | ||
| 45 | + */ | ||
| 46 | + private Integer type; | ||
| 47 | + /** | ||
| 48 | + * 开始日期 | ||
| 49 | + */ | ||
| 50 | + private LocalDateTime startDate; | ||
| 51 | + /** | ||
| 52 | + * 结束日期 | ||
| 53 | + */ | ||
| 54 | + private LocalDateTime endDate; | ||
| 55 | + // TODO @AI:需要在 dict constants 里枚举下,然后 @过去 | ||
| 56 | + /** | ||
| 57 | + * 周期类型 | ||
| 58 | + * | ||
| 59 | + * 字典类型 mes_dv_cycle_type(1=天,2=周,3=月,4=年) | ||
| 60 | + */ | ||
| 61 | + private Integer cycleType; | ||
| 62 | + /** | ||
| 63 | + * 周期数量 | ||
| 64 | + */ | ||
| 65 | + private Integer cycleCount; | ||
| 66 | + /** | ||
| 67 | + * 状态 | ||
| 68 | + * | ||
| 69 | + * 枚举 {@link MesDvCheckPlanStatusEnum} | ||
| 70 | + */ | ||
| 71 | + private Integer status; | ||
| 72 | + /** | ||
| 73 | + * 备注 | ||
| 74 | + */ | ||
| 75 | + private String remark; | ||
| 76 | + /** | ||
| 77 | + * 预留字段1 | ||
| 78 | + */ | ||
| 79 | + private String attribute1; | ||
| 80 | + /** | ||
| 81 | + * 预留字段2 | ||
| 82 | + */ | ||
| 83 | + private String attribute2; | ||
| 84 | + /** | ||
| 85 | + * 预留字段3 | ||
| 86 | + */ | ||
| 87 | + private Integer attribute3; | ||
| 88 | + /** | ||
| 89 | + * 预留字段4 | ||
| 90 | + */ | ||
| 91 | + private Integer attribute4; | ||
| 92 | + | ||
| 93 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/dv/checkplan/MesDvCheckPlanMachineryDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.dal.dataobject.dv.checkplan; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 4 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.machinery.MesDvMachineryDO; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 6 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 7 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 8 | +import lombok.*; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * MES 点检保养方案设备 DO | ||
| 12 | + * | ||
| 13 | + * @author 芋道源码 | ||
| 14 | + */ | ||
| 15 | +@TableName("mes_dv_check_plan_machinery") | ||
| 16 | +@KeySequence("mes_dv_check_plan_machinery_seq") | ||
| 17 | +@Data | ||
| 18 | +@EqualsAndHashCode(callSuper = true) | ||
| 19 | +@ToString(callSuper = true) | ||
| 20 | +@Builder | ||
| 21 | +@NoArgsConstructor | ||
| 22 | +@AllArgsConstructor | ||
| 23 | +public class MesDvCheckPlanMachineryDO extends BaseDO { | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 编号 | ||
| 27 | + */ | ||
| 28 | + @TableId | ||
| 29 | + private Long id; | ||
| 30 | + /** | ||
| 31 | + * 方案编号 | ||
| 32 | + * | ||
| 33 | + * 关联 {@link MesDvCheckPlanDO#getId()} | ||
| 34 | + */ | ||
| 35 | + private Long planId; | ||
| 36 | + /** | ||
| 37 | + * 设备编号 | ||
| 38 | + * | ||
| 39 | + * 关联 {@link MesDvMachineryDO#getId()} | ||
| 40 | + */ | ||
| 41 | + private Long machineryId; | ||
| 42 | + /** | ||
| 43 | + * 备注 | ||
| 44 | + */ | ||
| 45 | + private String remark; | ||
| 46 | + /** | ||
| 47 | + * 预留字段1 | ||
| 48 | + */ | ||
| 49 | + private String attribute1; | ||
| 50 | + /** | ||
| 51 | + * 预留字段2 | ||
| 52 | + */ | ||
| 53 | + private String attribute2; | ||
| 54 | + /** | ||
| 55 | + * 预留字段3 | ||
| 56 | + */ | ||
| 57 | + private Integer attribute3; | ||
| 58 | + /** | ||
| 59 | + * 预留字段4 | ||
| 60 | + */ | ||
| 61 | + private Integer attribute4; | ||
| 62 | + | ||
| 63 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/dataobject/dv/checkplan/MesDvCheckPlanSubjectDO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.dal.dataobject.dv.checkplan; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; | ||
| 4 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.subject.MesDvSubjectDO; | ||
| 5 | +import com.baomidou.mybatisplus.annotation.KeySequence; | ||
| 6 | +import com.baomidou.mybatisplus.annotation.TableId; | ||
| 7 | +import com.baomidou.mybatisplus.annotation.TableName; | ||
| 8 | +import lombok.*; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * MES 点检保养方案项目 DO | ||
| 12 | + * | ||
| 13 | + * @author 芋道源码 | ||
| 14 | + */ | ||
| 15 | +@TableName("mes_dv_check_plan_subject") | ||
| 16 | +@KeySequence("mes_dv_check_plan_subject_seq") | ||
| 17 | +@Data | ||
| 18 | +@EqualsAndHashCode(callSuper = true) | ||
| 19 | +@ToString(callSuper = true) | ||
| 20 | +@Builder | ||
| 21 | +@NoArgsConstructor | ||
| 22 | +@AllArgsConstructor | ||
| 23 | +public class MesDvCheckPlanSubjectDO extends BaseDO { | ||
| 24 | + | ||
| 25 | + /** | ||
| 26 | + * 编号 | ||
| 27 | + */ | ||
| 28 | + @TableId | ||
| 29 | + private Long id; | ||
| 30 | + /** | ||
| 31 | + * 方案编号 | ||
| 32 | + * | ||
| 33 | + * 关联 {@link MesDvCheckPlanDO#getId()} | ||
| 34 | + */ | ||
| 35 | + private Long planId; | ||
| 36 | + /** | ||
| 37 | + * 项目编号 | ||
| 38 | + * | ||
| 39 | + * 关联 {@link MesDvSubjectDO#getId()} | ||
| 40 | + */ | ||
| 41 | + private Long subjectId; | ||
| 42 | + /** | ||
| 43 | + * 备注 | ||
| 44 | + */ | ||
| 45 | + private String remark; | ||
| 46 | + /** | ||
| 47 | + * 预留字段1 | ||
| 48 | + */ | ||
| 49 | + private String attribute1; | ||
| 50 | + /** | ||
| 51 | + * 预留字段2 | ||
| 52 | + */ | ||
| 53 | + private String attribute2; | ||
| 54 | + /** | ||
| 55 | + * 预留字段3 | ||
| 56 | + */ | ||
| 57 | + private Integer attribute3; | ||
| 58 | + /** | ||
| 59 | + * 预留字段4 | ||
| 60 | + */ | ||
| 61 | + private Integer attribute4; | ||
| 62 | + | ||
| 63 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/dv/checkplan/MesDvCheckPlanMachineryMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.dal.mysql.dv.checkplan; | ||
| 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.dv.checkplan.MesDvCheckPlanMachineryDO; | ||
| 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 MesDvCheckPlanMachineryMapper extends BaseMapperX<MesDvCheckPlanMachineryDO> { | ||
| 17 | + | ||
| 18 | + default List<MesDvCheckPlanMachineryDO> selectListByPlanId(Long planId) { | ||
| 19 | + return selectList(MesDvCheckPlanMachineryDO::getPlanId, planId); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + default Long selectCountByPlanId(Long planId) { | ||
| 23 | + return selectCount(MesDvCheckPlanMachineryDO::getPlanId, planId); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + default void deleteByPlanId(Long planId) { | ||
| 27 | + delete(new LambdaQueryWrapperX<MesDvCheckPlanMachineryDO>() | ||
| 28 | + .eq(MesDvCheckPlanMachineryDO::getPlanId, planId)); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/dv/checkplan/MesDvCheckPlanMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.dal.mysql.dv.checkplan; | ||
| 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.dv.checkplan.vo.MesDvCheckPlanPageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.checkplan.MesDvCheckPlanDO; | ||
| 8 | +import org.apache.ibatis.annotations.Mapper; | ||
| 9 | + | ||
| 10 | +/** | ||
| 11 | + * MES 点检保养方案 Mapper | ||
| 12 | + * | ||
| 13 | + * @author 芋道源码 | ||
| 14 | + */ | ||
| 15 | +@Mapper | ||
| 16 | +public interface MesDvCheckPlanMapper extends BaseMapperX<MesDvCheckPlanDO> { | ||
| 17 | + | ||
| 18 | + default PageResult<MesDvCheckPlanDO> selectPage(MesDvCheckPlanPageReqVO reqVO) { | ||
| 19 | + return selectPage(reqVO, new LambdaQueryWrapperX<MesDvCheckPlanDO>() | ||
| 20 | + .likeIfPresent(MesDvCheckPlanDO::getCode, reqVO.getCode()) | ||
| 21 | + .likeIfPresent(MesDvCheckPlanDO::getName, reqVO.getName()) | ||
| 22 | + .eqIfPresent(MesDvCheckPlanDO::getType, reqVO.getType()) | ||
| 23 | + .eqIfPresent(MesDvCheckPlanDO::getStatus, reqVO.getStatus()) | ||
| 24 | + .betweenIfPresent(MesDvCheckPlanDO::getCreateTime, reqVO.getCreateTime()) | ||
| 25 | + .orderByDesc(MesDvCheckPlanDO::getId)); | ||
| 26 | + } | ||
| 27 | + | ||
| 28 | + default MesDvCheckPlanDO selectByCode(String code) { | ||
| 29 | + return selectOne(MesDvCheckPlanDO::getCode, code); | ||
| 30 | + } | ||
| 31 | + | ||
| 32 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/dal/mysql/dv/checkplan/MesDvCheckPlanSubjectMapper.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.dal.mysql.dv.checkplan; | ||
| 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.dv.checkplan.MesDvCheckPlanSubjectDO; | ||
| 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 MesDvCheckPlanSubjectMapper extends BaseMapperX<MesDvCheckPlanSubjectDO> { | ||
| 17 | + | ||
| 18 | + default List<MesDvCheckPlanSubjectDO> selectListByPlanId(Long planId) { | ||
| 19 | + return selectList(MesDvCheckPlanSubjectDO::getPlanId, planId); | ||
| 20 | + } | ||
| 21 | + | ||
| 22 | + default Long selectCountByPlanId(Long planId) { | ||
| 23 | + return selectCount(MesDvCheckPlanSubjectDO::getPlanId, planId); | ||
| 24 | + } | ||
| 25 | + | ||
| 26 | + default void deleteByPlanId(Long planId) { | ||
| 27 | + delete(new LambdaQueryWrapperX<MesDvCheckPlanSubjectDO>() | ||
| 28 | + .eq(MesDvCheckPlanSubjectDO::getPlanId, planId)); | ||
| 29 | + } | ||
| 30 | + | ||
| 31 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/enums/ErrorCodeConstants.java
| @@ -126,10 +126,23 @@ public interface ErrorCodeConstants { | @@ -126,10 +126,23 @@ public interface ErrorCodeConstants { | ||
| 126 | 126 | ||
| 127 | // ========== MES 设备管理-点检计划(1-040-302-000) ========== | 127 | // ========== MES 设备管理-点检计划(1-040-302-000) ========== |
| 128 | ErrorCode DV_CHECK_PLAN_NOT_EXISTS = new ErrorCode(1_040_302_000, "点检计划不存在"); | 128 | ErrorCode DV_CHECK_PLAN_NOT_EXISTS = new ErrorCode(1_040_302_000, "点检计划不存在"); |
| 129 | + ErrorCode DV_CHECK_PLAN_CODE_DUPLICATE = new ErrorCode(1_040_302_001, "点检保养方案编码已存在"); | ||
| 130 | + ErrorCode DV_CHECK_PLAN_NOT_PREPARE = new ErrorCode(1_040_302_002, "点检保养方案已启用,不允许修改或删除"); | ||
| 131 | + ErrorCode DV_CHECK_PLAN_NO_MACHINERY = new ErrorCode(1_040_302_003, "启用方案时,至少需要关联一台设备"); | ||
| 132 | + ErrorCode DV_CHECK_PLAN_NO_SUBJECT = new ErrorCode(1_040_302_004, "启用方案时,至少需要关联一个点检保养项目"); | ||
| 133 | + // ========== MES 设备管理-点检方案设备(1-040-302-100) ========== | ||
| 134 | + ErrorCode DV_CHECK_PLAN_MACHINERY_NOT_EXISTS = new ErrorCode(1_040_302_100, "点检保养方案设备不存在"); | ||
| 135 | + // ========== MES 设备管理-点检方案项目(1-040-302-200) ========== | ||
| 136 | + ErrorCode DV_CHECK_PLAN_SUBJECT_NOT_EXISTS = new ErrorCode(1_040_302_200, "点检保养方案项目不存在"); | ||
| 129 | 137 | ||
| 130 | // ========== MES 设备管理-维修工单(1-040-303-000) ========== | 138 | // ========== MES 设备管理-维修工单(1-040-303-000) ========== |
| 131 | ErrorCode DV_REPAIR_NOT_EXISTS = new ErrorCode(1_040_303_000, "维修工单不存在"); | 139 | ErrorCode DV_REPAIR_NOT_EXISTS = new ErrorCode(1_040_303_000, "维修工单不存在"); |
| 132 | 140 | ||
| 141 | + // ========== MES 设备管理-保养记录(1-040-305-000) ========== | ||
| 142 | + ErrorCode MAINTEN_RECORD_NOT_EXISTS = new ErrorCode(1_040_305_000, "设备保养记录不存在"); | ||
| 143 | + // ========== MES 设备管理-保养记录明细(1-040-305-100) ========== | ||
| 144 | + ErrorCode MAINTEN_RECORD_LINE_NOT_EXISTS = new ErrorCode(1_040_305_100, "设备保养记录明细不存在"); | ||
| 145 | + | ||
| 133 | // ========== MES 工具管理-工具类型(1-040-400-000) ========== | 146 | // ========== MES 工具管理-工具类型(1-040-400-000) ========== |
| 134 | ErrorCode TM_TOOL_TYPE_NOT_EXISTS = new ErrorCode(1_040_400_000, "工具类型不存在"); | 147 | ErrorCode TM_TOOL_TYPE_NOT_EXISTS = new ErrorCode(1_040_400_000, "工具类型不存在"); |
| 135 | ErrorCode TM_TOOL_TYPE_CODE_DUPLICATE = new ErrorCode(1_040_400_001, "工具类型编码已存在"); | 148 | ErrorCode TM_TOOL_TYPE_CODE_DUPLICATE = new ErrorCode(1_040_400_001, "工具类型编码已存在"); |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/enums/dv/MesDvCheckPlanStatusEnum.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.enums.dv; | ||
| 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 MesDvCheckPlanStatusEnum implements ArrayValuable<Integer> { | ||
| 17 | + | ||
| 18 | + PREPARE(0, "草稿"), | ||
| 19 | + ENABLED(1, "已启用"); | ||
| 20 | + | ||
| 21 | + public static final Integer[] ARRAYS = Arrays.stream(values()).map(MesDvCheckPlanStatusEnum::getStatus).toArray(Integer[]::new); | ||
| 22 | + | ||
| 23 | + /** | ||
| 24 | + * 状态值 | ||
| 25 | + */ | ||
| 26 | + private final Integer status; | ||
| 27 | + /** | ||
| 28 | + * 状态名 | ||
| 29 | + */ | ||
| 30 | + private final String name; | ||
| 31 | + | ||
| 32 | + @Override | ||
| 33 | + public Integer[] array() { | ||
| 34 | + return ARRAYS; | ||
| 35 | + } | ||
| 36 | + | ||
| 37 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/dv/checkplan/MesDvCheckPlanMachineryService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.service.dv.checkplan; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.machinery.MesDvCheckPlanMachinerySaveReqVO; | ||
| 4 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.checkplan.MesDvCheckPlanMachineryDO; | ||
| 5 | +import jakarta.validation.Valid; | ||
| 6 | + | ||
| 7 | +import java.util.List; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * MES 点检保养方案设备 Service 接口 | ||
| 11 | + * | ||
| 12 | + * @author 芋道源码 | ||
| 13 | + */ | ||
| 14 | +public interface MesDvCheckPlanMachineryService { | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * 创建方案设备关联 | ||
| 18 | + * | ||
| 19 | + * @param createReqVO 创建信息 | ||
| 20 | + * @return 编号 | ||
| 21 | + */ | ||
| 22 | + Long createCheckPlanMachinery(@Valid MesDvCheckPlanMachinerySaveReqVO createReqVO); | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 删除方案设备关联 | ||
| 26 | + * | ||
| 27 | + * @param id 编号 | ||
| 28 | + */ | ||
| 29 | + void deleteCheckPlanMachinery(Long id); | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 获得指定方案的设备列表 | ||
| 33 | + * | ||
| 34 | + * @param planId 方案编号 | ||
| 35 | + * @return 设备关联列表 | ||
| 36 | + */ | ||
| 37 | + List<MesDvCheckPlanMachineryDO> getCheckPlanMachineryListByPlanId(Long planId); | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 获得指定方案的设备数量 | ||
| 41 | + * | ||
| 42 | + * @param planId 方案编号 | ||
| 43 | + * @return 设备数量 | ||
| 44 | + */ | ||
| 45 | + Long getCheckPlanMachineryCountByPlanId(Long planId); | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 根据方案编号删除所有设备关联 | ||
| 49 | + * | ||
| 50 | + * @param planId 方案编号 | ||
| 51 | + */ | ||
| 52 | + void deleteByPlanId(Long planId); | ||
| 53 | + | ||
| 54 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/dv/checkplan/MesDvCheckPlanMachineryServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.service.dv.checkplan; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 4 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.machinery.MesDvCheckPlanMachinerySaveReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.checkplan.MesDvCheckPlanMachineryDO; | ||
| 6 | +import cn.iocoder.yudao.module.mes.dal.mysql.dv.checkplan.MesDvCheckPlanMachineryMapper; | ||
| 7 | +import cn.iocoder.yudao.module.mes.service.dv.machinery.MesDvMachineryService; | ||
| 8 | +import jakarta.annotation.Resource; | ||
| 9 | +import org.springframework.context.annotation.Lazy; | ||
| 10 | +import org.springframework.stereotype.Service; | ||
| 11 | +import org.springframework.validation.annotation.Validated; | ||
| 12 | + | ||
| 13 | +import java.util.List; | ||
| 14 | + | ||
| 15 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 16 | +import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * MES 点检保养方案设备 Service 实现类 | ||
| 20 | + * | ||
| 21 | + * @author 芋道源码 | ||
| 22 | + */ | ||
| 23 | +@Service | ||
| 24 | +@Validated | ||
| 25 | +public class MesDvCheckPlanMachineryServiceImpl implements MesDvCheckPlanMachineryService { | ||
| 26 | + | ||
| 27 | + @Resource | ||
| 28 | + private MesDvCheckPlanMachineryMapper checkPlanMachineryMapper; | ||
| 29 | + @Resource | ||
| 30 | + @Lazy | ||
| 31 | + private MesDvCheckPlanService checkPlanService; | ||
| 32 | + @Resource | ||
| 33 | + private MesDvMachineryService machineryService; | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public Long createCheckPlanMachinery(MesDvCheckPlanMachinerySaveReqVO createReqVO) { | ||
| 37 | + // 1.1 校验方案草稿状态 | ||
| 38 | + checkPlanService.validateCheckPlanPrepare(createReqVO.getPlanId()); | ||
| 39 | + // 1.2 校验设备存在 | ||
| 40 | + machineryService.validateMachineryExists(createReqVO.getMachineryId()); | ||
| 41 | + | ||
| 42 | + // 2. 插入 | ||
| 43 | + MesDvCheckPlanMachineryDO planMachinery = BeanUtils.toBean(createReqVO, MesDvCheckPlanMachineryDO.class); | ||
| 44 | + checkPlanMachineryMapper.insert(planMachinery); | ||
| 45 | + return planMachinery.getId(); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @Override | ||
| 49 | + public void deleteCheckPlanMachinery(Long id) { | ||
| 50 | + // 1.1 校验存在 | ||
| 51 | + MesDvCheckPlanMachineryDO existRecord = checkPlanMachineryMapper.selectById(id); | ||
| 52 | + if (existRecord == null) { | ||
| 53 | + throw exception(DV_CHECK_PLAN_MACHINERY_NOT_EXISTS); | ||
| 54 | + } | ||
| 55 | + // 1.2 校验方案草稿状态 | ||
| 56 | + checkPlanService.validateCheckPlanPrepare(existRecord.getPlanId()); | ||
| 57 | + | ||
| 58 | + // 2. 删除 | ||
| 59 | + checkPlanMachineryMapper.deleteById(id); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @Override | ||
| 63 | + public List<MesDvCheckPlanMachineryDO> getCheckPlanMachineryListByPlanId(Long planId) { | ||
| 64 | + return checkPlanMachineryMapper.selectListByPlanId(planId); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @Override | ||
| 68 | + public Long getCheckPlanMachineryCountByPlanId(Long planId) { | ||
| 69 | + return checkPlanMachineryMapper.selectCountByPlanId(planId); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @Override | ||
| 73 | + public void deleteByPlanId(Long planId) { | ||
| 74 | + checkPlanMachineryMapper.deleteByPlanId(planId); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/dv/checkplan/MesDvCheckPlanService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.service.dv.checkplan; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 4 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.MesDvCheckPlanPageReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.MesDvCheckPlanSaveReqVO; | ||
| 6 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.checkplan.MesDvCheckPlanDO; | ||
| 7 | +import jakarta.validation.Valid; | ||
| 8 | + | ||
| 9 | +import java.util.Collection; | ||
| 10 | +import java.util.List; | ||
| 11 | +import java.util.Map; | ||
| 12 | + | ||
| 13 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertMap; | ||
| 14 | + | ||
| 15 | +/** | ||
| 16 | + * MES 点检保养方案 Service 接口 | ||
| 17 | + * | ||
| 18 | + * @author 芋道源码 | ||
| 19 | + */ | ||
| 20 | +public interface MesDvCheckPlanService { | ||
| 21 | + | ||
| 22 | + /** | ||
| 23 | + * 创建点检保养方案 | ||
| 24 | + * | ||
| 25 | + * @param createReqVO 创建信息 | ||
| 26 | + * @return 编号 | ||
| 27 | + */ | ||
| 28 | + Long createCheckPlan(@Valid MesDvCheckPlanSaveReqVO createReqVO); | ||
| 29 | + | ||
| 30 | + /** | ||
| 31 | + * 更新点检保养方案 | ||
| 32 | + * | ||
| 33 | + * @param updateReqVO 更新信息 | ||
| 34 | + */ | ||
| 35 | + void updateCheckPlan(@Valid MesDvCheckPlanSaveReqVO updateReqVO); | ||
| 36 | + | ||
| 37 | + /** | ||
| 38 | + * 启用点检保养方案 | ||
| 39 | + * | ||
| 40 | + * @param id 编号 | ||
| 41 | + */ | ||
| 42 | + void enableCheckPlan(Long id); | ||
| 43 | + | ||
| 44 | + /** | ||
| 45 | + * 停用点检保养方案 | ||
| 46 | + * | ||
| 47 | + * @param id 编号 | ||
| 48 | + */ | ||
| 49 | + void disableCheckPlan(Long id); | ||
| 50 | + | ||
| 51 | + /** | ||
| 52 | + * 删除点检保养方案 | ||
| 53 | + * | ||
| 54 | + * @param id 编号 | ||
| 55 | + */ | ||
| 56 | + void deleteCheckPlan(Long id); | ||
| 57 | + | ||
| 58 | + /** | ||
| 59 | + * 校验点检保养方案存在 | ||
| 60 | + * | ||
| 61 | + * @param id 编号 | ||
| 62 | + */ | ||
| 63 | + void validateCheckPlanExists(Long id); | ||
| 64 | + | ||
| 65 | + /** | ||
| 66 | + * 校验点检保养方案为草稿状态 | ||
| 67 | + * | ||
| 68 | + * @param planId 方案编号 | ||
| 69 | + * @return 方案 | ||
| 70 | + */ | ||
| 71 | + MesDvCheckPlanDO validateCheckPlanPrepare(Long planId); | ||
| 72 | + | ||
| 73 | + /** | ||
| 74 | + * 获得点检保养方案 | ||
| 75 | + * | ||
| 76 | + * @param id 编号 | ||
| 77 | + * @return 方案 | ||
| 78 | + */ | ||
| 79 | + MesDvCheckPlanDO getCheckPlan(Long id); | ||
| 80 | + | ||
| 81 | + /** | ||
| 82 | + * 获得点检保养方案分页 | ||
| 83 | + * | ||
| 84 | + * @param pageReqVO 分页查询 | ||
| 85 | + * @return 方案分页 | ||
| 86 | + */ | ||
| 87 | + PageResult<MesDvCheckPlanDO> getCheckPlanPage(MesDvCheckPlanPageReqVO pageReqVO); | ||
| 88 | + | ||
| 89 | + /** | ||
| 90 | + * 获得点检保养方案列表 | ||
| 91 | + * | ||
| 92 | + * @param ids 编号数组 | ||
| 93 | + * @return 方案列表 | ||
| 94 | + */ | ||
| 95 | + List<MesDvCheckPlanDO> getCheckPlanList(Collection<Long> ids); | ||
| 96 | + | ||
| 97 | + /** | ||
| 98 | + * 获得点检保养方案 Map | ||
| 99 | + * | ||
| 100 | + * @param ids 编号数组 | ||
| 101 | + * @return 方案 Map | ||
| 102 | + */ | ||
| 103 | + default Map<Long, MesDvCheckPlanDO> getCheckPlanMap(Collection<Long> ids) { | ||
| 104 | + return convertMap(getCheckPlanList(ids), MesDvCheckPlanDO::getId); | ||
| 105 | + } | ||
| 106 | + | ||
| 107 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/dv/checkplan/MesDvCheckPlanServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.service.dv.checkplan; | ||
| 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.dv.checkplan.vo.MesDvCheckPlanPageReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.MesDvCheckPlanSaveReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.checkplan.MesDvCheckPlanDO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.dal.mysql.dv.checkplan.MesDvCheckPlanMapper; | ||
| 11 | +import cn.iocoder.yudao.module.mes.enums.dv.MesDvCheckPlanStatusEnum; | ||
| 12 | +import jakarta.annotation.Resource; | ||
| 13 | +import org.springframework.context.annotation.Lazy; | ||
| 14 | +import org.springframework.stereotype.Service; | ||
| 15 | +import org.springframework.transaction.annotation.Transactional; | ||
| 16 | +import org.springframework.validation.annotation.Validated; | ||
| 17 | + | ||
| 18 | +import java.util.Collection; | ||
| 19 | +import java.util.Collections; | ||
| 20 | +import java.util.List; | ||
| 21 | + | ||
| 22 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 23 | +import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; | ||
| 24 | + | ||
| 25 | +/** | ||
| 26 | + * MES 点检保养方案 Service 实现类 | ||
| 27 | + * | ||
| 28 | + * @author 芋道源码 | ||
| 29 | + */ | ||
| 30 | +@Service | ||
| 31 | +@Validated | ||
| 32 | +public class MesDvCheckPlanServiceImpl implements MesDvCheckPlanService { | ||
| 33 | + | ||
| 34 | + @Resource | ||
| 35 | + private MesDvCheckPlanMapper checkPlanMapper; | ||
| 36 | + @Resource | ||
| 37 | + @Lazy | ||
| 38 | + private MesDvCheckPlanMachineryService checkPlanMachineryService; | ||
| 39 | + @Resource | ||
| 40 | + @Lazy | ||
| 41 | + private MesDvCheckPlanSubjectService checkPlanSubjectService; | ||
| 42 | + | ||
| 43 | + @Override | ||
| 44 | + public Long createCheckPlan(MesDvCheckPlanSaveReqVO createReqVO) { | ||
| 45 | + // 1. 校验编码唯一 | ||
| 46 | + validateCheckPlanCodeUnique(null, createReqVO.getCode()); | ||
| 47 | + | ||
| 48 | + // 2. 插入方案 | ||
| 49 | + MesDvCheckPlanDO checkPlan = BeanUtils.toBean(createReqVO, MesDvCheckPlanDO.class); | ||
| 50 | + checkPlan.setStatus(MesDvCheckPlanStatusEnum.PREPARE.getStatus()); // 默认草稿 | ||
| 51 | + checkPlanMapper.insert(checkPlan); | ||
| 52 | + return checkPlan.getId(); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @Override | ||
| 56 | + public void updateCheckPlan(MesDvCheckPlanSaveReqVO updateReqVO) { | ||
| 57 | + // 1.1 校验存在 | ||
| 58 | + MesDvCheckPlanDO existPlan = doValidateCheckPlanExists(updateReqVO.getId()); | ||
| 59 | + // 1.2 校验草稿状态 | ||
| 60 | + if (ObjUtil.notEqual(MesDvCheckPlanStatusEnum.PREPARE.getStatus(), existPlan.getStatus())) { | ||
| 61 | + throw exception(DV_CHECK_PLAN_NOT_PREPARE); | ||
| 62 | + } | ||
| 63 | + // 1.3 校验编码唯一 | ||
| 64 | + validateCheckPlanCodeUnique(updateReqVO.getId(), updateReqVO.getCode()); | ||
| 65 | + | ||
| 66 | + // 2. 更新 | ||
| 67 | + updateReqVO.setStatus(null); // 不允许通过 update 修改状态 | ||
| 68 | + MesDvCheckPlanDO updateObj = BeanUtils.toBean(updateReqVO, MesDvCheckPlanDO.class); | ||
| 69 | + checkPlanMapper.updateById(updateObj); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @Override | ||
| 73 | + public void enableCheckPlan(Long id) { | ||
| 74 | + // 1.1 校验存在 + 校验草稿状态 | ||
| 75 | + validateCheckPlanPrepare(id); | ||
| 76 | + // 1.2 校验至少关联一台设备 | ||
| 77 | + Long machineryCount = checkPlanMachineryService.getCheckPlanMachineryCountByPlanId(id); | ||
| 78 | + if (machineryCount <= 0) { | ||
| 79 | + throw exception(DV_CHECK_PLAN_NO_MACHINERY); | ||
| 80 | + } | ||
| 81 | + // 1.3 校验至少关联一个项目 | ||
| 82 | + Long subjectCount = checkPlanSubjectService.getCheckPlanSubjectCountByPlanId(id); | ||
| 83 | + if (subjectCount <= 0) { | ||
| 84 | + throw exception(DV_CHECK_PLAN_NO_SUBJECT); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + // 2. 更新状态为已启用 | ||
| 88 | + checkPlanMapper.updateById(new MesDvCheckPlanDO().setId(id) | ||
| 89 | + .setStatus(MesDvCheckPlanStatusEnum.ENABLED.getStatus())); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + @Override | ||
| 93 | + public void disableCheckPlan(Long id) { | ||
| 94 | + // 1. 校验存在 | ||
| 95 | + validateCheckPlanExists(id); | ||
| 96 | + | ||
| 97 | + // 2. 更新状态为草稿 | ||
| 98 | + checkPlanMapper.updateById(new MesDvCheckPlanDO().setId(id) | ||
| 99 | + .setStatus(MesDvCheckPlanStatusEnum.PREPARE.getStatus())); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + @Override | ||
| 103 | + @Transactional(rollbackFor = Exception.class) | ||
| 104 | + public void deleteCheckPlan(Long id) { | ||
| 105 | + // 1. 校验存在 + 校验草稿状态 | ||
| 106 | + validateCheckPlanPrepare(id); | ||
| 107 | + | ||
| 108 | + // 2.1 级联删除设备关联 + 项目关联 | ||
| 109 | + checkPlanMachineryService.deleteByPlanId(id); | ||
| 110 | + checkPlanSubjectService.deleteByPlanId(id); | ||
| 111 | + // 2.2 删除方案 | ||
| 112 | + checkPlanMapper.deleteById(id); | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + @Override | ||
| 116 | + public MesDvCheckPlanDO validateCheckPlanPrepare(Long planId) { | ||
| 117 | + MesDvCheckPlanDO plan = doValidateCheckPlanExists(planId); | ||
| 118 | + if (ObjUtil.notEqual(MesDvCheckPlanStatusEnum.PREPARE.getStatus(), plan.getStatus())) { | ||
| 119 | + throw exception(DV_CHECK_PLAN_NOT_PREPARE); | ||
| 120 | + } | ||
| 121 | + return plan; | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + @Override | ||
| 125 | + public MesDvCheckPlanDO getCheckPlan(Long id) { | ||
| 126 | + return checkPlanMapper.selectById(id); | ||
| 127 | + } | ||
| 128 | + | ||
| 129 | + @Override | ||
| 130 | + public PageResult<MesDvCheckPlanDO> getCheckPlanPage(MesDvCheckPlanPageReqVO pageReqVO) { | ||
| 131 | + return checkPlanMapper.selectPage(pageReqVO); | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + @Override | ||
| 135 | + public void validateCheckPlanExists(Long id) { | ||
| 136 | + if (checkPlanMapper.selectById(id) == null) { | ||
| 137 | + throw exception(DV_CHECK_PLAN_NOT_EXISTS); | ||
| 138 | + } | ||
| 139 | + } | ||
| 140 | + | ||
| 141 | + private MesDvCheckPlanDO doValidateCheckPlanExists(Long id) { | ||
| 142 | + MesDvCheckPlanDO plan = checkPlanMapper.selectById(id); | ||
| 143 | + if (plan == null) { | ||
| 144 | + throw exception(DV_CHECK_PLAN_NOT_EXISTS); | ||
| 145 | + } | ||
| 146 | + return plan; | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + private void validateCheckPlanCodeUnique(Long id, String code) { | ||
| 150 | + MesDvCheckPlanDO plan = checkPlanMapper.selectByCode(code); | ||
| 151 | + if (plan == null) { | ||
| 152 | + return; | ||
| 153 | + } | ||
| 154 | + if (ObjUtil.notEqual(plan.getId(), id)) { | ||
| 155 | + throw exception(DV_CHECK_PLAN_CODE_DUPLICATE); | ||
| 156 | + } | ||
| 157 | + } | ||
| 158 | + | ||
| 159 | + @Override | ||
| 160 | + public List<MesDvCheckPlanDO> getCheckPlanList(Collection<Long> ids) { | ||
| 161 | + if (CollUtil.isEmpty(ids)) { | ||
| 162 | + return Collections.emptyList(); | ||
| 163 | + } | ||
| 164 | + return checkPlanMapper.selectByIds(ids); | ||
| 165 | + } | ||
| 166 | + | ||
| 167 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/dv/checkplan/MesDvCheckPlanSubjectService.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.service.dv.checkplan; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.subject.MesDvCheckPlanSubjectSaveReqVO; | ||
| 4 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.checkplan.MesDvCheckPlanSubjectDO; | ||
| 5 | +import jakarta.validation.Valid; | ||
| 6 | + | ||
| 7 | +import java.util.List; | ||
| 8 | + | ||
| 9 | +/** | ||
| 10 | + * MES 点检保养方案项目 Service 接口 | ||
| 11 | + * | ||
| 12 | + * @author 芋道源码 | ||
| 13 | + */ | ||
| 14 | +public interface MesDvCheckPlanSubjectService { | ||
| 15 | + | ||
| 16 | + /** | ||
| 17 | + * 创建方案项目关联 | ||
| 18 | + * | ||
| 19 | + * @param createReqVO 创建信息 | ||
| 20 | + * @return 编号 | ||
| 21 | + */ | ||
| 22 | + Long createCheckPlanSubject(@Valid MesDvCheckPlanSubjectSaveReqVO createReqVO); | ||
| 23 | + | ||
| 24 | + /** | ||
| 25 | + * 删除方案项目关联 | ||
| 26 | + * | ||
| 27 | + * @param id 编号 | ||
| 28 | + */ | ||
| 29 | + void deleteCheckPlanSubject(Long id); | ||
| 30 | + | ||
| 31 | + /** | ||
| 32 | + * 获得指定方案的项目列表 | ||
| 33 | + * | ||
| 34 | + * @param planId 方案编号 | ||
| 35 | + * @return 项目关联列表 | ||
| 36 | + */ | ||
| 37 | + List<MesDvCheckPlanSubjectDO> getCheckPlanSubjectListByPlanId(Long planId); | ||
| 38 | + | ||
| 39 | + /** | ||
| 40 | + * 获得指定方案的项目数量 | ||
| 41 | + * | ||
| 42 | + * @param planId 方案编号 | ||
| 43 | + * @return 项目数量 | ||
| 44 | + */ | ||
| 45 | + Long getCheckPlanSubjectCountByPlanId(Long planId); | ||
| 46 | + | ||
| 47 | + /** | ||
| 48 | + * 根据方案编号删除所有项目关联 | ||
| 49 | + * | ||
| 50 | + * @param planId 方案编号 | ||
| 51 | + */ | ||
| 52 | + void deleteByPlanId(Long planId); | ||
| 53 | + | ||
| 54 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/dv/checkplan/MesDvCheckPlanSubjectServiceImpl.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.service.dv.checkplan; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 4 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkplan.vo.subject.MesDvCheckPlanSubjectSaveReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.checkplan.MesDvCheckPlanSubjectDO; | ||
| 6 | +import cn.iocoder.yudao.module.mes.dal.mysql.dv.checkplan.MesDvCheckPlanSubjectMapper; | ||
| 7 | +import cn.iocoder.yudao.module.mes.service.dv.subject.MesDvSubjectService; | ||
| 8 | +import jakarta.annotation.Resource; | ||
| 9 | +import org.springframework.context.annotation.Lazy; | ||
| 10 | +import org.springframework.stereotype.Service; | ||
| 11 | +import org.springframework.validation.annotation.Validated; | ||
| 12 | + | ||
| 13 | +import java.util.List; | ||
| 14 | + | ||
| 15 | +import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; | ||
| 16 | +import static cn.iocoder.yudao.module.mes.enums.ErrorCodeConstants.*; | ||
| 17 | + | ||
| 18 | +/** | ||
| 19 | + * MES 点检保养方案项目 Service 实现类 | ||
| 20 | + * | ||
| 21 | + * @author 芋道源码 | ||
| 22 | + */ | ||
| 23 | +@Service | ||
| 24 | +@Validated | ||
| 25 | +public class MesDvCheckPlanSubjectServiceImpl implements MesDvCheckPlanSubjectService { | ||
| 26 | + | ||
| 27 | + @Resource | ||
| 28 | + private MesDvCheckPlanSubjectMapper checkPlanSubjectMapper; | ||
| 29 | + @Resource | ||
| 30 | + @Lazy | ||
| 31 | + private MesDvCheckPlanService checkPlanService; | ||
| 32 | + @Resource | ||
| 33 | + private MesDvSubjectService subjectService; | ||
| 34 | + | ||
| 35 | + @Override | ||
| 36 | + public Long createCheckPlanSubject(MesDvCheckPlanSubjectSaveReqVO createReqVO) { | ||
| 37 | + // 1.1 校验方案草稿状态 | ||
| 38 | + checkPlanService.validateCheckPlanPrepare(createReqVO.getPlanId()); | ||
| 39 | + // 1.2 校验项目存在 | ||
| 40 | + subjectService.validateSubjectExists(createReqVO.getSubjectId()); | ||
| 41 | + | ||
| 42 | + // 2. 插入 | ||
| 43 | + MesDvCheckPlanSubjectDO planSubject = BeanUtils.toBean(createReqVO, MesDvCheckPlanSubjectDO.class); | ||
| 44 | + checkPlanSubjectMapper.insert(planSubject); | ||
| 45 | + return planSubject.getId(); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @Override | ||
| 49 | + public void deleteCheckPlanSubject(Long id) { | ||
| 50 | + // 1.1 校验存在 | ||
| 51 | + MesDvCheckPlanSubjectDO existRecord = checkPlanSubjectMapper.selectById(id); | ||
| 52 | + if (existRecord == null) { | ||
| 53 | + throw exception(DV_CHECK_PLAN_SUBJECT_NOT_EXISTS); | ||
| 54 | + } | ||
| 55 | + // 1.2 校验方案草稿状态 | ||
| 56 | + checkPlanService.validateCheckPlanPrepare(existRecord.getPlanId()); | ||
| 57 | + | ||
| 58 | + // 2. 删除 | ||
| 59 | + checkPlanSubjectMapper.deleteById(id); | ||
| 60 | + } | ||
| 61 | + | ||
| 62 | + @Override | ||
| 63 | + public List<MesDvCheckPlanSubjectDO> getCheckPlanSubjectListByPlanId(Long planId) { | ||
| 64 | + return checkPlanSubjectMapper.selectListByPlanId(planId); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @Override | ||
| 68 | + public Long getCheckPlanSubjectCountByPlanId(Long planId) { | ||
| 69 | + return checkPlanSubjectMapper.selectCountByPlanId(planId); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @Override | ||
| 73 | + public void deleteByPlanId(Long planId) { | ||
| 74 | + checkPlanSubjectMapper.deleteByPlanId(planId); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | +} |