From 8c0e2ca5bc6153ba0bd894523b8f6047941edab2 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期六, 11 十月 2025 16:21:47 +0800
Subject: [PATCH] 优化任务查询与信号处理逻辑,添加二进制文件在多个文件中优化任务查询与信号处理逻辑: - `TaskService.cs`:`QueryExecutingConveyorLineTask` 方法新增托盘码校验。 - `CommonConveyorLine_BZJob.cs`:新增信号读取与在途数据处理逻辑。 - `CommonConveyorLine_CWJob.cs`:新增站点查询与信号处理逻辑。 - `CommonConveyorLine_GWJob.cs` 和 `CommonConveyorLine_NewCWJob.cs`: - 删除冗余注释代码。 - 增加站点查询与信号处理逻辑。 - 添加多个二进制文件:`CodeChunks.db`、`SemanticSymbols.db` 等。
---
Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/ObjectExtension.cs | 31 ++++++++++++++++++++++++++-----
1 files changed, 26 insertions(+), 5 deletions(-)
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/ObjectExtension.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/ObjectExtension.cs
index 6e000c3..781918a 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/ObjectExtension.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Core/Helper/ObjectExtension.cs
@@ -21,21 +21,42 @@
public static T DicToModel<T>(this Dictionary<string, object> dic)
{
+ //T model = Activator.CreateInstance<T>();
+ //PropertyInfo[] propertyInfos = typeof(T).GetProperties(BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance);
+
+ //Dictionary<string, object> upperDic = dic.ToDictionary(k => k.Key.ToUpper(), v => v.Value);
+
+ //foreach (var property in propertyInfos)
+ //{
+ // object value = null;
+ // if (!upperDic.TryGetValue(property.Name.ToUpper(), out value))
+ // {
+ // continue;
+ // }
+ // property.SetValue(model, value?.ToString().ChangeType(property.PropertyType));
+ //}
+ //return model;
+
T model = Activator.CreateInstance<T>();
PropertyInfo[] propertyInfos = typeof(T).GetProperties(BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance);
-
- Dictionary<string, object> upperDic = dic.ToDictionary(k => k.Key.ToUpper(), v => v.Value);
-
foreach (var property in propertyInfos)
{
object value = null;
- if (!upperDic.TryGetValue(property.Name.ToUpper(), out value))
+ if (!dic.TryGetValue(property.Name, out value))
{
- continue;
+ if (!dic.TryGetValue(property.Name.FirstLetterToUpper(), out value))
+ {
+ if (!dic.TryGetValue(property.Name.FirstLetterToLower(), out value))
+ {
+ continue;
+ }
+ }
}
+ ;
property.SetValue(model, value?.ToString().ChangeType(property.PropertyType));
}
return model;
+
}
}
}
--
Gitblit v1.9.3