From 1b8daa902b075c7cedee7bbcc13b914b7a5b4ad4 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期一, 03 十一月 2025 11:48:49 +0800
Subject: [PATCH] 优化盘点逻辑
---
新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/CabinOrderServicesLK.cs | 9 ++++-----
1 files changed, 4 insertions(+), 5 deletions(-)
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/CabinOrderServicesLK.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/CabinOrderServicesLK.cs"
index c0a4b66..299d649 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/CabinOrderServicesLK.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/CabinOrderServicesLK.cs"
@@ -45,16 +45,15 @@
if (orderDetail == null) throw new Exception($"鏈壘鍒扮洏鐐瑰崟銆恵cabinOrder.Order_no}銆戠墿鏂欑紪鍙枫�恵detail.productCode}銆戠墿鏂欐壒娆°�恵detail.batchNo}銆戠殑鏄庣粏淇℃伅");
decimal orderQty = detail.orderDetails?.Sum(x => decimal.TryParse(x.quantity, out var q) ? Math.Abs(q) : 0) ?? 0;
Dt_InventoryInfo inventoryInfo = inventoryInfos.Where(x => x.MaterielCode == detail.productCode && x.BatchNo == detail.batchNo).First();
- var qty = inventoryInfo.SupplyQuantity - inventoryInfo.StockQuantity;
- if (orderQty != qty)
- throw new Exception($"鐩樼泩鍏ュ簱鏁伴噺涓嶄竴鑷�,涓婁紶鏁伴噺銆恵orderQty}銆�,搴撳瓨鐩樼泩鏁伴噺銆恵qty}銆�");
- inventoryInfo.StockQuantity = inventoryInfo.SupplyQuantity;
+ if (orderQty != inventoryInfo.SupplyQuantity)
+ throw new Exception($"鐩樼泩鍏ュ簱鏁伴噺涓嶄竴鑷�,涓婁紶鏁伴噺銆恵orderQty}銆�,搴撳瓨鐩樼泩鏁伴噺銆恵inventoryInfo.SupplyQuantity}銆�");
+ inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity;
inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity;
inventoryInfo.SupplyQuantity = 0;
inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
infosUp.Add(inventoryInfo);
Dt_Inventory_Batch inventory_Batch = inventory_Batches.First(x => x.MaterielCode == inventoryInfo.MaterielCode && x.BatchNo == inventoryInfo.BatchNo);
- inventory_Batch.StockQuantity = inventory_Batch.SupplyQuantity;
+ inventory_Batch.StockQuantity += inventory_Batch.SupplyQuantity;
inventory_Batch.AvailableQuantity = inventory_Batch.StockQuantity;
inventory_Batch.SupplyQuantity = 0;
batchesUp.Add(inventory_Batch);
--
Gitblit v1.9.3