From 2756f7581ad6743ff796670a26787b85b8aaa2b2 Mon Sep 17 00:00:00 2001
From: xiaoyi <908147524@qq.com>
Date: 星期一, 02 十一月 2026 12:58:50 +0800
Subject: [PATCH] fix(mes): 修复工艺路线【本工序产出】保存不生效 - 后端补齐 outputs 字段与 JSON 存储/解析

---
 yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/task/schedule/MesProBatchScheduleService.java |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)

diff --git a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/task/schedule/MesProBatchScheduleService.java b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/task/schedule/MesProBatchScheduleService.java
index 026a97f..c32c99d 100644
--- a/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/task/schedule/MesProBatchScheduleService.java
+++ b/yudao-module-mes/src/main/java/cn/iocoder/yudao/module/mes/service/pro/task/schedule/MesProBatchScheduleService.java
@@ -22,6 +22,7 @@
 import cn.iocoder.yudao.module.mes.service.pro.workorder.MesProWorkOrderProcessService;
 import cn.iocoder.yudao.module.mes.service.pro.task.MesProTaskService;
 import cn.iocoder.yudao.module.mes.service.cal.holiday.MesCalHolidayService;
+import cn.iocoder.yudao.module.mes.util.MesOutputItemUtils;
 import jakarta.annotation.Resource;
 import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
@@ -127,7 +128,6 @@
         result.setPreviewTime(now());
         var orders = workOrderMapper.selectByIds(request.getWorkOrderIds());
         var orderMap = orders.stream().collect(Collectors.toMap(MesProWorkOrderDO::getId, order -> order));
-        List<Long> permitted = customerApi.getPermittedCustomerIds();
         var stations = workstationService.getWorkstationListByStatus(0).stream()
                 .sorted(Comparator.comparing(MesMdWorkstationDO::getId)).toList();
         var machineMap = machineryMapper.selectList().stream().collect(Collectors.toMap(MesDvMachineryDO::getId, machine -> machine));
@@ -170,9 +170,6 @@
             result.getOrders().add(orderPlan);
             try {
                 if (order == null) throw new IllegalArgumentException("宸ュ崟涓嶅瓨鍦ㄦ垨宸插垹闄�");
-                if (permitted != null && order.getClientId() != null && !permitted.contains(order.getClientId())) {
-                    throw new IllegalArgumentException("鏃犳潈鎿嶄綔璇ュ鎴风殑宸ュ崟");
-                }
                 orderPlan.setWorkOrderCode(order.getCode());
                 orderPlan.setWorkOrderName(order.getName());
                 orderPlan.setQuantity(order.getQuantity());
@@ -256,9 +253,9 @@
                     }
                     Long itemId = order.getProductId();
                     if (process.getOutputItemId() != null && !process.getOutputItemId().isBlank()) {
-                        String[] output = process.getOutputItemId().split(",");
-                        if (output.length != 1) throw new IllegalArgumentException("澶氫骇鍑哄伐搴忚浣跨敤鎵嬪伐鎺掍骇纭鍚勪骇鍑烘暟閲�");
-                        itemId = Long.valueOf(output[0].trim());
+                        List<Long> outputIds = MesOutputItemUtils.parseItemIds(process.getOutputItemId());
+                        if (outputIds.size() != 1) throw new IllegalArgumentException("澶氫骇鍑哄伐搴忚浣跨敤鎵嬪伐鎺掍骇纭鍚勪骇鍑烘暟閲�");
+                        itemId = outputIds.get(0);
                     }
                     var item = itemService.validateItemExists(itemId);
                     if (!Objects.equals(item.getStatus(), 0)) throw new IllegalArgumentException("宸ュ簭浜у嚭浜у搧宸插仠鐢�");

--
Gitblit v1.9.3