From ab01d75a3fbc8467d81a895cba5d6dde76fbe053 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期二, 16 九月 2025 23:29:30 +0800
Subject: [PATCH] 1111

---
 MES.Service/service/BasicData/SysDepartmentManager.cs |   33 +++++++++++++++------------------
 1 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/MES.Service/service/BasicData/SysDepartmentManager.cs b/MES.Service/service/BasicData/SysDepartmentManager.cs
index 8ecf223..6f29c07 100644
--- a/MES.Service/service/BasicData/SysDepartmentManager.cs
+++ b/MES.Service/service/BasicData/SysDepartmentManager.cs
@@ -1,4 +1,5 @@
-锘縰sing MES.Service.DB;
+锘縰sing Masuit.Tools;
+using MES.Service.DB;
 using MES.Service.Dto.webApi;
 using MES.Service.Modes;
 using SqlSugar;
@@ -127,16 +128,6 @@
     // 灏� ErpDepartment 瀵硅薄杞崲涓� SysDepartment 瀵硅薄鐨勬柟娉�
     private SysDepartment GetSysDepartment(ErpDepartment department)
     {
-        var fForbidStatus = department.FForbidStatus;
-        if (department.FForbidStatus == "0")
-        {
-            fForbidStatus = "A";
-        }
-        else if (department.FForbidStatus == "1")
-        {
-            fForbidStatus = "B";
-        }
-
         var entity = new SysDepartment
         {
             Departmentcode = department.FNumber,
@@ -144,20 +135,26 @@
             Depextr1 = department.FDeptProperty,
             Depextr2 = department.FGroup,
             Depextr3 = department.FWIPStockID,
-            Depextr4 = fForbidStatus,
             FParentID = department.FParentID,
-            FSubsidiary = string.IsNullOrEmpty(department.FUseOrgId)
-                ? "1"
-                : department.FUseOrgId,
-            Fumbrella = string.IsNullOrEmpty(department.FCreateOrgId)
-                ? "1"
-                : department.FCreateOrgId,
+            FSubsidiary = "1",
+            Fumbrella = "1",
             CreateDate = DateTime.Now,
             LastupdateDate = DateTime.Now,
             Company = "1000",
             Factory = "1000"
         };
 
+        if (department.FForbidStatus.IsNullOrEmpty())
+        {
+            entity.Depextr4 = "A";
+        }
+        else
+        {
+            //鎴戞湡鏈涚殑鍊兼槸A=鍚�,B=鏄�
+            //瀹為檯缁欐垜鐨勫�兼槸0鎴�1锛屾垜甯屾湜涓烘垜杞崲浠嶢鍜孊鐨勬柟寮�
+            entity.Depextr4 = department.FForbidStatus == "1" ? "B" : "A";
+        }
+
         // 鏌ユ壘鏄惁宸插瓨鍦ㄧ浉鍚岄儴闂ㄧ紪鐮佺殑璁板綍
         var existingDepartment = Db.Queryable<SysDepartment>()
             .Where(s => s.Departmentcode == entity.Departmentcode)

--
Gitblit v1.9.3