From a0e29a74fcaceb52b02bfe559409611132462947 Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期二, 14 一月 2025 17:53:30 +0800
Subject: [PATCH] DNC平移航宇救生   >  树结构新增工序、工步,去除默认新增工序,新增工步

---
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java |   58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 55 insertions(+), 3 deletions(-)

diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java
index 9d079ff..ca7177f 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java
+++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/ProductInfoServiceImpl.java
@@ -66,6 +66,8 @@
     @Lazy
     private IProcessStreamService processStreamService;
     @Autowired
+    private IWorkStepService workStepService;
+    @Autowired
     private IDocInfoService docInfoService;
     @Autowired
     private INcLogInfoService iNcLogInfoService;
@@ -163,16 +165,27 @@
 
     @Override
     public List<CommonGenericTree> loadProductTree(String userId) {
+        //浜у搧
         List<ProductInfo> productInfoList = getByUserPerms(userId);
         if(productInfoList == null || productInfoList.isEmpty())
             return Collections.emptyList();
+        //閮ㄤ欢
         List<ComponentExt> componentInfoList = componentInfoService.getByUserPermsAs(userId);
         if(componentInfoList == null)
             componentInfoList = Collections.emptyList();
+        //闆朵欢
         List<PartsInfo> partsInfos = partsInfoService.getByUserPerms(userId);
         if(partsInfos == null)
             partsInfos = Collections.emptyList();
-        return ProductTreeWrapper.loadTree(productInfoList, componentInfoList, partsInfos);
+        //宸ュ簭
+        List<ProcessStream> processStreams=processStreamService.getByuserPerms(userId);
+        if(processStreams==null)
+            processStreams = Collections.emptyList();
+        //宸ユ
+        List<WorkStep> workStepList=workStepService.getByUserPerms(userId);
+        if(workStepList==null)
+            workStepList = Collections.emptyList();
+        return ProductTreeWrapper.loadTree(productInfoList, componentInfoList, partsInfos,processStreams,workStepList);
     }
 
     @Override
@@ -1427,7 +1440,8 @@
         List<ProductInfo> productInfos = this.getByUserPerms(userId, queryParam);
         List<ComponentInfo> componentInfos = componentInfoService.getByUserPerms(userId, queryParam);
         List<PartsInfo> partsInfos = partsInfoService.getByUserPerms(userId, null, queryParam);
-
+        List<ProcessStream> processStreams=processStreamService.getByuserPerms(userId, queryParam);
+        List<WorkStep> workSteps=workStepService.getByUserPerms(userId, queryParam);
         List<ComponentInfo> componentInfoList = new ArrayList<>();
         List<ProductInfo> productInfoList = new ArrayList<>();
 
@@ -1462,6 +1476,44 @@
 
             if(!componentInfoMap.containsKey(p.getComponentId())) {
                 component = componentInfoService.getById(p.getComponentId());
+                if(component != null) {
+                    componentInfoMap.put(component.getComponentId(), component);
+                    componentInfoList.add(component);
+                }
+
+            }
+        }
+
+        for (ProcessStream processStream : processStreams) {
+            if (!productInfoMap.containsKey(processStream.getProductId())) {
+                product  = super.getById(processStream.getProductId());
+                if(product != null) {
+                    productInfoMap.put(product.getProductId(), product);
+                    productInfoList.add(product);
+                }
+            }
+
+            if(!componentInfoMap.containsKey(processStream.getComponentId())) {
+                component = componentInfoService.getById(processStream.getComponentId());
+                if(component != null) {
+                    componentInfoMap.put(component.getComponentId(), component);
+                    componentInfoList.add(component);
+                }
+
+            }
+        }
+
+        for (WorkStep workStep :workSteps){
+            if (!productInfoMap.containsKey(workStep.getProductId())) {
+                product  = super.getById(workStep.getProductId());
+                if(product != null) {
+                    productInfoMap.put(product.getProductId(), product);
+                    productInfoList.add(product);
+                }
+            }
+
+            if(!componentInfoMap.containsKey(workStep.getComponentId())) {
+                component = componentInfoService.getById(workStep.getComponentId());
                 if(component != null) {
                     componentInfoMap.put(component.getComponentId(), component);
                     componentInfoList.add(component);
@@ -1515,6 +1567,6 @@
         //杞崲鏁版嵁
         List<ComponentExt> componentExtList = ComponentExt.convertToExtList(componentInfoList);
 
-        return ProductTreeWrapper.loadTree(productInfoList, componentExtList, partsInfos);
+        return ProductTreeWrapper.loadTree(productInfoList, componentExtList, partsInfos,processStreams,workSteps);
     }
 }

--
Gitblit v1.9.3