From efaa975ca9a7fe133744e353e4eb321f11470fd2 Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期五, 20 三月 2026 11:28:45 +0800
Subject: [PATCH] fix: service导入修改

---
 src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java |   20 +++++++++++++++++++-
 1 files changed, 19 insertions(+), 1 deletions(-)

diff --git a/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java b/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
index 28cba27..5702c18 100644
--- a/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
+++ b/src/main/java/com/ruoyi/productionPlan/service/impl/ProductionPlanServiceImpl.java
@@ -14,8 +14,10 @@
 import com.ruoyi.common.utils.poi.ExcelUtil;
 import com.ruoyi.framework.config.AliDingConfig;
 import com.ruoyi.framework.util.AliDingUtils;
+import com.ruoyi.production.enums.ProductOrderStatusEnum;
 import com.ruoyi.production.pojo.ProductMaterialSku;
 import com.ruoyi.production.pojo.ProductOrder;
+import com.ruoyi.production.service.IProductionOrderAppendixService;
 import com.ruoyi.production.service.ProductMaterialService;
 import com.ruoyi.production.service.ProductMaterialSkuService;
 import com.ruoyi.production.service.ProductOrderService;
@@ -75,6 +77,9 @@
 
     @Autowired
     private ProductMaterialService productMaterialService;
+
+    @Autowired
+    private IProductionOrderAppendixService productionOrderAppendixService;
 
     /**
      * 鍚屾閿侊紝纭繚鎵嬪姩鍜屽畾鏃朵换鍔′笉鍚屾椂鎵ц
@@ -141,7 +146,20 @@
         ProductOrder productOrder = new ProductOrder();
         productOrder.setQuantity(productionPlanDto.getTotalAssignedQuantity());
         productOrder.setPlanCompleteTime(productionPlanDto.getPlanCompleteTime());
-        productOrderService.addProductOrder(productOrder);
+        productOrder.setStatus(ProductOrderStatusEnum.WAIT.getCode());
+        productOrder.setStrength(productionPlanDto.getStrength());
+
+        Long orderId = productOrderService.insertProductOrder(productOrder);
+
+        //  褰撲笅鍙戠殑浜у搧涓虹爩鍧楁垨鏉挎潗锛屽氨鎷夊彇BOM瀛愰泦涓庡伐鑹鸿矾绾垮瓙闆嗘暟鎹瓨鍏ュ埌闄勮〃涓�
+        if ("鐮屽潡".equals(productionPlanDto.getProductName())) {
+            productOrder.setRouteId(productionOrderAppendixService.populateBlocks(orderId, productionPlanDto));
+        }
+        if ("鏉挎潗".equals(productionPlanDto.getProductName())) {
+            productOrder.setRouteId(productionOrderAppendixService.populatePlates(orderId, productionPlanDto));
+        }
+        //  鏇存柊缁戝畾鐨勫伐鑹鸿矾绾�
+        productOrderService.updateById(productOrder);
 
         // 鏍规嵁涓嬪彂鏁伴噺锛屼粠绗竴涓敓浜ц鍒掑紑濮嬪垎閰嶆柟鏁�
         BigDecimal assignedVolume = BigDecimal.ZERO;

--
Gitblit v1.9.3