Commit b46960de38148c17faa4214262e305a08a9219f3
Merge branch 'feat/mes' of https://gitee.com/zhijiantianya/ruoyi-vue-pro into master-jdk17
Showing
1162 changed files
with
91090 additions
and
0 deletions
Too many changes.
To preserve performance only 100 of 1162 files are displayed.
pom.xml
| @@ -25,6 +25,7 @@ | @@ -25,6 +25,7 @@ | ||
| 25 | <!-- <module>yudao-module-erp</module>--> | 25 | <!-- <module>yudao-module-erp</module>--> |
| 26 | <!-- <module>yudao-module-ai</module>--> | 26 | <!-- <module>yudao-module-ai</module>--> |
| 27 | <!-- <module>yudao-module-iot</module>--> | 27 | <!-- <module>yudao-module-iot</module>--> |
| 28 | + <module>yudao-module-mes</module> | ||
| 28 | </modules> | 29 | </modules> |
| 29 | 30 | ||
| 30 | <name>${project.artifactId}</name> | 31 | <name>${project.artifactId}</name> |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/collection/CollectionUtils.java
| @@ -349,4 +349,27 @@ public class CollectionUtils { | @@ -349,4 +349,27 @@ public class CollectionUtils { | ||
| 349 | return (LinkedHashSet<T>) toCollection(LinkedHashSet.class, elementType, value); | 349 | return (LinkedHashSet<T>) toCollection(LinkedHashSet.class, elementType, value); |
| 350 | } | 350 | } |
| 351 | 351 | ||
| 352 | + public static boolean dfs(Long node, Map<Long, Set<Long>> graph) { | ||
| 353 | + return dfs(node, graph, new HashSet<>(), new HashSet<>()); | ||
| 354 | + } | ||
| 355 | + | ||
| 356 | + private static boolean dfs(Long node, Map<Long, Set<Long>> graph, Set<Long> visited, Set<Long> inStack) { | ||
| 357 | + if (inStack.contains(node)) { | ||
| 358 | + return true; | ||
| 359 | + } | ||
| 360 | + if (visited.contains(node)) { | ||
| 361 | + return false; | ||
| 362 | + } | ||
| 363 | + visited.add(node); | ||
| 364 | + inStack.add(node); | ||
| 365 | + Set<Long> neighbors = graph.getOrDefault(node, Collections.emptySet()); | ||
| 366 | + for (Long neighbor : neighbors) { | ||
| 367 | + if (dfs(neighbor, graph, visited, inStack)) { | ||
| 368 | + return true; | ||
| 369 | + } | ||
| 370 | + } | ||
| 371 | + inStack.remove(node); | ||
| 372 | + return false; | ||
| 373 | + } | ||
| 374 | + | ||
| 352 | } | 375 | } |
| 353 | \ No newline at end of file | 376 | \ No newline at end of file |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/date/LocalDateTimeUtils.java
| @@ -336,6 +336,27 @@ public class LocalDateTimeUtils { | @@ -336,6 +336,27 @@ public class LocalDateTimeUtils { | ||
| 336 | } | 336 | } |
| 337 | 337 | ||
| 338 | /** | 338 | /** |
| 339 | + * 获取指定日期所在季度的第一天 | ||
| 340 | + * | ||
| 341 | + * @param date 日期 | ||
| 342 | + * @return 所在季度的第一天 | ||
| 343 | + */ | ||
| 344 | + public static LocalDate getQuarterStart(LocalDate date) { | ||
| 345 | + Month firstMonthOfQuarter = date.getMonth().firstMonthOfQuarter(); | ||
| 346 | + return LocalDate.of(date.getYear(), firstMonthOfQuarter, 1); | ||
| 347 | + } | ||
| 348 | + | ||
| 349 | + /** | ||
| 350 | + * 获取指定日期所在周的第一天(周一) | ||
| 351 | + * | ||
| 352 | + * @param date 日期 | ||
| 353 | + * @return 所在周的周一 | ||
| 354 | + */ | ||
| 355 | + public static LocalDate getWeekStart(LocalDate date) { | ||
| 356 | + return date.with(DayOfWeek.MONDAY); | ||
| 357 | + } | ||
| 358 | + | ||
| 359 | + /** | ||
| 339 | * 将给定的 {@link LocalDateTime} 转换为自 Unix 纪元时间(1970-01-01T00:00:00Z)以来的秒数。 | 360 | * 将给定的 {@link LocalDateTime} 转换为自 Unix 纪元时间(1970-01-01T00:00:00Z)以来的秒数。 |
| 340 | * | 361 | * |
| 341 | * @param sourceDateTime 需要转换的本地日期时间,不能为空 | 362 | * @param sourceDateTime 需要转换的本地日期时间,不能为空 |
yudao-framework/yudao-common/src/main/java/cn/iocoder/yudao/framework/common/util/object/ObjectUtils.java
| @@ -60,6 +60,11 @@ public class ObjectUtils { | @@ -60,6 +60,11 @@ public class ObjectUtils { | ||
| 60 | return Arrays.asList(array).contains(obj); | 60 | return Arrays.asList(array).contains(obj); |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | + @SafeVarargs | ||
| 64 | + public static <T> boolean notEqualsAny(T obj, T... array) { | ||
| 65 | + return !Arrays.asList(array).contains(obj); | ||
| 66 | + } | ||
| 67 | + | ||
| 63 | public static boolean isNotAllEmpty(Object... objs) { | 68 | public static boolean isNotAllEmpty(Object... objs) { |
| 64 | return !ObjectUtil.isAllEmpty(objs); | 69 | return !ObjectUtil.isAllEmpty(objs); |
| 65 | } | 70 | } |
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/api/config/ConfigApi.java
yudao-module-infra/src/main/java/cn/iocoder/yudao/module/infra/api/websocket/WebSocketSenderApi.java
| @@ -11,6 +11,7 @@ import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | @@ -11,6 +11,7 @@ import cn.iocoder.yudao.framework.common.util.json.JsonUtils; | ||
| 11 | */ | 11 | */ |
| 12 | public interface WebSocketSenderApi { | 12 | public interface WebSocketSenderApi { |
| 13 | 13 | ||
| 14 | + | ||
| 14 | /** | 15 | /** |
| 15 | * 发送消息给指定用户 | 16 | * 发送消息给指定用户 |
| 16 | * | 17 | * |
yudao-module-mes/pom.xml
0 → 100644
| 1 | +<?xml version="1.0" encoding="UTF-8"?> | ||
| 2 | +<project xmlns="http://maven.apache.org/POM/4.0.0" | ||
| 3 | + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
| 4 | + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| 5 | + <parent> | ||
| 6 | + <groupId>cn.iocoder.boot</groupId> | ||
| 7 | + <artifactId>yudao</artifactId> | ||
| 8 | + <version>${revision}</version> | ||
| 9 | + </parent> | ||
| 10 | + <modelVersion>4.0.0</modelVersion> | ||
| 11 | + <artifactId>yudao-module-mes</artifactId> | ||
| 12 | + <packaging>jar</packaging> | ||
| 13 | + | ||
| 14 | + <name>${project.artifactId}</name> | ||
| 15 | + <description> | ||
| 16 | + mes 模块下,制造执行系统(Manufacturing Execution System)。 | ||
| 17 | + 例如说:基础数据、排班日历、设备管理、工具管理、生产管理、质量管理、仓库管理等等 | ||
| 18 | + </description> | ||
| 19 | + | ||
| 20 | + <dependencies> | ||
| 21 | + <dependency> | ||
| 22 | + <groupId>cn.iocoder.boot</groupId> | ||
| 23 | + <artifactId>yudao-module-system</artifactId> | ||
| 24 | + <version>${revision}</version> | ||
| 25 | + </dependency> | ||
| 26 | + | ||
| 27 | + <!-- 业务组件 --> | ||
| 28 | + | ||
| 29 | + <!-- Web 相关 --> | ||
| 30 | + <dependency> | ||
| 31 | + <groupId>cn.iocoder.boot</groupId> | ||
| 32 | + <artifactId>yudao-spring-boot-starter-web</artifactId> | ||
| 33 | + </dependency> | ||
| 34 | + | ||
| 35 | + <dependency> | ||
| 36 | + <groupId>cn.iocoder.boot</groupId> | ||
| 37 | + <artifactId>yudao-spring-boot-starter-security</artifactId> | ||
| 38 | + </dependency> | ||
| 39 | + | ||
| 40 | + <!-- DB 相关 --> | ||
| 41 | + <dependency> | ||
| 42 | + <groupId>cn.iocoder.boot</groupId> | ||
| 43 | + <artifactId>yudao-spring-boot-starter-mybatis</artifactId> | ||
| 44 | + </dependency> | ||
| 45 | + | ||
| 46 | + <dependency> | ||
| 47 | + <groupId>cn.iocoder.boot</groupId> | ||
| 48 | + <artifactId>yudao-spring-boot-starter-redis</artifactId> | ||
| 49 | + </dependency> | ||
| 50 | + | ||
| 51 | + <!-- 工具类相关 --> | ||
| 52 | + <dependency> | ||
| 53 | + <groupId>cn.iocoder.boot</groupId> | ||
| 54 | + <artifactId>yudao-spring-boot-starter-excel</artifactId> | ||
| 55 | + </dependency> | ||
| 56 | + | ||
| 57 | + <!-- Test 测试相关 --> | ||
| 58 | + <dependency> | ||
| 59 | + <groupId>cn.iocoder.boot</groupId> | ||
| 60 | + <artifactId>yudao-spring-boot-starter-test</artifactId> | ||
| 61 | + </dependency> | ||
| 62 | + | ||
| 63 | + </dependencies> | ||
| 64 | + | ||
| 65 | +</project> |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/calendar/MesCalCalendarController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.calendar; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.hutool.core.date.DatePattern; | ||
| 5 | +import cn.hutool.core.date.LocalDateTimeUtil; | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 7 | +import cn.iocoder.yudao.module.mes.controller.admin.cal.calendar.vo.MesCalCalendarListReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.mes.controller.admin.cal.calendar.vo.MesCalCalendarRespVO; | ||
| 9 | +import cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.shift.MesCalTeamShiftListReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.holiday.MesCalHolidayDO; | ||
| 11 | +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.plan.MesCalPlanDO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.plan.MesCalPlanShiftDO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamDO; | ||
| 14 | +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamMemberDO; | ||
| 15 | +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamShiftDO; | ||
| 16 | +import cn.iocoder.yudao.module.mes.enums.cal.MesCalHolidayTypeEnum; | ||
| 17 | +import cn.iocoder.yudao.module.mes.service.cal.holiday.MesCalHolidayService; | ||
| 18 | +import cn.iocoder.yudao.module.mes.service.cal.plan.MesCalPlanService; | ||
| 19 | +import cn.iocoder.yudao.module.mes.service.cal.plan.MesCalPlanShiftService; | ||
| 20 | +import cn.iocoder.yudao.module.mes.service.cal.team.MesCalTeamMemberService; | ||
| 21 | +import cn.iocoder.yudao.module.mes.service.cal.team.MesCalTeamService; | ||
| 22 | +import cn.iocoder.yudao.module.mes.service.cal.team.MesCalTeamShiftService; | ||
| 23 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 24 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 25 | +import jakarta.annotation.Resource; | ||
| 26 | +import jakarta.validation.Valid; | ||
| 27 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 28 | +import org.springframework.validation.annotation.Validated; | ||
| 29 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 30 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 31 | +import org.springframework.web.bind.annotation.RestController; | ||
| 32 | + | ||
| 33 | +import java.time.LocalDateTime; | ||
| 34 | +import java.util.*; | ||
| 35 | +import java.util.stream.Collectors; | ||
| 36 | + | ||
| 37 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 38 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.*; | ||
| 39 | + | ||
| 40 | +@Tag(name = "管理后台 - MES 排班日历") | ||
| 41 | +@RestController | ||
| 42 | +@RequestMapping("/mes/cal/calendar") | ||
| 43 | +@Validated | ||
| 44 | +public class MesCalCalendarController { | ||
| 45 | + | ||
| 46 | + @Resource | ||
| 47 | + private MesCalTeamShiftService teamShiftService; | ||
| 48 | + @Resource | ||
| 49 | + private MesCalTeamService teamService; | ||
| 50 | + @Resource | ||
| 51 | + private MesCalPlanShiftService planShiftService; | ||
| 52 | + @Resource | ||
| 53 | + private MesCalPlanService planService; | ||
| 54 | + @Resource | ||
| 55 | + private MesCalTeamMemberService teamMemberService; | ||
| 56 | + @Resource | ||
| 57 | + private MesCalHolidayService holidayService; | ||
| 58 | + | ||
| 59 | + @GetMapping("/list") | ||
| 60 | + @Operation(summary = "查询排班日历") | ||
| 61 | + @PreAuthorize("@ss.hasPermission('mes:cal-team-shift:query')") | ||
| 62 | + public CommonResult<List<MesCalCalendarRespVO>> getCalendarList(@Valid MesCalCalendarListReqVO reqVO) { | ||
| 63 | + // 1.1 根据查询类型获取班组排班记录 | ||
| 64 | + List<MesCalTeamShiftDO> teamShifts = getTeamShifts(reqVO); | ||
| 65 | + if (CollUtil.isEmpty(teamShifts)) { | ||
| 66 | + return success(Collections.emptyList()); | ||
| 67 | + } | ||
| 68 | + // 1.2 按日期范围查询假期,构建节假日日期集合 | ||
| 69 | + Set<String> holidaySet = buildHolidaySet(reqVO.getStartDay(), reqVO.getEndDay()); | ||
| 70 | + // 1.3 批量查询关联数据:班组、班次、排班计划 | ||
| 71 | + Map<Long, MesCalTeamDO> teamMap = teamService.getTeamMap( | ||
| 72 | + convertSet(teamShifts, MesCalTeamShiftDO::getTeamId)); | ||
| 73 | + Map<Long, MesCalPlanShiftDO> shiftMap = planShiftService.getPlanShiftMap( | ||
| 74 | + convertSet(teamShifts, MesCalTeamShiftDO::getShiftId)); | ||
| 75 | + Map<Long, MesCalPlanDO> planMap = planService.getPlanMap( | ||
| 76 | + convertSet(teamShifts, MesCalTeamShiftDO::getPlanId)); | ||
| 77 | + | ||
| 78 | + // 2. 按 day 分组聚合 | ||
| 79 | + Map<String, List<MesCalTeamShiftDO>> dayGroupMap = convertMultiMap(teamShifts, | ||
| 80 | + teamShift -> LocalDateTimeUtil.format(teamShift.getDay(), DatePattern.NORM_DATE_PATTERN)); | ||
| 81 | + | ||
| 82 | + // 3. 遍历分组,过滤假期,构建日历响应 | ||
| 83 | + List<MesCalCalendarRespVO> result = new ArrayList<>(); | ||
| 84 | + for (Map.Entry<String, List<MesCalTeamShiftDO>> entry : dayGroupMap.entrySet()) { | ||
| 85 | + String dayStr = entry.getKey(); | ||
| 86 | + // 3.1 过滤节假日 | ||
| 87 | + if (holidaySet.contains(dayStr)) { | ||
| 88 | + continue; | ||
| 89 | + } | ||
| 90 | + List<MesCalTeamShiftDO> dayShifts = entry.getValue(); | ||
| 91 | + dayShifts.sort(Comparator.comparing(ts -> ts.getSort() != null ? ts.getSort() : 0)); | ||
| 92 | + // 3.2 获取轮班方式(取第一条记录关联的排班计划) | ||
| 93 | + Integer shiftType = null; | ||
| 94 | + MesCalTeamShiftDO first = dayShifts.get(0); | ||
| 95 | + if (first.getPlanId() != null) { | ||
| 96 | + MesCalPlanDO plan = planMap.get(first.getPlanId()); | ||
| 97 | + if (plan != null) { | ||
| 98 | + shiftType = plan.getShiftType(); | ||
| 99 | + } | ||
| 100 | + } | ||
| 101 | + // 3.3 构建班组排班项列表 | ||
| 102 | + List<MesCalCalendarRespVO.TeamShiftItem> items = convertList(dayShifts, | ||
| 103 | + teamShift -> buildTeamShiftItem(teamShift, teamMap, shiftMap)); | ||
| 104 | + | ||
| 105 | + // 3.4 构建日历项,添加到结果列表 | ||
| 106 | + MesCalCalendarRespVO calendarVO = MesCalCalendarRespVO.builder() | ||
| 107 | + .day(LocalDateTimeUtil.parseDate(dayStr, DatePattern.NORM_DATE_FORMATTER).atStartOfDay()) | ||
| 108 | + .shiftType(shiftType) | ||
| 109 | + .teamShifts(items) | ||
| 110 | + .build(); | ||
| 111 | + result.add(calendarVO); | ||
| 112 | + } | ||
| 113 | + return success(result); | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + /** | ||
| 117 | + * 根据查询类型获取班组排班记录 | ||
| 118 | + */ | ||
| 119 | + @SuppressWarnings("EnhancedSwitchMigration") | ||
| 120 | + private List<MesCalTeamShiftDO> getTeamShifts(MesCalCalendarListReqVO reqVO) { | ||
| 121 | + LocalDateTime startDay = reqVO.getStartDay(); | ||
| 122 | + LocalDateTime endDay = reqVO.getEndDay(); | ||
| 123 | + switch (reqVO.getQueryType()) { | ||
| 124 | + case MesCalCalendarListReqVO.QUERY_TYPE_TYPE: | ||
| 125 | + return getTeamShiftsByCalendarType(reqVO.getCalendarType(), startDay, endDay); | ||
| 126 | + case MesCalCalendarListReqVO.QUERY_TYPE_TEAM: | ||
| 127 | + return getTeamShiftsByTeamId(reqVO.getTeamId(), startDay, endDay); | ||
| 128 | + case MesCalCalendarListReqVO.QUERY_TYPE_USER: | ||
| 129 | + return getTeamShiftsByUserId(reqVO.getUserId(), startDay, endDay); | ||
| 130 | + default: | ||
| 131 | + return Collections.emptyList(); | ||
| 132 | + } | ||
| 133 | + } | ||
| 134 | + | ||
| 135 | + /** | ||
| 136 | + * 构建单条 TeamShiftItem | ||
| 137 | + */ | ||
| 138 | + private MesCalCalendarRespVO.TeamShiftItem buildTeamShiftItem(MesCalTeamShiftDO ts, | ||
| 139 | + Map<Long, MesCalTeamDO> teamMap, | ||
| 140 | + Map<Long, MesCalPlanShiftDO> shiftMap) { | ||
| 141 | + MesCalTeamDO team = teamMap.get(ts.getTeamId()); | ||
| 142 | + MesCalPlanShiftDO shift = shiftMap.get(ts.getShiftId()); | ||
| 143 | + return MesCalCalendarRespVO.TeamShiftItem.builder() | ||
| 144 | + .teamId(ts.getTeamId()).teamName(team != null ? team.getName() : null) | ||
| 145 | + .shiftId(ts.getShiftId()).shiftName(shift != null ? shift.getName() : null) | ||
| 146 | + .sort(ts.getSort()).build(); | ||
| 147 | + } | ||
| 148 | + | ||
| 149 | + /** | ||
| 150 | + * 按班组类型查询排班记录 | ||
| 151 | + */ | ||
| 152 | + private List<MesCalTeamShiftDO> getTeamShiftsByCalendarType(Integer calendarType, | ||
| 153 | + LocalDateTime startDay, LocalDateTime endDay) { | ||
| 154 | + if (calendarType == null) { | ||
| 155 | + return Collections.emptyList(); | ||
| 156 | + } | ||
| 157 | + // 1. 查询指定类型的所有班组 | ||
| 158 | + List<MesCalTeamDO> teams = teamService.getTeamList().stream() | ||
| 159 | + .filter(t -> calendarType.equals(t.getCalendarType())) | ||
| 160 | + .collect(Collectors.toList()); | ||
| 161 | + if (CollUtil.isEmpty(teams)) { | ||
| 162 | + return Collections.emptyList(); | ||
| 163 | + } | ||
| 164 | + // 2. 一次 IN 查询这些班组在日期范围内的排班记录 | ||
| 165 | + MesCalTeamShiftListReqVO reqVO = new MesCalTeamShiftListReqVO() | ||
| 166 | + .setTeamIds(convertSet(teams, MesCalTeamDO::getId)) | ||
| 167 | + .setStartDay(startDay).setEndDay(endDay); | ||
| 168 | + return teamShiftService.getTeamShiftList(reqVO); | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | + /** | ||
| 172 | + * 按班组编号查询排班记录 | ||
| 173 | + */ | ||
| 174 | + private List<MesCalTeamShiftDO> getTeamShiftsByTeamId(Long teamId, LocalDateTime startDay, LocalDateTime endDay) { | ||
| 175 | + if (teamId == null) { | ||
| 176 | + return Collections.emptyList(); | ||
| 177 | + } | ||
| 178 | + MesCalTeamShiftListReqVO reqVO = new MesCalTeamShiftListReqVO() | ||
| 179 | + .setTeamId(teamId).setStartDay(startDay).setEndDay(endDay); | ||
| 180 | + return teamShiftService.getTeamShiftList(reqVO); | ||
| 181 | + } | ||
| 182 | + | ||
| 183 | + /** | ||
| 184 | + * 按用户编号查询排班记录(先查用户所属班组,再查班组排班) | ||
| 185 | + */ | ||
| 186 | + private List<MesCalTeamShiftDO> getTeamShiftsByUserId(Long userId, | ||
| 187 | + LocalDateTime startDay, LocalDateTime endDay) { | ||
| 188 | + if (userId == null) { | ||
| 189 | + return Collections.emptyList(); | ||
| 190 | + } | ||
| 191 | + // 1. 查询用户所属的班组(一个用户只属于一个班组) | ||
| 192 | + MesCalTeamMemberDO member = teamMemberService.getTeamMemberByUserId(userId); | ||
| 193 | + if (member == null) { | ||
| 194 | + return Collections.emptyList(); | ||
| 195 | + } | ||
| 196 | + // 2. 查询该班组在日期范围内的排班记录 | ||
| 197 | + MesCalTeamShiftListReqVO reqVO = new MesCalTeamShiftListReqVO() | ||
| 198 | + .setTeamId(member.getTeamId()).setStartDay(startDay).setEndDay(endDay); | ||
| 199 | + return teamShiftService.getTeamShiftList(reqVO); | ||
| 200 | + } | ||
| 201 | + | ||
| 202 | + /** | ||
| 203 | + * 按日期范围查询假期,构建节假日日期集合(yyyy-MM-dd 格式) | ||
| 204 | + */ | ||
| 205 | + private Set<String> buildHolidaySet(LocalDateTime startDay, LocalDateTime endDay) { | ||
| 206 | + List<MesCalHolidayDO> holidays = holidayService.getHolidayList(startDay, endDay); | ||
| 207 | + return convertSet(holidays, | ||
| 208 | + holiday -> LocalDateTimeUtil.format(holiday.getDay(), DatePattern.NORM_DATE_PATTERN), | ||
| 209 | + holiday -> MesCalHolidayTypeEnum.HOLIDAY.getType().equals(holiday.getType())); | ||
| 210 | + } | ||
| 211 | + | ||
| 212 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/calendar/vo/MesCalCalendarListReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.calendar.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 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 8 | + | ||
| 9 | +import java.time.LocalDateTime; | ||
| 10 | + | ||
| 11 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 12 | + | ||
| 13 | +@Schema(description = "管理后台 - MES 排班日历查询 Request VO") | ||
| 14 | +@Data | ||
| 15 | +public class MesCalCalendarListReqVO { | ||
| 16 | + | ||
| 17 | + public static final String QUERY_TYPE_TYPE = "TYPE"; | ||
| 18 | + public static final String QUERY_TYPE_TEAM = "TEAM"; | ||
| 19 | + public static final String QUERY_TYPE_USER = "USER"; | ||
| 20 | + | ||
| 21 | + @Schema(description = "开始日期", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 22 | + @NotNull(message = "开始日期不能为空") | ||
| 23 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 24 | + private LocalDateTime startDay; | ||
| 25 | + | ||
| 26 | + @Schema(description = "结束日期", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 27 | + @NotNull(message = "结束日期不能为空") | ||
| 28 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 29 | + private LocalDateTime endDay; | ||
| 30 | + | ||
| 31 | + @Schema(description = "查询类型:TYPE-按分类,TEAM-按班组,USER-按个人", requiredMode = Schema.RequiredMode.REQUIRED, example = "TYPE") | ||
| 32 | + @NotEmpty(message = "查询类型不能为空") | ||
| 33 | + private String queryType; | ||
| 34 | + | ||
| 35 | + @Schema(description = "班组类型(queryType=TYPE 时使用)", example = "1") | ||
| 36 | + private Integer calendarType; | ||
| 37 | + | ||
| 38 | + @Schema(description = "班组编号(queryType=TEAM 时使用)", example = "201") | ||
| 39 | + private Long teamId; | ||
| 40 | + | ||
| 41 | + @Schema(description = "用户编号(queryType=USER 时使用)", example = "1") | ||
| 42 | + private Long userId; | ||
| 43 | + | ||
| 44 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/calendar/vo/MesCalCalendarRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.calendar.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.AllArgsConstructor; | ||
| 5 | +import lombok.Builder; | ||
| 6 | +import lombok.Data; | ||
| 7 | +import lombok.NoArgsConstructor; | ||
| 8 | + | ||
| 9 | +import java.time.LocalDateTime; | ||
| 10 | +import java.util.List; | ||
| 11 | + | ||
| 12 | +@Schema(description = "管理后台 - MES 排班日历 Response VO") | ||
| 13 | +@Data | ||
| 14 | +@Builder | ||
| 15 | +@NoArgsConstructor | ||
| 16 | +@AllArgsConstructor | ||
| 17 | +public class MesCalCalendarRespVO { | ||
| 18 | + | ||
| 19 | + @Schema(description = "日期", requiredMode = Schema.RequiredMode.REQUIRED, example = "2025-01-15 00:00:00") | ||
| 20 | + private LocalDateTime day; | ||
| 21 | + | ||
| 22 | + @Schema(description = "轮班方式", example = "2") | ||
| 23 | + private Integer shiftType; // 对应 MesCalShiftTypeEnum 枚举值 | ||
| 24 | + | ||
| 25 | + @Schema(description = "班组排班列表") | ||
| 26 | + private List<TeamShiftItem> teamShifts; | ||
| 27 | + | ||
| 28 | + @Schema(description = "班组排班项") | ||
| 29 | + @Data | ||
| 30 | + @Builder | ||
| 31 | + @NoArgsConstructor | ||
| 32 | + @AllArgsConstructor | ||
| 33 | + public static class TeamShiftItem { | ||
| 34 | + | ||
| 35 | + @Schema(description = "班组编号", example = "201") | ||
| 36 | + private Long teamId; | ||
| 37 | + | ||
| 38 | + @Schema(description = "班组名称", example = "注塑A组") | ||
| 39 | + private String teamName; | ||
| 40 | + | ||
| 41 | + @Schema(description = "班次编号", example = "1") | ||
| 42 | + private Long shiftId; | ||
| 43 | + | ||
| 44 | + @Schema(description = "班次名称", example = "白班") | ||
| 45 | + private String shiftName; | ||
| 46 | + | ||
| 47 | + @Schema(description = "排序", example = "1") | ||
| 48 | + private Integer sort; | ||
| 49 | + | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/holiday/MesCalHolidayController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.holiday; | ||
| 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.cal.holiday.vo.MesCalHolidayRespVO; | ||
| 6 | +import cn.iocoder.yudao.module.mes.controller.admin.cal.holiday.vo.MesCalHolidaySaveReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.holiday.MesCalHolidayDO; | ||
| 8 | +import cn.iocoder.yudao.module.mes.service.cal.holiday.MesCalHolidayService; | ||
| 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.format.annotation.DateTimeFormat; | ||
| 15 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 16 | +import org.springframework.validation.annotation.Validated; | ||
| 17 | +import org.springframework.web.bind.annotation.*; | ||
| 18 | + | ||
| 19 | +import java.time.LocalDateTime; | ||
| 20 | +import java.util.List; | ||
| 21 | + | ||
| 22 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 23 | + | ||
| 24 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 25 | + | ||
| 26 | +@Tag(name = "管理后台 - MES 假期设置") | ||
| 27 | +@RestController | ||
| 28 | +@RequestMapping("/mes/cal/holiday") | ||
| 29 | +@Validated | ||
| 30 | +public class MesCalHolidayController { | ||
| 31 | + | ||
| 32 | + @Resource | ||
| 33 | + private MesCalHolidayService holidayService; | ||
| 34 | + | ||
| 35 | + @PostMapping("/save") | ||
| 36 | + @Operation(summary = "保存假期设置", description = "如果该日期已存在记录,则更新") | ||
| 37 | + @PreAuthorize("@ss.hasPermission('mes:cal-holiday:create')") | ||
| 38 | + public CommonResult<Long> saveHoliday(@Valid @RequestBody MesCalHolidaySaveReqVO saveReqVO) { | ||
| 39 | + return success(holidayService.saveHoliday(saveReqVO)); | ||
| 40 | + } | ||
| 41 | + | ||
| 42 | + @GetMapping("/get-by-day") | ||
| 43 | + @Operation(summary = "根据日期获得假期设置") | ||
| 44 | + @Parameter(name = "day", description = "日期", required = true) | ||
| 45 | + @PreAuthorize("@ss.hasPermission('mes:cal-holiday:query')") | ||
| 46 | + public CommonResult<MesCalHolidayRespVO> getHolidayByDay( | ||
| 47 | + @RequestParam("day") @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) LocalDateTime day) { | ||
| 48 | + MesCalHolidayDO holiday = holidayService.getHolidayByDay(day); | ||
| 49 | + return success(BeanUtils.toBean(holiday, MesCalHolidayRespVO.class)); | ||
| 50 | + } | ||
| 51 | + | ||
| 52 | + @GetMapping("/list") | ||
| 53 | + @Operation(summary = "获得假期设置列表", description = "支持可选日期范围过滤,不传则返回全量数据") | ||
| 54 | + @PreAuthorize("@ss.hasPermission('mes:cal-holiday:query')") | ||
| 55 | + public CommonResult<List<MesCalHolidayRespVO>> getHolidayList( | ||
| 56 | + @RequestParam(value = "startDay", required = false) | ||
| 57 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) LocalDateTime startDay, | ||
| 58 | + @RequestParam(value = "endDay", required = false) | ||
| 59 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) LocalDateTime endDay) { | ||
| 60 | + List<MesCalHolidayDO> list = holidayService.getHolidayList(startDay, endDay); | ||
| 61 | + return success(BeanUtils.toBean(list, MesCalHolidayRespVO.class)); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/holiday/vo/MesCalHolidayRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.holiday.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 MesCalHolidayRespVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "编号", example = "1024") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | + @Schema(description = "日期") | ||
| 16 | + private LocalDateTime day; | ||
| 17 | + | ||
| 18 | + @Schema(description = "日期类型") | ||
| 19 | + private Integer type; | ||
| 20 | + | ||
| 21 | + @Schema(description = "备注") | ||
| 22 | + private String remark; | ||
| 23 | + | ||
| 24 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/holiday/vo/MesCalHolidaySaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.holiday.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.NotNull; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | + | ||
| 9 | +@Schema(description = "管理后台 - MES 假期设置新增/修改 Request VO") | ||
| 10 | +@Data | ||
| 11 | +public class MesCalHolidaySaveReqVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "编号", example = "1024") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "日期", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 17 | + @NotNull(message = "日期不能为空") | ||
| 18 | + private LocalDateTime day; | ||
| 19 | + | ||
| 20 | + @Schema(description = "日期类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 21 | + @NotNull(message = "日期类型不能为空") | ||
| 22 | + private Integer type; | ||
| 23 | + | ||
| 24 | + @Schema(description = "备注") | ||
| 25 | + private String remark; | ||
| 26 | + | ||
| 27 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/package-info.java
0 → 100644
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/MesCalPlanController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.plan; | ||
| 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.cal.plan.vo.MesCalPlanPageReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.MesCalPlanRespVO; | ||
| 11 | +import cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.MesCalPlanSaveReqVO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.plan.MesCalPlanDO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.service.cal.plan.MesCalPlanService; | ||
| 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/cal/plan") | ||
| 33 | +@Validated | ||
| 34 | +public class MesCalPlanController { | ||
| 35 | + | ||
| 36 | + @Resource | ||
| 37 | + private MesCalPlanService planService; | ||
| 38 | + | ||
| 39 | + @PostMapping("/create") | ||
| 40 | + @Operation(summary = "创建排班计划") | ||
| 41 | + @PreAuthorize("@ss.hasPermission('mes:cal-plan:create')") | ||
| 42 | + public CommonResult<Long> createPlan(@Valid @RequestBody MesCalPlanSaveReqVO createReqVO) { | ||
| 43 | + return success(planService.createPlan(createReqVO)); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @PutMapping("/update") | ||
| 47 | + @Operation(summary = "更新排班计划") | ||
| 48 | + @PreAuthorize("@ss.hasPermission('mes:cal-plan:update')") | ||
| 49 | + public CommonResult<Boolean> updatePlan(@Valid @RequestBody MesCalPlanSaveReqVO updateReqVO) { | ||
| 50 | + planService.updatePlan(updateReqVO); | ||
| 51 | + return success(true); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @PutMapping("/confirm") | ||
| 55 | + @Operation(summary = "确认排班计划") | ||
| 56 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 57 | + @PreAuthorize("@ss.hasPermission('mes:cal-plan:update')") | ||
| 58 | + public CommonResult<Boolean> confirmPlan(@RequestParam("id") Long id) { | ||
| 59 | + planService.confirmPlan(id); | ||
| 60 | + return success(true); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @DeleteMapping("/delete") | ||
| 64 | + @Operation(summary = "删除排班计划") | ||
| 65 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 66 | + @PreAuthorize("@ss.hasPermission('mes:cal-plan:delete')") | ||
| 67 | + public CommonResult<Boolean> deletePlan(@RequestParam("id") Long id) { | ||
| 68 | + planService.deletePlan(id); | ||
| 69 | + return success(true); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @GetMapping("/get") | ||
| 73 | + @Operation(summary = "获得排班计划") | ||
| 74 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 75 | + @PreAuthorize("@ss.hasPermission('mes:cal-plan:query')") | ||
| 76 | + public CommonResult<MesCalPlanRespVO> getPlan(@RequestParam("id") Long id) { | ||
| 77 | + MesCalPlanDO plan = planService.getPlan(id); | ||
| 78 | + return success(BeanUtils.toBean(plan, MesCalPlanRespVO.class)); | ||
| 79 | + } | ||
| 80 | + | ||
| 81 | + @GetMapping("/page") | ||
| 82 | + @Operation(summary = "获得排班计划分页") | ||
| 83 | + @PreAuthorize("@ss.hasPermission('mes:cal-plan:query')") | ||
| 84 | + public CommonResult<PageResult<MesCalPlanRespVO>> getPlanPage(@Valid MesCalPlanPageReqVO pageReqVO) { | ||
| 85 | + PageResult<MesCalPlanDO> pageResult = planService.getPlanPage(pageReqVO); | ||
| 86 | + return success(BeanUtils.toBean(pageResult, MesCalPlanRespVO.class)); | ||
| 87 | + } | ||
| 88 | + | ||
| 89 | + @GetMapping("/export-excel") | ||
| 90 | + @Operation(summary = "导出排班计划 Excel") | ||
| 91 | + @PreAuthorize("@ss.hasPermission('mes:cal-plan:export')") | ||
| 92 | + @ApiAccessLog(operateType = EXPORT) | ||
| 93 | + public void exportPlanExcel(@Valid MesCalPlanPageReqVO pageReqVO, | ||
| 94 | + HttpServletResponse response) throws IOException { | ||
| 95 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 96 | + List<MesCalPlanDO> list = planService.getPlanPage(pageReqVO).getList(); | ||
| 97 | + // 导出 Excel | ||
| 98 | + ExcelUtils.write(response, "排班计划.xls", "数据", MesCalPlanRespVO.class, | ||
| 99 | + BeanUtils.toBean(list, MesCalPlanRespVO.class)); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/MesCalPlanShiftController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.plan; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 5 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 6 | +import cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.shift.MesCalPlanShiftPageReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.shift.MesCalPlanShiftRespVO; | ||
| 8 | +import cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.shift.MesCalPlanShiftSaveReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.plan.MesCalPlanShiftDO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.service.cal.plan.MesCalPlanShiftService; | ||
| 11 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 12 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 13 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 14 | +import jakarta.annotation.Resource; | ||
| 15 | +import jakarta.validation.Valid; | ||
| 16 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 17 | +import org.springframework.validation.annotation.Validated; | ||
| 18 | +import org.springframework.web.bind.annotation.*; | ||
| 19 | + | ||
| 20 | +import java.util.List; | ||
| 21 | + | ||
| 22 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 23 | + | ||
| 24 | +@Tag(name = "管理后台 - MES 计划班次") | ||
| 25 | +@RestController | ||
| 26 | +@RequestMapping("/mes/cal/plan-shift") | ||
| 27 | +@Validated | ||
| 28 | +public class MesCalPlanShiftController { | ||
| 29 | + | ||
| 30 | + @Resource | ||
| 31 | + private MesCalPlanShiftService planShiftService; | ||
| 32 | + | ||
| 33 | + @PostMapping("/create") | ||
| 34 | + @Operation(summary = "创建计划班次") | ||
| 35 | + @PreAuthorize("@ss.hasPermission('mes:cal-plan:update')") | ||
| 36 | + public CommonResult<Long> createPlanShift(@Valid @RequestBody MesCalPlanShiftSaveReqVO createReqVO) { | ||
| 37 | + return success(planShiftService.createPlanShift(createReqVO)); | ||
| 38 | + } | ||
| 39 | + | ||
| 40 | + @PutMapping("/update") | ||
| 41 | + @Operation(summary = "更新计划班次") | ||
| 42 | + @PreAuthorize("@ss.hasPermission('mes:cal-plan:update')") | ||
| 43 | + public CommonResult<Boolean> updatePlanShift(@Valid @RequestBody MesCalPlanShiftSaveReqVO updateReqVO) { | ||
| 44 | + planShiftService.updatePlanShift(updateReqVO); | ||
| 45 | + return success(true); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @DeleteMapping("/delete") | ||
| 49 | + @Operation(summary = "删除计划班次") | ||
| 50 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 51 | + @PreAuthorize("@ss.hasPermission('mes:cal-plan:update')") | ||
| 52 | + public CommonResult<Boolean> deletePlanShift(@RequestParam("id") Long id) { | ||
| 53 | + planShiftService.deletePlanShift(id); | ||
| 54 | + return success(true); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | + @GetMapping("/get") | ||
| 58 | + @Operation(summary = "获得计划班次") | ||
| 59 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 60 | + @PreAuthorize("@ss.hasPermission('mes:cal-plan:query')") | ||
| 61 | + public CommonResult<MesCalPlanShiftRespVO> getPlanShift(@RequestParam("id") Long id) { | ||
| 62 | + MesCalPlanShiftDO planShift = planShiftService.getPlanShift(id); | ||
| 63 | + return success(BeanUtils.toBean(planShift, MesCalPlanShiftRespVO.class)); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @GetMapping("/page") | ||
| 67 | + @Operation(summary = "获得计划班次分页") | ||
| 68 | + @PreAuthorize("@ss.hasPermission('mes:cal-plan:query')") | ||
| 69 | + public CommonResult<PageResult<MesCalPlanShiftRespVO>> getPlanShiftPage(@Valid MesCalPlanShiftPageReqVO pageReqVO) { | ||
| 70 | + PageResult<MesCalPlanShiftDO> pageResult = planShiftService.getPlanShiftPage(pageReqVO); | ||
| 71 | + return success(BeanUtils.toBean(pageResult, MesCalPlanShiftRespVO.class)); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + @GetMapping("/list-by-plan") | ||
| 75 | + @Operation(summary = "获得指定排班计划的班次列表") | ||
| 76 | + @Parameter(name = "planId", description = "排班计划编号", required = true) | ||
| 77 | + @PreAuthorize("@ss.hasPermission('mes:cal-plan:query')") | ||
| 78 | + public CommonResult<List<MesCalPlanShiftRespVO>> getPlanShiftListByPlan(@RequestParam("planId") Long planId) { | ||
| 79 | + List<MesCalPlanShiftDO> list = planShiftService.getPlanShiftListByPlanId(planId); | ||
| 80 | + return success(BeanUtils.toBean(list, MesCalPlanShiftRespVO.class)); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/MesCalPlanTeamController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.plan; | ||
| 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.object.BeanUtils; | ||
| 6 | +import cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.team.MesCalPlanTeamRespVO; | ||
| 7 | +import cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.team.MesCalPlanTeamSaveReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.plan.MesCalPlanTeamDO; | ||
| 9 | +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamDO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.service.cal.plan.MesCalPlanTeamService; | ||
| 11 | +import cn.iocoder.yudao.module.mes.service.cal.team.MesCalTeamService; | ||
| 12 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 13 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 14 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 15 | +import jakarta.annotation.Resource; | ||
| 16 | +import jakarta.validation.Valid; | ||
| 17 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 18 | +import org.springframework.validation.annotation.Validated; | ||
| 19 | +import org.springframework.web.bind.annotation.*; | ||
| 20 | + | ||
| 21 | +import java.util.List; | ||
| 22 | +import java.util.Map; | ||
| 23 | + | ||
| 24 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 25 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | ||
| 26 | + | ||
| 27 | +@Tag(name = "管理后台 - MES 计划班组关联") | ||
| 28 | +@RestController | ||
| 29 | +@RequestMapping("/mes/cal/plan-team") | ||
| 30 | +@Validated | ||
| 31 | +public class MesCalPlanTeamController { | ||
| 32 | + | ||
| 33 | + @Resource | ||
| 34 | + private MesCalPlanTeamService planTeamService; | ||
| 35 | + @Resource | ||
| 36 | + private MesCalTeamService teamService; | ||
| 37 | + | ||
| 38 | + @PostMapping("/create") | ||
| 39 | + @Operation(summary = "创建计划班组关联") | ||
| 40 | + @PreAuthorize("@ss.hasPermission('mes:cal-plan:update')") | ||
| 41 | + public CommonResult<Long> createPlanTeam(@Valid @RequestBody MesCalPlanTeamSaveReqVO createReqVO) { | ||
| 42 | + return success(planTeamService.createPlanTeam(createReqVO)); | ||
| 43 | + } | ||
| 44 | + | ||
| 45 | + @DeleteMapping("/delete") | ||
| 46 | + @Operation(summary = "删除计划班组关联") | ||
| 47 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 48 | + @PreAuthorize("@ss.hasPermission('mes:cal-plan:update')") | ||
| 49 | + public CommonResult<Boolean> deletePlanTeam(@RequestParam("id") Long id) { | ||
| 50 | + planTeamService.deletePlanTeam(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:cal-plan:query')") | ||
| 58 | + public CommonResult<List<MesCalPlanTeamRespVO>> getPlanTeamListByPlan(@RequestParam("planId") Long planId) { | ||
| 59 | + List<MesCalPlanTeamDO> list = planTeamService.getPlanTeamListByPlanId(planId); | ||
| 60 | + List<MesCalPlanTeamRespVO> respList = BeanUtils.toBean(list, MesCalPlanTeamRespVO.class); | ||
| 61 | + // 拼装班组编码/名称 | ||
| 62 | + // TODO @AI:if return | ||
| 63 | + if (CollUtil.isNotEmpty(respList)) { | ||
| 64 | + Map<Long, MesCalTeamDO> teamMap = teamService.getTeamMap( | ||
| 65 | + convertList(respList, MesCalPlanTeamRespVO::getTeamId)); | ||
| 66 | + respList.forEach(resp -> { | ||
| 67 | + // TODO @AI:findand then | ||
| 68 | + MesCalTeamDO team = teamMap.get(resp.getTeamId()); | ||
| 69 | + if (team != null) { | ||
| 70 | + resp.setTeamCode(team.getCode()).setTeamName(team.getName()); | ||
| 71 | + } | ||
| 72 | + }); | ||
| 73 | + } | ||
| 74 | + return success(respList); | ||
| 75 | + } | ||
| 76 | + | ||
| 77 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/vo/MesCalPlanPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.plan.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 MesCalPlanPageReqVO extends PageParam { | ||
| 19 | + | ||
| 20 | + @Schema(description = "计划编码", example = "PLAN001") | ||
| 21 | + private String code; | ||
| 22 | + | ||
| 23 | + @Schema(description = "计划名称", example = "2024年排班") | ||
| 24 | + private String name; | ||
| 25 | + | ||
| 26 | + @Schema(description = "轮班方式", example = "1") | ||
| 27 | + private Integer shiftType; | ||
| 28 | + | ||
| 29 | + @Schema(description = "状态", example = "0") | ||
| 30 | + private Integer status; | ||
| 31 | + | ||
| 32 | + @Schema(description = "班组类型", example = "1") | ||
| 33 | + private Integer calendarType; | ||
| 34 | + | ||
| 35 | + @Schema(description = "开始日期") | ||
| 36 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 37 | + private LocalDateTime[] startDate; | ||
| 38 | + | ||
| 39 | + @Schema(description = "结束日期") | ||
| 40 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 41 | + private LocalDateTime[] endDate; | ||
| 42 | + | ||
| 43 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/vo/MesCalPlanRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.plan.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 MesCalPlanRespVO { | ||
| 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 = "PLAN001") | ||
| 20 | + @ExcelProperty("计划编码") | ||
| 21 | + private String code; | ||
| 22 | + | ||
| 23 | + @Schema(description = "计划名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "2024年排班计划") | ||
| 24 | + @ExcelProperty("计划名称") | ||
| 25 | + private String name; | ||
| 26 | + | ||
| 27 | + @Schema(description = "班组类型", example = "1") | ||
| 28 | + @ExcelProperty("班组类型") | ||
| 29 | + private Integer calendarType; | ||
| 30 | + | ||
| 31 | + @Schema(description = "开始日期", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 32 | + @ExcelProperty("开始日期") | ||
| 33 | + private LocalDateTime startDate; | ||
| 34 | + | ||
| 35 | + @Schema(description = "结束日期", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 36 | + @ExcelProperty("结束日期") | ||
| 37 | + private LocalDateTime endDate; | ||
| 38 | + | ||
| 39 | + @Schema(description = "轮班方式", example = "1") | ||
| 40 | + @ExcelProperty("轮班方式") | ||
| 41 | + private Integer shiftType; | ||
| 42 | + | ||
| 43 | + @Schema(description = "倒班方式", example = "1") | ||
| 44 | + @ExcelProperty("倒班方式") | ||
| 45 | + private Integer shiftMethod; | ||
| 46 | + | ||
| 47 | + @Schema(description = "倒班天数", example = "7") | ||
| 48 | + @ExcelProperty("倒班天数") | ||
| 49 | + private Integer shiftCount; | ||
| 50 | + | ||
| 51 | + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | ||
| 52 | + @ExcelProperty("状态") | ||
| 53 | + private Integer status; | ||
| 54 | + | ||
| 55 | + @Schema(description = "备注") | ||
| 56 | + @ExcelProperty("备注") | ||
| 57 | + private String remark; | ||
| 58 | + | ||
| 59 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 60 | + @ExcelProperty("创建时间") | ||
| 61 | + private LocalDateTime createTime; | ||
| 62 | + | ||
| 63 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/vo/MesCalPlanSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.plan.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 MesCalPlanSaveReqVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "计划编号", example = "1024") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + @Schema(description = "计划编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "PLAN001") | ||
| 18 | + @NotEmpty(message = "计划编码不能为空") | ||
| 19 | + private String code; | ||
| 20 | + | ||
| 21 | + @Schema(description = "计划名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "2024年排班计划") | ||
| 22 | + @NotEmpty(message = "计划名称不能为空") | ||
| 23 | + private String name; | ||
| 24 | + | ||
| 25 | + @Schema(description = "班组类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 26 | + @NotNull(message = "班组类型不能为空") | ||
| 27 | + private Integer calendarType; | ||
| 28 | + | ||
| 29 | + @Schema(description = "开始日期", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 30 | + @NotNull(message = "开始日期不能为空") | ||
| 31 | + private LocalDateTime startDate; | ||
| 32 | + | ||
| 33 | + @Schema(description = "结束日期", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 34 | + @NotNull(message = "结束日期不能为空") | ||
| 35 | + private LocalDateTime endDate; | ||
| 36 | + | ||
| 37 | + @Schema(description = "轮班方式", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 38 | + @NotNull(message = "轮班方式不能为空") | ||
| 39 | + private Integer shiftType; | ||
| 40 | + | ||
| 41 | + @Schema(description = "倒班方式", example = "1") | ||
| 42 | + private Integer shiftMethod; | ||
| 43 | + | ||
| 44 | + @Schema(description = "倒班天数", example = "7") | ||
| 45 | + private Integer shiftCount; | ||
| 46 | + | ||
| 47 | + @Schema(description = "状态", example = "0") | ||
| 48 | + private Integer status; | ||
| 49 | + | ||
| 50 | + @Schema(description = "备注") | ||
| 51 | + private String remark; | ||
| 52 | + | ||
| 53 | + } |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/vo/shift/MesCalPlanShiftPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.shift; | ||
| 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 | + | ||
| 9 | +@Schema(description = "管理后台 - MES 计划班次分页 Request VO") | ||
| 10 | +@Data | ||
| 11 | +@EqualsAndHashCode(callSuper = true) | ||
| 12 | +@ToString(callSuper = true) | ||
| 13 | +public class MesCalPlanShiftPageReqVO extends PageParam { | ||
| 14 | + | ||
| 15 | + @Schema(description = "排班计划编号", example = "1") | ||
| 16 | + private Long planId; | ||
| 17 | + | ||
| 18 | + @Schema(description = "班次名称", example = "白班") | ||
| 19 | + private String name; | ||
| 20 | + | ||
| 21 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/vo/shift/MesCalPlanShiftRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.shift; | ||
| 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 MesCalPlanShiftRespVO { | ||
| 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 Integer sort; | ||
| 20 | + | ||
| 21 | + @Schema(description = "班次名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "白班") | ||
| 22 | + private String name; | ||
| 23 | + | ||
| 24 | + @Schema(description = "开始时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "08:00") | ||
| 25 | + private String startTime; | ||
| 26 | + | ||
| 27 | + @Schema(description = "结束时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "17:00") | ||
| 28 | + private String endTime; | ||
| 29 | + | ||
| 30 | + @Schema(description = "备注") | ||
| 31 | + private String remark; | ||
| 32 | + | ||
| 33 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 34 | + private LocalDateTime createTime; | ||
| 35 | + | ||
| 36 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/vo/shift/MesCalPlanShiftSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.shift; | ||
| 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 | +@Schema(description = "管理后台 - MES 计划班次新增/修改 Request VO") | ||
| 9 | +@Data | ||
| 10 | +public class MesCalPlanShiftSaveReqVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "班次编号", example = "1024") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | + @Schema(description = "排班计划编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 16 | + @NotNull(message = "排班计划不能为空") | ||
| 17 | + private Long planId; | ||
| 18 | + | ||
| 19 | + @Schema(description = "显示顺序", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 20 | + @NotNull(message = "显示顺序不能为空") | ||
| 21 | + private Integer sort; | ||
| 22 | + | ||
| 23 | + @Schema(description = "班次名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "白班") | ||
| 24 | + @NotEmpty(message = "班次名称不能为空") | ||
| 25 | + private String name; | ||
| 26 | + | ||
| 27 | + @Schema(description = "开始时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "08:00") | ||
| 28 | + @NotEmpty(message = "开始时间不能为空") | ||
| 29 | + private String startTime; | ||
| 30 | + | ||
| 31 | + @Schema(description = "结束时间", requiredMode = Schema.RequiredMode.REQUIRED, example = "17:00") | ||
| 32 | + @NotEmpty(message = "结束时间不能为空") | ||
| 33 | + private String endTime; | ||
| 34 | + | ||
| 35 | + @Schema(description = "备注") | ||
| 36 | + private String remark; | ||
| 37 | + | ||
| 38 | + } |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/vo/team/MesCalPlanTeamRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.team; | ||
| 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 MesCalPlanTeamRespVO { | ||
| 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 teamId; | ||
| 20 | + | ||
| 21 | + @Schema(description = "班组编码", example = "T001") | ||
| 22 | + private String teamCode; | ||
| 23 | + | ||
| 24 | + @Schema(description = "班组名称", example = "A组") | ||
| 25 | + private String teamName; | ||
| 26 | + | ||
| 27 | + @Schema(description = "备注") | ||
| 28 | + private String remark; | ||
| 29 | + | ||
| 30 | + @Schema(description = "创建时间") | ||
| 31 | + private LocalDateTime createTime; | ||
| 32 | + | ||
| 33 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/plan/vo/team/MesCalPlanTeamSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.plan.vo.team; | ||
| 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 MesCalPlanTeamSaveReqVO { | ||
| 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 teamId; | ||
| 21 | + | ||
| 22 | + @Schema(description = "备注") | ||
| 23 | + private String remark; | ||
| 24 | + | ||
| 25 | + } |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/MesCalTeamController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.team; | ||
| 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.cal.team.vo.MesCalTeamPageReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.MesCalTeamRespVO; | ||
| 11 | +import cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.MesCalTeamSaveReqVO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamDO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.service.cal.team.MesCalTeamService; | ||
| 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/cal/team") | ||
| 33 | +@Validated | ||
| 34 | +public class MesCalTeamController { | ||
| 35 | + | ||
| 36 | + @Resource | ||
| 37 | + private MesCalTeamService teamService; | ||
| 38 | + | ||
| 39 | + @PostMapping("/create") | ||
| 40 | + @Operation(summary = "创建班组") | ||
| 41 | + @PreAuthorize("@ss.hasPermission('mes:cal-team:create')") | ||
| 42 | + public CommonResult<Long> createTeam(@Valid @RequestBody MesCalTeamSaveReqVO createReqVO) { | ||
| 43 | + return success(teamService.createTeam(createReqVO)); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @PutMapping("/update") | ||
| 47 | + @Operation(summary = "更新班组") | ||
| 48 | + @PreAuthorize("@ss.hasPermission('mes:cal-team:update')") | ||
| 49 | + public CommonResult<Boolean> updateTeam(@Valid @RequestBody MesCalTeamSaveReqVO updateReqVO) { | ||
| 50 | + teamService.updateTeam(updateReqVO); | ||
| 51 | + return success(true); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @DeleteMapping("/delete") | ||
| 55 | + @Operation(summary = "删除班组") | ||
| 56 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 57 | + @PreAuthorize("@ss.hasPermission('mes:cal-team:delete')") | ||
| 58 | + public CommonResult<Boolean> deleteTeam(@RequestParam("id") Long id) { | ||
| 59 | + teamService.deleteTeam(id); | ||
| 60 | + return success(true); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @GetMapping("/get") | ||
| 64 | + @Operation(summary = "获得班组") | ||
| 65 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 66 | + @PreAuthorize("@ss.hasPermission('mes:cal-team:query')") | ||
| 67 | + public CommonResult<MesCalTeamRespVO> getTeam(@RequestParam("id") Long id) { | ||
| 68 | + MesCalTeamDO team = teamService.getTeam(id); | ||
| 69 | + return success(BeanUtils.toBean(team, MesCalTeamRespVO.class)); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @GetMapping("/page") | ||
| 73 | + @Operation(summary = "获得班组分页") | ||
| 74 | + @PreAuthorize("@ss.hasPermission('mes:cal-team:query')") | ||
| 75 | + public CommonResult<PageResult<MesCalTeamRespVO>> getTeamPage(@Valid MesCalTeamPageReqVO pageReqVO) { | ||
| 76 | + PageResult<MesCalTeamDO> pageResult = teamService.getTeamPage(pageReqVO); | ||
| 77 | + return success(BeanUtils.toBean(pageResult, MesCalTeamRespVO.class)); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @GetMapping("/list") | ||
| 81 | + @Operation(summary = "获得班组列表") | ||
| 82 | + @PreAuthorize("@ss.hasPermission('mes:cal-team:query')") | ||
| 83 | + public CommonResult<List<MesCalTeamRespVO>> getTeamList() { | ||
| 84 | + List<MesCalTeamDO> list = teamService.getTeamList(); | ||
| 85 | + return success(BeanUtils.toBean(list, MesCalTeamRespVO.class)); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + @GetMapping("/export-excel") | ||
| 89 | + @Operation(summary = "导出班组 Excel") | ||
| 90 | + @PreAuthorize("@ss.hasPermission('mes:cal-team:export')") | ||
| 91 | + @ApiAccessLog(operateType = EXPORT) | ||
| 92 | + public void exportTeamExcel(@Valid MesCalTeamPageReqVO pageReqVO, | ||
| 93 | + HttpServletResponse response) throws IOException { | ||
| 94 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 95 | + List<MesCalTeamDO> list = teamService.getTeamPage(pageReqVO).getList(); | ||
| 96 | + // 导出 Excel | ||
| 97 | + ExcelUtils.write(response, "班组.xls", "数据", MesCalTeamRespVO.class, | ||
| 98 | + BeanUtils.toBean(list, MesCalTeamRespVO.class)); | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/MesCalTeamMemberController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.team; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||
| 7 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 8 | +import cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.member.MesCalTeamMemberPageReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.member.MesCalTeamMemberRespVO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.member.MesCalTeamMemberSaveReqVO; | ||
| 11 | +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamMemberDO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.service.cal.team.MesCalTeamMemberService; | ||
| 13 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | ||
| 14 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | ||
| 15 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 16 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 17 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 18 | +import jakarta.annotation.Resource; | ||
| 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.util.Collection; | ||
| 25 | +import java.util.Collections; | ||
| 26 | +import java.util.List; | ||
| 27 | +import java.util.Map; | ||
| 28 | + | ||
| 29 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 30 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||
| 31 | + | ||
| 32 | +@Tag(name = "管理后台 - MES 班组成员") | ||
| 33 | +@RestController | ||
| 34 | +@RequestMapping("/mes/cal/team-member") | ||
| 35 | +@Validated | ||
| 36 | +public class MesCalTeamMemberController { | ||
| 37 | + | ||
| 38 | + @Resource | ||
| 39 | + private MesCalTeamMemberService teamMemberService; | ||
| 40 | + @Resource | ||
| 41 | + private AdminUserApi adminUserApi; | ||
| 42 | + | ||
| 43 | + @PostMapping("/create") | ||
| 44 | + @Operation(summary = "创建班组成员") | ||
| 45 | + @PreAuthorize("@ss.hasPermission('mes:cal-team:create')") | ||
| 46 | + public CommonResult<Long> createTeamMember(@Valid @RequestBody MesCalTeamMemberSaveReqVO createReqVO) { | ||
| 47 | + return success(teamMemberService.createTeamMember(createReqVO)); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + @DeleteMapping("/delete") | ||
| 51 | + @Operation(summary = "删除班组成员") | ||
| 52 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 53 | + @PreAuthorize("@ss.hasPermission('mes:cal-team:delete')") | ||
| 54 | + public CommonResult<Boolean> deleteTeamMember(@RequestParam("id") Long id) { | ||
| 55 | + teamMemberService.deleteTeamMember(id); | ||
| 56 | + return success(true); | ||
| 57 | + } | ||
| 58 | + | ||
| 59 | + @GetMapping("/get") | ||
| 60 | + @Operation(summary = "获得班组成员") | ||
| 61 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 62 | + @PreAuthorize("@ss.hasPermission('mes:cal-team:query')") | ||
| 63 | + public CommonResult<MesCalTeamMemberRespVO> getTeamMember(@RequestParam("id") Long id) { | ||
| 64 | + MesCalTeamMemberDO member = teamMemberService.getTeamMember(id); | ||
| 65 | + return success(BeanUtils.toBean(member, MesCalTeamMemberRespVO.class)); | ||
| 66 | + } | ||
| 67 | + | ||
| 68 | + @GetMapping("/page") | ||
| 69 | + @Operation(summary = "获得班组成员分页") | ||
| 70 | + @PreAuthorize("@ss.hasPermission('mes:cal-team:query')") | ||
| 71 | + public CommonResult<PageResult<MesCalTeamMemberRespVO>> getTeamMemberPage(@Valid MesCalTeamMemberPageReqVO pageReqVO) { | ||
| 72 | + PageResult<MesCalTeamMemberDO> pageResult = teamMemberService.getTeamMemberPage(pageReqVO); | ||
| 73 | + return success(BeanUtils.toBean(pageResult, MesCalTeamMemberRespVO.class)); | ||
| 74 | + } | ||
| 75 | + | ||
| 76 | + @GetMapping("/list-by-team") | ||
| 77 | + @Operation(summary = "获得班组成员列表", description = "支持单个 teamId 或多个 teamIds") | ||
| 78 | + @PreAuthorize("@ss.hasPermission('mes:cal-team:query')") | ||
| 79 | + public CommonResult<List<MesCalTeamMemberRespVO>> getTeamMemberListByTeam( | ||
| 80 | + @RequestParam(value = "teamId", required = false) Long teamId, | ||
| 81 | + @RequestParam(value = "teamIds", required = false) Collection<Long> teamIds) { | ||
| 82 | + List<MesCalTeamMemberDO> list; | ||
| 83 | + if (CollUtil.isNotEmpty(teamIds)) { | ||
| 84 | + list = teamMemberService.getTeamMemberListByTeamIds(teamIds); | ||
| 85 | + } else if (teamId != null) { | ||
| 86 | + list = teamMemberService.getTeamMemberListByTeamId(teamId); | ||
| 87 | + } else { | ||
| 88 | + list = Collections.emptyList(); | ||
| 89 | + } | ||
| 90 | + return success(buildMemberRespVOList(list)); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + // ==================== 拼接 VO ==================== | ||
| 94 | + | ||
| 95 | + private List<MesCalTeamMemberRespVO> buildMemberRespVOList(List<MesCalTeamMemberDO> list) { | ||
| 96 | + if (CollUtil.isEmpty(list)) { | ||
| 97 | + return Collections.emptyList(); | ||
| 98 | + } | ||
| 99 | + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap( | ||
| 100 | + convertSet(list, MesCalTeamMemberDO::getUserId)); | ||
| 101 | + return BeanUtils.toBean(list, MesCalTeamMemberRespVO.class, vo -> | ||
| 102 | + MapUtils.findAndThen(userMap, vo.getUserId(), user -> { | ||
| 103 | + vo.setNickname(user.getNickname()); | ||
| 104 | + vo.setTelephone(user.getMobile()); | ||
| 105 | + })); | ||
| 106 | + } | ||
| 107 | + | ||
| 108 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/MesCalTeamShiftController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.team; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 5 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||
| 6 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 7 | +import cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.shift.MesCalTeamShiftListReqVO; | ||
| 8 | +import cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.shift.MesCalTeamShiftRespVO; | ||
| 9 | +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.plan.MesCalPlanShiftDO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamDO; | ||
| 11 | +import cn.iocoder.yudao.module.mes.dal.dataobject.cal.team.MesCalTeamShiftDO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.service.cal.plan.MesCalPlanShiftService; | ||
| 13 | +import cn.iocoder.yudao.module.mes.service.cal.team.MesCalTeamService; | ||
| 14 | +import cn.iocoder.yudao.module.mes.service.cal.team.MesCalTeamShiftService; | ||
| 15 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 16 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 17 | +import jakarta.annotation.Resource; | ||
| 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.GetMapping; | ||
| 22 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 23 | +import org.springframework.web.bind.annotation.RestController; | ||
| 24 | + | ||
| 25 | +import java.util.Collections; | ||
| 26 | +import java.util.List; | ||
| 27 | +import java.util.Map; | ||
| 28 | + | ||
| 29 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 30 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||
| 31 | + | ||
| 32 | +@Tag(name = "管理后台 - MES 班组排班") | ||
| 33 | +@RestController | ||
| 34 | +@RequestMapping("/mes/cal/team-shift") | ||
| 35 | +@Validated | ||
| 36 | +public class MesCalTeamShiftController { | ||
| 37 | + | ||
| 38 | + @Resource | ||
| 39 | + private MesCalTeamShiftService teamShiftService; | ||
| 40 | + @Resource | ||
| 41 | + private MesCalTeamService teamService; | ||
| 42 | + @Resource | ||
| 43 | + private MesCalPlanShiftService planShiftService; | ||
| 44 | + | ||
| 45 | + @GetMapping("/list") | ||
| 46 | + @Operation(summary = "获得班组排班列表") | ||
| 47 | + @PreAuthorize("@ss.hasPermission('mes:cal-team-shift:query')") | ||
| 48 | + public CommonResult<List<MesCalTeamShiftRespVO>> getTeamShiftList(@Valid MesCalTeamShiftListReqVO reqVO) { | ||
| 49 | + List<MesCalTeamShiftDO> list = teamShiftService.getTeamShiftList(reqVO); | ||
| 50 | + if (CollUtil.isEmpty(list)) { | ||
| 51 | + return success(Collections.emptyList()); | ||
| 52 | + } | ||
| 53 | + // 关联查询班组名称和班次名称 | ||
| 54 | + Map<Long, MesCalTeamDO> teamMap = teamService.getTeamMap( | ||
| 55 | + convertSet(list, MesCalTeamShiftDO::getTeamId)); | ||
| 56 | + Map<Long, MesCalPlanShiftDO> shiftMap = planShiftService.getPlanShiftMap( | ||
| 57 | + convertSet(list, MesCalTeamShiftDO::getShiftId)); | ||
| 58 | + return success(BeanUtils.toBean(list, MesCalTeamShiftRespVO.class, vo -> { | ||
| 59 | + MapUtils.findAndThen(teamMap, vo.getTeamId(), team -> vo.setTeamName(team.getName())); | ||
| 60 | + MapUtils.findAndThen(shiftMap, vo.getShiftId(), shift -> vo.setShiftName(shift.getName())); | ||
| 61 | + })); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/MesCalTeamPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.team.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 | + | ||
| 9 | +@Schema(description = "管理后台 - MES 班组分页 Request VO") | ||
| 10 | +@Data | ||
| 11 | +@EqualsAndHashCode(callSuper = true) | ||
| 12 | +@ToString(callSuper = true) | ||
| 13 | +public class MesCalTeamPageReqVO extends PageParam { | ||
| 14 | + | ||
| 15 | + @Schema(description = "班组编码", example = "TEAM-A") | ||
| 16 | + private String code; | ||
| 17 | + | ||
| 18 | + @Schema(description = "班组名称", example = "注塑") | ||
| 19 | + private String name; | ||
| 20 | + | ||
| 21 | + @Schema(description = "班组类型", example = "1") | ||
| 22 | + private Integer calendarType; | ||
| 23 | + | ||
| 24 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/MesCalTeamRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.team.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 MesCalTeamRespVO { | ||
| 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 = "TEAM-A") | ||
| 20 | + @ExcelProperty("班组编码") | ||
| 21 | + private String code; | ||
| 22 | + | ||
| 23 | + @Schema(description = "班组名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "注塑A组") | ||
| 24 | + @ExcelProperty("班组名称") | ||
| 25 | + private String name; | ||
| 26 | + | ||
| 27 | + @Schema(description = "班组类型", example = "1") | ||
| 28 | + @ExcelProperty("班组类型") | ||
| 29 | + private Integer calendarType; | ||
| 30 | + | ||
| 31 | + @Schema(description = "备注") | ||
| 32 | + @ExcelProperty("备注") | ||
| 33 | + private String remark; | ||
| 34 | + | ||
| 35 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 36 | + @ExcelProperty("创建时间") | ||
| 37 | + private LocalDateTime createTime; | ||
| 38 | + | ||
| 39 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/MesCalTeamSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.team.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 | +@Schema(description = "管理后台 - MES 班组新增/修改 Request VO") | ||
| 9 | +@Data | ||
| 10 | +public class MesCalTeamSaveReqVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "班组编号", example = "1024") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | + @Schema(description = "班组编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "TEAM-A") | ||
| 16 | + @NotEmpty(message = "班组编码不能为空") | ||
| 17 | + private String code; | ||
| 18 | + | ||
| 19 | + @Schema(description = "班组名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "注塑A组") | ||
| 20 | + @NotEmpty(message = "班组名称不能为空") | ||
| 21 | + private String name; | ||
| 22 | + | ||
| 23 | + @Schema(description = "班组类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 24 | + @NotNull(message = "班组类型不能为空") | ||
| 25 | + private Integer calendarType; | ||
| 26 | + | ||
| 27 | + @Schema(description = "备注") | ||
| 28 | + private String remark; | ||
| 29 | + | ||
| 30 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/member/MesCalTeamMemberPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.member; | ||
| 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 MesCalTeamMemberPageReqVO extends PageParam { | ||
| 15 | + | ||
| 16 | + @Schema(description = "班组编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "201") | ||
| 17 | + @NotNull(message = "班组编号不能为空") | ||
| 18 | + private Long teamId; | ||
| 19 | + | ||
| 20 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/member/MesCalTeamMemberRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.member; | ||
| 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 MesCalTeamMemberRespVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "班组成员编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | + @Schema(description = "班组编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "201") | ||
| 16 | + private Long teamId; | ||
| 17 | + | ||
| 18 | + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 19 | + private Long userId; | ||
| 20 | + | ||
| 21 | + @Schema(description = "用户昵称", example = "管理员") | ||
| 22 | + private String nickname; | ||
| 23 | + | ||
| 24 | + @Schema(description = "电话", example = "13800138000") | ||
| 25 | + private String telephone; | ||
| 26 | + | ||
| 27 | + @Schema(description = "备注") | ||
| 28 | + private String remark; | ||
| 29 | + | ||
| 30 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 31 | + private LocalDateTime createTime; | ||
| 32 | + | ||
| 33 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/member/MesCalTeamMemberSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.member; | ||
| 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 MesCalTeamMemberSaveReqVO { | ||
| 10 | + | ||
| 11 | + @Schema(description = "班组成员编号", example = "1024") | ||
| 12 | + private Long id; | ||
| 13 | + | ||
| 14 | + @Schema(description = "班组编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "201") | ||
| 15 | + @NotNull(message = "班组编号不能为空") | ||
| 16 | + private Long teamId; | ||
| 17 | + | ||
| 18 | + @Schema(description = "用户编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 19 | + @NotNull(message = "用户编号不能为空") | ||
| 20 | + private Long userId; | ||
| 21 | + | ||
| 22 | + @Schema(description = "备注") | ||
| 23 | + private String remark; | ||
| 24 | + | ||
| 25 | + } |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/shift/MesCalTeamShiftListReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.shift; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 6 | + | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | +import java.util.Collection; | ||
| 9 | + | ||
| 10 | +import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; | ||
| 11 | + | ||
| 12 | +@Schema(description = "管理后台 - MES 班组排班列表 Request VO") | ||
| 13 | +@Data | ||
| 14 | +public class MesCalTeamShiftListReqVO { | ||
| 15 | + | ||
| 16 | + @Schema(description = "班组编号", example = "201") | ||
| 17 | + private Long teamId; | ||
| 18 | + | ||
| 19 | + @Schema(description = "班组编号集合") | ||
| 20 | + private Collection<Long> teamIds; | ||
| 21 | + | ||
| 22 | + @Schema(description = "排班计划编号", example = "1") | ||
| 23 | + private Long planId; | ||
| 24 | + | ||
| 25 | + @Schema(description = "开始日期") | ||
| 26 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 27 | + private LocalDateTime startDay; | ||
| 28 | + | ||
| 29 | + @Schema(description = "结束日期") | ||
| 30 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 31 | + private LocalDateTime endDay; | ||
| 32 | + | ||
| 33 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/cal/team/vo/shift/MesCalTeamShiftRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.cal.team.vo.shift; | ||
| 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 MesCalTeamShiftRespVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | + @Schema(description = "排班计划编号", example = "1") | ||
| 16 | + private Long planId; | ||
| 17 | + | ||
| 18 | + @Schema(description = "班组编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "201") | ||
| 19 | + private Long teamId; | ||
| 20 | + | ||
| 21 | + @Schema(description = "班组名称", example = "注塑A组") | ||
| 22 | + private String teamName; | ||
| 23 | + | ||
| 24 | + @Schema(description = "班次编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 25 | + private Long shiftId; | ||
| 26 | + | ||
| 27 | + @Schema(description = "班次名称", example = "白班") | ||
| 28 | + private String shiftName; | ||
| 29 | + | ||
| 30 | + @Schema(description = "日期", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 31 | + private LocalDateTime day; | ||
| 32 | + | ||
| 33 | + @Schema(description = "排序", example = "1") | ||
| 34 | + private Integer sort; | ||
| 35 | + | ||
| 36 | + @Schema(description = "备注") | ||
| 37 | + private String remark; | ||
| 38 | + | ||
| 39 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 40 | + private LocalDateTime createTime; | ||
| 41 | + | ||
| 42 | +} |
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.MapUtils; | ||
| 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.Collections; | ||
| 23 | +import java.util.List; | ||
| 24 | +import java.util.Map; | ||
| 25 | + | ||
| 26 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 27 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||
| 28 | + | ||
| 29 | +@Tag(name = "管理后台 - MES 点检保养方案设备") | ||
| 30 | +@RestController | ||
| 31 | +@RequestMapping("/mes/dv/check-plan-machinery") | ||
| 32 | +@Validated | ||
| 33 | +public class MesDvCheckPlanMachineryController { | ||
| 34 | + | ||
| 35 | + @Resource | ||
| 36 | + private MesDvCheckPlanMachineryService checkPlanMachineryService; | ||
| 37 | + @Resource | ||
| 38 | + private MesDvMachineryService machineryService; | ||
| 39 | + | ||
| 40 | + @PostMapping("/create") | ||
| 41 | + @Operation(summary = "创建方案设备关联") | ||
| 42 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-plan:update')") | ||
| 43 | + public CommonResult<Long> createCheckPlanMachinery(@Valid @RequestBody MesDvCheckPlanMachinerySaveReqVO createReqVO) { | ||
| 44 | + return success(checkPlanMachineryService.createCheckPlanMachinery(createReqVO)); | ||
| 45 | + } | ||
| 46 | + | ||
| 47 | + @DeleteMapping("/delete") | ||
| 48 | + @Operation(summary = "删除方案设备关联") | ||
| 49 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 50 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-plan:update')") | ||
| 51 | + public CommonResult<Boolean> deleteCheckPlanMachinery(@RequestParam("id") Long id) { | ||
| 52 | + checkPlanMachineryService.deleteCheckPlanMachinery(id); | ||
| 53 | + return success(true); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @GetMapping("/list-by-plan") | ||
| 57 | + @Operation(summary = "获得指定方案的设备列表") | ||
| 58 | + @Parameter(name = "planId", description = "方案编号", required = true) | ||
| 59 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-plan:query')") | ||
| 60 | + public CommonResult<List<MesDvCheckPlanMachineryRespVO>> getCheckPlanMachineryListByPlan( | ||
| 61 | + @RequestParam("planId") Long planId) { | ||
| 62 | + List<MesDvCheckPlanMachineryDO> list = checkPlanMachineryService.getCheckPlanMachineryListByPlanId(planId); | ||
| 63 | + return success(buildCheckPlanMachineryRespVOList(list)); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + // ==================== 拼接 VO ==================== | ||
| 67 | + | ||
| 68 | + private List<MesDvCheckPlanMachineryRespVO> buildCheckPlanMachineryRespVOList( | ||
| 69 | + List<MesDvCheckPlanMachineryDO> list) { | ||
| 70 | + if (CollUtil.isEmpty(list)) { | ||
| 71 | + return Collections.emptyList(); | ||
| 72 | + } | ||
| 73 | + Map<Long, MesDvMachineryDO> machineryMap = machineryService.getMachineryMap( | ||
| 74 | + convertSet(list, MesDvCheckPlanMachineryDO::getMachineryId)); | ||
| 75 | + return BeanUtils.toBean(list, MesDvCheckPlanMachineryRespVO.class, vo -> | ||
| 76 | + MapUtils.findAndThen(machineryMap, vo.getMachineryId(), machinery -> | ||
| 77 | + vo.setMachineryCode(machinery.getCode()).setMachineryName(machinery.getName()) | ||
| 78 | + .setMachineryBrand(machinery.getBrand()).setMachinerySpec(machinery.getSpec()) | ||
| 79 | + ) | ||
| 80 | + ); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | +} |
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 = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 56 | + @ExcelProperty("创建时间") | ||
| 57 | + private LocalDateTime createTime; | ||
| 58 | + | ||
| 59 | +} |
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 | + } |
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 = "创建时间") | ||
| 37 | + private LocalDateTime createTime; | ||
| 38 | + | ||
| 39 | +} |
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 | + } |
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 = "创建时间") | ||
| 40 | + private LocalDateTime createTime; | ||
| 41 | + | ||
| 42 | +} |
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 | + } |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkrecord/MesDvCheckRecordController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.checkrecord; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 7 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 8 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||
| 9 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 10 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 11 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkrecord.vo.MesDvCheckRecordPageReqVO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkrecord.vo.MesDvCheckRecordRespVO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkrecord.vo.MesDvCheckRecordSaveReqVO; | ||
| 14 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.checkplan.MesDvCheckPlanDO; | ||
| 15 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.checkrecord.MesDvCheckRecordDO; | ||
| 16 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.machinery.MesDvMachineryDO; | ||
| 17 | +import cn.iocoder.yudao.module.mes.service.dv.checkplan.MesDvCheckPlanService; | ||
| 18 | +import cn.iocoder.yudao.module.mes.service.dv.checkrecord.MesDvCheckRecordService; | ||
| 19 | +import cn.iocoder.yudao.module.mes.service.dv.machinery.MesDvMachineryService; | ||
| 20 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | ||
| 21 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | ||
| 22 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 23 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 24 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 25 | +import jakarta.annotation.Resource; | ||
| 26 | +import jakarta.servlet.http.HttpServletResponse; | ||
| 27 | +import jakarta.validation.Valid; | ||
| 28 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 29 | +import org.springframework.validation.annotation.Validated; | ||
| 30 | +import org.springframework.web.bind.annotation.*; | ||
| 31 | + | ||
| 32 | +import java.io.IOException; | ||
| 33 | +import java.util.Collections; | ||
| 34 | +import java.util.List; | ||
| 35 | +import java.util.Map; | ||
| 36 | + | ||
| 37 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||
| 38 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 39 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||
| 40 | + | ||
| 41 | +@Tag(name = "管理后台 - MES 设备点检记录") | ||
| 42 | +@RestController | ||
| 43 | +@RequestMapping("/mes/dv/check-record") | ||
| 44 | +@Validated | ||
| 45 | +public class MesDvCheckRecordController { | ||
| 46 | + | ||
| 47 | + @Resource | ||
| 48 | + private MesDvCheckRecordService checkRecordService; | ||
| 49 | + | ||
| 50 | + @Resource | ||
| 51 | + private MesDvCheckPlanService checkPlanService; | ||
| 52 | + | ||
| 53 | + @Resource | ||
| 54 | + private MesDvMachineryService machineryService; | ||
| 55 | + | ||
| 56 | + @Resource | ||
| 57 | + private AdminUserApi adminUserApi; | ||
| 58 | + | ||
| 59 | + @PostMapping("/create") | ||
| 60 | + @Operation(summary = "创建设备点检记录") | ||
| 61 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-record:create')") | ||
| 62 | + public CommonResult<Long> createCheckRecord(@Valid @RequestBody MesDvCheckRecordSaveReqVO createReqVO) { | ||
| 63 | + return success(checkRecordService.createCheckRecord(createReqVO)); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @PutMapping("/update") | ||
| 67 | + @Operation(summary = "更新设备点检记录") | ||
| 68 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-record:update')") | ||
| 69 | + public CommonResult<Boolean> updateCheckRecord(@Valid @RequestBody MesDvCheckRecordSaveReqVO updateReqVO) { | ||
| 70 | + checkRecordService.updateCheckRecord(updateReqVO); | ||
| 71 | + return success(true); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + @PutMapping("/submit") | ||
| 75 | + @Operation(summary = "提交设备点检记录(草稿→已完成)") | ||
| 76 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 77 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-record:update')") | ||
| 78 | + public CommonResult<Boolean> submitCheckRecord(@RequestParam("id") Long id) { | ||
| 79 | + checkRecordService.submitCheckRecord(id); | ||
| 80 | + return success(true); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + @DeleteMapping("/delete") | ||
| 84 | + @Operation(summary = "删除设备点检记录") | ||
| 85 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 86 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-record:delete')") | ||
| 87 | + public CommonResult<Boolean> deleteCheckRecord(@RequestParam("id") Long id) { | ||
| 88 | + checkRecordService.deleteCheckRecord(id); | ||
| 89 | + return success(true); | ||
| 90 | + } | ||
| 91 | + | ||
| 92 | + @GetMapping("/get") | ||
| 93 | + @Operation(summary = "获得设备点检记录") | ||
| 94 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 95 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-record:query')") | ||
| 96 | + public CommonResult<MesDvCheckRecordRespVO> getCheckRecord(@RequestParam("id") Long id) { | ||
| 97 | + MesDvCheckRecordDO checkRecord = checkRecordService.getCheckRecord(id); | ||
| 98 | + if (checkRecord == null) { | ||
| 99 | + return success(null); | ||
| 100 | + } | ||
| 101 | + return success(buildCheckRecordRespVOList(Collections.singletonList(checkRecord)).get(0)); | ||
| 102 | + } | ||
| 103 | + | ||
| 104 | + @GetMapping("/page") | ||
| 105 | + @Operation(summary = "获得设备点检记录分页") | ||
| 106 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-record:query')") | ||
| 107 | + public CommonResult<PageResult<MesDvCheckRecordRespVO>> getCheckRecordPage(@Valid MesDvCheckRecordPageReqVO pageReqVO) { | ||
| 108 | + PageResult<MesDvCheckRecordDO> pageResult = checkRecordService.getCheckRecordPage(pageReqVO); | ||
| 109 | + return success(new PageResult<>(buildCheckRecordRespVOList(pageResult.getList()), pageResult.getTotal())); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + @GetMapping("/export-excel") | ||
| 113 | + @Operation(summary = "导出设备点检记录 Excel") | ||
| 114 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-record:export')") | ||
| 115 | + @ApiAccessLog(operateType = EXPORT) | ||
| 116 | + public void exportCheckRecordExcel(@Valid MesDvCheckRecordPageReqVO pageReqVO, | ||
| 117 | + HttpServletResponse response) throws IOException { | ||
| 118 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 119 | + List<MesDvCheckRecordDO> list = checkRecordService.getCheckRecordPage(pageReqVO).getList(); | ||
| 120 | + ExcelUtils.write(response, "设备点检记录.xls", "数据", MesDvCheckRecordRespVO.class, | ||
| 121 | + buildCheckRecordRespVOList(list)); | ||
| 122 | + } | ||
| 123 | + | ||
| 124 | + // ==================== 拼接 VO ==================== | ||
| 125 | + | ||
| 126 | + @SuppressWarnings("DuplicatedCode") | ||
| 127 | + private List<MesDvCheckRecordRespVO> buildCheckRecordRespVOList(List<MesDvCheckRecordDO> list) { | ||
| 128 | + if (CollUtil.isEmpty(list)) { | ||
| 129 | + return Collections.emptyList(); | ||
| 130 | + } | ||
| 131 | + // 1. 批量获取关联数据 | ||
| 132 | + Map<Long, MesDvCheckPlanDO> planMap = checkPlanService.getCheckPlanMap( | ||
| 133 | + convertSet(list, MesDvCheckRecordDO::getPlanId)); | ||
| 134 | + Map<Long, MesDvMachineryDO> machineryMap = machineryService.getMachineryMap( | ||
| 135 | + convertSet(list, MesDvCheckRecordDO::getMachineryId)); | ||
| 136 | + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap( | ||
| 137 | + convertSet(list, MesDvCheckRecordDO::getUserId)); | ||
| 138 | + // 2. 拼接 VO | ||
| 139 | + return BeanUtils.toBean(list, MesDvCheckRecordRespVO.class, vo -> { | ||
| 140 | + MapUtils.findAndThen(planMap, vo.getPlanId(), | ||
| 141 | + plan -> vo.setPlanName(plan.getName()).setPlanCode(plan.getCode()) | ||
| 142 | + .setPlanStartDate(plan.getStartDate()).setPlanEndDate(plan.getEndDate()) | ||
| 143 | + .setPlanCycleType(plan.getCycleType()).setPlanCycleCount(plan.getCycleCount())); | ||
| 144 | + MapUtils.findAndThen(machineryMap, vo.getMachineryId(), machinery -> vo | ||
| 145 | + .setMachineryCode(machinery.getCode()).setMachineryName(machinery.getName()) | ||
| 146 | + .setMachineryBrand(machinery.getBrand()).setMachinerySpec(machinery.getSpec())); | ||
| 147 | + MapUtils.findAndThen(userMap, vo.getUserId(), | ||
| 148 | + user -> vo.setNickname(user.getNickname())); | ||
| 149 | + }); | ||
| 150 | + } | ||
| 151 | + | ||
| 152 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkrecord/MesDvCheckRecordLineController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.checkrecord; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 6 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||
| 7 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 8 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkrecord.vo.line.MesDvCheckRecordLinePageReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkrecord.vo.line.MesDvCheckRecordLineRespVO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.checkrecord.vo.line.MesDvCheckRecordLineSaveReqVO; | ||
| 11 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.checkrecord.MesDvCheckRecordLineDO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.subject.MesDvSubjectDO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.service.dv.checkrecord.MesDvCheckRecordLineService; | ||
| 14 | +import cn.iocoder.yudao.module.mes.service.dv.subject.MesDvSubjectService; | ||
| 15 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 16 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 17 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 18 | +import jakarta.annotation.Resource; | ||
| 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.util.Collections; | ||
| 25 | +import java.util.List; | ||
| 26 | +import java.util.Map; | ||
| 27 | + | ||
| 28 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 29 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||
| 30 | + | ||
| 31 | +@Tag(name = "管理后台 - MES 设备点检记录明细") | ||
| 32 | +@RestController | ||
| 33 | +@RequestMapping("/mes/dv/check-record-line") | ||
| 34 | +@Validated | ||
| 35 | +public class MesDvCheckRecordLineController { | ||
| 36 | + | ||
| 37 | + @Resource | ||
| 38 | + private MesDvCheckRecordLineService checkRecordLineService; | ||
| 39 | + | ||
| 40 | + @Resource | ||
| 41 | + private MesDvSubjectService subjectService; | ||
| 42 | + | ||
| 43 | + @PostMapping("/create") | ||
| 44 | + @Operation(summary = "创建设备点检记录明细") | ||
| 45 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-record:create')") | ||
| 46 | + public CommonResult<Long> createCheckRecordLine(@Valid @RequestBody MesDvCheckRecordLineSaveReqVO createReqVO) { | ||
| 47 | + return success(checkRecordLineService.createCheckRecordLine(createReqVO)); | ||
| 48 | + } | ||
| 49 | + | ||
| 50 | + @PutMapping("/update") | ||
| 51 | + @Operation(summary = "更新设备点检记录明细") | ||
| 52 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-record:update')") | ||
| 53 | + public CommonResult<Boolean> updateCheckRecordLine(@Valid @RequestBody MesDvCheckRecordLineSaveReqVO updateReqVO) { | ||
| 54 | + checkRecordLineService.updateCheckRecordLine(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:dv-check-record:delete')") | ||
| 62 | + public CommonResult<Boolean> deleteCheckRecordLine(@RequestParam("id") Long id) { | ||
| 63 | + checkRecordLineService.deleteCheckRecordLine(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:dv-check-record:query')") | ||
| 71 | + public CommonResult<MesDvCheckRecordLineRespVO> getCheckRecordLine(@RequestParam("id") Long id) { | ||
| 72 | + MesDvCheckRecordLineDO line = checkRecordLineService.getCheckRecordLine(id); | ||
| 73 | + if (line == null) { | ||
| 74 | + return success(null); | ||
| 75 | + } | ||
| 76 | + return success(buildCheckRecordLineRespVOList(Collections.singletonList(line)).get(0)); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + @GetMapping("/page") | ||
| 80 | + @Operation(summary = "获得设备点检记录明细分页") | ||
| 81 | + @PreAuthorize("@ss.hasPermission('mes:dv-check-record:query')") | ||
| 82 | + public CommonResult<PageResult<MesDvCheckRecordLineRespVO>> getCheckRecordLinePage(@Valid MesDvCheckRecordLinePageReqVO pageReqVO) { | ||
| 83 | + PageResult<MesDvCheckRecordLineDO> pageResult = checkRecordLineService.getCheckRecordLinePage(pageReqVO); | ||
| 84 | + return success(new PageResult<>(buildCheckRecordLineRespVOList(pageResult.getList()), pageResult.getTotal())); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + // ==================== 拼接 VO ==================== | ||
| 88 | + | ||
| 89 | + private List<MesDvCheckRecordLineRespVO> buildCheckRecordLineRespVOList(List<MesDvCheckRecordLineDO> list) { | ||
| 90 | + if (CollUtil.isEmpty(list)) { | ||
| 91 | + return Collections.emptyList(); | ||
| 92 | + } | ||
| 93 | + // 1. 批量获取关联数据 | ||
| 94 | + Map<Long, MesDvSubjectDO> subjectMap = subjectService.getSubjectMap( | ||
| 95 | + convertSet(list, MesDvCheckRecordLineDO::getSubjectId)); | ||
| 96 | + // 2. 拼接 VO | ||
| 97 | + return BeanUtils.toBean(list, MesDvCheckRecordLineRespVO.class, vo -> | ||
| 98 | + MapUtils.findAndThen(subjectMap, vo.getSubjectId(), subject -> vo | ||
| 99 | + .setSubjectCode(subject.getCode()).setSubjectName(subject.getName()) | ||
| 100 | + .setSubjectType(subject.getType()).setSubjectContent(subject.getContent()).setSubjectStandard(subject.getStandard()))); | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkrecord/vo/MesDvCheckRecordPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.checkrecord.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 MesDvCheckRecordPageReqVO extends PageParam { | ||
| 19 | + | ||
| 20 | + @Schema(description = "点检计划编号", example = "1") | ||
| 21 | + private Long planId; | ||
| 22 | + | ||
| 23 | + @Schema(description = "设备编号", example = "1") | ||
| 24 | + private Long machineryId; | ||
| 25 | + | ||
| 26 | + @Schema(description = "点检人编号", example = "1") | ||
| 27 | + private Long userId; | ||
| 28 | + | ||
| 29 | + @Schema(description = "状态", example = "10") | ||
| 30 | + private Integer status; | ||
| 31 | + | ||
| 32 | + @Schema(description = "点检时间") | ||
| 33 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 34 | + private LocalDateTime[] checkTime; | ||
| 35 | + | ||
| 36 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkrecord/vo/MesDvCheckRecordRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.checkrecord.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||
| 5 | +import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; | ||
| 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 9 | +import lombok.Data; | ||
| 10 | + | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | + | ||
| 13 | +@Schema(description = "管理后台 - MES 设备点检记录 Response VO") | ||
| 14 | +@Data | ||
| 15 | +@ExcelIgnoreUnannotated | ||
| 16 | +public class MesDvCheckRecordRespVO { | ||
| 17 | + | ||
| 18 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 19 | + @ExcelProperty("编号") | ||
| 20 | + private Long id; | ||
| 21 | + | ||
| 22 | + @Schema(description = "点检计划编号", example = "1") | ||
| 23 | + private Long planId; | ||
| 24 | + | ||
| 25 | + @Schema(description = "计划名称", example = "日常点检计划") | ||
| 26 | + @ExcelProperty("计划名称") | ||
| 27 | + private String planName; | ||
| 28 | + | ||
| 29 | + @Schema(description = "计划编码", example = "P001") | ||
| 30 | + @ExcelProperty("计划编码") | ||
| 31 | + private String planCode; | ||
| 32 | + | ||
| 33 | + @Schema(description = "开始时间") | ||
| 34 | + @ExcelProperty("开始时间") | ||
| 35 | + private LocalDateTime planStartDate; | ||
| 36 | + | ||
| 37 | + @Schema(description = "结束日期") | ||
| 38 | + @ExcelProperty("结束日期") | ||
| 39 | + private LocalDateTime planEndDate; | ||
| 40 | + | ||
| 41 | + @Schema(description = "频率类型", example = "1") | ||
| 42 | + @ExcelProperty(value = "频率类型", converter = DictConvert.class) | ||
| 43 | + @DictFormat(DictTypeConstants.MES_DV_CYCLE_TYPE) | ||
| 44 | + private Integer planCycleType; | ||
| 45 | + | ||
| 46 | + @Schema(description = "频率数量", example = "5") | ||
| 47 | + @ExcelProperty(value = "频率数量") | ||
| 48 | + private Integer planCycleCount; | ||
| 49 | + | ||
| 50 | + @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 51 | + private Long machineryId; | ||
| 52 | + | ||
| 53 | + @Schema(description = "设备编码", example = "M001") | ||
| 54 | + @ExcelProperty("设备编码") | ||
| 55 | + private String machineryCode; | ||
| 56 | + | ||
| 57 | + @Schema(description = "设备名称", example = "机床A") | ||
| 58 | + @ExcelProperty("设备名称") | ||
| 59 | + private String machineryName; | ||
| 60 | + | ||
| 61 | + @Schema(description = "品牌", example = "西门子") | ||
| 62 | + @ExcelProperty("品牌") | ||
| 63 | + private String machineryBrand; | ||
| 64 | + | ||
| 65 | + @Schema(description = "规格型号", example = "X-100") | ||
| 66 | + @ExcelProperty("规格型号") | ||
| 67 | + private String machinerySpec; | ||
| 68 | + | ||
| 69 | + @Schema(description = "点检时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 70 | + @ExcelProperty("点检时间") | ||
| 71 | + private LocalDateTime checkTime; | ||
| 72 | + | ||
| 73 | + @Schema(description = "点检人编号", example = "1") | ||
| 74 | + private Long userId; | ||
| 75 | + | ||
| 76 | + @Schema(description = "点检人名称", example = "张三") | ||
| 77 | + @ExcelProperty("点检人") | ||
| 78 | + private String nickname; | ||
| 79 | + | ||
| 80 | + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") | ||
| 81 | + @ExcelProperty(value = "状态", converter = DictConvert.class) | ||
| 82 | + @DictFormat(DictTypeConstants.MES_DV_CHECK_RECORD_STATUS) | ||
| 83 | + private Integer status; | ||
| 84 | + | ||
| 85 | + @Schema(description = "备注", example = "测试备注") | ||
| 86 | + @ExcelProperty("备注") | ||
| 87 | + private String remark; | ||
| 88 | + | ||
| 89 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 90 | + @ExcelProperty("创建时间") | ||
| 91 | + private LocalDateTime createTime; | ||
| 92 | + | ||
| 93 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkrecord/vo/MesDvCheckRecordSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.checkrecord.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import jakarta.validation.constraints.NotNull; | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | + | ||
| 9 | +@Schema(description = "管理后台 - MES 设备点检记录新增/修改 Request VO") | ||
| 10 | +@Data | ||
| 11 | +public class MesDvCheckRecordSaveReqVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1024") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "点检计划编号", example = "1") | ||
| 17 | + private Long planId; | ||
| 18 | + | ||
| 19 | + @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 20 | + @NotNull(message = "设备不能为空") | ||
| 21 | + private Long machineryId; | ||
| 22 | + | ||
| 23 | + @Schema(description = "点检时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 24 | + @NotNull(message = "点检时间不能为空") | ||
| 25 | + private LocalDateTime checkTime; | ||
| 26 | + | ||
| 27 | + @Schema(description = "点检人编号", example = "1") | ||
| 28 | + private Long userId; | ||
| 29 | + | ||
| 30 | + @Schema(description = "备注", example = "测试备注") | ||
| 31 | + private String remark; | ||
| 32 | + | ||
| 33 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkrecord/vo/line/MesDvCheckRecordLinePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.checkrecord.vo.line; | ||
| 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 | + | ||
| 9 | +@Schema(description = "管理后台 - MES 设备点检记录明细分页 Request VO") | ||
| 10 | +@Data | ||
| 11 | +@EqualsAndHashCode(callSuper = true) | ||
| 12 | +@ToString(callSuper = true) | ||
| 13 | +public class MesDvCheckRecordLinePageReqVO extends PageParam { | ||
| 14 | + | ||
| 15 | + @Schema(description = "点检记录编号", example = "1") | ||
| 16 | + private Long recordId; | ||
| 17 | + | ||
| 18 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkrecord/vo/line/MesDvCheckRecordLineRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.checkrecord.vo.line; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||
| 5 | +import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; | ||
| 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 9 | +import lombok.Data; | ||
| 10 | + | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | + | ||
| 13 | +@Schema(description = "管理后台 - MES 设备点检记录明细 Response VO") | ||
| 14 | +@Data | ||
| 15 | +@ExcelIgnoreUnannotated | ||
| 16 | +public class MesDvCheckRecordLineRespVO { | ||
| 17 | + | ||
| 18 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 19 | + @ExcelProperty("编号") | ||
| 20 | + private Long id; | ||
| 21 | + | ||
| 22 | + @Schema(description = "点检记录编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 23 | + private Long recordId; | ||
| 24 | + | ||
| 25 | + @Schema(description = "点检项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 26 | + private Long subjectId; | ||
| 27 | + | ||
| 28 | + @Schema(description = "项目编码", example = "S001") | ||
| 29 | + @ExcelProperty("项目编码") | ||
| 30 | + private String subjectCode; | ||
| 31 | + | ||
| 32 | + @Schema(description = "项目名称", example = "润滑油检查") | ||
| 33 | + @ExcelProperty("项目名称") | ||
| 34 | + private String subjectName; | ||
| 35 | + | ||
| 36 | + @Schema(description = "项目类型", example = "1") | ||
| 37 | + @ExcelProperty("项目类型") | ||
| 38 | + private Integer subjectType; | ||
| 39 | + | ||
| 40 | + @Schema(description = "检查内容", example = "检查润滑油是否充足") | ||
| 41 | + @ExcelProperty("检查内容") | ||
| 42 | + private String subjectContent; | ||
| 43 | + | ||
| 44 | + @Schema(description = "检查标准", example = "油位不低于最低刻度") | ||
| 45 | + @ExcelProperty("检查标准") | ||
| 46 | + private String subjectStandard; | ||
| 47 | + | ||
| 48 | + @Schema(description = "点检结果", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 49 | + @ExcelProperty(value = "点检结果", converter = DictConvert.class) | ||
| 50 | + @DictFormat(DictTypeConstants.MES_DV_CHECK_RESULT) | ||
| 51 | + private Integer checkStatus; | ||
| 52 | + | ||
| 53 | + @Schema(description = "异常描述", example = "设备异响") | ||
| 54 | + @ExcelProperty("异常描述") | ||
| 55 | + private String checkResult; | ||
| 56 | + | ||
| 57 | + @Schema(description = "备注", example = "测试备注") | ||
| 58 | + @ExcelProperty("备注") | ||
| 59 | + private String remark; | ||
| 60 | + | ||
| 61 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 62 | + @ExcelProperty("创建时间") | ||
| 63 | + private LocalDateTime createTime; | ||
| 64 | + | ||
| 65 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/checkrecord/vo/line/MesDvCheckRecordLineSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.checkrecord.vo.line; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import jakarta.validation.constraints.NotNull; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - MES 设备点检记录明细新增/修改 Request VO") | ||
| 9 | +@Data | ||
| 10 | +public class MesDvCheckRecordLineSaveReqVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1024") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | + @Schema(description = "点检记录编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 16 | + @NotNull(message = "点检记录不能为空") | ||
| 17 | + private Long recordId; | ||
| 18 | + | ||
| 19 | + @Schema(description = "点检项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 20 | + @NotNull(message = "点检项目不能为空") | ||
| 21 | + private Long subjectId; | ||
| 22 | + | ||
| 23 | + @Schema(description = "点检结果", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 24 | + @NotNull(message = "点检结果不能为空") | ||
| 25 | + private Integer checkStatus; | ||
| 26 | + | ||
| 27 | + @Schema(description = "异常描述", example = "设备异响") | ||
| 28 | + private String checkResult; | ||
| 29 | + | ||
| 30 | + @Schema(description = "备注", example = "测试备注") | ||
| 31 | + private String remark; | ||
| 32 | + | ||
| 33 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/machinery/MesDvMachineryController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.machinery; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 7 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 8 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||
| 9 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 10 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 11 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo.MesDvMachineryImportExcelVO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo.MesDvMachineryImportRespVO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo.MesDvMachineryPageReqVO; | ||
| 14 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo.MesDvMachineryRespVO; | ||
| 15 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo.MesDvMachinerySaveReqVO; | ||
| 16 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.machinery.MesDvMachineryDO; | ||
| 17 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.machinery.MesDvMachineryTypeDO; | ||
| 18 | +import cn.iocoder.yudao.module.mes.dal.dataobject.md.workstation.MesMdWorkshopDO; | ||
| 19 | +import cn.iocoder.yudao.module.mes.service.dv.machinery.MesDvMachineryService; | ||
| 20 | +import cn.iocoder.yudao.module.mes.service.dv.machinery.MesDvMachineryTypeService; | ||
| 21 | +import cn.iocoder.yudao.module.mes.service.md.workstation.MesMdWorkshopService; | ||
| 22 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 23 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 24 | +import io.swagger.v3.oas.annotations.Parameters; | ||
| 25 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 26 | +import jakarta.annotation.Resource; | ||
| 27 | +import jakarta.servlet.http.HttpServletResponse; | ||
| 28 | +import jakarta.validation.Valid; | ||
| 29 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 30 | +import org.springframework.validation.annotation.Validated; | ||
| 31 | +import org.springframework.web.bind.annotation.*; | ||
| 32 | +import org.springframework.web.multipart.MultipartFile; | ||
| 33 | + | ||
| 34 | +import java.io.IOException; | ||
| 35 | +import java.util.Collections; | ||
| 36 | +import java.util.List; | ||
| 37 | +import java.util.Map; | ||
| 38 | + | ||
| 39 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||
| 40 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 41 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||
| 42 | + | ||
| 43 | +@Tag(name = "管理后台 - MES 设备台账") | ||
| 44 | +@RestController | ||
| 45 | +@RequestMapping("/mes/dv/machinery") | ||
| 46 | +@Validated | ||
| 47 | +public class MesDvMachineryController { | ||
| 48 | + | ||
| 49 | + @Resource | ||
| 50 | + private MesDvMachineryService machineryService; | ||
| 51 | + | ||
| 52 | + @Resource | ||
| 53 | + private MesDvMachineryTypeService machineryTypeService; | ||
| 54 | + | ||
| 55 | + @Resource | ||
| 56 | + private MesMdWorkshopService workshopService; | ||
| 57 | + | ||
| 58 | + @PostMapping("/create") | ||
| 59 | + @Operation(summary = "创建设备") | ||
| 60 | + @PreAuthorize("@ss.hasPermission('mes:dv-machinery:create')") | ||
| 61 | + public CommonResult<Long> createMachinery(@Valid @RequestBody MesDvMachinerySaveReqVO createReqVO) { | ||
| 62 | + return success(machineryService.createMachinery(createReqVO)); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + @PutMapping("/update") | ||
| 66 | + @Operation(summary = "更新设备") | ||
| 67 | + @PreAuthorize("@ss.hasPermission('mes:dv-machinery:update')") | ||
| 68 | + public CommonResult<Boolean> updateMachinery(@Valid @RequestBody MesDvMachinerySaveReqVO updateReqVO) { | ||
| 69 | + machineryService.updateMachinery(updateReqVO); | ||
| 70 | + return success(true); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + @DeleteMapping("/delete") | ||
| 74 | + @Operation(summary = "删除设备") | ||
| 75 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 76 | + @PreAuthorize("@ss.hasPermission('mes:dv-machinery:delete')") | ||
| 77 | + public CommonResult<Boolean> deleteMachinery(@RequestParam("id") Long id) { | ||
| 78 | + machineryService.deleteMachinery(id); | ||
| 79 | + return success(true); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + @GetMapping("/get") | ||
| 83 | + @Operation(summary = "获得设备") | ||
| 84 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 85 | + @PreAuthorize("@ss.hasPermission('mes:dv-machinery:query')") | ||
| 86 | + public CommonResult<MesDvMachineryRespVO> getMachinery(@RequestParam("id") Long id) { | ||
| 87 | + MesDvMachineryDO machinery = machineryService.getMachinery(id); | ||
| 88 | + if (machinery == null) { | ||
| 89 | + return success(null); | ||
| 90 | + } | ||
| 91 | + return success(buildMachineryRespVOList(Collections.singletonList(machinery)).get(0)); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + @GetMapping("/page") | ||
| 95 | + @Operation(summary = "获得设备分页") | ||
| 96 | + @PreAuthorize("@ss.hasPermission('mes:dv-machinery:query')") | ||
| 97 | + public CommonResult<PageResult<MesDvMachineryRespVO>> getMachineryPage(@Valid MesDvMachineryPageReqVO pageReqVO) { | ||
| 98 | + PageResult<MesDvMachineryDO> pageResult = machineryService.getMachineryPage(pageReqVO); | ||
| 99 | + return success(new PageResult<>(buildMachineryRespVOList(pageResult.getList()), pageResult.getTotal())); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + @GetMapping("/export-excel") | ||
| 103 | + @Operation(summary = "导出设备 Excel") | ||
| 104 | + @PreAuthorize("@ss.hasPermission('mes:dv-machinery:export')") | ||
| 105 | + @ApiAccessLog(operateType = EXPORT) | ||
| 106 | + public void exportMachineryExcel(@Valid MesDvMachineryPageReqVO pageReqVO, | ||
| 107 | + HttpServletResponse response) throws IOException { | ||
| 108 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 109 | + List<MesDvMachineryDO> list = machineryService.getMachineryPage(pageReqVO).getList(); | ||
| 110 | + // 导出 Excel | ||
| 111 | + ExcelUtils.write(response, "设备台账.xls", "数据", MesDvMachineryRespVO.class, | ||
| 112 | + buildMachineryRespVOList(list)); | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + @GetMapping("/simple-list") | ||
| 116 | + @Operation(summary = "获得设备精简列表", description = "主要用于前端的下拉选项") | ||
| 117 | + @PreAuthorize("@ss.hasPermission('mes:dv-machinery:query')") | ||
| 118 | + public CommonResult<List<MesDvMachineryRespVO>> getMachinerySimpleList() { | ||
| 119 | + List<MesDvMachineryDO> list = machineryService.getMachineryList(); | ||
| 120 | + return success(BeanUtils.toBean(list, MesDvMachineryRespVO.class)); | ||
| 121 | + } | ||
| 122 | + | ||
| 123 | + @GetMapping("/get-import-template") | ||
| 124 | + @Operation(summary = "获得设备导入模板") | ||
| 125 | + public void importTemplate(HttpServletResponse response) throws IOException { | ||
| 126 | + // 手动创建导出 demo | ||
| 127 | + List<MesDvMachineryImportExcelVO> list = Collections.singletonList( | ||
| 128 | + MesDvMachineryImportExcelVO.builder().code("EQ-001").name("示例设备") | ||
| 129 | + .brand("示例品牌").spec("型号A").machineryTypeCode("MT-001") | ||
| 130 | + .workshopCode("WS-001").status(0).build() | ||
| 131 | + ); | ||
| 132 | + // 输出 | ||
| 133 | + ExcelUtils.write(response, "设备导入模板.xls", "设备列表", MesDvMachineryImportExcelVO.class, list); | ||
| 134 | + } | ||
| 135 | + | ||
| 136 | + @PostMapping("/import") | ||
| 137 | + @Operation(summary = "导入设备") | ||
| 138 | + @Parameters({ | ||
| 139 | + @Parameter(name = "file", description = "Excel 文件", required = true), | ||
| 140 | + @Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true") | ||
| 141 | + }) | ||
| 142 | + @PreAuthorize("@ss.hasPermission('mes:dv-machinery:import')") | ||
| 143 | + public CommonResult<MesDvMachineryImportRespVO> importExcel(@RequestParam("file") MultipartFile file, | ||
| 144 | + @RequestParam(value = "updateSupport", required = false, | ||
| 145 | + defaultValue = "false") Boolean updateSupport) throws Exception { | ||
| 146 | + List<MesDvMachineryImportExcelVO> list = ExcelUtils.read(file, MesDvMachineryImportExcelVO.class); | ||
| 147 | + return success(machineryService.importMachineryList(list, updateSupport)); | ||
| 148 | + } | ||
| 149 | + | ||
| 150 | + // ==================== 拼接 VO ==================== | ||
| 151 | + | ||
| 152 | + private List<MesDvMachineryRespVO> buildMachineryRespVOList(List<MesDvMachineryDO> list) { | ||
| 153 | + if (CollUtil.isEmpty(list)) { | ||
| 154 | + return Collections.emptyList(); | ||
| 155 | + } | ||
| 156 | + // 1. 批量获取设备类型和车间信息 | ||
| 157 | + Map<Long, MesDvMachineryTypeDO> machineryTypeMap = machineryTypeService.getMachineryTypeMap( | ||
| 158 | + convertSet(list, MesDvMachineryDO::getMachineryTypeId)); | ||
| 159 | + Map<Long, MesMdWorkshopDO> workshopMap = workshopService.getWorkshopMap( | ||
| 160 | + convertSet(list, MesDvMachineryDO::getWorkshopId)); | ||
| 161 | + // 2. 拼接 VO | ||
| 162 | + return BeanUtils.toBean(list, MesDvMachineryRespVO.class, vo -> { | ||
| 163 | + MapUtils.findAndThen(machineryTypeMap, vo.getMachineryTypeId(), | ||
| 164 | + machineryType -> vo.setMachineryTypeName(machineryType.getName())); | ||
| 165 | + MapUtils.findAndThen(workshopMap, vo.getWorkshopId(), | ||
| 166 | + workshop -> vo.setWorkshopName(workshop.getName())); | ||
| 167 | + }); | ||
| 168 | + } | ||
| 169 | + | ||
| 170 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/machinery/MesDvMachineryTypeController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.machinery; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 4 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 5 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 6 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo.type.MesDvMachineryTypeListReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo.type.MesDvMachineryTypeRespVO; | ||
| 8 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo.type.MesDvMachineryTypeSaveReqVO; | ||
| 9 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.machinery.MesDvMachineryTypeDO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.service.dv.machinery.MesDvMachineryTypeService; | ||
| 11 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 12 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 13 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 14 | +import jakarta.annotation.Resource; | ||
| 15 | +import jakarta.validation.Valid; | ||
| 16 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 17 | +import org.springframework.validation.annotation.Validated; | ||
| 18 | +import org.springframework.web.bind.annotation.*; | ||
| 19 | + | ||
| 20 | +import java.util.List; | ||
| 21 | + | ||
| 22 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 23 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | ||
| 24 | + | ||
| 25 | +@Tag(name = "管理后台 - MES 设备类型") | ||
| 26 | +@RestController | ||
| 27 | +@RequestMapping("/mes/dv/machinery-type") | ||
| 28 | +@Validated | ||
| 29 | +public class MesDvMachineryTypeController { | ||
| 30 | + | ||
| 31 | + @Resource | ||
| 32 | + private MesDvMachineryTypeService machineryTypeService; | ||
| 33 | + | ||
| 34 | + @PostMapping("/create") | ||
| 35 | + @Operation(summary = "创建设备类型") | ||
| 36 | + @PreAuthorize("@ss.hasPermission('mes:dv-machinery-type:create')") | ||
| 37 | + public CommonResult<Long> createMachineryType(@Valid @RequestBody MesDvMachineryTypeSaveReqVO createReqVO) { | ||
| 38 | + return success(machineryTypeService.createMachineryType(createReqVO)); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + @PutMapping("/update") | ||
| 42 | + @Operation(summary = "更新设备类型") | ||
| 43 | + @PreAuthorize("@ss.hasPermission('mes:dv-machinery-type:update')") | ||
| 44 | + public CommonResult<Boolean> updateMachineryType(@Valid @RequestBody MesDvMachineryTypeSaveReqVO updateReqVO) { | ||
| 45 | + machineryTypeService.updateMachineryType(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:dv-machinery-type:delete')") | ||
| 53 | + public CommonResult<Boolean> deleteMachineryType(@RequestParam("id") Long id) { | ||
| 54 | + machineryTypeService.deleteMachineryType(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:dv-machinery-type:query')") | ||
| 62 | + public CommonResult<MesDvMachineryTypeRespVO> getMachineryType(@RequestParam("id") Long id) { | ||
| 63 | + MesDvMachineryTypeDO machineryType = machineryTypeService.getMachineryType(id); | ||
| 64 | + return success(BeanUtils.toBean(machineryType, MesDvMachineryTypeRespVO.class)); | ||
| 65 | + } | ||
| 66 | + | ||
| 67 | + @GetMapping("/list") | ||
| 68 | + @Operation(summary = "获得设备类型列表") | ||
| 69 | + @PreAuthorize("@ss.hasPermission('mes:dv-machinery-type:query')") | ||
| 70 | + public CommonResult<List<MesDvMachineryTypeRespVO>> getMachineryTypeList(@Valid MesDvMachineryTypeListReqVO listReqVO) { | ||
| 71 | + List<MesDvMachineryTypeDO> list = machineryTypeService.getMachineryTypeList(listReqVO); | ||
| 72 | + return success(BeanUtils.toBean(list, MesDvMachineryTypeRespVO.class)); | ||
| 73 | + } | ||
| 74 | + | ||
| 75 | + @GetMapping("/simple-list") | ||
| 76 | + @Operation(summary = "获得设备类型精简列表", description = "只包含被开启的类型,主要用于前端的下拉选项") | ||
| 77 | + public CommonResult<List<MesDvMachineryTypeRespVO>> getMachineryTypeSimpleList() { | ||
| 78 | + List<MesDvMachineryTypeDO> list = machineryTypeService.getMachineryTypeList( | ||
| 79 | + new MesDvMachineryTypeListReqVO().setStatus(CommonStatusEnum.ENABLE.getStatus())); | ||
| 80 | + return success(convertList(list, machineryType -> new MesDvMachineryTypeRespVO() | ||
| 81 | + .setId(machineryType.getId()).setName(machineryType.getName()) | ||
| 82 | + .setParentId(machineryType.getParentId()))); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/machinery/vo/MesDvMachineryImportExcelVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo; | ||
| 2 | + | ||
| 3 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 4 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 5 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||
| 6 | +import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; | ||
| 7 | +import lombok.AllArgsConstructor; | ||
| 8 | +import lombok.Builder; | ||
| 9 | +import lombok.Data; | ||
| 10 | +import lombok.NoArgsConstructor; | ||
| 11 | + | ||
| 12 | +/** | ||
| 13 | + * 设备台账 Excel 导入 VO | ||
| 14 | + */ | ||
| 15 | +@Data | ||
| 16 | +@Builder | ||
| 17 | +@AllArgsConstructor | ||
| 18 | +@NoArgsConstructor | ||
| 19 | +public class MesDvMachineryImportExcelVO { | ||
| 20 | + | ||
| 21 | + @ExcelProperty("设备编码") | ||
| 22 | + private String code; | ||
| 23 | + | ||
| 24 | + @ExcelProperty("设备名称") | ||
| 25 | + private String name; | ||
| 26 | + | ||
| 27 | + @ExcelProperty("品牌") | ||
| 28 | + private String brand; | ||
| 29 | + | ||
| 30 | + @ExcelProperty("规格型号") | ||
| 31 | + private String spec; | ||
| 32 | + | ||
| 33 | + @ExcelProperty("设备类型编码") | ||
| 34 | + private String machineryTypeCode; | ||
| 35 | + | ||
| 36 | + @ExcelProperty("所属车间编码") | ||
| 37 | + private String workshopCode; | ||
| 38 | + | ||
| 39 | + @ExcelProperty(value = "设备状态", converter = DictConvert.class) | ||
| 40 | + @DictFormat(DictTypeConstants.MES_DV_MACHINERY_STATUS) | ||
| 41 | + private Integer status; | ||
| 42 | + | ||
| 43 | + @ExcelProperty("备注") | ||
| 44 | + private String remark; | ||
| 45 | + | ||
| 46 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/machinery/vo/MesDvMachineryImportRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Builder; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +import java.util.List; | ||
| 8 | +import java.util.Map; | ||
| 9 | + | ||
| 10 | +@Schema(description = "管理后台 - MES 设备台账导入 Response VO") | ||
| 11 | +@Data | ||
| 12 | +@Builder | ||
| 13 | +public class MesDvMachineryImportRespVO { | ||
| 14 | + | ||
| 15 | + @Schema(description = "创建成功的设备编码数组", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 16 | + private List<String> createCodes; | ||
| 17 | + | ||
| 18 | + @Schema(description = "更新成功的设备编码数组", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 19 | + private List<String> updateCodes; | ||
| 20 | + | ||
| 21 | + @Schema(description = "导入失败的设备集合,key 为设备编码,value 为失败原因", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 22 | + private Map<String, String> failureCodes; | ||
| 23 | + | ||
| 24 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/machinery/vo/MesDvMachineryPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.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 | + | ||
| 9 | +import java.util.Set; | ||
| 10 | + | ||
| 11 | +@Schema(description = "管理后台 - MES 设备台账分页 Request VO") | ||
| 12 | +@Data | ||
| 13 | +@EqualsAndHashCode(callSuper = true) | ||
| 14 | +@ToString(callSuper = true) | ||
| 15 | +public class MesDvMachineryPageReqVO extends PageParam { | ||
| 16 | + | ||
| 17 | + @Schema(description = "设备编码", example = "EQ-001") | ||
| 18 | + private String code; | ||
| 19 | + | ||
| 20 | + @Schema(description = "设备名称", example = "CNC 加工中心") | ||
| 21 | + private String name; | ||
| 22 | + | ||
| 23 | + @Schema(description = "品牌", example = "西门子") | ||
| 24 | + private String brand; | ||
| 25 | + | ||
| 26 | + @Schema(description = "设备类型编号", example = "100") | ||
| 27 | + private Long machineryTypeId; | ||
| 28 | + | ||
| 29 | + @Schema(description = "设备类型编号列表(含子类型,由后端自动填充)", hidden = true) | ||
| 30 | + private Set<Long> machineryTypeIds; | ||
| 31 | + | ||
| 32 | + @Schema(description = "所属车间编号", example = "200") | ||
| 33 | + private Long workshopId; | ||
| 34 | + | ||
| 35 | + @Schema(description = "设备状态", example = "1") | ||
| 36 | + private Integer status; | ||
| 37 | + | ||
| 38 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/machinery/vo/MesDvMachineryRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||
| 5 | +import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; | ||
| 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 9 | +import lombok.Data; | ||
| 10 | + | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | + | ||
| 13 | +@Schema(description = "管理后台 - MES 设备台账 Response VO") | ||
| 14 | +@Data | ||
| 15 | +@ExcelIgnoreUnannotated | ||
| 16 | +public class MesDvMachineryRespVO { | ||
| 17 | + | ||
| 18 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 19 | + @ExcelProperty("编号") | ||
| 20 | + private Long id; | ||
| 21 | + | ||
| 22 | + @Schema(description = "设备编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "EQ-001") | ||
| 23 | + @ExcelProperty("设备编码") | ||
| 24 | + private String code; | ||
| 25 | + | ||
| 26 | + @Schema(description = "设备名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "CNC 加工中心") | ||
| 27 | + @ExcelProperty("设备名称") | ||
| 28 | + private String name; | ||
| 29 | + | ||
| 30 | + @Schema(description = "品牌", example = "西门子") | ||
| 31 | + @ExcelProperty("品牌") | ||
| 32 | + private String brand; | ||
| 33 | + | ||
| 34 | + @Schema(description = "规格型号", example = "S7-300") | ||
| 35 | + @ExcelProperty("规格型号") | ||
| 36 | + private String spec; | ||
| 37 | + | ||
| 38 | + @Schema(description = "设备类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") | ||
| 39 | + private Long machineryTypeId; | ||
| 40 | + | ||
| 41 | + @Schema(description = "设备类型名称", example = "数控机床") | ||
| 42 | + @ExcelProperty("设备类型") | ||
| 43 | + private String machineryTypeName; | ||
| 44 | + | ||
| 45 | + @Schema(description = "所属车间编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "200") | ||
| 46 | + private Long workshopId; | ||
| 47 | + | ||
| 48 | + @Schema(description = "所属车间名称", example = "一号车间") | ||
| 49 | + @ExcelProperty("所属车间") | ||
| 50 | + private String workshopName; | ||
| 51 | + | ||
| 52 | + @Schema(description = "设备状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 53 | + @ExcelProperty(value = "设备状态", converter = DictConvert.class) | ||
| 54 | + @DictFormat(DictTypeConstants.MES_DV_MACHINERY_STATUS) | ||
| 55 | + private Integer status; | ||
| 56 | + | ||
| 57 | + @Schema(description = "最近保养时间") | ||
| 58 | + @ExcelProperty("最近保养时间") | ||
| 59 | + private LocalDateTime lastMaintenTime; | ||
| 60 | + | ||
| 61 | + @Schema(description = "最近点检时间") | ||
| 62 | + @ExcelProperty("最近点检时间") | ||
| 63 | + private LocalDateTime lastCheckTime; | ||
| 64 | + | ||
| 65 | + @Schema(description = "备注", example = "备注") | ||
| 66 | + @ExcelProperty("备注") | ||
| 67 | + private String remark; | ||
| 68 | + | ||
| 69 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 70 | + @ExcelProperty("创建时间") | ||
| 71 | + private LocalDateTime createTime; | ||
| 72 | + | ||
| 73 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/machinery/vo/MesDvMachinerySaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.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 MesDvMachinerySaveReqVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + @Schema(description = "设备编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "EQ-001") | ||
| 18 | + @NotEmpty(message = "设备编码不能为空") | ||
| 19 | + private String code; | ||
| 20 | + | ||
| 21 | + @Schema(description = "设备名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "CNC 加工中心") | ||
| 22 | + @NotEmpty(message = "设备名称不能为空") | ||
| 23 | + private String name; | ||
| 24 | + | ||
| 25 | + @Schema(description = "品牌", example = "西门子") | ||
| 26 | + private String brand; | ||
| 27 | + | ||
| 28 | + @Schema(description = "规格型号", example = "S7-300") | ||
| 29 | + private String spec; | ||
| 30 | + | ||
| 31 | + @Schema(description = "设备类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "100") | ||
| 32 | + @NotNull(message = "设备类型不能为空") | ||
| 33 | + private Long machineryTypeId; | ||
| 34 | + | ||
| 35 | + @Schema(description = "所属车间编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "200") | ||
| 36 | + @NotNull(message = "所属车间不能为空") | ||
| 37 | + private Long workshopId; | ||
| 38 | + | ||
| 39 | + @Schema(description = "设备状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 40 | + @NotNull(message = "设备状态不能为空") | ||
| 41 | + private Integer status; | ||
| 42 | + | ||
| 43 | + @Schema(description = "最近保养时间") | ||
| 44 | + private LocalDateTime lastMaintenTime; | ||
| 45 | + | ||
| 46 | + @Schema(description = "最近点检时间") | ||
| 47 | + private LocalDateTime lastCheckTime; | ||
| 48 | + | ||
| 49 | + @Schema(description = "备注", example = "备注") | ||
| 50 | + private String remark; | ||
| 51 | + | ||
| 52 | + } |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/machinery/vo/type/MesDvMachineryTypeListReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo.type; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | +import lombok.experimental.Accessors; | ||
| 6 | + | ||
| 7 | +@Schema(description = "管理后台 - MES 设备类型列表 Request VO") | ||
| 8 | +@Data | ||
| 9 | +@Accessors(chain = true) | ||
| 10 | +public class MesDvMachineryTypeListReqVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "类型名称", example = "数控机床") | ||
| 13 | + private String name; | ||
| 14 | + | ||
| 15 | + @Schema(description = "状态", example = "0") | ||
| 16 | + private Integer status; | ||
| 17 | + | ||
| 18 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/machinery/vo/type/MesDvMachineryTypeRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo.type; | ||
| 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 MesDvMachineryTypeRespVO { | ||
| 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 = "MT-001") | ||
| 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 = "0") | ||
| 28 | + private Long parentId; | ||
| 29 | + | ||
| 30 | + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | ||
| 31 | + @ExcelProperty("状态") | ||
| 32 | + private Integer status; | ||
| 33 | + | ||
| 34 | + @Schema(description = "显示排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | ||
| 35 | + @ExcelProperty("显示排序") | ||
| 36 | + private Integer sort; | ||
| 37 | + | ||
| 38 | + @Schema(description = "备注", example = "备注") | ||
| 39 | + @ExcelProperty("备注") | ||
| 40 | + private String remark; | ||
| 41 | + | ||
| 42 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 43 | + @ExcelProperty("创建时间") | ||
| 44 | + private LocalDateTime createTime; | ||
| 45 | + | ||
| 46 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/machinery/vo/type/MesDvMachineryTypeSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.machinery.vo.type; | ||
| 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 | +@Schema(description = "管理后台 - MES 设备类型新增/修改 Request VO") | ||
| 9 | +@Data | ||
| 10 | +public class MesDvMachineryTypeSaveReqVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | + @Schema(description = "类型编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "MT-001") | ||
| 16 | + @NotEmpty(message = "类型编码不能为空") | ||
| 17 | + private String code; | ||
| 18 | + | ||
| 19 | + @Schema(description = "类型名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "数控机床") | ||
| 20 | + @NotEmpty(message = "类型名称不能为空") | ||
| 21 | + private String name; | ||
| 22 | + | ||
| 23 | + @Schema(description = "父类型编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | ||
| 24 | + @NotNull(message = "父类型编号不能为空") | ||
| 25 | + private Long parentId; | ||
| 26 | + | ||
| 27 | + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | ||
| 28 | + @NotNull(message = "状态不能为空") | ||
| 29 | + private Integer status; | ||
| 30 | + | ||
| 31 | + @Schema(description = "显示排序", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | ||
| 32 | + @NotNull(message = "显示排序不能为空") | ||
| 33 | + private Integer sort; | ||
| 34 | + | ||
| 35 | + @Schema(description = "备注", example = "备注") | ||
| 36 | + private String remark; | ||
| 37 | + | ||
| 38 | + } |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/maintenrecord/MesDvMaintenRecordController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.maintenrecord; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 7 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 8 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||
| 9 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 10 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 11 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.maintenrecord.vo.MesDvMaintenRecordPageReqVO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.maintenrecord.vo.MesDvMaintenRecordRespVO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.maintenrecord.vo.MesDvMaintenRecordSaveReqVO; | ||
| 14 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.checkplan.MesDvCheckPlanDO; | ||
| 15 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.machinery.MesDvMachineryDO; | ||
| 16 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.maintenrecord.MesDvMaintenRecordDO; | ||
| 17 | +import cn.iocoder.yudao.module.mes.service.dv.checkplan.MesDvCheckPlanService; | ||
| 18 | +import cn.iocoder.yudao.module.mes.service.dv.machinery.MesDvMachineryService; | ||
| 19 | +import cn.iocoder.yudao.module.mes.service.dv.maintenrecord.MesDvMaintenRecordService; | ||
| 20 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | ||
| 21 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | ||
| 22 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 23 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 24 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 25 | +import jakarta.annotation.Resource; | ||
| 26 | +import jakarta.servlet.http.HttpServletResponse; | ||
| 27 | +import jakarta.validation.Valid; | ||
| 28 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 29 | +import org.springframework.validation.annotation.Validated; | ||
| 30 | +import org.springframework.web.bind.annotation.*; | ||
| 31 | + | ||
| 32 | +import java.io.IOException; | ||
| 33 | +import java.util.Collections; | ||
| 34 | +import java.util.List; | ||
| 35 | +import java.util.Map; | ||
| 36 | + | ||
| 37 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||
| 38 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 39 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||
| 40 | + | ||
| 41 | +@Tag(name = "管理后台 - MES 设备保养记录") | ||
| 42 | +@RestController | ||
| 43 | +@RequestMapping("/mes/dv/mainten-record") | ||
| 44 | +@Validated | ||
| 45 | +public class MesDvMaintenRecordController { | ||
| 46 | + | ||
| 47 | + @Resource | ||
| 48 | + private MesDvMaintenRecordService maintenRecordService; | ||
| 49 | + | ||
| 50 | + @Resource | ||
| 51 | + private MesDvCheckPlanService checkPlanService; | ||
| 52 | + | ||
| 53 | + @Resource | ||
| 54 | + private MesDvMachineryService machineryService; | ||
| 55 | + | ||
| 56 | + @Resource | ||
| 57 | + private AdminUserApi adminUserApi; | ||
| 58 | + | ||
| 59 | + @PostMapping("/create") | ||
| 60 | + @Operation(summary = "创建设备保养记录") | ||
| 61 | + @PreAuthorize("@ss.hasPermission('mes:dv-mainten-record:create')") | ||
| 62 | + public CommonResult<Long> createMaintenRecord(@Valid @RequestBody MesDvMaintenRecordSaveReqVO createReqVO) { | ||
| 63 | + return success(maintenRecordService.createMaintenRecord(createReqVO)); | ||
| 64 | + } | ||
| 65 | + | ||
| 66 | + @PutMapping("/update") | ||
| 67 | + @Operation(summary = "更新设备保养记录") | ||
| 68 | + @PreAuthorize("@ss.hasPermission('mes:dv-mainten-record:update')") | ||
| 69 | + public CommonResult<Boolean> updateMaintenRecord(@Valid @RequestBody MesDvMaintenRecordSaveReqVO updateReqVO) { | ||
| 70 | + maintenRecordService.updateMaintenRecord(updateReqVO); | ||
| 71 | + return success(true); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + @DeleteMapping("/delete") | ||
| 75 | + @Operation(summary = "删除设备保养记录") | ||
| 76 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 77 | + @PreAuthorize("@ss.hasPermission('mes:dv-mainten-record:delete')") | ||
| 78 | + public CommonResult<Boolean> deleteMaintenRecord(@RequestParam("id") Long id) { | ||
| 79 | + maintenRecordService.deleteMaintenRecord(id); | ||
| 80 | + return success(true); | ||
| 81 | + } | ||
| 82 | + | ||
| 83 | + @GetMapping("/get") | ||
| 84 | + @Operation(summary = "获得设备保养记录") | ||
| 85 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 86 | + @PreAuthorize("@ss.hasPermission('mes:dv-mainten-record:query')") | ||
| 87 | + public CommonResult<MesDvMaintenRecordRespVO> getMaintenRecord(@RequestParam("id") Long id) { | ||
| 88 | + MesDvMaintenRecordDO maintenRecord = maintenRecordService.getMaintenRecord(id); | ||
| 89 | + if (maintenRecord == null) { | ||
| 90 | + return success(null); | ||
| 91 | + } | ||
| 92 | + return success(buildMaintenRecordRespVOList(Collections.singletonList(maintenRecord)).get(0)); | ||
| 93 | + } | ||
| 94 | + | ||
| 95 | + @GetMapping("/page") | ||
| 96 | + @Operation(summary = "获得设备保养记录分页") | ||
| 97 | + @PreAuthorize("@ss.hasPermission('mes:dv-mainten-record:query')") | ||
| 98 | + public CommonResult<PageResult<MesDvMaintenRecordRespVO>> getMaintenRecordPage(@Valid MesDvMaintenRecordPageReqVO pageReqVO) { | ||
| 99 | + PageResult<MesDvMaintenRecordDO> pageResult = maintenRecordService.getMaintenRecordPage(pageReqVO); | ||
| 100 | + return success(new PageResult<>(buildMaintenRecordRespVOList(pageResult.getList()), pageResult.getTotal())); | ||
| 101 | + } | ||
| 102 | + | ||
| 103 | + @GetMapping("/export-excel") | ||
| 104 | + @Operation(summary = "导出设备保养记录 Excel") | ||
| 105 | + @PreAuthorize("@ss.hasPermission('mes:dv-mainten-record:export')") | ||
| 106 | + @ApiAccessLog(operateType = EXPORT) | ||
| 107 | + public void exportMaintenRecordExcel(@Valid MesDvMaintenRecordPageReqVO pageReqVO, | ||
| 108 | + HttpServletResponse response) throws IOException { | ||
| 109 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 110 | + List<MesDvMaintenRecordDO> list = maintenRecordService.getMaintenRecordPage(pageReqVO).getList(); | ||
| 111 | + // 导出 Excel | ||
| 112 | + ExcelUtils.write(response, "设备保养记录.xls", "数据", MesDvMaintenRecordRespVO.class, | ||
| 113 | + buildMaintenRecordRespVOList(list)); | ||
| 114 | + } | ||
| 115 | + | ||
| 116 | + @PutMapping("/submit") | ||
| 117 | + @Operation(summary = "提交设备保养记录(草稿→已提交)") | ||
| 118 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 119 | + @PreAuthorize("@ss.hasPermission('mes:dv-mainten-record:update')") | ||
| 120 | + public CommonResult<Boolean> submitMaintenRecord(@RequestParam("id") Long id) { | ||
| 121 | + maintenRecordService.submitMaintenRecord(id); | ||
| 122 | + return success(true); | ||
| 123 | + } | ||
| 124 | + | ||
| 125 | + // ==================== 拼接 VO ==================== | ||
| 126 | + | ||
| 127 | + private List<MesDvMaintenRecordRespVO> buildMaintenRecordRespVOList(List<MesDvMaintenRecordDO> list) { | ||
| 128 | + if (CollUtil.isEmpty(list)) { | ||
| 129 | + return Collections.emptyList(); | ||
| 130 | + } | ||
| 131 | + // 1. 批量获取关联数据 | ||
| 132 | + Map<Long, MesDvCheckPlanDO> planMap = checkPlanService.getCheckPlanMap( | ||
| 133 | + convertSet(list, MesDvMaintenRecordDO::getPlanId)); | ||
| 134 | + Map<Long, MesDvMachineryDO> machineryMap = machineryService.getMachineryMap( | ||
| 135 | + convertSet(list, MesDvMaintenRecordDO::getMachineryId)); | ||
| 136 | + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap( | ||
| 137 | + convertSet(list, MesDvMaintenRecordDO::getUserId)); | ||
| 138 | + // 2. 拼接 VO | ||
| 139 | + return BeanUtils.toBean(list, MesDvMaintenRecordRespVO.class, vo -> { | ||
| 140 | + MapUtils.findAndThen(planMap, vo.getPlanId(), | ||
| 141 | + plan -> vo.setPlanName(plan.getName()) | ||
| 142 | + .setPlanCode(plan.getCode()) | ||
| 143 | + .setPlanStartDate(plan.getStartDate()) | ||
| 144 | + .setPlanEndDate(plan.getEndDate()) | ||
| 145 | + .setPlanCycleType(plan.getCycleType()) | ||
| 146 | + .setPlanCycleCount(plan.getCycleCount())); | ||
| 147 | + MapUtils.findAndThen(machineryMap, vo.getMachineryId(), machinery -> vo | ||
| 148 | + .setMachineryCode(machinery.getCode()).setMachineryName(machinery.getName()) | ||
| 149 | + .setMachineryBrand(machinery.getBrand()).setMachinerySpec(machinery.getSpec())); | ||
| 150 | + MapUtils.findAndThen(userMap, vo.getUserId(), | ||
| 151 | + user -> vo.setNickname(user.getNickname())); | ||
| 152 | + }); | ||
| 153 | + } | ||
| 154 | + | ||
| 155 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/maintenrecord/MesDvMaintenRecordLineController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.maintenrecord; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 7 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 8 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||
| 9 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 10 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 11 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.maintenrecord.vo.line.MesDvMaintenRecordLinePageReqVO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.maintenrecord.vo.line.MesDvMaintenRecordLineRespVO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.maintenrecord.vo.line.MesDvMaintenRecordLineSaveReqVO; | ||
| 14 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.maintenrecord.MesDvMaintenRecordLineDO; | ||
| 15 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.subject.MesDvSubjectDO; | ||
| 16 | +import cn.iocoder.yudao.module.mes.service.dv.maintenrecord.MesDvMaintenRecordLineService; | ||
| 17 | +import cn.iocoder.yudao.module.mes.service.dv.subject.MesDvSubjectService; | ||
| 18 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 19 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 20 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 21 | +import jakarta.annotation.Resource; | ||
| 22 | +import jakarta.servlet.http.HttpServletResponse; | ||
| 23 | +import jakarta.validation.Valid; | ||
| 24 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 25 | +import org.springframework.validation.annotation.Validated; | ||
| 26 | +import org.springframework.web.bind.annotation.*; | ||
| 27 | + | ||
| 28 | +import java.io.IOException; | ||
| 29 | +import java.util.Collections; | ||
| 30 | +import java.util.List; | ||
| 31 | +import java.util.Map; | ||
| 32 | + | ||
| 33 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||
| 34 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 35 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||
| 36 | + | ||
| 37 | +@Tag(name = "管理后台 - MES 设备保养记录明细") | ||
| 38 | +@RestController | ||
| 39 | +@RequestMapping("/mes/dv/mainten-record-line") | ||
| 40 | +@Validated | ||
| 41 | +public class MesDvMaintenRecordLineController { | ||
| 42 | + | ||
| 43 | + @Resource | ||
| 44 | + private MesDvMaintenRecordLineService maintenRecordLineService; | ||
| 45 | + | ||
| 46 | + @Resource | ||
| 47 | + private MesDvSubjectService subjectService; | ||
| 48 | + | ||
| 49 | + @PostMapping("/create") | ||
| 50 | + @Operation(summary = "创建设备保养记录明细") | ||
| 51 | + @PreAuthorize("@ss.hasPermission('mes:dv-mainten-record:create')") | ||
| 52 | + public CommonResult<Long> createMaintenRecordLine(@Valid @RequestBody MesDvMaintenRecordLineSaveReqVO createReqVO) { | ||
| 53 | + return success(maintenRecordLineService.createMaintenRecordLine(createReqVO)); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @PutMapping("/update") | ||
| 57 | + @Operation(summary = "更新设备保养记录明细") | ||
| 58 | + @PreAuthorize("@ss.hasPermission('mes:dv-mainten-record:update')") | ||
| 59 | + public CommonResult<Boolean> updateMaintenRecordLine(@Valid @RequestBody MesDvMaintenRecordLineSaveReqVO updateReqVO) { | ||
| 60 | + maintenRecordLineService.updateMaintenRecordLine(updateReqVO); | ||
| 61 | + return success(true); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @DeleteMapping("/delete") | ||
| 65 | + @Operation(summary = "删除设备保养记录明细") | ||
| 66 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 67 | + @PreAuthorize("@ss.hasPermission('mes:dv-mainten-record:delete')") | ||
| 68 | + public CommonResult<Boolean> deleteMaintenRecordLine(@RequestParam("id") Long id) { | ||
| 69 | + maintenRecordLineService.deleteMaintenRecordLine(id); | ||
| 70 | + return success(true); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + @GetMapping("/get") | ||
| 74 | + @Operation(summary = "获得设备保养记录明细") | ||
| 75 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 76 | + @PreAuthorize("@ss.hasPermission('mes:dv-mainten-record:query')") | ||
| 77 | + public CommonResult<MesDvMaintenRecordLineRespVO> getMaintenRecordLine(@RequestParam("id") Long id) { | ||
| 78 | + MesDvMaintenRecordLineDO maintenRecordLine = maintenRecordLineService.getMaintenRecordLine(id); | ||
| 79 | + if (maintenRecordLine == null) { | ||
| 80 | + return success(null); | ||
| 81 | + } | ||
| 82 | + return success(buildMaintenRecordLineRespVOList(Collections.singletonList(maintenRecordLine)).get(0)); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + @GetMapping("/page") | ||
| 86 | + @Operation(summary = "获得设备保养记录明细分页") | ||
| 87 | + @PreAuthorize("@ss.hasPermission('mes:dv-mainten-record:query')") | ||
| 88 | + public CommonResult<PageResult<MesDvMaintenRecordLineRespVO>> getMaintenRecordLinePage(@Valid MesDvMaintenRecordLinePageReqVO pageReqVO) { | ||
| 89 | + PageResult<MesDvMaintenRecordLineDO> pageResult = maintenRecordLineService.getMaintenRecordLinePage(pageReqVO); | ||
| 90 | + return success(new PageResult<>(buildMaintenRecordLineRespVOList(pageResult.getList()), pageResult.getTotal())); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + @GetMapping("/export-excel") | ||
| 94 | + @Operation(summary = "导出设备保养记录明细 Excel") | ||
| 95 | + @PreAuthorize("@ss.hasPermission('mes:dv-mainten-record:export')") | ||
| 96 | + @ApiAccessLog(operateType = EXPORT) | ||
| 97 | + public void exportMaintenRecordLineExcel(@Valid MesDvMaintenRecordLinePageReqVO pageReqVO, | ||
| 98 | + HttpServletResponse response) throws IOException { | ||
| 99 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 100 | + List<MesDvMaintenRecordLineDO> list = maintenRecordLineService.getMaintenRecordLinePage(pageReqVO).getList(); | ||
| 101 | + // 导出 Excel | ||
| 102 | + ExcelUtils.write(response, "设备保养记录明细.xls", "数据", MesDvMaintenRecordLineRespVO.class, | ||
| 103 | + buildMaintenRecordLineRespVOList(list)); | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + // ==================== 拼接 VO ==================== | ||
| 107 | + | ||
| 108 | + private List<MesDvMaintenRecordLineRespVO> buildMaintenRecordLineRespVOList(List<MesDvMaintenRecordLineDO> list) { | ||
| 109 | + if (CollUtil.isEmpty(list)) { | ||
| 110 | + return Collections.emptyList(); | ||
| 111 | + } | ||
| 112 | + // 1. 批量获取关联数据 | ||
| 113 | + Map<Long, MesDvSubjectDO> subjectMap = subjectService.getSubjectMap( | ||
| 114 | + convertSet(list, MesDvMaintenRecordLineDO::getSubjectId)); | ||
| 115 | + // 2. 拼接 VO | ||
| 116 | + return BeanUtils.toBean(list, MesDvMaintenRecordLineRespVO.class, vo -> | ||
| 117 | + MapUtils.findAndThen(subjectMap, vo.getSubjectId(), subject -> vo | ||
| 118 | + .setSubjectName(subject.getName()).setSubjectContent(subject.getContent()) | ||
| 119 | + .setSubjectStandard(subject.getStandard()))); | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/maintenrecord/vo/MesDvMaintenRecordPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.maintenrecord.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 MesDvMaintenRecordPageReqVO extends PageParam { | ||
| 19 | + | ||
| 20 | + @Schema(description = "保养计划编号", example = "1") | ||
| 21 | + private Long planId; | ||
| 22 | + | ||
| 23 | + @Schema(description = "设备编号", example = "1") | ||
| 24 | + private Long machineryId; | ||
| 25 | + | ||
| 26 | + @Schema(description = "保养人编号", example = "1") | ||
| 27 | + private Long userId; | ||
| 28 | + | ||
| 29 | + @Schema(description = "保养时间") | ||
| 30 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 31 | + private LocalDateTime[] maintenTime; | ||
| 32 | + | ||
| 33 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/maintenrecord/vo/MesDvMaintenRecordRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.maintenrecord.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||
| 5 | +import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; | ||
| 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 9 | +import lombok.Data; | ||
| 10 | + | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | + | ||
| 13 | +@Schema(description = "管理后台 - MES 设备保养记录 Response VO") | ||
| 14 | +@Data | ||
| 15 | +@ExcelIgnoreUnannotated | ||
| 16 | +public class MesDvMaintenRecordRespVO { | ||
| 17 | + | ||
| 18 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 19 | + @ExcelProperty("编号") | ||
| 20 | + private Long id; | ||
| 21 | + | ||
| 22 | + @Schema(description = "计划编号", example = "1") | ||
| 23 | + private Long planId; | ||
| 24 | + | ||
| 25 | + @Schema(description = "计划名称", example = "保养计划1") | ||
| 26 | + @ExcelProperty("计划名称") | ||
| 27 | + private String planName; | ||
| 28 | + | ||
| 29 | + @Schema(description = "计划编码", example = "P001") | ||
| 30 | + @ExcelProperty("计划编码") | ||
| 31 | + private String planCode; | ||
| 32 | + | ||
| 33 | + @Schema(description = "开始时间") | ||
| 34 | + @ExcelProperty("开始时间") | ||
| 35 | + private LocalDateTime planStartDate; | ||
| 36 | + | ||
| 37 | + @Schema(description = "结束日期") | ||
| 38 | + @ExcelProperty("结束日期") | ||
| 39 | + private LocalDateTime planEndDate; | ||
| 40 | + | ||
| 41 | + @Schema(description = "频率类型", example = "1") | ||
| 42 | + @ExcelProperty(value = "频率类型", converter = DictConvert.class) | ||
| 43 | + @DictFormat(DictTypeConstants.MES_DV_CYCLE_TYPE) | ||
| 44 | + private Integer planCycleType; | ||
| 45 | + | ||
| 46 | + @Schema(description = "频率数量", example = "5") | ||
| 47 | + @ExcelProperty(value = "频率数量") | ||
| 48 | + private Integer planCycleCount; | ||
| 49 | + | ||
| 50 | + @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 51 | + private Long machineryId; | ||
| 52 | + | ||
| 53 | + @Schema(description = "设备编码", example = "M001") | ||
| 54 | + @ExcelProperty("设备编码") | ||
| 55 | + private String machineryCode; | ||
| 56 | + | ||
| 57 | + @Schema(description = "设备名称", example = "机床A") | ||
| 58 | + @ExcelProperty("设备名称") | ||
| 59 | + private String machineryName; | ||
| 60 | + | ||
| 61 | + @Schema(description = "品牌", example = "西门子") | ||
| 62 | + @ExcelProperty("品牌") | ||
| 63 | + private String machineryBrand; | ||
| 64 | + | ||
| 65 | + @Schema(description = "规格型号", example = "X-100") | ||
| 66 | + @ExcelProperty("规格型号") | ||
| 67 | + private String machinerySpec; | ||
| 68 | + | ||
| 69 | + @Schema(description = "保养时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 70 | + @ExcelProperty("保养时间") | ||
| 71 | + private LocalDateTime maintenTime; | ||
| 72 | + | ||
| 73 | + @Schema(description = "用户编号", example = "1") | ||
| 74 | + private Long userId; | ||
| 75 | + | ||
| 76 | + @Schema(description = "保养人名称", example = "张三") | ||
| 77 | + @ExcelProperty("保养人") | ||
| 78 | + private String nickname; | ||
| 79 | + | ||
| 80 | + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") | ||
| 81 | + @ExcelProperty(value = "状态", converter = DictConvert.class) | ||
| 82 | + @DictFormat(DictTypeConstants.MES_MAINTEN_RECORD_STATUS) | ||
| 83 | + private Integer status; | ||
| 84 | + | ||
| 85 | + @Schema(description = "备注", example = "测试备注") | ||
| 86 | + @ExcelProperty("备注") | ||
| 87 | + private String remark; | ||
| 88 | + | ||
| 89 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 90 | + @ExcelProperty("创建时间") | ||
| 91 | + private LocalDateTime createTime; | ||
| 92 | + | ||
| 93 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/maintenrecord/vo/MesDvMaintenRecordSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.maintenrecord.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import jakarta.validation.constraints.NotNull; | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | + | ||
| 9 | +@Schema(description = "管理后台 - MES 设备保养记录新增/修改 Request VO") | ||
| 10 | +@Data | ||
| 11 | +public class MesDvMaintenRecordSaveReqVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1024") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "计划编号", example = "1") | ||
| 17 | + private Long planId; | ||
| 18 | + | ||
| 19 | + @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 20 | + @NotNull(message = "设备不能为空") | ||
| 21 | + private Long machineryId; | ||
| 22 | + | ||
| 23 | + @Schema(description = "保养时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 24 | + @NotNull(message = "保养时间不能为空") | ||
| 25 | + private LocalDateTime maintenTime; | ||
| 26 | + | ||
| 27 | + @Schema(description = "用户编号", example = "1") | ||
| 28 | + private Long userId; | ||
| 29 | + | ||
| 30 | + @Schema(description = "备注", example = "测试备注") | ||
| 31 | + private String remark; | ||
| 32 | + | ||
| 33 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/maintenrecord/vo/line/MesDvMaintenRecordLinePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.maintenrecord.vo.line; | ||
| 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 | + | ||
| 9 | +@Schema(description = "管理后台 - MES 设备保养记录明细分页 Request VO") | ||
| 10 | +@Data | ||
| 11 | +@EqualsAndHashCode(callSuper = true) | ||
| 12 | +@ToString(callSuper = true) | ||
| 13 | +public class MesDvMaintenRecordLinePageReqVO extends PageParam { | ||
| 14 | + | ||
| 15 | + @Schema(description = "保养记录ID", example = "1") | ||
| 16 | + private Long recordId; | ||
| 17 | + | ||
| 18 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/maintenrecord/vo/line/MesDvMaintenRecordLineRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.maintenrecord.vo.line; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||
| 5 | +import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; | ||
| 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 9 | +import lombok.Data; | ||
| 10 | + | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | + | ||
| 13 | +@Schema(description = "管理后台 - MES 设备保养记录明细 Response VO") | ||
| 14 | +@Data | ||
| 15 | +@ExcelIgnoreUnannotated | ||
| 16 | +public class MesDvMaintenRecordLineRespVO { | ||
| 17 | + | ||
| 18 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 19 | + @ExcelProperty("编号") | ||
| 20 | + private Long id; | ||
| 21 | + | ||
| 22 | + @Schema(description = "保养记录编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 23 | + private Long recordId; | ||
| 24 | + | ||
| 25 | + @Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 26 | + private Long subjectId; | ||
| 27 | + | ||
| 28 | + @Schema(description = "项目名称", example = "检查机油") | ||
| 29 | + @ExcelProperty("项目名称") | ||
| 30 | + private String subjectName; | ||
| 31 | + | ||
| 32 | + @Schema(description = "项目内容", example = "检查机油是否充足") | ||
| 33 | + @ExcelProperty("项目内容") | ||
| 34 | + private String subjectContent; | ||
| 35 | + | ||
| 36 | + @Schema(description = "项目标准", example = "无漏油") | ||
| 37 | + @ExcelProperty("标准") | ||
| 38 | + private String subjectStandard; | ||
| 39 | + | ||
| 40 | + @Schema(description = "保养结果", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 41 | + @ExcelProperty(value = "保养结果", converter = DictConvert.class) | ||
| 42 | + @DictFormat(DictTypeConstants.MES_MAINTEN_STATUS) | ||
| 43 | + private Integer status; | ||
| 44 | + | ||
| 45 | + @Schema(description = "异常描述", example = "发现损坏") | ||
| 46 | + @ExcelProperty("异常描述") | ||
| 47 | + private String result; | ||
| 48 | + | ||
| 49 | + @Schema(description = "备注", example = "测试备注") | ||
| 50 | + @ExcelProperty("备注") | ||
| 51 | + private String remark; | ||
| 52 | + | ||
| 53 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 54 | + @ExcelProperty("创建时间") | ||
| 55 | + private LocalDateTime createTime; | ||
| 56 | + | ||
| 57 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/maintenrecord/vo/line/MesDvMaintenRecordLineSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.maintenrecord.vo.line; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import jakarta.validation.constraints.NotNull; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - MES 设备保养记录明细新增/修改 Request VO") | ||
| 9 | +@Data | ||
| 10 | +public class MesDvMaintenRecordLineSaveReqVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1024") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | + @Schema(description = "保养记录编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 16 | + @NotNull(message = "保养记录不能为空") | ||
| 17 | + private Long recordId; | ||
| 18 | + | ||
| 19 | + @Schema(description = "项目编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 20 | + @NotNull(message = "项目不能为空") | ||
| 21 | + private Long subjectId; | ||
| 22 | + | ||
| 23 | + @Schema(description = "保养结果", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 24 | + @NotNull(message = "保养结果不能为空") | ||
| 25 | + private Integer status; | ||
| 26 | + | ||
| 27 | + @Schema(description = "异常描述", example = "发现损坏") | ||
| 28 | + private String result; | ||
| 29 | + | ||
| 30 | + @Schema(description = "备注", example = "测试备注") | ||
| 31 | + private String remark; | ||
| 32 | + | ||
| 33 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/package-info.java
0 → 100644
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/repair/MesDvRepairController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.repair; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 7 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 8 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||
| 9 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 10 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 11 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo.MesDvRepairPageReqVO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo.MesDvRepairRespVO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo.MesDvRepairSaveReqVO; | ||
| 14 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.machinery.MesDvMachineryDO; | ||
| 15 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.repair.MesDvRepairDO; | ||
| 16 | +import cn.iocoder.yudao.module.mes.service.dv.machinery.MesDvMachineryService; | ||
| 17 | +import cn.iocoder.yudao.module.mes.service.dv.repair.MesDvRepairService; | ||
| 18 | +import cn.iocoder.yudao.module.system.api.user.AdminUserApi; | ||
| 19 | +import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; | ||
| 20 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 21 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 22 | +import io.swagger.v3.oas.annotations.Parameters; | ||
| 23 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 24 | +import jakarta.annotation.Resource; | ||
| 25 | +import jakarta.servlet.http.HttpServletResponse; | ||
| 26 | +import jakarta.validation.Valid; | ||
| 27 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 28 | +import org.springframework.validation.annotation.Validated; | ||
| 29 | +import org.springframework.web.bind.annotation.*; | ||
| 30 | + | ||
| 31 | +import java.io.IOException; | ||
| 32 | +import java.util.Collections; | ||
| 33 | +import java.util.List; | ||
| 34 | +import java.util.Map; | ||
| 35 | +import java.util.stream.Stream; | ||
| 36 | + | ||
| 37 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||
| 38 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 39 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||
| 40 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSetByFlatMap; | ||
| 41 | +import static cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId; | ||
| 42 | + | ||
| 43 | +@Tag(name = "管理后台 - MES 维修工单") | ||
| 44 | +@RestController | ||
| 45 | +@RequestMapping("/mes/dv/repair") | ||
| 46 | +@Validated | ||
| 47 | +public class MesDvRepairController { | ||
| 48 | + | ||
| 49 | + @Resource | ||
| 50 | + private MesDvRepairService repairService; | ||
| 51 | + | ||
| 52 | + @Resource | ||
| 53 | + private MesDvMachineryService machineryService; | ||
| 54 | + | ||
| 55 | + @Resource | ||
| 56 | + private AdminUserApi adminUserApi; | ||
| 57 | + | ||
| 58 | + @PostMapping("/create") | ||
| 59 | + @Operation(summary = "创建维修工单") | ||
| 60 | + @PreAuthorize("@ss.hasPermission('mes:dv-repair:create')") | ||
| 61 | + public CommonResult<Long> createRepair(@Valid @RequestBody MesDvRepairSaveReqVO createReqVO) { | ||
| 62 | + return success(repairService.createRepair(createReqVO)); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + @PutMapping("/update") | ||
| 66 | + @Operation(summary = "更新维修工单") | ||
| 67 | + @PreAuthorize("@ss.hasPermission('mes:dv-repair:update')") | ||
| 68 | + public CommonResult<Boolean> updateRepair(@Valid @RequestBody MesDvRepairSaveReqVO updateReqVO) { | ||
| 69 | + repairService.updateRepair(updateReqVO); | ||
| 70 | + return success(true); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + @DeleteMapping("/delete") | ||
| 74 | + @Operation(summary = "删除维修工单") | ||
| 75 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 76 | + @PreAuthorize("@ss.hasPermission('mes:dv-repair:delete')") | ||
| 77 | + public CommonResult<Boolean> deleteRepair(@RequestParam("id") Long id) { | ||
| 78 | + repairService.deleteRepair(id); | ||
| 79 | + return success(true); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + @GetMapping("/get") | ||
| 83 | + @Operation(summary = "获得维修工单") | ||
| 84 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 85 | + @PreAuthorize("@ss.hasPermission('mes:dv-repair:query')") | ||
| 86 | + public CommonResult<MesDvRepairRespVO> getRepair(@RequestParam("id") Long id) { | ||
| 87 | + MesDvRepairDO repair = repairService.getRepair(id); | ||
| 88 | + if (repair == null) { | ||
| 89 | + return success(null); | ||
| 90 | + } | ||
| 91 | + return success(buildRepairRespVOList(Collections.singletonList(repair)).get(0)); | ||
| 92 | + } | ||
| 93 | + | ||
| 94 | + @GetMapping("/page") | ||
| 95 | + @Operation(summary = "获得维修工单分页") | ||
| 96 | + @PreAuthorize("@ss.hasPermission('mes:dv-repair:query')") | ||
| 97 | + public CommonResult<PageResult<MesDvRepairRespVO>> getRepairPage(@Valid MesDvRepairPageReqVO pageReqVO) { | ||
| 98 | + PageResult<MesDvRepairDO> pageResult = repairService.getRepairPage(pageReqVO); | ||
| 99 | + return success(new PageResult<>(buildRepairRespVOList(pageResult.getList()), pageResult.getTotal())); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | + @GetMapping("/export-excel") | ||
| 103 | + @Operation(summary = "导出维修工单 Excel") | ||
| 104 | + @PreAuthorize("@ss.hasPermission('mes:dv-repair:export')") | ||
| 105 | + @ApiAccessLog(operateType = EXPORT) | ||
| 106 | + public void exportRepairExcel(@Valid MesDvRepairPageReqVO pageReqVO, | ||
| 107 | + HttpServletResponse response) throws IOException { | ||
| 108 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 109 | + List<MesDvRepairDO> list = repairService.getRepairPage(pageReqVO).getList(); | ||
| 110 | + // 导出 Excel | ||
| 111 | + ExcelUtils.write(response, "维修工单.xls", "数据", MesDvRepairRespVO.class, | ||
| 112 | + buildRepairRespVOList(list)); | ||
| 113 | + } | ||
| 114 | + | ||
| 115 | + // DONE @AI:submit=>confirm=>finish(然后里面有是 resultstatus 这样的字段【对齐实体?】) | ||
| 116 | + | ||
| 117 | + @PutMapping("/submit") | ||
| 118 | + @Operation(summary = "提交维修工单(草稿→维修中)") | ||
| 119 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 120 | + @PreAuthorize("@ss.hasPermission('mes:dv-repair:update')") | ||
| 121 | + public CommonResult<Boolean> submitRepair(@RequestParam("id") Long id) { | ||
| 122 | + repairService.submitRepair(id, getLoginUserId()); | ||
| 123 | + return success(true); | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | + @PutMapping("/confirm") | ||
| 127 | + @Operation(summary = "确认维修完成(维修中→待验收)") | ||
| 128 | + @PreAuthorize("@ss.hasPermission('mes:dv-repair:update')") | ||
| 129 | + public CommonResult<Boolean> confirmRepair(@Valid @RequestBody cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo.MesDvRepairConfirmReqVO confirmReqVO) { | ||
| 130 | + repairService.confirmRepair(confirmReqVO); | ||
| 131 | + return success(true); | ||
| 132 | + } | ||
| 133 | + | ||
| 134 | + @PutMapping("/finish") | ||
| 135 | + @Operation(summary = "完成验收(待验收→已确认)") | ||
| 136 | + @Parameters({ | ||
| 137 | + @Parameter(name = "id", description = "编号", required = true), | ||
| 138 | + @Parameter(name = "result", description = "验收结果", required = true) | ||
| 139 | + }) | ||
| 140 | + @PreAuthorize("@ss.hasPermission('mes:dv-repair:update')") | ||
| 141 | + public CommonResult<Boolean> finishRepair(@RequestParam("id") Long id, | ||
| 142 | + @RequestParam("result") Integer result) { | ||
| 143 | + repairService.finishRepair(id, result, getLoginUserId()); | ||
| 144 | + return success(true); | ||
| 145 | + } | ||
| 146 | + | ||
| 147 | + // ==================== 拼接 VO ==================== | ||
| 148 | + | ||
| 149 | + private List<MesDvRepairRespVO> buildRepairRespVOList(List<MesDvRepairDO> list) { | ||
| 150 | + if (CollUtil.isEmpty(list)) { | ||
| 151 | + return Collections.emptyList(); | ||
| 152 | + } | ||
| 153 | + // 1.1 批量获取关联数据 | ||
| 154 | + Map<Long, MesDvMachineryDO> machineryMap = machineryService.getMachineryMap( | ||
| 155 | + convertSet(list, MesDvRepairDO::getMachineryId)); | ||
| 156 | + // 1.2 收集所有用户 ID(维修人 + 验收人) | ||
| 157 | + Map<Long, AdminUserRespDTO> userMap = adminUserApi.getUserMap(convertSetByFlatMap(list, | ||
| 158 | + repair -> Stream.of(repair.getAcceptedUserId(), repair.getConfirmUserId()))); | ||
| 159 | + // 2. 拼接 VO | ||
| 160 | + return BeanUtils.toBean(list, MesDvRepairRespVO.class, vo -> { | ||
| 161 | + MapUtils.findAndThen(machineryMap, vo.getMachineryId(), machinery -> vo | ||
| 162 | + .setMachineryCode(machinery.getCode()).setMachineryName(machinery.getName()) | ||
| 163 | + .setMachineryBrand(machinery.getBrand()).setMachinerySpec(machinery.getSpec())); | ||
| 164 | + MapUtils.findAndThen(userMap, vo.getAcceptedUserId(), | ||
| 165 | + user -> vo.setAcceptedUserNickname(user.getNickname())); | ||
| 166 | + MapUtils.findAndThen(userMap, vo.getConfirmUserId(), | ||
| 167 | + user -> vo.setConfirmUserNickname(user.getNickname())); | ||
| 168 | + }); | ||
| 169 | + } | ||
| 170 | + | ||
| 171 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/repair/MesDvRepairLineController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.repair; | ||
| 2 | + | ||
| 3 | +import cn.hutool.core.collection.CollUtil; | ||
| 4 | +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 7 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 8 | +import cn.iocoder.yudao.framework.common.util.collection.MapUtils; | ||
| 9 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 10 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 11 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo.line.MesDvRepairLinePageReqVO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo.line.MesDvRepairLineRespVO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo.line.MesDvRepairLineSaveReqVO; | ||
| 14 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.repair.MesDvRepairLineDO; | ||
| 15 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.subject.MesDvSubjectDO; | ||
| 16 | +import cn.iocoder.yudao.module.mes.service.dv.repair.MesDvRepairLineService; | ||
| 17 | +import cn.iocoder.yudao.module.mes.service.dv.subject.MesDvSubjectService; | ||
| 18 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 19 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 20 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 21 | +import jakarta.annotation.Resource; | ||
| 22 | +import jakarta.servlet.http.HttpServletResponse; | ||
| 23 | +import jakarta.validation.Valid; | ||
| 24 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 25 | +import org.springframework.validation.annotation.Validated; | ||
| 26 | +import org.springframework.web.bind.annotation.*; | ||
| 27 | + | ||
| 28 | +import java.io.IOException; | ||
| 29 | +import java.util.Collections; | ||
| 30 | +import java.util.List; | ||
| 31 | +import java.util.Map; | ||
| 32 | + | ||
| 33 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||
| 34 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 35 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertSet; | ||
| 36 | + | ||
| 37 | +@Tag(name = "管理后台 - MES 维修工单行") | ||
| 38 | +@RestController | ||
| 39 | +@RequestMapping("/mes/dv/repair-line") | ||
| 40 | +@Validated | ||
| 41 | +public class MesDvRepairLineController { | ||
| 42 | + | ||
| 43 | + @Resource | ||
| 44 | + private MesDvRepairLineService repairLineService; | ||
| 45 | + | ||
| 46 | + @Resource | ||
| 47 | + private MesDvSubjectService subjectService; | ||
| 48 | + | ||
| 49 | + @PostMapping("/create") | ||
| 50 | + @Operation(summary = "创建维修工单行") | ||
| 51 | + @PreAuthorize("@ss.hasPermission('mes:dv-repair:create')") | ||
| 52 | + public CommonResult<Long> createRepairLine(@Valid @RequestBody MesDvRepairLineSaveReqVO createReqVO) { | ||
| 53 | + return success(repairLineService.createRepairLine(createReqVO)); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @PutMapping("/update") | ||
| 57 | + @Operation(summary = "更新维修工单行") | ||
| 58 | + @PreAuthorize("@ss.hasPermission('mes:dv-repair:update')") | ||
| 59 | + public CommonResult<Boolean> updateRepairLine(@Valid @RequestBody MesDvRepairLineSaveReqVO updateReqVO) { | ||
| 60 | + repairLineService.updateRepairLine(updateReqVO); | ||
| 61 | + return success(true); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @DeleteMapping("/delete") | ||
| 65 | + @Operation(summary = "删除维修工单行") | ||
| 66 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 67 | + @PreAuthorize("@ss.hasPermission('mes:dv-repair:delete')") | ||
| 68 | + public CommonResult<Boolean> deleteRepairLine(@RequestParam("id") Long id) { | ||
| 69 | + repairLineService.deleteRepairLine(id); | ||
| 70 | + return success(true); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | + @GetMapping("/get") | ||
| 74 | + @Operation(summary = "获得维修工单行") | ||
| 75 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 76 | + @PreAuthorize("@ss.hasPermission('mes:dv-repair:query')") | ||
| 77 | + public CommonResult<MesDvRepairLineRespVO> getRepairLine(@RequestParam("id") Long id) { | ||
| 78 | + MesDvRepairLineDO repairLine = repairLineService.getRepairLine(id); | ||
| 79 | + if (repairLine == null) { | ||
| 80 | + return success(null); | ||
| 81 | + } | ||
| 82 | + return success(buildRepairLineRespVOList(Collections.singletonList(repairLine)).get(0)); | ||
| 83 | + } | ||
| 84 | + | ||
| 85 | + @GetMapping("/page") | ||
| 86 | + @Operation(summary = "获得维修工单行分页") | ||
| 87 | + @PreAuthorize("@ss.hasPermission('mes:dv-repair:query')") | ||
| 88 | + public CommonResult<PageResult<MesDvRepairLineRespVO>> getRepairLinePage(@Valid MesDvRepairLinePageReqVO pageReqVO) { | ||
| 89 | + PageResult<MesDvRepairLineDO> pageResult = repairLineService.getRepairLinePage(pageReqVO); | ||
| 90 | + return success(new PageResult<>(buildRepairLineRespVOList(pageResult.getList()), pageResult.getTotal())); | ||
| 91 | + } | ||
| 92 | + | ||
| 93 | + @GetMapping("/export-excel") | ||
| 94 | + @Operation(summary = "导出维修工单行 Excel") | ||
| 95 | + @PreAuthorize("@ss.hasPermission('mes:dv-repair:export')") | ||
| 96 | + @ApiAccessLog(operateType = EXPORT) | ||
| 97 | + public void exportRepairLineExcel(@Valid MesDvRepairLinePageReqVO pageReqVO, | ||
| 98 | + HttpServletResponse response) throws IOException { | ||
| 99 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 100 | + List<MesDvRepairLineDO> list = repairLineService.getRepairLinePage(pageReqVO).getList(); | ||
| 101 | + // 导出 Excel | ||
| 102 | + ExcelUtils.write(response, "维修工单行.xls", "数据", MesDvRepairLineRespVO.class, | ||
| 103 | + buildRepairLineRespVOList(list)); | ||
| 104 | + } | ||
| 105 | + | ||
| 106 | + // ==================== 拼接 VO ==================== | ||
| 107 | + | ||
| 108 | + private List<MesDvRepairLineRespVO> buildRepairLineRespVOList(List<MesDvRepairLineDO> list) { | ||
| 109 | + if (CollUtil.isEmpty(list)) { | ||
| 110 | + return Collections.emptyList(); | ||
| 111 | + } | ||
| 112 | + // 1. 批量获取关联数据 | ||
| 113 | + Map<Long, MesDvSubjectDO> subjectMap = subjectService.getSubjectMap( | ||
| 114 | + convertSet(list, MesDvRepairLineDO::getSubjectId)); | ||
| 115 | + // 2. 拼接 VO | ||
| 116 | + return BeanUtils.toBean(list, MesDvRepairLineRespVO.class, vo -> | ||
| 117 | + MapUtils.findAndThen(subjectMap, vo.getSubjectId(), subject -> vo | ||
| 118 | + .setSubjectName(subject.getName()).setSubjectContent(subject.getContent()) | ||
| 119 | + .setSubjectStandard(subject.getStandard()))); | ||
| 120 | + } | ||
| 121 | + | ||
| 122 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/repair/vo/MesDvRepairConfirmReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import jakarta.validation.constraints.NotNull; | ||
| 7 | +import java.time.LocalDateTime; | ||
| 8 | + | ||
| 9 | +@Schema(description = "管理后台 - MES 维修工单确认完成 Request VO") | ||
| 10 | +@Data | ||
| 11 | +public class MesDvRepairConfirmReqVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 14 | + @NotNull(message = "维修工单编号不能为空") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + @Schema(description = "维修完成日期", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 18 | + @NotNull(message = "维修完成日期不能为空") | ||
| 19 | + private LocalDateTime finishDate; | ||
| 20 | + | ||
| 21 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/repair/vo/MesDvRepairPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.repair.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 MesDvRepairPageReqVO extends PageParam { | ||
| 19 | + | ||
| 20 | + @Schema(description = "维修工单编码", example = "REP2024001") | ||
| 21 | + private String code; | ||
| 22 | + | ||
| 23 | + @Schema(description = "维修工单名称", example = "注塑机维修") | ||
| 24 | + private String name; | ||
| 25 | + | ||
| 26 | + @Schema(description = "设备编号", example = "1") | ||
| 27 | + private Long machineryId; | ||
| 28 | + | ||
| 29 | + @Schema(description = "维修结果", example = "1") | ||
| 30 | + private Integer result; | ||
| 31 | + | ||
| 32 | + @Schema(description = "状态", example = "10") | ||
| 33 | + private Integer status; | ||
| 34 | + | ||
| 35 | + @Schema(description = "报修日期") | ||
| 36 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 37 | + private LocalDateTime[] requireDate; | ||
| 38 | + | ||
| 39 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/repair/vo/MesDvRepairRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||
| 5 | +import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; | ||
| 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 9 | +import lombok.Data; | ||
| 10 | + | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | + | ||
| 13 | +@Schema(description = "管理后台 - MES 维修工单 Response VO") | ||
| 14 | +@Data | ||
| 15 | +@ExcelIgnoreUnannotated | ||
| 16 | +public class MesDvRepairRespVO { | ||
| 17 | + | ||
| 18 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 19 | + @ExcelProperty("编号") | ||
| 20 | + private Long id; | ||
| 21 | + | ||
| 22 | + @Schema(description = "维修工单编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "REP2024001") | ||
| 23 | + @ExcelProperty("维修工单编码") | ||
| 24 | + private String code; | ||
| 25 | + | ||
| 26 | + @Schema(description = "维修工单名称", example = "注塑机液压系统维修") | ||
| 27 | + @ExcelProperty("维修工单名称") | ||
| 28 | + private String name; | ||
| 29 | + | ||
| 30 | + @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 31 | + private Long machineryId; | ||
| 32 | + | ||
| 33 | + @Schema(description = "设备编码", example = "M001") | ||
| 34 | + @ExcelProperty("设备编码") | ||
| 35 | + private String machineryCode; | ||
| 36 | + | ||
| 37 | + @Schema(description = "设备名称", example = "注塑机") | ||
| 38 | + @ExcelProperty("设备名称") | ||
| 39 | + private String machineryName; | ||
| 40 | + | ||
| 41 | + @Schema(description = "品牌", example = "西门子") | ||
| 42 | + @ExcelProperty("品牌") | ||
| 43 | + private String machineryBrand; | ||
| 44 | + | ||
| 45 | + @Schema(description = "规格型号", example = "X-100") | ||
| 46 | + @ExcelProperty("规格型号") | ||
| 47 | + private String machinerySpec; | ||
| 48 | + | ||
| 49 | + @Schema(description = "报修日期") | ||
| 50 | + @ExcelProperty("报修日期") | ||
| 51 | + private LocalDateTime requireDate; | ||
| 52 | + | ||
| 53 | + @Schema(description = "维修完成日期") | ||
| 54 | + @ExcelProperty("维修完成日期") | ||
| 55 | + private LocalDateTime finishDate; | ||
| 56 | + | ||
| 57 | + @Schema(description = "验收日期") | ||
| 58 | + @ExcelProperty("验收日期") | ||
| 59 | + private LocalDateTime confirmDate; | ||
| 60 | + | ||
| 61 | + @Schema(description = "维修结果", example = "1") | ||
| 62 | + @ExcelProperty(value = "维修结果", converter = DictConvert.class) | ||
| 63 | + @DictFormat(DictTypeConstants.MES_DV_REPAIR_RESULT) | ||
| 64 | + private Integer result; | ||
| 65 | + | ||
| 66 | + @Schema(description = "维修人用户编号", example = "1") | ||
| 67 | + private Long acceptedUserId; | ||
| 68 | + | ||
| 69 | + @Schema(description = "维修人名称", example = "张三") | ||
| 70 | + @ExcelProperty("维修人") | ||
| 71 | + private String acceptedUserNickname; | ||
| 72 | + | ||
| 73 | + @Schema(description = "验收人用户编号", example = "1") | ||
| 74 | + private Long confirmUserId; | ||
| 75 | + | ||
| 76 | + @Schema(description = "验收人名称", example = "李四") | ||
| 77 | + @ExcelProperty("验收人") | ||
| 78 | + private String confirmUserNickname; | ||
| 79 | + | ||
| 80 | + @Schema(description = "来源单据类型", example = "1") | ||
| 81 | + private Integer sourceDocType; | ||
| 82 | + | ||
| 83 | + @Schema(description = "来源单据编号", example = "1") | ||
| 84 | + private Long sourceDocId; | ||
| 85 | + | ||
| 86 | + @Schema(description = "来源单据编码", example = "DOC001") | ||
| 87 | + private String sourceDocCode; | ||
| 88 | + | ||
| 89 | + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "10") | ||
| 90 | + @ExcelProperty(value = "状态", converter = DictConvert.class) | ||
| 91 | + @DictFormat(DictTypeConstants.MES_DV_REPAIR_STATUS) | ||
| 92 | + private Integer status; | ||
| 93 | + | ||
| 94 | + @Schema(description = "备注", example = "测试备注") | ||
| 95 | + @ExcelProperty("备注") | ||
| 96 | + private String remark; | ||
| 97 | + | ||
| 98 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 99 | + @ExcelProperty("创建时间") | ||
| 100 | + private LocalDateTime createTime; | ||
| 101 | + | ||
| 102 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/repair/vo/MesDvRepairSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import jakarta.validation.constraints.NotBlank; | ||
| 7 | +import jakarta.validation.constraints.NotNull; | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | + | ||
| 10 | +@Schema(description = "管理后台 - MES 维修工单新增/修改 Request VO") | ||
| 11 | +@Data | ||
| 12 | +public class MesDvRepairSaveReqVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1024") | ||
| 15 | + private Long id; | ||
| 16 | + | ||
| 17 | + @Schema(description = "维修工单编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "REP2024001") | ||
| 18 | + @NotBlank(message = "维修工单编码不能为空") | ||
| 19 | + private String code; | ||
| 20 | + | ||
| 21 | + @Schema(description = "维修工单名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "注塑机液压系统维修") | ||
| 22 | + @NotBlank(message = "维修工单名称不能为空") | ||
| 23 | + private String name; | ||
| 24 | + | ||
| 25 | + @Schema(description = "设备编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 26 | + @NotNull(message = "设备不能为空") | ||
| 27 | + private Long machineryId; | ||
| 28 | + | ||
| 29 | + @Schema(description = "报修日期", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 30 | + @NotNull(message = "报修日期不能为空") | ||
| 31 | + private LocalDateTime requireDate; | ||
| 32 | + | ||
| 33 | + @Schema(description = "维修完成日期") | ||
| 34 | + private LocalDateTime finishDate; | ||
| 35 | + | ||
| 36 | + @Schema(description = "验收日期") | ||
| 37 | + private LocalDateTime confirmDate; | ||
| 38 | + | ||
| 39 | + @Schema(description = "维修结果", example = "1") | ||
| 40 | + private Integer result; | ||
| 41 | + | ||
| 42 | + @Schema(description = "维修人用户编号", example = "1") | ||
| 43 | + private Long acceptedUserId; | ||
| 44 | + | ||
| 45 | + @Schema(description = "验收人用户编号", example = "1") | ||
| 46 | + private Long confirmUserId; | ||
| 47 | + | ||
| 48 | + @Schema(description = "来源单据类型", example = "1") | ||
| 49 | + private Integer sourceDocType; | ||
| 50 | + | ||
| 51 | + @Schema(description = "来源单据编号", example = "1") | ||
| 52 | + private Long sourceDocId; | ||
| 53 | + | ||
| 54 | + @Schema(description = "来源单据编码", example = "DOC001") | ||
| 55 | + private String sourceDocCode; | ||
| 56 | + | ||
| 57 | + @Schema(description = "备注", example = "测试备注") | ||
| 58 | + private String remark; | ||
| 59 | + | ||
| 60 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/repair/vo/line/MesDvRepairLinePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo.line; | ||
| 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 | + | ||
| 9 | +@Schema(description = "管理后台 - MES 维修工单行分页 Request VO") | ||
| 10 | +@Data | ||
| 11 | +@EqualsAndHashCode(callSuper = true) | ||
| 12 | +@ToString(callSuper = true) | ||
| 13 | +public class MesDvRepairLinePageReqVO extends PageParam { | ||
| 14 | + | ||
| 15 | + @Schema(description = "维修工单编号", example = "1") | ||
| 16 | + private Long repairId; | ||
| 17 | + | ||
| 18 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/repair/vo/line/MesDvRepairLineRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo.line; | ||
| 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 MesDvRepairLineRespVO { | ||
| 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 = "1") | ||
| 20 | + private Long repairId; | ||
| 21 | + | ||
| 22 | + @Schema(description = "点检保养项目编号", example = "1") | ||
| 23 | + private Long subjectId; | ||
| 24 | + | ||
| 25 | + @Schema(description = "项目名称", example = "检查机油") | ||
| 26 | + @ExcelProperty("项目名称") | ||
| 27 | + private String subjectName; | ||
| 28 | + | ||
| 29 | + @Schema(description = "项目内容", example = "检查机油是否充足") | ||
| 30 | + @ExcelProperty("项目内容") | ||
| 31 | + private String subjectContent; | ||
| 32 | + | ||
| 33 | + @Schema(description = "项目标准", example = "无漏油") | ||
| 34 | + @ExcelProperty("标准") | ||
| 35 | + private String subjectStandard; | ||
| 36 | + | ||
| 37 | + @Schema(description = "故障描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "液压系统漏油") | ||
| 38 | + @ExcelProperty("故障描述") | ||
| 39 | + private String malfunction; | ||
| 40 | + | ||
| 41 | + @Schema(description = "故障图片 URL", example = "https://example.com/image.png") | ||
| 42 | + private String malfunctionUrl; | ||
| 43 | + | ||
| 44 | + @Schema(description = "维修描述", example = "更换密封圈") | ||
| 45 | + @ExcelProperty("维修描述") | ||
| 46 | + private String description; | ||
| 47 | + | ||
| 48 | + @Schema(description = "备注", example = "测试备注") | ||
| 49 | + @ExcelProperty("备注") | ||
| 50 | + private String remark; | ||
| 51 | + | ||
| 52 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 53 | + @ExcelProperty("创建时间") | ||
| 54 | + private LocalDateTime createTime; | ||
| 55 | + | ||
| 56 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/repair/vo/line/MesDvRepairLineSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.repair.vo.line; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import jakarta.validation.constraints.NotBlank; | ||
| 7 | +import jakarta.validation.constraints.NotNull; | ||
| 8 | + | ||
| 9 | +@Schema(description = "管理后台 - MES 维修工单行新增/修改 Request VO") | ||
| 10 | +@Data | ||
| 11 | +public class MesDvRepairLineSaveReqVO { | ||
| 12 | + | ||
| 13 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.NOT_REQUIRED, example = "1024") | ||
| 14 | + private Long id; | ||
| 15 | + | ||
| 16 | + @Schema(description = "维修工单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 17 | + @NotNull(message = "维修工单不能为空") | ||
| 18 | + private Long repairId; | ||
| 19 | + | ||
| 20 | + @Schema(description = "点检保养项目编号", example = "1") | ||
| 21 | + private Long subjectId; | ||
| 22 | + | ||
| 23 | + @Schema(description = "故障描述", requiredMode = Schema.RequiredMode.REQUIRED, example = "液压系统漏油") | ||
| 24 | + @NotBlank(message = "故障描述不能为空") | ||
| 25 | + private String malfunction; | ||
| 26 | + | ||
| 27 | + @Schema(description = "故障图片 URL", example = "https://example.com/image.png") | ||
| 28 | + private String malfunctionUrl; | ||
| 29 | + | ||
| 30 | + @Schema(description = "维修描述", example = "更换密封圈") | ||
| 31 | + private String description; | ||
| 32 | + | ||
| 33 | + @Schema(description = "备注", example = "测试备注") | ||
| 34 | + private String remark; | ||
| 35 | + | ||
| 36 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/subject/MesDvSubjectController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.subject; | ||
| 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.subject.vo.MesDvSubjectPageReqVO; | ||
| 10 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.subject.vo.MesDvSubjectRespVO; | ||
| 11 | +import cn.iocoder.yudao.module.mes.controller.admin.dv.subject.vo.MesDvSubjectSaveReqVO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.dal.dataobject.dv.subject.MesDvSubjectDO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.service.dv.subject.MesDvSubjectService; | ||
| 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/subject") | ||
| 33 | +@Validated | ||
| 34 | +public class MesDvSubjectController { | ||
| 35 | + | ||
| 36 | + @Resource | ||
| 37 | + private MesDvSubjectService subjectService; | ||
| 38 | + | ||
| 39 | + @PostMapping("/create") | ||
| 40 | + @Operation(summary = "创建点检保养项目") | ||
| 41 | + @PreAuthorize("@ss.hasPermission('mes:dv-subject:create')") | ||
| 42 | + public CommonResult<Long> createSubject(@Valid @RequestBody MesDvSubjectSaveReqVO createReqVO) { | ||
| 43 | + return success(subjectService.createSubject(createReqVO)); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @PutMapping("/update") | ||
| 47 | + @Operation(summary = "更新点检保养项目") | ||
| 48 | + @PreAuthorize("@ss.hasPermission('mes:dv-subject:update')") | ||
| 49 | + public CommonResult<Boolean> updateSubject(@Valid @RequestBody MesDvSubjectSaveReqVO updateReqVO) { | ||
| 50 | + subjectService.updateSubject(updateReqVO); | ||
| 51 | + return success(true); | ||
| 52 | + } | ||
| 53 | + | ||
| 54 | + @DeleteMapping("/delete") | ||
| 55 | + @Operation(summary = "删除点检保养项目") | ||
| 56 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 57 | + @PreAuthorize("@ss.hasPermission('mes:dv-subject:delete')") | ||
| 58 | + public CommonResult<Boolean> deleteSubject(@RequestParam("id") Long id) { | ||
| 59 | + subjectService.deleteSubject(id); | ||
| 60 | + return success(true); | ||
| 61 | + } | ||
| 62 | + | ||
| 63 | + @GetMapping("/get") | ||
| 64 | + @Operation(summary = "获得点检保养项目") | ||
| 65 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 66 | + @PreAuthorize("@ss.hasPermission('mes:dv-subject:query')") | ||
| 67 | + public CommonResult<MesDvSubjectRespVO> getSubject(@RequestParam("id") Long id) { | ||
| 68 | + MesDvSubjectDO subject = subjectService.getSubject(id); | ||
| 69 | + return success(BeanUtils.toBean(subject, MesDvSubjectRespVO.class)); | ||
| 70 | + } | ||
| 71 | + | ||
| 72 | + @GetMapping("/page") | ||
| 73 | + @Operation(summary = "获得点检保养项目分页") | ||
| 74 | + @PreAuthorize("@ss.hasPermission('mes:dv-subject:query')") | ||
| 75 | + public CommonResult<PageResult<MesDvSubjectRespVO>> getSubjectPage(@Valid MesDvSubjectPageReqVO pageReqVO) { | ||
| 76 | + PageResult<MesDvSubjectDO> pageResult = subjectService.getSubjectPage(pageReqVO); | ||
| 77 | + return success(BeanUtils.toBean(pageResult, MesDvSubjectRespVO.class)); | ||
| 78 | + } | ||
| 79 | + | ||
| 80 | + @GetMapping("/simple-list") | ||
| 81 | + @Operation(summary = "获得点检保养项目精简列表", description = "主要用于前端的下拉选项") | ||
| 82 | + @PreAuthorize("@ss.hasPermission('mes:dv-subject:query')") | ||
| 83 | + public CommonResult<List<MesDvSubjectRespVO>> getSubjectSimpleList() { | ||
| 84 | + List<MesDvSubjectDO> list = subjectService.getSubjectList(); | ||
| 85 | + return success(BeanUtils.toBean(list, MesDvSubjectRespVO.class)); | ||
| 86 | + } | ||
| 87 | + | ||
| 88 | + @GetMapping("/export-excel") | ||
| 89 | + @Operation(summary = "导出点检保养项目 Excel") | ||
| 90 | + @PreAuthorize("@ss.hasPermission('mes:dv-subject:export')") | ||
| 91 | + @ApiAccessLog(operateType = EXPORT) | ||
| 92 | + public void exportSubjectExcel(@Valid MesDvSubjectPageReqVO pageReqVO, | ||
| 93 | + HttpServletResponse response) throws IOException { | ||
| 94 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 95 | + List<MesDvSubjectDO> list = subjectService.getSubjectPage(pageReqVO).getList(); | ||
| 96 | + // 导出 Excel | ||
| 97 | + ExcelUtils.write(response, "点检保养项目.xls", "数据", MesDvSubjectRespVO.class, | ||
| 98 | + BeanUtils.toBean(list, MesDvSubjectRespVO.class)); | ||
| 99 | + } | ||
| 100 | + | ||
| 101 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/subject/vo/MesDvSubjectPageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.subject.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 | + | ||
| 9 | +@Schema(description = "管理后台 - MES 点检保养项目分页 Request VO") | ||
| 10 | +@Data | ||
| 11 | +@EqualsAndHashCode(callSuper = true) | ||
| 12 | +@ToString(callSuper = true) | ||
| 13 | +public class MesDvSubjectPageReqVO extends PageParam { | ||
| 14 | + | ||
| 15 | + @Schema(description = "项目编码", example = "CHK001") | ||
| 16 | + private String code; | ||
| 17 | + | ||
| 18 | + @Schema(description = "项目名称", example = "注塑机外观检查") | ||
| 19 | + private String name; | ||
| 20 | + | ||
| 21 | + @Schema(description = "项目类型", example = "1") | ||
| 22 | + private Integer type; | ||
| 23 | + | ||
| 24 | + @Schema(description = "状态", example = "0") | ||
| 25 | + private Integer status; | ||
| 26 | + | ||
| 27 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/subject/vo/MesDvSubjectRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.subject.vo; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||
| 5 | +import cn.iocoder.yudao.module.mes.enums.DictTypeConstants; | ||
| 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 9 | +import lombok.Data; | ||
| 10 | + | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | + | ||
| 13 | +@Schema(description = "管理后台 - MES 点检保养项目 Response VO") | ||
| 14 | +@Data | ||
| 15 | +@ExcelIgnoreUnannotated | ||
| 16 | +public class MesDvSubjectRespVO { | ||
| 17 | + | ||
| 18 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 19 | + @ExcelProperty("编号") | ||
| 20 | + private Long id; | ||
| 21 | + | ||
| 22 | + @Schema(description = "项目编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "CHK001") | ||
| 23 | + @ExcelProperty("项目编码") | ||
| 24 | + private String code; | ||
| 25 | + | ||
| 26 | + @Schema(description = "项目名称", example = "注塑机外观检查") | ||
| 27 | + @ExcelProperty("项目名称") | ||
| 28 | + private String name; | ||
| 29 | + | ||
| 30 | + @Schema(description = "项目类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 31 | + @ExcelProperty(value = "项目类型", converter = DictConvert.class) | ||
| 32 | + @DictFormat(DictTypeConstants.MES_DV_SUBJECT_TYPE) | ||
| 33 | + private Integer type; | ||
| 34 | + | ||
| 35 | + @Schema(description = "项目内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "检查注塑机外壳是否有裂纹") | ||
| 36 | + @ExcelProperty("项目内容") | ||
| 37 | + private String content; | ||
| 38 | + | ||
| 39 | + @Schema(description = "标准", example = "外观完好,无明显损伤") | ||
| 40 | + @ExcelProperty("标准") | ||
| 41 | + private String standard; | ||
| 42 | + | ||
| 43 | + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | ||
| 44 | + @ExcelProperty(value = "状态", converter = DictConvert.class) | ||
| 45 | + @DictFormat("common_status") | ||
| 46 | + private Integer status; | ||
| 47 | + | ||
| 48 | + @Schema(description = "备注", example = "备注") | ||
| 49 | + @ExcelProperty("备注") | ||
| 50 | + private String remark; | ||
| 51 | + | ||
| 52 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 53 | + @ExcelProperty("创建时间") | ||
| 54 | + private LocalDateTime createTime; | ||
| 55 | + | ||
| 56 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/dv/subject/vo/MesDvSubjectSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.dv.subject.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 | +@Schema(description = "管理后台 - MES 点检保养项目新增/修改 Request VO") | ||
| 9 | +@Data | ||
| 10 | +public class MesDvSubjectSaveReqVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | + @Schema(description = "项目编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "CHK001") | ||
| 16 | + @NotEmpty(message = "项目编码不能为空") | ||
| 17 | + private String code; | ||
| 18 | + | ||
| 19 | + @Schema(description = "项目名称", example = "注塑机外观检查") | ||
| 20 | + private String name; | ||
| 21 | + | ||
| 22 | + @Schema(description = "项目类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 23 | + @NotNull(message = "项目类型不能为空") | ||
| 24 | + private Integer type; | ||
| 25 | + | ||
| 26 | + @Schema(description = "项目内容", requiredMode = Schema.RequiredMode.REQUIRED, example = "检查注塑机外壳是否有裂纹") | ||
| 27 | + @NotEmpty(message = "项目内容不能为空") | ||
| 28 | + private String content; | ||
| 29 | + | ||
| 30 | + @Schema(description = "标准", example = "外观完好,无明显损伤") | ||
| 31 | + private String standard; | ||
| 32 | + | ||
| 33 | + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | ||
| 34 | + @NotNull(message = "状态不能为空") | ||
| 35 | + private Integer status; | ||
| 36 | + | ||
| 37 | + @Schema(description = "备注", example = "备注") | ||
| 38 | + private String remark; | ||
| 39 | + | ||
| 40 | + } |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/home/MesHomeStatisticsController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.home; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.yudao.module.mes.controller.admin.home.vo.MesHomeProductionTrendRespVO; | ||
| 5 | +import cn.iocoder.yudao.module.mes.controller.admin.home.vo.MesHomeSummaryRespVO; | ||
| 6 | +import cn.iocoder.yudao.module.mes.controller.admin.home.vo.MesHomeWorkOrderStatusRespVO; | ||
| 7 | +import cn.iocoder.yudao.module.mes.service.home.MesHomeStatisticsService; | ||
| 8 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 9 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 10 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 11 | +import jakarta.annotation.Resource; | ||
| 12 | +import jakarta.validation.constraints.Max; | ||
| 13 | +import jakarta.validation.constraints.Min; | ||
| 14 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 15 | +import org.springframework.validation.annotation.Validated; | ||
| 16 | +import org.springframework.web.bind.annotation.GetMapping; | ||
| 17 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 18 | +import org.springframework.web.bind.annotation.RequestParam; | ||
| 19 | +import org.springframework.web.bind.annotation.RestController; | ||
| 20 | + | ||
| 21 | +import java.util.List; | ||
| 22 | + | ||
| 23 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 24 | + | ||
| 25 | +@Tag(name = "管理后台 - MES 首页统计") | ||
| 26 | +@RestController | ||
| 27 | +@RequestMapping("/mes/home-statistics") | ||
| 28 | +@Validated | ||
| 29 | +public class MesHomeStatisticsController { | ||
| 30 | + | ||
| 31 | + @Resource | ||
| 32 | + private MesHomeStatisticsService homeStatisticsService; | ||
| 33 | + | ||
| 34 | + @GetMapping("/summary") | ||
| 35 | + @Operation(summary = "获得首页汇总统计") | ||
| 36 | + @PreAuthorize("@ss.hasPermission('mes:home:query')") | ||
| 37 | + public CommonResult<MesHomeSummaryRespVO> getHomeSummary() { | ||
| 38 | + return success(homeStatisticsService.getHomeSummary()); | ||
| 39 | + } | ||
| 40 | + | ||
| 41 | + @GetMapping("/work-order-status") | ||
| 42 | + @Operation(summary = "获得工单状态分布") | ||
| 43 | + @PreAuthorize("@ss.hasPermission('mes:home:query')") | ||
| 44 | + public CommonResult<List<MesHomeWorkOrderStatusRespVO>> getWorkOrderStatusDistribution() { | ||
| 45 | + return success(homeStatisticsService.getWorkOrderStatusDistribution()); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @GetMapping("/production-trend") | ||
| 49 | + @Operation(summary = "获得生产趋势") | ||
| 50 | + @Parameter(name = "days", description = "天数", example = "7") | ||
| 51 | + @PreAuthorize("@ss.hasPermission('mes:home:query')") | ||
| 52 | + public CommonResult<List<MesHomeProductionTrendRespVO>> getProductionTrend( | ||
| 53 | + @RequestParam(value = "days", defaultValue = "7") @Min(1) @Max(90) Integer days) { | ||
| 54 | + return success(homeStatisticsService.getProductionTrend(days)); | ||
| 55 | + } | ||
| 56 | + | ||
| 57 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/home/vo/MesHomeProductionTrendRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.home.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.AllArgsConstructor; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import lombok.NoArgsConstructor; | ||
| 7 | + | ||
| 8 | +import java.math.BigDecimal; | ||
| 9 | + | ||
| 10 | +@Schema(description = "管理后台 - MES 首页生产趋势 Response VO") | ||
| 11 | +@Data | ||
| 12 | +@NoArgsConstructor | ||
| 13 | +@AllArgsConstructor | ||
| 14 | +public class MesHomeProductionTrendRespVO { | ||
| 15 | + | ||
| 16 | + @Schema(description = "日期", requiredMode = Schema.RequiredMode.REQUIRED, example = "2026-04-05") | ||
| 17 | + private String date; | ||
| 18 | + | ||
| 19 | + @Schema(description = "产量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1234") | ||
| 20 | + private BigDecimal quantity; | ||
| 21 | + | ||
| 22 | + @Schema(description = "合格品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1200") | ||
| 23 | + private BigDecimal qualifiedQuantity; | ||
| 24 | + | ||
| 25 | + @Schema(description = "不良品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "34") | ||
| 26 | + private BigDecimal unqualifiedQuantity; | ||
| 27 | + | ||
| 28 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/home/vo/MesHomeSummaryRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.home.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.Data; | ||
| 5 | + | ||
| 6 | +import java.math.BigDecimal; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - MES 首页汇总统计 Response VO") | ||
| 9 | +@Data | ||
| 10 | +public class MesHomeSummaryRespVO { | ||
| 11 | + | ||
| 12 | + // ========== 工单统计 ========== | ||
| 13 | + | ||
| 14 | + @Schema(description = "进行中工单数", requiredMode = Schema.RequiredMode.REQUIRED, example = "12") | ||
| 15 | + private Long workOrderActiveCount; | ||
| 16 | + | ||
| 17 | + @Schema(description = "待排产工单数(草稿)", requiredMode = Schema.RequiredMode.REQUIRED, example = "5") | ||
| 18 | + private Long workOrderPrepareCount; | ||
| 19 | + | ||
| 20 | + @Schema(description = "已完成工单数", requiredMode = Schema.RequiredMode.REQUIRED, example = "30") | ||
| 21 | + private Long workOrderFinishedCount; | ||
| 22 | + | ||
| 23 | + // ========== 产量统计 ========== | ||
| 24 | + | ||
| 25 | + @Schema(description = "今日报工总产量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1234") | ||
| 26 | + private BigDecimal todayOutput; | ||
| 27 | + | ||
| 28 | + @Schema(description = "昨日报工总产量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1100") | ||
| 29 | + private BigDecimal yesterdayOutput; | ||
| 30 | + | ||
| 31 | + // ========== 质量统计 ========== | ||
| 32 | + | ||
| 33 | + @Schema(description = "今日合格品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "1200") | ||
| 34 | + private BigDecimal todayQualifiedQuantity; | ||
| 35 | + | ||
| 36 | + @Schema(description = "今日不良品数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "34") | ||
| 37 | + private BigDecimal todayUnqualifiedQuantity; | ||
| 38 | + | ||
| 39 | + // ========== 设备统计 ========== | ||
| 40 | + | ||
| 41 | + @Schema(description = "设备总数", requiredMode = Schema.RequiredMode.REQUIRED, example = "20") | ||
| 42 | + private Long machineryTotal; | ||
| 43 | + | ||
| 44 | + @Schema(description = "运行中设备数", requiredMode = Schema.RequiredMode.REQUIRED, example = "15") | ||
| 45 | + private Long machineryProducing; | ||
| 46 | + | ||
| 47 | + @Schema(description = "停机设备数", requiredMode = Schema.RequiredMode.REQUIRED, example = "3") | ||
| 48 | + private Long machineryStop; | ||
| 49 | + | ||
| 50 | + @Schema(description = "维护中设备数", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 51 | + private Long machineryMaintenance; | ||
| 52 | + | ||
| 53 | + // ========== 异常/待办统计 ========== | ||
| 54 | + | ||
| 55 | + @Schema(description = "未处置安灯报警数", requiredMode = Schema.RequiredMode.REQUIRED, example = "3") | ||
| 56 | + private Long andonActiveCount; | ||
| 57 | + | ||
| 58 | + @Schema(description = "未完成维修工单数", requiredMode = Schema.RequiredMode.REQUIRED, example = "2") | ||
| 59 | + private Long repairActiveCount; | ||
| 60 | + | ||
| 61 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/home/vo/MesHomeWorkOrderStatusRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.home.vo; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import lombok.AllArgsConstructor; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import lombok.NoArgsConstructor; | ||
| 7 | + | ||
| 8 | +@Schema(description = "管理后台 - MES 首页工单状态分布 Response VO") | ||
| 9 | +@Data | ||
| 10 | +@NoArgsConstructor | ||
| 11 | +@AllArgsConstructor | ||
| 12 | +public class MesHomeWorkOrderStatusRespVO { | ||
| 13 | + | ||
| 14 | + @Schema(description = "状态值", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | ||
| 15 | + private Integer status; | ||
| 16 | + | ||
| 17 | + @Schema(description = "状态名", requiredMode = Schema.RequiredMode.REQUIRED, example = "草稿") | ||
| 18 | + private String statusName; | ||
| 19 | + | ||
| 20 | + @Schema(description = "工单数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "12") | ||
| 21 | + private Long count; | ||
| 22 | + | ||
| 23 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/md/autocode/MesMdAutoCodePartController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.md.autocode; | ||
| 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.md.autocode.vo.part.MesMdAutoCodePartRespVO; | ||
| 6 | +import cn.iocoder.yudao.module.mes.controller.admin.md.autocode.vo.part.MesMdAutoCodePartSaveReqVO; | ||
| 7 | +import cn.iocoder.yudao.module.mes.dal.dataobject.md.autocode.MesMdAutoCodePartDO; | ||
| 8 | +import cn.iocoder.yudao.module.mes.service.md.autocode.MesMdAutoCodePartService; | ||
| 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 | +@Tag(name = "管理后台 - MES 编码规则组成") | ||
| 23 | +@RestController | ||
| 24 | +@RequestMapping("/mes/md/auto-code-part") | ||
| 25 | +@Validated | ||
| 26 | +public class MesMdAutoCodePartController { | ||
| 27 | + | ||
| 28 | + @Resource | ||
| 29 | + private MesMdAutoCodePartService partService; | ||
| 30 | + | ||
| 31 | + @PostMapping("/create") | ||
| 32 | + @Operation(summary = "创建规则组成") | ||
| 33 | + @PreAuthorize("@ss.hasPermission('mes:auto-code-rule:update')") | ||
| 34 | + public CommonResult<Long> createAutoCodePart(@Valid @RequestBody MesMdAutoCodePartSaveReqVO createReqVO) { | ||
| 35 | + return success(partService.createAutoCodePart(createReqVO)); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | + @PutMapping("/update") | ||
| 39 | + @Operation(summary = "更新规则组成") | ||
| 40 | + @PreAuthorize("@ss.hasPermission('mes:auto-code-rule:update')") | ||
| 41 | + public CommonResult<Boolean> updateAutoCodePart(@Valid @RequestBody MesMdAutoCodePartSaveReqVO updateReqVO) { | ||
| 42 | + partService.updateAutoCodePart(updateReqVO); | ||
| 43 | + return success(true); | ||
| 44 | + } | ||
| 45 | + | ||
| 46 | + @DeleteMapping("/delete") | ||
| 47 | + @Operation(summary = "删除规则组成") | ||
| 48 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 49 | + @PreAuthorize("@ss.hasPermission('mes:auto-code-rule:update')") | ||
| 50 | + public CommonResult<Boolean> deleteAutoCodePart(@RequestParam("id") Long id) { | ||
| 51 | + partService.deleteAutoCodePart(id); | ||
| 52 | + return success(true); | ||
| 53 | + } | ||
| 54 | + | ||
| 55 | + @GetMapping("/get") | ||
| 56 | + @Operation(summary = "获得规则组成") | ||
| 57 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 58 | + @PreAuthorize("@ss.hasPermission('mes:auto-code-rule:query')") | ||
| 59 | + public CommonResult<MesMdAutoCodePartRespVO> getAutoCodePart(@RequestParam("id") Long id) { | ||
| 60 | + MesMdAutoCodePartDO part = partService.getAutoCodePart(id); | ||
| 61 | + return success(BeanUtils.toBean(part, MesMdAutoCodePartRespVO.class)); | ||
| 62 | + } | ||
| 63 | + | ||
| 64 | + @GetMapping("/list-by-rule-id") | ||
| 65 | + @Operation(summary = "根据规则 ID 获得规则组成列表") | ||
| 66 | + @Parameter(name = "ruleId", description = "规则 ID", required = true, example = "1") | ||
| 67 | + @PreAuthorize("@ss.hasPermission('mes:auto-code-rule:query')") | ||
| 68 | + public CommonResult<List<MesMdAutoCodePartRespVO>> getAutoCodePartListByRuleId(@RequestParam("ruleId") Long ruleId) { | ||
| 69 | + List<MesMdAutoCodePartDO> list = partService.getAutoCodePartListByRuleId(ruleId); | ||
| 70 | + return success(BeanUtils.toBean(list, MesMdAutoCodePartRespVO.class)); | ||
| 71 | + } | ||
| 72 | + | ||
| 73 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/md/autocode/MesMdAutoCodeRecordController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.md.autocode; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 4 | +import cn.iocoder.yudao.module.mes.controller.admin.md.autocode.vo.record.MesMdAutoCodeGenerateReqVO; | ||
| 5 | +import cn.iocoder.yudao.module.mes.service.md.autocode.MesMdAutoCodeRecordService; | ||
| 6 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 7 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 8 | +import jakarta.annotation.Resource; | ||
| 9 | +import jakarta.validation.Valid; | ||
| 10 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 11 | +import org.springframework.validation.annotation.Validated; | ||
| 12 | +import org.springframework.web.bind.annotation.*; | ||
| 13 | + | ||
| 14 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 15 | + | ||
| 16 | +@Tag(name = "管理后台 - MES 编码生成记录") | ||
| 17 | +@RestController | ||
| 18 | +@RequestMapping("/mes/md/auto-code-record") | ||
| 19 | +@Validated | ||
| 20 | +public class MesMdAutoCodeRecordController { | ||
| 21 | + | ||
| 22 | + @Resource | ||
| 23 | + private MesMdAutoCodeRecordService autoCodeRecordService; | ||
| 24 | + | ||
| 25 | + @PostMapping("/generate") | ||
| 26 | + @Operation(summary = "生成编码") | ||
| 27 | + @PreAuthorize("@ss.hasPermission('mes:auto-code-rule:query')") | ||
| 28 | + public CommonResult<String> generateAutoCode(@Valid @RequestBody MesMdAutoCodeGenerateReqVO generateReqVO) { | ||
| 29 | + String code = autoCodeRecordService.generateAutoCode(generateReqVO.getRuleCode(), generateReqVO.getInputChar()); | ||
| 30 | + return success(code); | ||
| 31 | + } | ||
| 32 | + | ||
| 33 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/md/autocode/MesMdAutoCodeRuleController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.md.autocode; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | ||
| 4 | +import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum; | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 7 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 8 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 9 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 10 | +import cn.iocoder.yudao.module.mes.controller.admin.md.autocode.vo.rule.MesMdAutoCodeRulePageReqVO; | ||
| 11 | +import cn.iocoder.yudao.module.mes.controller.admin.md.autocode.vo.rule.MesMdAutoCodeRuleRespVO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.controller.admin.md.autocode.vo.rule.MesMdAutoCodeRuleSaveReqVO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.dal.dataobject.md.autocode.MesMdAutoCodeRuleDO; | ||
| 14 | +import cn.iocoder.yudao.module.mes.service.md.autocode.MesMdAutoCodeRuleService; | ||
| 15 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 16 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 17 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 18 | +import jakarta.annotation.Resource; | ||
| 19 | +import jakarta.servlet.http.HttpServletResponse; | ||
| 20 | +import jakarta.validation.Valid; | ||
| 21 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 22 | +import org.springframework.validation.annotation.Validated; | ||
| 23 | +import org.springframework.web.bind.annotation.*; | ||
| 24 | + | ||
| 25 | +import java.io.IOException; | ||
| 26 | +import java.util.List; | ||
| 27 | + | ||
| 28 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||
| 29 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 30 | +import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList; | ||
| 31 | + | ||
| 32 | +@Tag(name = "管理后台 - MES 编码规则") | ||
| 33 | +@RestController | ||
| 34 | +@RequestMapping("/mes/md/auto-code-rule") | ||
| 35 | +@Validated | ||
| 36 | +public class MesMdAutoCodeRuleController { | ||
| 37 | + | ||
| 38 | + @Resource | ||
| 39 | + private MesMdAutoCodeRuleService ruleService; | ||
| 40 | + | ||
| 41 | + @PostMapping("/create") | ||
| 42 | + @Operation(summary = "创建编码规则") | ||
| 43 | + @PreAuthorize("@ss.hasPermission('mes:auto-code-rule:create')") | ||
| 44 | + public CommonResult<Long> createAutoCodeRule(@Valid @RequestBody MesMdAutoCodeRuleSaveReqVO createReqVO) { | ||
| 45 | + return success(ruleService.createAutoCodeRule(createReqVO)); | ||
| 46 | + } | ||
| 47 | + | ||
| 48 | + @PutMapping("/update") | ||
| 49 | + @Operation(summary = "更新编码规则") | ||
| 50 | + @PreAuthorize("@ss.hasPermission('mes:auto-code-rule:update')") | ||
| 51 | + public CommonResult<Boolean> updateAutoCodeRule(@Valid @RequestBody MesMdAutoCodeRuleSaveReqVO updateReqVO) { | ||
| 52 | + ruleService.updateAutoCodeRule(updateReqVO); | ||
| 53 | + return success(true); | ||
| 54 | + } | ||
| 55 | + | ||
| 56 | + @DeleteMapping("/delete") | ||
| 57 | + @Operation(summary = "删除编码规则") | ||
| 58 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 59 | + @PreAuthorize("@ss.hasPermission('mes:auto-code-rule:delete')") | ||
| 60 | + public CommonResult<Boolean> deleteAutoCodeRule(@RequestParam("id") Long id) { | ||
| 61 | + ruleService.deleteAutoCodeRule(id); | ||
| 62 | + return success(true); | ||
| 63 | + } | ||
| 64 | + | ||
| 65 | + @GetMapping("/get") | ||
| 66 | + @Operation(summary = "获得编码规则") | ||
| 67 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 68 | + @PreAuthorize("@ss.hasPermission('mes:auto-code-rule:query')") | ||
| 69 | + public CommonResult<MesMdAutoCodeRuleRespVO> getAutoCodeRule(@RequestParam("id") Long id) { | ||
| 70 | + MesMdAutoCodeRuleDO rule = ruleService.getAutoCodeRule(id); | ||
| 71 | + return success(BeanUtils.toBean(rule, MesMdAutoCodeRuleRespVO.class)); | ||
| 72 | + } | ||
| 73 | + | ||
| 74 | + @GetMapping("/page") | ||
| 75 | + @Operation(summary = "获得编码规则分页") | ||
| 76 | + @PreAuthorize("@ss.hasPermission('mes:auto-code-rule:query')") | ||
| 77 | + public CommonResult<PageResult<MesMdAutoCodeRuleRespVO>> getAutoCodeRulePage(@Valid MesMdAutoCodeRulePageReqVO pageReqVO) { | ||
| 78 | + PageResult<MesMdAutoCodeRuleDO> pageResult = ruleService.getAutoCodeRulePage(pageReqVO); | ||
| 79 | + return success(BeanUtils.toBean(pageResult, MesMdAutoCodeRuleRespVO.class)); | ||
| 80 | + } | ||
| 81 | + | ||
| 82 | + @GetMapping("/simple-list") | ||
| 83 | + @Operation(summary = "获得编码规则精简列表", description = "只包含被开启的编码规则,主要用于前端的下拉选项") | ||
| 84 | + public CommonResult<List<MesMdAutoCodeRuleRespVO>> getAutoCodeRuleSimpleList() { | ||
| 85 | + List<MesMdAutoCodeRuleDO> list = ruleService.getAutoCodeRuleListByStatus(CommonStatusEnum.ENABLE.getStatus()); | ||
| 86 | + return success(convertList(list, rule -> new MesMdAutoCodeRuleRespVO() | ||
| 87 | + .setId(rule.getId()).setName(rule.getName()).setCode(rule.getCode()))); | ||
| 88 | + } | ||
| 89 | + | ||
| 90 | + @GetMapping("/export-excel") | ||
| 91 | + @Operation(summary = "导出编码规则 Excel") | ||
| 92 | + @PreAuthorize("@ss.hasPermission('mes:auto-code-rule:export')") | ||
| 93 | + @ApiAccessLog(operateType = EXPORT) | ||
| 94 | + public void exportAutoCodeRuleExcel(@Valid MesMdAutoCodeRulePageReqVO pageReqVO, | ||
| 95 | + HttpServletResponse response) throws IOException { | ||
| 96 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 97 | + List<MesMdAutoCodeRuleDO> list = ruleService.getAutoCodeRulePage(pageReqVO).getList(); | ||
| 98 | + List<MesMdAutoCodeRuleRespVO> data = BeanUtils.toBean(list, MesMdAutoCodeRuleRespVO.class); | ||
| 99 | + ExcelUtils.write(response, "编码规则.xls", "数据", MesMdAutoCodeRuleRespVO.class, data); | ||
| 100 | + } | ||
| 101 | + | ||
| 102 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/md/autocode/vo/part/MesMdAutoCodePartRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.md.autocode.vo.part; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||
| 5 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | ||
| 6 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 7 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 8 | +import lombok.Data; | ||
| 9 | + | ||
| 10 | +import java.time.LocalDateTime; | ||
| 11 | + | ||
| 12 | +@Schema(description = "管理后台 - MES 编码规则组成 Response VO") | ||
| 13 | +@Data | ||
| 14 | +@ExcelIgnoreUnannotated | ||
| 15 | +public class MesMdAutoCodePartRespVO { | ||
| 16 | + | ||
| 17 | + @Schema(description = "分段 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 18 | + @ExcelProperty("分段 ID") | ||
| 19 | + private Long id; | ||
| 20 | + | ||
| 21 | + @Schema(description = "规则 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 22 | + @ExcelProperty("规则 ID") | ||
| 23 | + private Long ruleId; | ||
| 24 | + | ||
| 25 | + @Schema(description = "分段序号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 26 | + @ExcelProperty("分段序号") | ||
| 27 | + private Integer sort; | ||
| 28 | + | ||
| 29 | + @Schema(description = "分段类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 30 | + @ExcelProperty(value = "分段类型", converter = DictConvert.class) | ||
| 31 | + @DictFormat("mes_auto_code_part_type") | ||
| 32 | + private Integer type; | ||
| 33 | + | ||
| 34 | + @Schema(description = "分段长度", requiredMode = Schema.RequiredMode.REQUIRED, example = "4") | ||
| 35 | + @ExcelProperty("分段长度") | ||
| 36 | + private Integer length; | ||
| 37 | + | ||
| 38 | + @Schema(description = "日期格式", example = "yyyyMMdd") | ||
| 39 | + @ExcelProperty("日期格式") | ||
| 40 | + private String dateFormat; | ||
| 41 | + | ||
| 42 | + @Schema(description = "固定字符", example = "ITEM_") | ||
| 43 | + @ExcelProperty("固定字符") | ||
| 44 | + private String fixCharacter; | ||
| 45 | + | ||
| 46 | + @Schema(description = "流水号起始值", example = "1") | ||
| 47 | + @ExcelProperty("流水号起始值") | ||
| 48 | + private Integer serialStartNo; | ||
| 49 | + | ||
| 50 | + @Schema(description = "流水号步长", example = "1") | ||
| 51 | + @ExcelProperty("流水号步长") | ||
| 52 | + private Integer serialStep; | ||
| 53 | + | ||
| 54 | + @Schema(description = "流水号是否循环", example = "true") | ||
| 55 | + @ExcelProperty("流水号是否循环") | ||
| 56 | + private Boolean cycleFlag; | ||
| 57 | + | ||
| 58 | + @Schema(description = "循环方式", example = "3") | ||
| 59 | + @ExcelProperty(value = "循环方式", converter = DictConvert.class) | ||
| 60 | + @DictFormat("mes_auto_code_cycle_method") | ||
| 61 | + private Integer cycleMethod; | ||
| 62 | + | ||
| 63 | + @Schema(description = "备注", example = "备注") | ||
| 64 | + @ExcelProperty("备注") | ||
| 65 | + private String remark; | ||
| 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/md/autocode/vo/part/MesMdAutoCodePartSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.md.autocode.vo.part; | ||
| 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 MesMdAutoCodePartSaveReqVO { | ||
| 10 | + | ||
| 11 | + @Schema(description = "分段 ID", example = "1024") | ||
| 12 | + private Long id; | ||
| 13 | + | ||
| 14 | + @Schema(description = "规则 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 15 | + @NotNull(message = "规则 ID 不能为空") | ||
| 16 | + private Long ruleId; | ||
| 17 | + | ||
| 18 | + @Schema(description = "分段序号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 19 | + @NotNull(message = "分段序号不能为空") | ||
| 20 | + private Integer sort; | ||
| 21 | + | ||
| 22 | + @Schema(description = "分段类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") | ||
| 23 | + @NotNull(message = "分段类型不能为空") | ||
| 24 | + private Integer type; | ||
| 25 | + | ||
| 26 | + @Schema(description = "分段长度", requiredMode = Schema.RequiredMode.REQUIRED, example = "4") | ||
| 27 | + @NotNull(message = "分段长度不能为空") | ||
| 28 | + private Integer length; | ||
| 29 | + | ||
| 30 | + @Schema(description = "日期格式", example = "yyyyMMdd") | ||
| 31 | + private String dateFormat; | ||
| 32 | + | ||
| 33 | + @Schema(description = "固定字符", example = "ITEM_") | ||
| 34 | + private String fixCharacter; | ||
| 35 | + | ||
| 36 | + @Schema(description = "流水号起始值", example = "1") | ||
| 37 | + private Integer serialStartNo; | ||
| 38 | + | ||
| 39 | + @Schema(description = "流水号步长", example = "1") | ||
| 40 | + private Integer serialStep; | ||
| 41 | + | ||
| 42 | + @Schema(description = "流水号是否循环", example = "true") | ||
| 43 | + private Boolean cycleFlag; | ||
| 44 | + | ||
| 45 | + @Schema(description = "循环方式", example = "3") | ||
| 46 | + private Integer cycleMethod; | ||
| 47 | + | ||
| 48 | + @Schema(description = "备注", example = "备注") | ||
| 49 | + private String remark; | ||
| 50 | + | ||
| 51 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/md/autocode/vo/record/MesMdAutoCodeGenerateReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.md.autocode.vo.record; | ||
| 2 | + | ||
| 3 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 4 | +import jakarta.validation.constraints.NotEmpty; | ||
| 5 | +import lombok.Data; | ||
| 6 | + | ||
| 7 | +@Schema(description = "管理后台 - MES 编码生成 Request VO") | ||
| 8 | +@Data | ||
| 9 | +public class MesMdAutoCodeGenerateReqVO { | ||
| 10 | + | ||
| 11 | + @Schema(description = "规则编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "ITEM_CODE") | ||
| 12 | + @NotEmpty(message = "规则编码不能为空") | ||
| 13 | + private String ruleCode; | ||
| 14 | + | ||
| 15 | + @Schema(description = "输入字符", example = "A") | ||
| 16 | + private String inputChar; | ||
| 17 | + | ||
| 18 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/md/autocode/vo/rule/MesMdAutoCodeRulePageReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.md.autocode.vo.rule; | ||
| 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 MesMdAutoCodeRulePageReqVO extends PageParam { | ||
| 19 | + | ||
| 20 | + @Schema(description = "规则编码", example = "ITEM_CODE") | ||
| 21 | + private String code; | ||
| 22 | + | ||
| 23 | + @Schema(description = "规则名称", example = "物料编码规则") | ||
| 24 | + private String name; | ||
| 25 | + | ||
| 26 | + @Schema(description = "状态", example = "0") | ||
| 27 | + private Integer status; | ||
| 28 | + | ||
| 29 | + @Schema(description = "创建时间") | ||
| 30 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) | ||
| 31 | + private LocalDateTime[] createTime; | ||
| 32 | + | ||
| 33 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/md/autocode/vo/rule/MesMdAutoCodeRuleRespVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.md.autocode.vo.rule; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.excel.core.annotations.DictFormat; | ||
| 4 | +import cn.iocoder.yudao.framework.excel.core.convert.DictConvert; | ||
| 5 | +import cn.iocoder.yudao.module.system.enums.DictTypeConstants; | ||
| 6 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | ||
| 7 | +import cn.idev.excel.annotation.ExcelProperty; | ||
| 8 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 9 | +import lombok.Data; | ||
| 10 | + | ||
| 11 | +import java.time.LocalDateTime; | ||
| 12 | + | ||
| 13 | +@Schema(description = "管理后台 - MES 编码规则 Response VO") | ||
| 14 | +@Data | ||
| 15 | +@ExcelIgnoreUnannotated | ||
| 16 | +public class MesMdAutoCodeRuleRespVO { | ||
| 17 | + | ||
| 18 | + @Schema(description = "规则 ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "1024") | ||
| 19 | + @ExcelProperty("规则 ID") | ||
| 20 | + private Long id; | ||
| 21 | + | ||
| 22 | + @Schema(description = "规则编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "ITEM_CODE") | ||
| 23 | + @ExcelProperty("规则编码") | ||
| 24 | + private String code; | ||
| 25 | + | ||
| 26 | + @Schema(description = "规则名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "物料编码规则") | ||
| 27 | + @ExcelProperty("规则名称") | ||
| 28 | + private String name; | ||
| 29 | + | ||
| 30 | + @Schema(description = "描述", example = "用于生成物料编码") | ||
| 31 | + @ExcelProperty("描述") | ||
| 32 | + private String description; | ||
| 33 | + | ||
| 34 | + @Schema(description = "最大长度", example = "20") | ||
| 35 | + @ExcelProperty("最大长度") | ||
| 36 | + private Integer maxLength; | ||
| 37 | + | ||
| 38 | + @Schema(description = "是否补齐", example = "true") | ||
| 39 | + @ExcelProperty("是否补齐") | ||
| 40 | + private Boolean padded; | ||
| 41 | + | ||
| 42 | + @Schema(description = "补齐字符", example = "0") | ||
| 43 | + @ExcelProperty("补齐字符") | ||
| 44 | + private String paddedChar; | ||
| 45 | + | ||
| 46 | + @Schema(description = "补齐方式", example = "1") | ||
| 47 | + @ExcelProperty(value = "补齐方式", converter = DictConvert.class) | ||
| 48 | + @DictFormat("mes_auto_code_padded_method") | ||
| 49 | + private Integer paddedMethod; | ||
| 50 | + | ||
| 51 | + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | ||
| 52 | + @ExcelProperty(value = "状态", converter = DictConvert.class) | ||
| 53 | + @DictFormat(DictTypeConstants.COMMON_STATUS) | ||
| 54 | + private Integer status; | ||
| 55 | + | ||
| 56 | + @Schema(description = "备注", example = "备注") | ||
| 57 | + @ExcelProperty("备注") | ||
| 58 | + private String remark; | ||
| 59 | + | ||
| 60 | + @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 61 | + @ExcelProperty("创建时间") | ||
| 62 | + private LocalDateTime createTime; | ||
| 63 | + | ||
| 64 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/md/autocode/vo/rule/MesMdAutoCodeRuleSaveReqVO.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.md.autocode.vo.rule; | ||
| 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 | +@Schema(description = "管理后台 - MES 编码规则新增/修改 Request VO") | ||
| 9 | +@Data | ||
| 10 | +public class MesMdAutoCodeRuleSaveReqVO { | ||
| 11 | + | ||
| 12 | + @Schema(description = "规则 ID", example = "1024") | ||
| 13 | + private Long id; | ||
| 14 | + | ||
| 15 | + @Schema(description = "规则编码", requiredMode = Schema.RequiredMode.REQUIRED, example = "ITEM_CODE") | ||
| 16 | + @NotEmpty(message = "规则编码不能为空") | ||
| 17 | + private String code; | ||
| 18 | + | ||
| 19 | + @Schema(description = "规则名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "物料编码规则") | ||
| 20 | + @NotEmpty(message = "规则名称不能为空") | ||
| 21 | + private String name; | ||
| 22 | + | ||
| 23 | + @Schema(description = "描述", example = "用于生成物料编码") | ||
| 24 | + private String description; | ||
| 25 | + | ||
| 26 | + @Schema(description = "最大长度", example = "20") | ||
| 27 | + private Integer maxLength; | ||
| 28 | + | ||
| 29 | + @Schema(description = "是否补齐", example = "true") | ||
| 30 | + private Boolean padded; | ||
| 31 | + | ||
| 32 | + @Schema(description = "补齐字符", example = "0") | ||
| 33 | + private String paddedChar; | ||
| 34 | + | ||
| 35 | + @Schema(description = "补齐方式", example = "1") | ||
| 36 | + private Integer paddedMethod; | ||
| 37 | + | ||
| 38 | + @Schema(description = "状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "0") | ||
| 39 | + @NotNull(message = "状态不能为空") | ||
| 40 | + private Integer status; | ||
| 41 | + | ||
| 42 | + @Schema(description = "备注", example = "备注") | ||
| 43 | + private String remark; | ||
| 44 | + | ||
| 45 | +} |
yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/md/client/MesMdClientController.java
0 → 100644
| 1 | +package cn.iocoder.yudao.module.mes.controller.admin.md.client; | ||
| 2 | + | ||
| 3 | +import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog; | ||
| 4 | + | ||
| 5 | +import cn.iocoder.yudao.framework.common.pojo.CommonResult; | ||
| 6 | +import cn.iocoder.yudao.framework.common.pojo.PageParam; | ||
| 7 | +import cn.iocoder.yudao.framework.common.pojo.PageResult; | ||
| 8 | +import cn.iocoder.yudao.framework.common.util.object.BeanUtils; | ||
| 9 | +import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils; | ||
| 10 | +import cn.iocoder.yudao.module.mes.controller.admin.md.client.vo.MesMdClientImportExcelVO; | ||
| 11 | +import cn.iocoder.yudao.module.mes.controller.admin.md.client.vo.MesMdClientImportRespVO; | ||
| 12 | +import cn.iocoder.yudao.module.mes.controller.admin.md.client.vo.MesMdClientPageReqVO; | ||
| 13 | +import cn.iocoder.yudao.module.mes.controller.admin.md.client.vo.MesMdClientRespVO; | ||
| 14 | +import cn.iocoder.yudao.module.mes.controller.admin.md.client.vo.MesMdClientSaveReqVO; | ||
| 15 | +import cn.iocoder.yudao.module.mes.dal.dataobject.md.client.MesMdClientDO; | ||
| 16 | +import cn.iocoder.yudao.module.mes.service.md.client.MesMdClientService; | ||
| 17 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 18 | +import io.swagger.v3.oas.annotations.Parameter; | ||
| 19 | +import io.swagger.v3.oas.annotations.Parameters; | ||
| 20 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 21 | +import jakarta.annotation.Resource; | ||
| 22 | +import jakarta.servlet.http.HttpServletResponse; | ||
| 23 | +import jakarta.validation.Valid; | ||
| 24 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 25 | +import org.springframework.validation.annotation.Validated; | ||
| 26 | +import org.springframework.web.bind.annotation.*; | ||
| 27 | +import org.springframework.web.multipart.MultipartFile; | ||
| 28 | + | ||
| 29 | +import java.io.IOException; | ||
| 30 | +import java.util.Collections; | ||
| 31 | +import java.util.List; | ||
| 32 | + | ||
| 33 | +import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT; | ||
| 34 | +import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success; | ||
| 35 | + | ||
| 36 | + | ||
| 37 | +@Tag(name = "管理后台 - MES 客户") | ||
| 38 | +@RestController | ||
| 39 | +@RequestMapping("/mes/md-client") | ||
| 40 | +@Validated | ||
| 41 | +public class MesMdClientController { | ||
| 42 | + | ||
| 43 | + @Resource | ||
| 44 | + private MesMdClientService clientService; | ||
| 45 | + | ||
| 46 | + @PostMapping("/create") | ||
| 47 | + @Operation(summary = "创建客户") | ||
| 48 | + @PreAuthorize("@ss.hasPermission('mes:md-client:create')") | ||
| 49 | + public CommonResult<Long> createClient(@Valid @RequestBody MesMdClientSaveReqVO createReqVO) { | ||
| 50 | + return success(clientService.createClient(createReqVO)); | ||
| 51 | + } | ||
| 52 | + | ||
| 53 | + @PutMapping("/update") | ||
| 54 | + @Operation(summary = "更新客户") | ||
| 55 | + @PreAuthorize("@ss.hasPermission('mes:md-client:update')") | ||
| 56 | + public CommonResult<Boolean> updateClient(@Valid @RequestBody MesMdClientSaveReqVO updateReqVO) { | ||
| 57 | + clientService.updateClient(updateReqVO); | ||
| 58 | + return success(true); | ||
| 59 | + } | ||
| 60 | + | ||
| 61 | + @DeleteMapping("/delete") | ||
| 62 | + @Operation(summary = "删除客户") | ||
| 63 | + @Parameter(name = "id", description = "编号", required = true) | ||
| 64 | + @PreAuthorize("@ss.hasPermission('mes:md-client:delete')") | ||
| 65 | + public CommonResult<Boolean> deleteClient(@RequestParam("id") Long id) { | ||
| 66 | + clientService.deleteClient(id); | ||
| 67 | + return success(true); | ||
| 68 | + } | ||
| 69 | + | ||
| 70 | + @GetMapping("/get") | ||
| 71 | + @Operation(summary = "获得客户") | ||
| 72 | + @Parameter(name = "id", description = "编号", required = true, example = "1024") | ||
| 73 | + @PreAuthorize("@ss.hasPermission('mes:md-client:query')") | ||
| 74 | + public CommonResult<MesMdClientRespVO> getClient(@RequestParam("id") Long id) { | ||
| 75 | + MesMdClientDO client = clientService.getClient(id); | ||
| 76 | + return success(BeanUtils.toBean(client, MesMdClientRespVO.class)); | ||
| 77 | + } | ||
| 78 | + | ||
| 79 | + @GetMapping("/page") | ||
| 80 | + @Operation(summary = "获得客户分页") | ||
| 81 | + @PreAuthorize("@ss.hasPermission('mes:md-client:query')") | ||
| 82 | + public CommonResult<PageResult<MesMdClientRespVO>> getClientPage(@Valid MesMdClientPageReqVO pageReqVO) { | ||
| 83 | + PageResult<MesMdClientDO> pageResult = clientService.getClientPage(pageReqVO); | ||
| 84 | + return success(BeanUtils.toBean(pageResult, MesMdClientRespVO.class)); | ||
| 85 | + } | ||
| 86 | + | ||
| 87 | + @GetMapping("/export-excel") | ||
| 88 | + @Operation(summary = "导出客户 Excel") | ||
| 89 | + @PreAuthorize("@ss.hasPermission('mes:md-client:export')") | ||
| 90 | + @ApiAccessLog(operateType = EXPORT) | ||
| 91 | + public void exportClientExcel(@Valid MesMdClientPageReqVO pageReqVO, | ||
| 92 | + HttpServletResponse response) throws IOException { | ||
| 93 | + pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); | ||
| 94 | + List<MesMdClientDO> list = clientService.getClientPage(pageReqVO).getList(); | ||
| 95 | + // 导出 Excel | ||
| 96 | + ExcelUtils.write(response, "客户.xls", "数据", MesMdClientRespVO.class, | ||
| 97 | + BeanUtils.toBean(list, MesMdClientRespVO.class)); | ||
| 98 | + } | ||
| 99 | + | ||
| 100 | + @GetMapping("/get-import-template") | ||
| 101 | + @Operation(summary = "获得客户导入模板") | ||
| 102 | + public void importTemplate(HttpServletResponse response) throws IOException { | ||
| 103 | + // 手动创建导出 demo | ||
| 104 | + List<MesMdClientImportExcelVO> list = Collections.singletonList( | ||
| 105 | + MesMdClientImportExcelVO.builder().code("C001").name("示例客户").nickname("示例") | ||
| 106 | + .type(1).telephone("13800138000").status(0).build() | ||
| 107 | + ); | ||
| 108 | + // 输出 | ||
| 109 | + ExcelUtils.write(response, "客户导入模板.xls", "客户列表", MesMdClientImportExcelVO.class, list); | ||
| 110 | + } | ||
| 111 | + | ||
| 112 | + @PostMapping("/import") | ||
| 113 | + @Operation(summary = "导入客户") | ||
| 114 | + @Parameters({ | ||
| 115 | + @Parameter(name = "file", description = "Excel 文件", required = true), | ||
| 116 | + @Parameter(name = "updateSupport", description = "是否支持更新,默认为 false", example = "true") | ||
| 117 | + }) | ||
| 118 | + @PreAuthorize("@ss.hasPermission('mes:md-client:import')") | ||
| 119 | + public CommonResult<MesMdClientImportRespVO> importExcel(@RequestParam("file") MultipartFile file, | ||
| 120 | + @RequestParam(value = "updateSupport", required = false, | ||
| 121 | + defaultValue = "false") Boolean updateSupport) throws Exception { | ||
| 122 | + List<MesMdClientImportExcelVO> list = ExcelUtils.read(file, MesMdClientImportExcelVO.class); | ||
| 123 | + return success(clientService.importClientList(list, updateSupport)); | ||
| 124 | + } | ||
| 125 | + | ||
| 126 | +} |