From a8be8f9371b6fc03b66d212b2902d08f93b087dd Mon Sep 17 00:00:00 2001 From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com> Date: 星期三, 02 七月 2025 13:55:55 +0800 Subject: [PATCH] 新增任务查询方法并优化逻辑在 `ITaskService.cs` 中添加了新的 `QueryExecutingConveyorLineTask` 方法,支持根据托盘号和下一地址查询任务,同时调整了原有方法的参数以保留旧功能。在 `TaskService.cs` 中新增重载方法,允许根据下一地址和条形码查询任务。在 `CommonConveyorLine_GWJob.cs` 中更新了 `ConveyorLineOutFinish` 方法,简化了任务查询逻辑并删除了多余的注释代码。同时,增加了对 `taskNext` 的处理逻辑,确保在任务未找到时的相应处理,并更新在途数据的逻辑,提升数据一致性和准确性。 --- Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Utilities/EntityProperties.cs | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 files changed, 55 insertions(+), 3 deletions(-) diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Utilities/EntityProperties.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Utilities/EntityProperties.cs index dec0451..b22b218 100644 --- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Utilities/EntityProperties.cs +++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Utilities/EntityProperties.cs @@ -147,12 +147,64 @@ /// <param name="removeNotContains">绉婚櫎涓嶅瓨鍦ㄥ瓧娈�</param> /// <param name="removerKey">绉婚櫎涓婚敭</param> /// <returns></returns> + //public static string ValidateDicInEntity(this Type typeinfo, Dictionary<string, object> dic, bool removerKey, PropertyInfo[] propertyInfo, string[] ignoreFields = null) + //{ + // if (dic == null || dic.Count == 0) { return "鍙傛暟鏃犳晥"; } + + // // 涓嶅瓨鍦ㄧ殑瀛楁鐩存帴绉婚櫎 + // dic.Where(x => !propertyInfo.Any(p => p.Name.ToUpper() == x.Key.ToUpper())).Select(s => s.Key).ToList().ForEach(f => + // { + // dic.Remove(f); + // }); + + // string keyName = typeinfo.GetKeyName(); + // //绉婚櫎涓婚敭 + // if (removerKey) + // dic.Remove(keyName); + // //else + // //{ + // // if (!dic.ContainsKey(keyName)) + // // return "璇蜂紶鍏ヤ富閿弬鏁�"; + // //} + + // foreach (PropertyInfo property in propertyInfo) + // { + // SugarColumn sugarColumn = property.GetCustomAttribute<SugarColumn>(); + // if (sugarColumn == null) + // return "璇烽厤缃甋ugarColumn灞炴��"; + // //蹇界暐涓庝富閿殑瀛楁涓嶅仛楠岃瘉 + // if (property.Name.ToUpper() == keyName.ToUpper() || (ignoreFields != null && ignoreFields.Contains(property.Name)) || sugarColumn.IsOnlyIgnoreInsert || sugarColumn.IsOnlyIgnoreUpdate || sugarColumn.IsIgnore) + // continue; + + // //涓嶅湪缂栬緫涓殑鍒楋紝鏄惁涔熻蹇呭~ + // if (!dic.ContainsKey(property.Name.ToUpper())) + // { + // if (!sugarColumn.IsNullable) + // { + // if (sugarColumn.DefaultValue == null) + // return sugarColumn.ColumnDescription + "涓哄繀椤绘彁浜ら」"; + // continue; + // } + // continue; + // } + // if(dic[property.Name.ToUpper()] != null) + // { + // string str = dic[property.Name.ToUpper()].ToString(); + // //灏嗘墍鏈夌┖鍊艰缃负null + // if (str == string.Empty) + // dic[property.Name.ToUpper()] = null; + // } + + // } + // return string.Empty; + //} + public static string ValidateDicInEntity(this Type typeinfo, Dictionary<string, object> dic, bool removerKey, PropertyInfo[] propertyInfo, string[] ignoreFields = null) { if (dic == null || dic.Count == 0) { return "鍙傛暟鏃犳晥"; } // 涓嶅瓨鍦ㄧ殑瀛楁鐩存帴绉婚櫎 - dic.Where(x => !propertyInfo.Any(p => p.Name == x.Key.FirstLetterToUpper())).Select(s => s.Key).ToList().ForEach(f => + dic.Where(x => !propertyInfo.Any(p => p.Name.ToUpper() == x.Key.ToUpper())).Select(s => s.Key).ToList().ForEach(f => { dic.Remove(f); }); @@ -187,14 +239,14 @@ } continue; } - if(dic[property.Name.FirstLetterToLower()] != null) + if (dic[property.Name.FirstLetterToLower()] != null) { string str = dic[property.Name.FirstLetterToLower()].ToString(); //灏嗘墍鏈夌┖鍊艰缃负null if (str == string.Empty) dic[property.Name.FirstLetterToLower()] = null; } - + } return string.Empty; } -- Gitblit v1.9.3