From 9a886d711d8b21adc335fdf8c39350584c7ba6fd Mon Sep 17 00:00:00 2001
From: wangxinhui <wangxinhui@hnkhzn.com>
Date: 星期二, 14 十月 2025 02:12:14 +0800
Subject: [PATCH] 更新代码,取消MES出库单号同步标识,平库转立库功能,寄售周期判断取消,精品标识等
---
代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/Utilities/EntityProperties.cs | 66 ++++++++++++++++++++++++++++----
1 files changed, 57 insertions(+), 9 deletions(-)
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Utilities/EntityProperties.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Utilities/EntityProperties.cs"
index d0b698a..bf691b9 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Utilities/EntityProperties.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/Utilities/EntityProperties.cs"
@@ -5,10 +5,12 @@
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
+using System.Linq.Expressions;
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
using WIDESEA_Core.Const;
+using WIDESEA_Core.Enums;
using WIDESEA_Core.Helper;
namespace WIDESEA_Core.Utilities
@@ -86,16 +88,19 @@
else
{
- int length = sugarColumn.Length;
- if (length == 0) { return (true, null, null); }
- //鍒ゆ柇鍙屽瓧鑺備笌鍗曞瓧娈�
- else if (length < 8000 &&
- ((dbType.Substring(0, 1) != "n"
- && Encoding.UTF8.GetBytes(val.ToCharArray()).Length > length)
- || val.Length > length)
- )
+ if (sugarColumn != null)
{
- reslutMsg = $"鏈�澶氬彧鑳姐�恵length}銆戜釜瀛楃銆�";
+ int length = sugarColumn.Length;
+ if (length == 0) { return (true, null, null); }
+ //鍒ゆ柇鍙屽瓧鑺備笌鍗曞瓧娈�
+ else if (length < 8000 &&
+ ((dbType.Substring(0, 1) != "n"
+ && Encoding.UTF8.GetBytes(val.ToCharArray()).Length > length)
+ || val.Length > length)
+ )
+ {
+ reslutMsg = $"鏈�澶氬彧鑳姐�恵length}銆戜釜瀛楃銆�";
+ }
}
}
}
@@ -318,5 +323,48 @@
}
return null;
}
+
+ public static void ValidatePageOptions<TEntity>(PageDataOptions options, ref ISugarQueryable<TEntity> sugarQueryable)
+ {
+ string where = string.Empty;
+ PropertyInfo[] entityProperties = typeof(TEntity).GetProperties();
+ 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 { }
+ }
+ for (int i = 0; i < searchParametersList.Count; i++)
+ {
+ if (string.IsNullOrEmpty(searchParametersList[i].Value))
+ {
+ continue;
+ }
+
+ PropertyInfo? property = entityProperties.Where(c => c.Name.ToUpper() == searchParametersList[i].Name.ToUpper()).FirstOrDefault();
+
+ if (property == null) continue;
+
+ List<(bool, string, object)> results = property.ValidationValueForDbType(searchParametersList[i].Value.Split(',')).ToList();
+ if (results == null || results.Count() == 0)
+ {
+ continue;
+ }
+ for (int j = 0; j < results.Count(); j++)
+ {
+ LinqExpressionType expressionType = searchParametersList[i].DisplayType.GetLinqCondition();
+ Expression<Func<TEntity, bool>> expression = property.GetWhereExpression<TEntity>(results[j].Item3, null, expressionType);
+ sugarQueryable = sugarQueryable.Where(expression);
+ }
+ }
+ }
}
}
--
Gitblit v1.9.3