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_Core/BaseServices/ServiceBase.cs |   62 +++++++++++++++++++++++++++++++
 1 files changed, 62 insertions(+), 0 deletions(-)

diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseServices/ServiceBase.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseServices/ServiceBase.cs"
index f66f4b5..2db7ace 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseServices/ServiceBase.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/BaseServices/ServiceBase.cs"
@@ -58,6 +58,68 @@
 
             return pageGridData;
         }
+        public string ValidatePageOptions(PageDataOptions options)
+        {
+            options = options ?? new PageDataOptions();
+            string text = "";
+            List<SearchParameters> searchParametersList = new List<SearchParameters>();
+            if (options.Filter != null && options.Filter.Count > 0)
+            {
+                searchParametersList.AddRange(options.Filter);
+            }
+            else if (!string.IsNullOrEmpty(options.Wheres))
+            {
+                try
+                {
+                    searchParametersList = options.Wheres.DeserializeObject<List<SearchParameters>>();
+                    options.Filter = searchParametersList;
+                }
+                catch
+                {
+                }
+            }
+
+            base.QueryRelativeList?.Invoke(searchParametersList);
+            int i;
+            for (i = 0; i < searchParametersList.Count; i++)
+            {
+                if (string.IsNullOrEmpty(searchParametersList[i].Value))
+                {
+                    continue;
+                }
+
+                PropertyInfo propertyInfo = TProperties.Where((PropertyInfo c) => c.Name.ToUpper() == searchParametersList[i].Name.ToUpper()).FirstOrDefault();
+                if (propertyInfo == null)
+                {
+                    continue;
+                }
+
+                object[] values = searchParametersList[i].Value.Split(',');
+                List<(bool, string, object)> list = propertyInfo.ValidationValueForDbType(values).ToList();
+                if (list == null || list.Count() == 0)
+                {
+                    continue;
+                }
+
+                for (int j = 0; j < list.Count(); j++)
+                {
+                    if (j == 0)
+                    {
+                        text += "(";
+                    }
+
+                    text = ((searchParametersList[i].DisplayType.GetLinqCondition() != 0) ? (text + $"{searchParametersList[i].Name} {searchParametersList[i].DisplayType} '{list[j].Item3}'") : (text + $"{searchParametersList[i].Name} = '{list[j].Item3}'"));
+                    text = ((j != list.Count() - 1) ? (text + " or ") : (text + ")"));
+                }
+
+                if (i < searchParametersList.Count - 1)
+                {
+                    text += " and ";
+                }
+            }
+
+            return text;
+        }
 
         public virtual object GetDetailPage(PageDataOptions pageData)
         {

--
Gitblit v1.9.3