From 4f8d1da89bc7cf399e6d90d6230ad6c28114443a Mon Sep 17 00:00:00 2001
From: 南骏 池 <chiffly@163.com>
Date: 星期一, 23 六月 2025 11:20:13 +0800
Subject: [PATCH] 1.采购入库优化 2.采购退货推荐库位优化

---
 service/Warehouse/MesInvItemInCDetailsManager.cs |   34 +++++++++++++++++-----------------
 1 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/service/Warehouse/MesInvItemInCDetailsManager.cs b/service/Warehouse/MesInvItemInCDetailsManager.cs
index 9c0a051..339dc2f 100644
--- a/service/Warehouse/MesInvItemInCDetailsManager.cs
+++ b/service/Warehouse/MesInvItemInCDetailsManager.cs
@@ -26,15 +26,15 @@
         var freeze = 0;
         decimal cSyQty = 0;
 
-        //if (string.IsNullOrEmpty(sectionCode))
-        //    throw new Exception("璇锋壂搴撲綅鏉$爜锛�");
+        if (string.IsNullOrEmpty(sectionCode))
+            throw new Exception("璇锋壂搴撲綅鏉$爜锛�");
 
         var itemBarcodeDetails = Db.Queryable<MesInvItemBarcodes>()
             .Where(it => it.ItemBarcode == itemBarcode)
             .First();
 
-        //if (itemBarcodeDetails == null)
-        //    throw new Exception("鏉$爜涓嶅瓨鍦紝璇锋牳瀵癸紒");
+        if (itemBarcodeDetails == null)
+            throw new Exception("鏉$爜涓嶅瓨鍦紝璇锋牳瀵癸紒");
 
         if (string.IsNullOrEmpty(itemBarcodeDetails.Memo) || itemBarcodeDetails.Memo != "閲囪喘鍏ュ簱")
             throw new Exception("姝ゆ潯鐮佷笉灞炰簬鍒拌揣鏉$爜锛屾棤娉曠敤閲囪喘鍏ュ簱锛�");
@@ -87,10 +87,10 @@
         MesDepots mesDepost = null;
 
         var checkGuid = UtilityHelper.CheckGuid(depotCode);
-        if (checkGuid && depotCode2 != null)
+        if (checkGuid && depotCode != null)
         {
             mesDepost = Db.Queryable<MesDepots>()
-                .Where(s => s.DepotId.ToString() == depotCode2).First();
+                .Where(s => s.DepotId.ToString() == depotCode).First();
 
             // if (depotCode != mesDepost.Guid)
             //     throw new Exception("鎵弿搴撲綅涓庨噰璐叆搴撳簱浣嶄笉涓�鑷达紒");
@@ -298,7 +298,7 @@
                             .Where(it =>
                                 it.ItemInId == cId &&
                                     it.ItemId == detail.ItemId &&
-                                    it.DepotId == depotCode2 &&
+                                    it.DepotId == mesDepost.DepotId.ToString() &&
                                     it.EbelnK3id == detail.EbelnK3id &&
                                     it.LineK3id == detail.LineK3id)
                             .Count();
@@ -327,7 +327,7 @@
                                 Remark = itemBarcodeDetails.Memo,
                                 EbelnK3id = detail.EbelnK3id,
                                 LineK3id = detail.LineK3id,
-                                DepotId = depotCode2,
+                                DepotId = mesDepost.DepotId.ToString(),
                                 itemDabid = itemBarcodeDetails.AboutGuid.ToString()
                             }).IgnoreColumns(true).ExecuteCommand();
                         else
@@ -337,7 +337,7 @@
                                 .Where(it =>
                                     it.ItemInId == cId &&
                                     it.ItemId == detail.ItemId &&
-                                    it.DepotId == depotCode2 &&
+                                    it.DepotId == mesDepost.DepotId.ToString() &&
                                     it.EbelnK3id == detail.EbelnK3id &&
                                     it.LineK3id == detail.LineK3id)
                                 .IgnoreColumns(true)
@@ -395,7 +395,7 @@
                             .Where(it =>
                                 it.ItemInId == cId &&
                                     it.ItemId == detail.ItemId &&
-                                    it.DepotId == depotCode2 &&
+                                    it.DepotId == mesDepost.DepotId.ToString() &&
                                     it.EbelnK3id == detail.EbelnK3id &&
                                     it.LineK3id == detail.LineK3id)
                             .Count();
@@ -423,7 +423,7 @@
                                 EbelnK3id = detail.EbelnK3id,
                                 LineK3id = detail.LineK3id,
                                 ItemId = detail.ItemId,
-                                DepotId = depotCode2
+                                DepotId = mesDepost.DepotId.ToString()
                             }).IgnoreColumns(true).ExecuteCommand();
                         else
                             db.Updateable<MesInvItemInCItems>()
@@ -432,7 +432,7 @@
                                 .Where(it =>
                                     it.ItemInId == cId &&
                                     it.ItemId == detail.ItemId &&
-                                    it.DepotId == depotCode2 &&
+                                    it.DepotId == mesDepost.DepotId.ToString() &&
                                     it.EbelnK3id == detail.EbelnK3id &&
                                     it.LineK3id == detail.LineK3id)
                                 .IgnoreColumns(true)
@@ -521,7 +521,7 @@
                     .Where(it =>
                     it.ItemInId == cId &&
                                     it.ItemId == detailone.ItemId &&
-                                    it.DepotId == depotCode2 &&
+                                    it.DepotId == mesDepost.DepotId.ToString() &&
                                     it.itemDabid == itemBarcodeDetails.AboutGuid.ToString())
                     .Count();
 
@@ -549,7 +549,7 @@
                         EbelnK3id = itemBarcodeDetails.EbelnK3id,
                         LineK3id = itemBarcodeDetails.LineK3id,
                         ItemId = itemBarcodeDetails.ItemId,
-                        DepotId = depotCode2,
+                        DepotId = mesDepost.DepotId.ToString(),
                         itemDabid = itemBarcodeDetails.AboutGuid.ToString()
                     }).IgnoreColumns(true).ExecuteCommand();
                 else
@@ -562,7 +562,7 @@
                         .Where(it =>
                                     it.ItemInId == cId &&
                                     it.ItemId == detailone.ItemId &&
-                                    it.DepotId == depotCode2 &&
+                                    it.DepotId == mesDepost.DepotId.ToString() &&
                                     it.itemDabid == itemBarcodeDetails.AboutGuid.ToString())
                         //.IgnoreColumns(true) // 淇濈暀 IgnoreColumns
                         .ExecuteCommand();
@@ -606,7 +606,7 @@
                     CheckRes = inventoryDetails.CheckRes,
                     CheckStates = inventoryDetails.CheckStates,
                     ReceiveOrgId = inventory.ReceiveOrgId,
-                    DepotId = Convert.ToInt64(depotCode2)
+                    DepotId = Convert.ToInt64(mesDepost.DepotId.ToString())
                 }).IgnoreColumns(true).ExecuteCommand();
 
                 // 鎻掑叆 mes_inv_business2 琛�
@@ -667,7 +667,7 @@
                 LineK3id = itemBarcodeDetails.LineK3id,
                 ItemId = itemBarcodeDetails.ItemId,
                 BillNo = itemBarcodeDetails.BillNo,
-                DepotId = Convert.ToInt32(depotCode2),
+                DepotId = Convert.ToInt32(mesDepost.DepotId),
                 OwnerId = cgddDetails.DemandOrg,
                 OwnerType = owner_type,
                 StockOrgId = mesDepost.FSubsidiary,

--
Gitblit v1.9.3