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/LKBusiness/CabinOrderServicesLK.cs    |   11 +++++++++++
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/DeliveryOrderServicesLK.cs |   10 ++++++++++
 2 files changed, 21 insertions(+), 0 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 299d649..55ec36e 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"
@@ -36,6 +36,7 @@
                 List<Dt_MaterielInfo> materielInfos = _materielInfoService.Repository.QueryData(x => cabinOrder.Details.Select(x => x.Goods_no).ToList().Contains(x.MaterielCode));
                 List<Dt_InventoryInfo> inventoryInfos = _inventoryInfoService.Repository.QueryData(x => cabinOrder.Warehouse_no == x.WarehouseCode && cabinOrder.Details.Select(x => x.Goods_no).ToList().Contains(x.MaterielCode));
                 List<Dt_Inventory_Batch> inventory_Batches = _inventory_BatchServices.Repository.QueryData(x => cabinOrder.Details.Select(x => x.Goods_no).ToList().Contains(x.MaterielCode));
+                List<Dt_MaterielInfo> MaterieInfoBusiness = new List<Dt_MaterielInfo>();
                 #region 鐩樼泩鍏ュ簱鍗�
                 if (cabinOrder.Order_type == "5")
                 {
@@ -47,6 +48,14 @@
                         Dt_InventoryInfo inventoryInfo = inventoryInfos.Where(x => x.MaterielCode == detail.productCode && x.BatchNo == detail.batchNo).First();
                         if (orderQty != inventoryInfo.SupplyQuantity)
                             throw new Exception($"鐩樼泩鍏ュ簱鏁伴噺涓嶄竴鑷�,涓婁紶鏁伴噺銆恵orderQty}銆�,搴撳瓨鐩樼泩鏁伴噺銆恵inventoryInfo.SupplyQuantity}銆�");
+                        var mater = materielInfos.FirstOrDefault(x => x.MaterielCode == detail.productCode);
+                        //娣诲姞鐗╂枡淇℃伅涓殑绔嬪簱涓氬姟搴撳瓨淇℃伅
+                        if (mater != null)
+                        {
+                            mater.Business_qty += inventoryInfo.SupplyQuantity;
+                            MaterieInfoBusiness.Add(mater);
+                        }
+
                         inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity;
                         inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity;
                         inventoryInfo.SupplyQuantity = 0;
@@ -91,6 +100,8 @@
                     _inventory_BatchServices.UpdateData(batchesUp);
                     _cabinOrderDetailServices.UpdateData(cabinOrderDetailsUp);
                     BaseDal.UpdateData(cabinOrder);
+                    //娣诲姞鐗╂枡鐨勭珛搴撲笟鍔″熀纭�鏁版嵁
+                    _materielInfoService.UpdateData(MaterieInfoBusiness);
                     _unitOfWorkManage.CommitTran();
                 }
                 #endregion
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/DeliveryOrderServicesLK.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/DeliveryOrderServicesLK.cs"
index 84065f4..f96c94d 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/DeliveryOrderServicesLK.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/LKBusiness/DeliveryOrderServicesLK.cs"
@@ -28,6 +28,7 @@
                 List<Dt_MaterielInfo> materielInfos = _materielInfoService.Repository.QueryData(x => deliveryOrder.Details.Select(x => x.Goods_no).ToList().Contains(x.MaterielCode));
                 List<Dt_InventoryInfo> inventoryInfos = _inventoryInfoService.Repository.QueryData(x => deliveryOrder.Warehouse_no == x.WarehouseCode && deliveryOrder.Details.Select(x => x.Goods_no).ToList().Contains(x.MaterielCode));
                 List<Dt_Inventory_Batch> inventory_Batches = _inventory_BatchServices.Repository.QueryData(x => deliveryOrder.Details.Select(x => x.Goods_no).ToList().Contains(x.MaterielCode));
+                List<Dt_MaterielInfo> MaterieInfoBusiness =new List<Dt_MaterielInfo>();
                 #region 鐩樹簭鍑哄簱鍗�
                 if (deliveryOrder.Out_type == "6")
                 {
@@ -41,6 +42,13 @@
                             Dt_InventoryInfo inventoryInfo = inventoryInfos.Where(x => x.MaterielCode == detail.productCode && x.BatchNo == detail.batchNo).First();
                             if (orderQty != Math.Abs(inventoryInfo.SupplyQuantity))
                                 throw new Exception($"鐩樹簭鍑哄簱鏁伴噺涓嶄竴鑷�,涓婁紶鏁伴噺銆恵orderQty}銆�,搴撳瓨鐩樹簭鏁伴噺銆恵Math.Abs(inventoryInfo.SupplyQuantity)}銆�");
+                            //娣诲姞鐗╂枡淇℃伅涓殑绔嬪簱涓氬姟搴撳瓨淇℃伅
+                            var mater = materielInfos.FirstOrDefault(x => x.MaterielCode == detail.productCode);
+                            if (mater != null)
+                            {
+                                mater.Business_qty += inventoryInfo.SupplyQuantity;
+                                MaterieInfoBusiness.Add(mater);
+                            }
                             inventoryInfo.StockQuantity += inventoryInfo.SupplyQuantity;
                             inventoryInfo.AvailableQuantity = inventoryInfo.StockQuantity;
                             inventoryInfo.SupplyQuantity = 0;
@@ -85,6 +93,8 @@
                         _inventory_BatchServices.UpdateData(batchesUp);
                         _deliveryOrderDetailServices.UpdateData(cabinOrderDetailsUp);
                         BaseDal.UpdateData(deliveryOrder);
+                        //娣诲姞鐗╂枡淇℃伅涓殑绔嬪簱涓氬姟搴撳瓨淇℃伅
+                        _materielInfoService.UpdateData(MaterieInfoBusiness);
                         _unitOfWorkManage.CommitTran();
                     }
                     catch (Exception ex)

--
Gitblit v1.9.3