From cdd325cf78ca5bac74f941a917d8c90f34fa63e6 Mon Sep 17 00:00:00 2001
From: 啊鑫 <t2856754968@163.com>
Date: 星期一, 25 八月 2025 10:03:41 +0800
Subject: [PATCH] 11

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

diff --git a/MES.Service/service/BasicData/MesDepotsManager.cs b/MES.Service/service/BasicData/MesDepotsManager.cs
index b6088d9..dc15001 100644
--- a/MES.Service/service/BasicData/MesDepotsManager.cs
+++ b/MES.Service/service/BasicData/MesDepotsManager.cs
@@ -42,7 +42,7 @@
     }
 
     // 鏇存柊浠撳簱鐘舵�佺殑鏂规硶
-    private bool UpdateDepotStatus(SqlSugarScope db, decimal depotId,
+    private bool UpdateDepotStatus(SqlSugarScope db, long depotId,
         string status)
     {
         var result = db.Updateable<MesDepots>()
@@ -89,30 +89,42 @@
     // 灏� ErpDepots 瀵硅薄杞崲涓� MesDepots 瀵硅薄鐨勬柟娉�
     private MesDepots GetMesDepots(ErpDepots depots)
     {
-        return new MesDepots
+        var entity = new MesDepots
         {
-            Guid = depots.Id,
             DepotCode = depots.FNumber,
             DepotName = depots.FName,
-            DepotId = Convert.ToDecimal(depots.Id),
+            DepotId = string.IsNullOrEmpty(depots.Id)
+                ? DateTimeOffset.UtcNow.ToUnixTimeSeconds()
+                : long.Parse(depots.Id),
             IsFkc = depots.FAllowMinusQty,
             CreateBy = depots.FPrincipal,
             Depottype = depots.FStockProperty,
             IsNg = depots.FForbidStatus,
             Zuid = depots.FGroup,
-            FSubsidiary = depots.FUseOrgId,
-            Fumbrella = depots.FCreateOrgId,
-            CreateDate = DateTime.Now,
-            LastupdateDate = DateTime.Now,
-            SupplierId = depots.FSUPPLIERID,
-            Company = "1000",
-            Factory = "1000",
-            FCustomerId = depots.FCustomerId,
-            FDocumentStatus = depots.FDocumentStatus,
-            FStockStatusType = depots.FStockStatusType
-        
+            DocumentStatus = depots.FDocumentStatus,
             
+            UseOrg = string.IsNullOrEmpty(depots.FUseOrgId)
+                ? 1
+                : long.Parse(depots.FUseOrgId),
+            CreateOrg = string.IsNullOrEmpty(depots.FCreateOrgId)
+                ? 1
+                : long.Parse(depots.FCreateOrgId),
+            CreateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+            LastupdateDate = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"),
+            Company = "1000",
+            Factory = "1000"
         };
+
+        var mesDepots = Db.Queryable<MesDepots>()
+            .Where(s => s.DepotCode == entity.DepotCode)
+            .First();
+
+        if (mesDepots != null)
+        {
+            entity.DepotId = mesDepots.DepotId;
+        }
+
+        return entity;
     }
 
     // SaveList 鏂规硶鐢ㄤ簬淇濆瓨澶氫釜浠撳簱璁板綍锛屾牴鎹被鍨嬫壒閲忔墽琛屼笉鍚岀殑鎿嶄綔

--
Gitblit v1.9.3