From 8328aed1bca2a30c3105b19f41d324acb59437c9 Mon Sep 17 00:00:00 2001
From: 快乐的昕的电脑 <快乐的昕的电脑@DESKTOP-C2BQPQU>
Date: 星期四, 18 十二月 2025 14:11:42 +0800
Subject: [PATCH] 采购订单:添加组合键、添加单别。生产订单:添加整单删除、主表id生产改为序列化

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

diff --git a/MES.Service/service/BasicData/MesDepotsManager.cs b/MES.Service/service/BasicData/MesDepotsManager.cs
index 9fa8176..2e5830f 100644
--- a/MES.Service/service/BasicData/MesDepotsManager.cs
+++ b/MES.Service/service/BasicData/MesDepotsManager.cs
@@ -4,7 +4,9 @@
 using SqlSugar;
 
 namespace MES.Service.service.BasicData;
-
+/// <summary>
+/// 浠撳簱淇℃伅
+/// </summary>
 public class MesDepotsManager : Repository<MesDepots>
 {
     // Save 鏂规硶鐢ㄤ簬淇濆瓨鍗曚釜浠撳簱璁板綍锛屾牴鎹被鍨嬫墽琛屼笉鍚岀殑鎿嶄綔
@@ -77,7 +79,7 @@
     }
 
     /// <summary>
-    /// 鍚屾鐗╂枡淇℃伅new_0/4
+    /// 鍚屾浠撳簱淇℃伅new_0/4
     /// </summary>
     /// <param name="db"></param>
     /// <param name="entity"></param>
@@ -157,8 +159,8 @@
             Depottype = depots.FStockProperty,
             IsNg = depots.FForbidStatus,
             Zuid = depots.FGroup,
-            FSubsidiary = depots.FUseOrgId,
-            Fumbrella = depots.FCreateOrgId,
+            //FSubsidiary = depots.FUseOrgId,
+            //Fumbrella = depots.FCreateOrgId,
             // 濡傛灉瀛樺湪锛屼娇鐢ㄧ幇鏈夌殑CreateDate锛屽悗缁皢鍒犻櫎鍚庨噸鏂版彃鍏�
             // 濡傛灉涓嶅瓨鍦紝璁句负褰撳墠鏃堕棿
             CreateDate = existingCustomer?.CreateDate ?? DateTime.Now,
@@ -168,22 +170,26 @@
             Department = depots.Fdeptid,
             Phone = depots.Phone,
             Company = "1000",
-            Factory = depots.Factory??"1000",
-            Remark3 = depots.remark3,
+            Factory = depots.Factory,
+            factory_name = depots.factory_name,
             Remark4 = depots.remark4,
             Remark5 = depots.remark5,
+            FSubsidiary = string.IsNullOrEmpty(depots.FUseOrgId) ? "1" : depots.FUseOrgId,
+            Fumbrella = string.IsNullOrEmpty(depots.FCreateOrgId) ? "1" : depots.FCreateOrgId,
         };
         // ERP: 0=鏈鐢�, 1=绂佺敤
         // MES: A=鏈鐢�, B=绂佺敤
+        //浼犲叆0銆�1鎴栬�匒銆丅鏃堕兘浼氳浆涓篈銆丅锛屽叾浠栨儏鍐典负A
         if (string.IsNullOrEmpty(depots.FForbidStatus))
         {
             entity.IsNg = "A";
         }
         else
         {
-            //鎴戞湡鏈涚殑鍊兼槸A=鍚�,B=鏄�
-            //瀹為檯缁欐垜鐨勫�兼槸0鎴�1锛屾垜甯屾湜涓烘垜杞崲浠嶢鍜孊鐨勬柟寮�
-            entity.IsNg = depots.FForbidStatus == "1" ? "B" : "A";
+            // 鍥炰紶B鎴�1鏃跺啓鍏锛屽叾瀹冨啓A
+            entity.IsNg = (depots.FForbidStatus == "1" || depots.FForbidStatus == "B")
+                ? "B"
+                : "A";
         }
 
         return entity;
@@ -238,8 +244,7 @@
     }
 
     // 鎵归噺鏇存柊浠撳簱鐘舵�佺殑鏂规硶
-    private bool UpdateDepotStatusBatch(SqlSugarScope db,
-        List<MesDepots> depotList, string status)
+    private bool UpdateDepotStatusBatch(SqlSugarScope db,List<MesDepots> depotList, string status)
     {
         var ids = depotList.Select(it => it.DepotId).ToArray();
         var result = db.Updateable<MesDepots>()
@@ -253,8 +258,7 @@
     }
 
     // 鎵归噺鎻掑叆浠撳簱鐨勬柟娉�
-    private bool InsertDepotBatch(SqlSugarScope db,
-        List<MesDepots> depotList)
+    private bool InsertDepotBatch(SqlSugarScope db,List<MesDepots> depotList)
     {
         var insertRange = db.Insertable(depotList).ExecuteCommand();
         if (insertRange > 0)
@@ -278,8 +282,7 @@
     }
 
     // 鎵归噺鎻掑叆鎴栨洿鏂颁粨搴撶殑鏂规硶
-    private bool InsertOrUpdateBatch(SqlSugarScope db,
-        List<MesDepots> depotList)
+    private bool InsertOrUpdateBatch(SqlSugarScope db,List<MesDepots> depotList)
     {
         return depotList.All(entity => InsertOrUpdate(db, entity));
     }

--
Gitblit v1.9.3