From cde56aae50adc11ff8db84e424d873843c566bfd Mon Sep 17 00:00:00 2001 From: dengjunjie <dengjunjie@hnkhzn.com> Date: 星期一, 24 二月 2025 23:40:41 +0800 Subject: [PATCH] 优化WCS移库逻辑 --- 项目代码/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/ObjectExtension.cs | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/ObjectExtension.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/ObjectExtension.cs" index 16a91cf..939ca84 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/ObjectExtension.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WMS/WIDESEA_WMSServer/WIDESEA_Core/Helper/ObjectExtension.cs" @@ -1,4 +1,5 @@ -锘縰sing System; +锘縰sing SqlSugar; +using System; using System.Collections.Generic; using System.Linq; using System.Reflection; @@ -25,8 +26,9 @@ PropertyInfo[] propertyInfos = typeof(T).GetProperties(BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance); foreach (var property in propertyInfos) { + object value = null; - if (!dic.TryGetValue(property.Name, out value)) + if (!dic.TryGetValue(property.Name, out value)) { if (!dic.TryGetValue(property.Name.FirstLetterToUpper(), out value)) { @@ -36,6 +38,11 @@ } } }; + SugarColumn? sugarColumn = property.GetCustomAttribute<SugarColumn>(); + if (sugarColumn != null && sugarColumn.IsIdentity && (value == null || value.Equals(""))) + { + continue; + } property.SetValue(model, value?.ToString().ChangeType(property.PropertyType)); } return model; -- Gitblit v1.9.3