From c42731f080a4873e298bfe8489b47993432d8404 Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期五, 24 十月 2025 12:08:48 +0800
Subject: [PATCH] 优化权限配置

---
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs |   32 +++++++++++++++++++++++++-------
 1 files changed, 25 insertions(+), 7 deletions(-)

diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
index 47dcbca..17c4d11 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs"
@@ -13,6 +13,7 @@
 using WIDESEA_Common;
 using WIDESEA_Common.LocationEnum;
 using WIDESEA_Common.OrderEnum;
+using WIDESEA_Common.StockEnum;
 using WIDESEA_Common.TaskEnum;
 using WIDESEA_Common.WareHouseEnum;
 using WIDESEA_Core;
@@ -41,8 +42,9 @@
         private readonly IDeliveryOrderDetailServices _deliveryOrderDetailServices;
         private readonly ISupplyTaskService _supplyTaskService;
         private readonly ICabinOrderServices _cabinOrderServices;
+        private readonly ITacticsService _tacticsService;
         public IRepository<Dt_DeliveryOrder> Repository => BaseDal;
-        public DeliveryOrderServices(IRepository<Dt_DeliveryOrder> BaseDal, IBasicService basicService, IUnitOfWorkManage unitOfWorkManage, IInventory_BatchServices inventory_BatchServices, IInventoryInfoService inventoryInfoService, IDeliveryOrderDetailServices deliveryOrderDetailServices, ISupplyTaskService supplyTaskService, ICabinOrderServices cabinOrderServices) : base(BaseDal)
+        public DeliveryOrderServices(IRepository<Dt_DeliveryOrder> BaseDal, IBasicService basicService, IUnitOfWorkManage unitOfWorkManage, IInventory_BatchServices inventory_BatchServices, IInventoryInfoService inventoryInfoService, IDeliveryOrderDetailServices deliveryOrderDetailServices, ISupplyTaskService supplyTaskService, ICabinOrderServices cabinOrderServices, ITacticsService tacticsService) : base(BaseDal)
         {
             _basicService = basicService;
             _unitOfWorkManage = unitOfWorkManage;
@@ -51,6 +53,7 @@
             _inventory_BatchServices = inventory_BatchServices;
             _inventoryInfoService = inventoryInfoService;
             _cabinOrderServices = cabinOrderServices;
+            _tacticsService = tacticsService;
         }
         public WebResponseContent GetUpstreamOutOrder()
         {
@@ -336,6 +339,7 @@
             WebResponseContent webResponseContent = new WebResponseContent();
             try
             {
+                Dt_Tactics tactics = _tacticsService.Repository.QueryFirst(x => x.TacticeName == "鍑哄簱绛栫暐");
                 if (outorder.warehouse_no == WarehouseEnum.楹荤簿搴�.ObjToInt().ToString("000") || outorder.warehouse_no == WarehouseEnum.鍐峰喕搴�.ObjToInt().ToString("000"))
                 {
                     #region 娣诲姞鍑哄簱鍗�
@@ -350,6 +354,7 @@
                         OutStatus = "鏂板缓",
                         Details = outorder.details.Select(d => new Dt_DeliveryOrderDetail
                         {
+                            Reservoirarea = outorder.warehouse_no,
                             Goods_no = d.goods_no,
                             Order_qty = Math.Abs(d.order_qty), // 鍑哄簱鏁伴噺杞负姝f暟
                             Batch_num = d.batch_num,
@@ -360,13 +365,26 @@
                     };
                     BaseDal.Db.InsertNav(entityOrder).Include(x => x.Details).ExecuteCommand();
                     #endregion
+                    List<Dt_InventoryInfo> dt_InventoryInfos = new List<Dt_InventoryInfo>();
+                    #region 澶勭悊搴撳瓨銆佹坊鍔犲嚭搴撲换鍔�
+                    foreach (var item in entityOrder.Details)
+                    {
+                        dt_InventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.MaterielCode == item.Goods_no && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() && x.StockQuantity > x.OutboundQuantity && x.WarehouseCode == item.Reservoirarea);
+                        #region 鎸夊嚭搴撶瓥鐣ユ煡鎵惧簱瀛�
+                        if (tactics.SelectTactice == TacticsEnum.ComeOutonFirstTime.ObjToInt())
+                            dt_InventoryInfos = dt_InventoryInfos.OrderBy(x => x.ValidityPeriod).ToList();
+                        else
+                            dt_InventoryInfos = dt_InventoryInfos.OrderBy(x => x.InDate).ToList();
+                        #endregion
+                        var Order_qty = item.Order_qty;
+                        foreach (var InventoryInfo in dt_InventoryInfos)
+                        {
+                            if (InventoryInfo.AvailableQuantity < Order_qty)
+                            {
 
-                    #region 澶勭悊搴撳瓨
-
-                    #endregion
-
-                    #region 娣诲姞鍑哄簱浠诲姟
-
+                            }
+                        }
+                    }
                     #endregion
                 }
                 else

--
Gitblit v1.9.3