From b0ed419ede8bd1829e670891ffe878630ba517e2 Mon Sep 17 00:00:00 2001
From: yanjinhui <3306209981@qq.com>
Date: 星期一, 03 十一月 2025 17:57:32 +0800
Subject: [PATCH] 优化

---
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs |   21 +++++++++------------
 1 files changed, 9 insertions(+), 12 deletions(-)

diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs"
index 996a1fc..7a2e10e 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Check.cs"
@@ -257,7 +257,7 @@
                 {
                     inventoryInfo = _inventoryInfoService.Repository.QueryFirst(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no && x.WarehouseCode == supplyTask.WarehouseCode);
                 }
-                inventoryInfo.SupplyQuantity = supplyTask.SupplyQuantity;
+                inventoryInfo.SupplyQuantity = supplyTask.SupplyQuantity - inventoryInfo.StockQuantity;
                 #endregion
 
                 #region 鍒ゆ柇褰撳墠鐗╂枡鎵规鐨勭洏鐐逛换鍔℃槸鍚﹀叏閮ㄥ畬鎴�
@@ -269,27 +269,27 @@
                 {
                     #region 鏌ユ壘搴撳瓨
                     inventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no && x.Id != inventoryInfo.Id);
-                    var SupplyQuantitys = inventoryInfos.Sum(x => x.SupplyQuantity) + supplyTask.SupplyQuantity;
+                    var SupplyQuantitys = inventoryInfos.Sum(x => x.SupplyQuantity) + inventoryInfo.SupplyQuantity;//璁$畻鐩樼偣鎬绘暟
                     #endregion
 
                     #region 搴撳瓨鎵规
                     inventory_Batch = _inventory_BatchServices.Repository.QueryFirst(x => x.BatchNo == cabinOrderDetail.Batch_num && x.MaterielCode == cabinOrderDetail.Goods_no);
-                    //濡傛灉鐩樼偣鏁板拰鎵规鎬绘暟瀵逛笂浜嗭紝鐩樼偣鏁拌祴鍊间负0锛岃祴鍊煎氨娣诲姞鐩樼偣鏁�
-                    if (SupplyQuantitys == inventory_Batch.StockQuantity)
+                    
+                    if (SupplyQuantitys == 0)
                     {
                         foreach (var item in inventoryInfos)
                         {
-                            item.StockQuantity = item.SupplyQuantity;
+                            item.StockQuantity += item.SupplyQuantity;
                             item.SupplyQuantity = 0;
                             item.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
                         }
-                        inventoryInfo.StockQuantity = supplyTask.SupplyQuantity;
+                        inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity;
                         inventoryInfo.SupplyQuantity = 0;
                         inventoryInfo.StockStatus = StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt();
                     }
                     else
                     {
-                        inventory_Batch.SupplyQuantity = SupplyQuantitys;
+                        inventory_Batch.SupplyQuantity += SupplyQuantitys;
                     }
                     #endregion
                 }
@@ -317,11 +317,8 @@
                 #endregion
                 _inventoryInfoService.UpdateData(inventoryInfo);
                 _supplyTaskService.Repository.DeleteAndMoveIntoHty(supplyTask, OperateTypeEnum.鑷姩瀹屾垚);
-                if (inventoryInfos.Count >= 1)
-                {
-                    _inventoryInfoService.UpdateData(inventoryInfos);
-                    _inventory_BatchServices.UpdateData(inventory_Batch);
-                }
+                _inventoryInfoService.UpdateData(inventoryInfos);
+                _inventory_BatchServices.UpdateData(inventory_Batch);
                 _unitOfWorkManage.CommitTran();
                 #endregion
                 content.OK();

--
Gitblit v1.9.3