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/ClassLibrary1/ITacticsService.cs                     |    3 ++-
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_RoleService.cs             |    8 ++++----
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/DeliveryOrderServices.cs |   32 +++++++++++++++++++++++++-------
 新建文件夹/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs        |    8 +++++++-
 新建文件夹/WIDESEA_WMSServer/ClassLibrary2/TacticsService.cs                      |    2 +-
 新建文件夹/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_Tactics.cs           |    4 ++--
 6 files changed, 41 insertions(+), 16 deletions(-)

diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary1/ITacticsService.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary1/ITacticsService.cs"
index b13de02..da57079 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary1/ITacticsService.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary1/ITacticsService.cs"
@@ -4,6 +4,7 @@
 using System.Text;
 using System.Threading.Tasks;
 using WIDESEA_Core;
+using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
 using WIDESEA_Model.Models;
 
@@ -12,6 +13,6 @@
 {
     public interface ITacticsService : IService<Dt_Tactics>
     {
-        
+        IRepository<Dt_Tactics> Repository { get; }
     }
 }
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/TacticsService.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/TacticsService.cs"
index 95bfa5e..fb37290 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/TacticsService.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/ClassLibrary2/TacticsService.cs"
@@ -22,6 +22,6 @@
         {
         }
 
-        
+        public IRepository<Dt_Tactics> Repository => BaseDal;
     }
 }
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_Tactics.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_Tactics.cs"
index 664aae2..7aa2a00 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_Tactics.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_Model/Models/WMSInfo/Dt_Tactics.cs"
@@ -55,7 +55,7 @@
         /// <summary>
         /// 鏁翠欢鍏堝嚭
         /// </summary>
-        [Description("鏁翠欢鍏堝嚭")]
-        WholePieceComesFirst,
+        //[Description("鏁翠欢鍏堝嚭")]
+        //WholePieceComesFirst,
     }
 }
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
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs"
index efcbf5f..ec5ff26 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SquareCabinServices/extend/Allocat.cs"
@@ -9,6 +9,7 @@
 using WIDESEA_Common.OrderEnum;
 using WIDESEA_Common.StockEnum;
 using WIDESEA_Common.TaskEnum;
+using WIDESEA_Common.WareHouseEnum;
 using WIDESEA_Core;
 using WIDESEA_ISquareCabinServices;
 using WIDESEA_Model.Models;
@@ -30,8 +31,13 @@
             try
             {
                 if (materielInfo.Business_qty >= materielInfo.MinQty) return response;
+                Dt_Tactics tactics = _tacticsService.Repository.QueryFirst(x => x.TacticeName == "鍑哄簱绛栫暐");
                 List<Dt_SupplyTask> supplyTasks = new List<Dt_SupplyTask>();
-                List<Dt_InventoryInfo> dt_InventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.MaterielCode == materielInfo.MaterielCode && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() && x.StockQuantity > x.OutboundQuantity && x.LocationCode != "绔嬪簱").OrderBy(x => x.InDate).ToList();
+                List<Dt_InventoryInfo> dt_InventoryInfos = _inventoryInfoService.Repository.QueryData(x => x.MaterielCode == materielInfo.MaterielCode && x.StockStatus == StockStatusEmun.鍏ュ簱瀹屾垚.ObjToInt() && x.StockQuantity > x.OutboundQuantity && x.WarehouseCode == WarehouseEnum.澶т欢搴�.ObjToInt().ToString("000"));
+                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();
                 decimal Qty = 0;
                 foreach (var item in dt_InventoryInfos)
                 {
diff --git "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_RoleService.cs" "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_RoleService.cs"
index fb668b1..f639c07 100644
--- "a/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_RoleService.cs"
+++ "b/\346\226\260\345\273\272\346\226\207\344\273\266\345\244\271/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_RoleService.cs"
@@ -26,7 +26,7 @@
 
         public IRepository<Sys_Role> Repository => BaseDal;
 
-        public Sys_RoleService(IRepository<Sys_Role> BaseDal, ISys_MenuService MenuService,  IUnitOfWorkManage unitOfWorkManage, ISys_RoleAuthService roleAuthService) : base(BaseDal)
+        public Sys_RoleService(IRepository<Sys_Role> BaseDal, ISys_MenuService MenuService, IUnitOfWorkManage unitOfWorkManage, ISys_RoleAuthService roleAuthService) : base(BaseDal)
         {
             _unitOfWorkManage = unitOfWorkManage;
             _MenuService = MenuService;
@@ -187,7 +187,7 @@
                 //褰撳墠鐢ㄦ埛鐨勬潈闄�
                 List<Permissions> permissions = _MenuService.GetPermissions(App.User.RoleId);
 
-                List<int> menuIds = _MenuService.Repository.QueryData(x => x.MenuId, x => x.MenuType == 1);
+                List<int> menuIds = _MenuService.Repository.QueryData(x => x.MenuId, x => x.MenuType == 0);
 
                 List<int> originalMeunIds = new List<int>();
                 //琚垎閰嶈鑹茬殑鏉冮檺
@@ -229,9 +229,9 @@
 
                 }
                 //鏇存柊鏉冮檺
-                _RoleAuthService.Repository.UpdateData(updateAuths);
+                _RoleAuthService.Repository.UpdateData(updateAuths.Where(x => x.AuthId > 0).ToList());
                 //鏂板鐨勬潈闄�
-                _RoleAuthService.Repository.AddData(updateAuths);
+                _RoleAuthService.Repository.AddData(updateAuths.Where(x => x.AuthId <= 0).ToList());
 
                 //鑾峰彇鏉冮檺鍙栨秷鐨勬潈闄�
                 int[] authIds = roleAuths.Where(x => userPermissions.Select(u => u.Id)

--
Gitblit v1.9.3