From f43b7df8400f4fcffc9f19dca0888d61e2b33d5f Mon Sep 17 00:00:00 2001
From: dengjunjie <dengjunjie@hnkhzn.com>
Date: 星期三, 12 三月 2025 18:41:52 +0800
Subject: [PATCH] WMS系统添加PDA权限,PDA程序

---
 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockViewService.cs |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockViewService.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockViewService.cs"
index f2fb085..85fac0c 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockViewService.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_StockService/Service/StockViewService.cs"
@@ -12,8 +12,10 @@
 using WIDESEA_Core;
 using WIDESEA_Core.BaseRepository;
 using WIDESEA_Core.BaseServices;
+using WIDESEA_Core.DB.Models;
 using WIDESEA_Core.Enums;
 using WIDESEA_Core.Helper;
+using WIDESEA_Core.HostedService;
 using WIDESEA_Core.Utilities;
 using WIDESEA_DTO.Stock;
 using WIDESEA_IStockRepository;
@@ -24,5 +26,33 @@
 {
     public partial class StockViewService : IStockViewService
     {
+        private string GetDataRole(Type type)
+        {
+            try
+            {
+                UserRole? userRole = PermissionDataHostService.UserRoles.FirstOrDefault(x => x.UserId == App.User.UserId);
+                if (userRole == null)
+                    throw new Exception($"鏃犳潈闄�");
+
+                if (type.IsAssignableFrom(typeof(BaseWarehouseEntity)) || type.GetProperty(nameof(BaseWarehouseEntity.WarehouseId)) != null)
+                {
+                    if (userRole.WarehouseIds.Count > 0)
+                    {
+                        return $"{nameof(BaseWarehouseEntity.WarehouseId)} in ({userRole.WarehouseIds.Serialize().Replace("[", "").Replace("]", "")})";
+                    }
+
+                    else
+                        return $"1 != 1";
+                }
+                else
+                {
+                    return "1 = 1";
+                }
+            }
+            catch (Exception ex)
+            {
+                throw new Exception($"鏃犳潈闄愶紝{ex.Message}");
+            }
+        }
     }
 }

--
Gitblit v1.9.3