From 1d3a018e6d707179eef127424e3d78d3863fba71 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期一, 30 三月 2026 16:09:02 +0800
Subject: [PATCH] 实现MES过点记录与库存变动记录全流程功能 本次提交实现了MES过点记录和库存变动记录的前后端全流程,包括数据模型、仓储、服务、控制器、前端页面及扩展配置。新增精排显示页面,支持虚拟精排与车身信息弹窗。优化货位信息行页面的悬浮提示框,丰富展示内容并美化样式。后端完善了相关API、DTO、AutoMapper映射及业务逻辑,支持数据追溯与可视化。整体提升了系统的可维护性和用户体验。
---
项目代码/WCS/WCSServer/WIDESEAWCS_Core/Helper/ObjectExtension.cs | 48 +++++++++++++++++++++++++++++++++++++++---------
1 files changed, 39 insertions(+), 9 deletions(-)
diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServer/WIDESEAWCS_Core/Helper/ObjectExtension.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServer/WIDESEAWCS_Core/Helper/ObjectExtension.cs"
index 6e000c3..55f95d4 100644
--- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServer/WIDESEAWCS_Core/Helper/ObjectExtension.cs"
+++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WCSServer/WIDESEAWCS_Core/Helper/ObjectExtension.cs"
@@ -1,4 +1,5 @@
-锘縰sing System;
+锘縰sing Newtonsoft.Json;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
@@ -21,19 +22,48 @@
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);
+ #region
+ //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);
+ //Dictionary<string, object> upperDic = dic.ToDictionary(k => k.Key.ToUpper(), v => v.Value);
- foreach (var property in propertyInfos)
+ //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;
+ #endregion
+
+ T? model = Activator.CreateInstance<T>();
+ try
{
- object value = null;
- if (!upperDic.TryGetValue(property.Name.ToUpper(), out value))
+ model = JsonConvert.DeserializeObject<T>(dic.Serialize());
+ }
+ catch{ }
+ if (model == null)
+ {
+ PropertyInfo[] propertyInfos = typeof(T).GetProperties(BindingFlags.GetProperty | BindingFlags.Public | BindingFlags.Instance);
+ foreach (var property in propertyInfos)
{
- continue;
+ object value = null;
+ if (!dic.TryGetValue(property.Name, out value))
+ {
+ 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));
}
- property.SetValue(model, value?.ToString().ChangeType(property.PropertyType));
}
return model;
}
--
Gitblit v1.9.3