diff --git a/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/plan/vo/PlanProcessRouteItemRespVO.java b/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/plan/vo/PlanProcessRouteItemRespVO.java index 37d5cf34e..7d2416ed6 100644 --- a/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/plan/vo/PlanProcessRouteItemRespVO.java +++ b/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/plan/vo/PlanProcessRouteItemRespVO.java @@ -37,7 +37,13 @@ public class PlanProcessRouteItemRespVO { @Schema(description = "设备名称") private String deviceName; + @Schema(description = "采集设备编号", example = "1") + private Long dvId; + + @Schema(description = "采集设备名称") + private String dvName; + @Schema(description = "备注") private String remark; -} +} \ No newline at end of file diff --git a/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/plan/vo/PlanProcessRouteItemSaveReqVO.java b/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/plan/vo/PlanProcessRouteItemSaveReqVO.java index ae3058f28..64499ae07 100644 --- a/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/plan/vo/PlanProcessRouteItemSaveReqVO.java +++ b/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/controller/admin/plan/vo/PlanProcessRouteItemSaveReqVO.java @@ -10,13 +10,34 @@ public class PlanProcessRouteItemSaveReqVO { @Schema(description = "工艺路线明细 ID,对应 /mes/process-route 的 items.id", example = "1") private Long processRouteItemId; - @Schema(description = "排序,从 1 开始。不传时使用工艺路线明细排序", example = "1") + @Schema(description = "工艺路线编号", example = "9") + private Long processRouteId; + + @Schema(description = "工艺参数编号", example = "3") + private Long processParameterId; + + @Schema(description = "工艺参数编码") + private String processParameterCode; + + @Schema(description = "工艺参数名称") + private String processParameterName; + + @Schema(description = "排序,从 1 开始", example = "1") private Integer sort; @Schema(description = "设备 ID,对应 /mes/device-ledger", example = "10") private Long deviceId; + @Schema(description = "设备名称") + private String deviceName; + + @Schema(description = "采集设备编号", example = "1") + private Long dvId; + + @Schema(description = "采集设备名称") + private String dvName; + @Schema(description = "备注") private String remark; -} +} \ No newline at end of file diff --git a/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/service/plan/PlanServiceImpl.java b/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/service/plan/PlanServiceImpl.java index e0d67aae2..0cd425c3f 100644 --- a/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/service/plan/PlanServiceImpl.java +++ b/yudao-module-mes/yudao-module-mes-biz/src/main/java/cn/iocoder/yudao/module/mes/service/plan/PlanServiceImpl.java @@ -393,46 +393,22 @@ public class PlanServiceImpl implements PlanService { plan.setProcessRouteName(processRoute == null ? null : processRoute.getName()); } - private void savePlanProcessRouteItems(Long planId, Long processRouteId, List reqItems) { - if (planId == null || processRouteId == null) { + private void savePlanProcessRouteItems(Long planId, Long processRouteId, List reqItems) { + if (planId == null || CollUtil.isEmpty(reqItems)) { return; } - List routeItems = processRouteItemMapper.selectListByRouteId(processRouteId); - if (CollUtil.isEmpty(routeItems)) { - return; - } - - Map reqItemMap = Optional.ofNullable(reqItems) - .orElse(Collections.emptyList()) - .stream() - .filter(item -> item.getProcessRouteItemId() != null) - .collect(Collectors.toMap(PlanProcessRouteItemSaveReqVO::getProcessRouteItemId, item -> item, (first, second) -> second)); - - Set deviceIds = Optional.ofNullable(reqItems) - .orElse(Collections.emptyList()) - .stream() - .map(PlanProcessRouteItemSaveReqVO::getDeviceId) - .filter(Objects::nonNull) - .collect(Collectors.toSet()); - Map deviceMap = CollUtil.isEmpty(deviceIds) ? Collections.emptyMap() - : deviceLedgerMapper.selectBatchIds(deviceIds).stream() - .collect(Collectors.toMap(DeviceLedgerDO::getId, item -> item, (first, second) -> first)); - - for (ProcessRouteItemDO routeItem : routeItems) { - PlanProcessRouteItemSaveReqVO reqItem = reqItemMap.get(routeItem.getId()); - DeviceLedgerDO device = reqItem == null || reqItem.getDeviceId() == null ? null : deviceMap.get(reqItem.getDeviceId()); - + for (PlanProcessRouteItemSaveReqVO reqItem : reqItems) { PlanProcessRouteItemDO planRouteItem = new PlanProcessRouteItemDO(); planRouteItem.setPlanId(planId); planRouteItem.setProcessRouteId(processRouteId); - planRouteItem.setProcessRouteItemId(routeItem.getId()); - planRouteItem.setSort(reqItem != null && reqItem.getSort() != null ? reqItem.getSort() : routeItem.getSort()); - planRouteItem.setProcessParameterId(routeItem.getProcessParameterId()); - planRouteItem.setProcessParameterCode(routeItem.getProcessParameterCode()); - planRouteItem.setProcessParameterName(routeItem.getProcessParameterName()); - planRouteItem.setDeviceId(reqItem == null ? null : reqItem.getDeviceId()); - planRouteItem.setDeviceName(device == null ? null : device.getDeviceName()); - planRouteItem.setRemark(reqItem == null ? routeItem.getRemark() : reqItem.getRemark()); + planRouteItem.setProcessRouteItemId(reqItem.getProcessRouteItemId()); + planRouteItem.setSort(reqItem.getSort()); + planRouteItem.setProcessParameterId(reqItem.getProcessParameterId()); + planRouteItem.setProcessParameterCode(reqItem.getProcessParameterCode()); + planRouteItem.setProcessParameterName(reqItem.getProcessParameterName()); + planRouteItem.setDeviceId(reqItem.getDeviceId()); + planRouteItem.setDeviceName(reqItem.getDeviceName()); + planRouteItem.setRemark(reqItem.getRemark()); planProcessRouteItemMapper.insert(planRouteItem); } }