From 8d63dd77b9b3cd9b6d9768f216670fc499a8cab3 Mon Sep 17 00:00:00 2001
From: lyh <925863403@qq.com>
Date: 星期四, 23 一月 2025 14:32:16 +0800
Subject: [PATCH] 整合DNC 权限分配 修改为设备车间管理权限

---
 lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java |   48 ++++++++++++++++++++++--------------------------
 1 files changed, 22 insertions(+), 26 deletions(-)

diff --git a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java
index bd53894..7b67da4 100644
--- a/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java
+++ b/lxzn-module-dnc/src/main/java/org/jeecg/modules/dnc/service/impl/PartsInfoServiceImpl.java
@@ -21,6 +21,7 @@
 import org.jeecg.modules.dnc.utils.ValidateUtil;
 
 import org.jeecg.modules.dnc.entity.*;
+import org.jeecg.modules.system.entity.MdcProduction;
 import org.jeecg.modules.system.entity.SysUser;
 import org.apache.commons.collections4.ListUtils;
 
@@ -125,30 +126,23 @@
         b = partsPermissionService.save(permission);
         if(!b)
             ExceptionCast.cast(CommonCode.FAIL);
-        //娣诲姞榛樿宸ュ簭
-        ProcessStream processStream = new ProcessStream();
-        processStream.setProductId(partsInfo.getProductId());
-        processStream.setComponentId(partsInfo.getComponentId());
-        processStream.setPartsId(partsInfo.getPartsId());
-        processStream.setProcessCode("1");
-        b = processStreamService.save(processStream);
-        if(!b)
-            ExceptionCast.cast(CommonCode.FAIL);
+//        if(!b)
+//            ExceptionCast.cast(CommonCode.FAIL);
         //娣诲姞鐢ㄦ埛鏉冮檺
         PermissionStream stream = new PermissionStream();
         stream.setProductId(partsInfo.getProductId());
         stream.setComponentId(partsInfo.getComponentId());
         stream.setPartsId(partsInfo.getPartsId());
         stream.setUserId(userId);
-        //娣诲姞鏃ュ織
-        NcLogInfo ncLogInfogx = new NcLogInfo();
-        //妯″潡
-        ncLogInfogx.setModuleInfo("浜у搧缁撴瀯鏍�");
-        //绫诲瀷
-        ncLogInfogx.setOperateType(2);
-        //鏃ュ織鍐呭
-        ncLogInfogx.setLogContent("闆朵欢鍚嶇О锛�"+partsInfo.getPartsName()+"鐢熸垚榛樿宸ュ簭锛屽伐搴忓彿锛�"+processStream.getProcessCode());
-        iNcLogInfoService.saveLogNcInfos(ncLogInfogx);
+//        //娣诲姞鏃ュ織
+//        NcLogInfo ncLogInfogx = new NcLogInfo();
+//        //妯″潡
+//        ncLogInfogx.setModuleInfo("浜у搧缁撴瀯鏍�");
+//        //绫诲瀷
+//        ncLogInfogx.setOperateType(2);
+//        //鏃ュ織鍐呭
+//        ncLogInfogx.setLogContent("闆朵欢鍚嶇О锛�"+partsInfo.getPartsName()+"鐢熸垚榛樿宸ュ簭锛屽伐搴忓彿锛�"+processStream.getProcessCode());
+//        iNcLogInfoService.saveLogNcInfos(ncLogInfogx);
         return permissionStreamService.save(stream);
     }
 
@@ -383,23 +377,24 @@
 
     @Override
     @Transactional(rollbackFor = {Exception.class})
-    public boolean assignAddDepart(PartsInfo partsInfo, Collection<Department> departmentList) {
+    public boolean assignAddDepart(PartsInfo partsInfo, Collection<MdcProduction> departmentList) {
         if(partsInfo == null || departmentList == null || departmentList.isEmpty())
             ExceptionCast.cast(CommonCode.INVALID_PARAM);
         List<PartsDepartment> partsDepartments = new ArrayList<>();
         List<PermissionStream> permissionStreamList = new ArrayList<>();
         departmentList.forEach(item -> {
-            PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getDepartId());
+            PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getId());
             if(en == null) {
                 en = new PartsDepartment();
-                en.setDepartId(item.getDepartId());
+                en.setDepartId(item.getId());
                 en.setPartsId(partsInfo.getPartsId());
                 partsDepartments.add(en);
             }
-            PermissionStream stream = permissionStreamService.getByPartsIdAndDepartId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId(), item.getDepartId());
+            PermissionStream stream = permissionStreamService.getByPartsIdAndDepartId(partsInfo.getProductId(), partsInfo.getComponentId(),
+                    partsInfo.getPartsId(), item.getId());
             if(stream == null) {
                 stream = new PermissionStream();
-                stream.setDepartId(item.getDepartId());
+                stream.setDepartId(item.getId());
                 stream.setProductId(partsInfo.getProductId());
                 stream.setComponentId(partsInfo.getComponentId());
                 stream.setPartsId(partsInfo.getPartsId());
@@ -423,17 +418,18 @@
 
     @Override
     @Transactional(rollbackFor = {Exception.class})
-    public boolean assignRemoveDepart(PartsInfo partsInfo, Collection<Department> departmentList) {
+    public boolean assignRemoveDepart(PartsInfo partsInfo, Collection<MdcProduction> departmentList) {
         if(partsInfo == null || departmentList == null || departmentList.isEmpty())
             ExceptionCast.cast(CommonCode.INVALID_PARAM);
         List<PartsDepartment> partsDepartments = new ArrayList<>();
         List<PermissionStream> permissionStreamList = new ArrayList<>();
         departmentList.forEach(item -> {
-            PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getDepartId());
+            PartsDepartment en = partsDepartmentService.getByPartsIdAndDepartId(partsInfo.getPartsId(), item.getId());
             if(en != null) {
                 partsDepartments.add(en);
             }
-            PermissionStream stream = permissionStreamService.getByPartsIdAndDepartId(partsInfo.getProductId(), partsInfo.getComponentId(), partsInfo.getPartsId(), item.getDepartId());
+            PermissionStream stream = permissionStreamService.getByPartsIdAndDepartId(partsInfo.getProductId(), partsInfo.getComponentId(),
+                    partsInfo.getPartsId(), item.getId());
             if(stream != null) {
                 permissionStreamList.add(stream);
             }

--
Gitblit v1.9.3