From 2ec78835e454cecb95e48a2be2cb0b8393674ec5 Mon Sep 17 00:00:00 2001
From: xiazhengtongxue <133085197+xiazhengtongxue@users.noreply.github.com>
Date: 星期二, 31 三月 2026 10:27:16 +0800
Subject: [PATCH] fix(Sys_Dictionary): 修复数字字典中文映射
---
Code/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_DictionaryService.cs | 302 +++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 286 insertions(+), 16 deletions(-)
diff --git a/Code/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_DictionaryService.cs b/Code/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_DictionaryService.cs
index 4e2449d..f6ade60 100644
--- a/Code/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_DictionaryService.cs
+++ b/Code/WMS/WIDESEA_WMSServer/WIDESEA_SystemService/Sys_DictionaryService.cs
@@ -13,6 +13,7 @@
using WIDESEA_Common.OrderEnum;
using WIDESEA_Common.StockEnum;
using WIDESEA_Common.TaskEnum;
+using WIDESEA_Common.WareHouseEnum;
using WIDESEA_Core;
using WIDESEA_Core.BaseRepository;
using WIDESEA_Core.BaseServices;
@@ -146,20 +147,7 @@
vueDictionaryDTOs.AddRange(selectDics);
}
- //object GetSourceData(string dicNo, string dbSql, object data)
- //{
- // if (string.IsNullOrEmpty(dbSql))
- // {
- // return data;
- // }
- // return BaseDal.QueryObjectDataBySql(dbSql, null);
- //}
- //List<VueDictionaryDTO> vueDictionaryDTOs = dicConfig.Select(item => new VueDictionaryDTO
- //{
- // DicNo = item.dicNo,
- // Config = item.config,
- // Data = GetSourceData(item.dicNo, item.dbSql, item.list)
- //}).ToList();
+
try
{
@@ -211,9 +199,291 @@
{
switch (key)
{
- default:
- return result;
+ case "taskTypeEnum":
+ {
+ List<object> data = new List<object>();
+
+ {
+ Type type = typeof(TaskTypeEnum);
+ List<int> enums = Enum.GetValues(typeof(TaskTypeEnum)).Cast<int>().ToList();
+ int index = 0;
+ foreach (var item in enums)
+ {
+ FieldInfo? fieldInfo = typeof(TaskTypeEnum).GetField(((TaskTypeEnum)item).ToString());
+ DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
+ if (description != null)
+ {
+ data.Add(new { key = item.ToString(), value = description.Description });
+ }
+ else
+ {
+ data.Add(new { key = item.ToString(), value = item.ToString() });
+ }
+ index++;
+ }
+ }
+
+ result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
+ }
+ break;
+ case "taskStatusEnum":
+ {
+ List<object> data = new List<object>();
+
+ {
+ Type type = typeof(TaskInStatusEnum);
+ List<int> enums = Enum.GetValues(typeof(TaskInStatusEnum)).Cast<int>().ToList();
+ int index = 0;
+ foreach (var item in enums)
+ {
+ FieldInfo? fieldInfo = typeof(TaskInStatusEnum).GetField(((TaskInStatusEnum)item).ToString());
+ DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
+ if (description != null)
+ {
+ data.Add(new { key = item.ToString(), value = description.Description });
+ }
+ else
+ {
+ data.Add(new { key = item.ToString(), value = item.ToString() });
+ }
+ index++;
+ }
+ }
+
+ {
+ Type type = typeof(TaskOutStatusEnum);
+ List<int> enums = Enum.GetValues(typeof(TaskOutStatusEnum)).Cast<int>().ToList();
+ int index = 0;
+ foreach (var item in enums)
+ {
+ FieldInfo? fieldInfo = typeof(TaskOutStatusEnum).GetField(((TaskOutStatusEnum)item).ToString());
+ DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
+ if (description != null)
+ {
+ data.Add(new { key = item.ToString(), value = description.Description });
+ }
+ else
+ {
+ data.Add(new { key = item.ToString(), value = item.ToString() });
+ }
+ index++;
+ }
+ }
+
+ {
+ Type type = typeof(TaskRobotStatusEnum);
+ List<int> enums = Enum.GetValues(typeof(TaskRobotStatusEnum)).Cast<int>().ToList();
+ int index = 0;
+ foreach (var item in enums)
+ {
+ FieldInfo? fieldInfo = typeof(TaskRobotStatusEnum).GetField(((TaskRobotStatusEnum)item).ToString());
+ DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
+ if (description != null)
+ {
+ data.Add(new { key = item.ToString(), value = description.Description });
+ }
+ else
+ {
+ data.Add(new { key = item.ToString(), value = item.ToString() });
+ }
+ index++;
+ }
+ }
+
+ result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
+ }
+ break;
+ case "enableStatusEnum":
+ {
+ List<object> data = new List<object>();
+
+ {
+ Type type = typeof(EnableStatusEnum);
+ List<int> enums = Enum.GetValues(typeof(EnableStatusEnum)).Cast<int>().ToList();
+ int index = 0;
+ foreach (var item in enums)
+ {
+ FieldInfo? fieldInfo = typeof(EnableStatusEnum).GetField(((EnableStatusEnum)item).ToString());
+ DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
+ if (description != null)
+ {
+ data.Add(new { key = item.ToString(), value = description.Description });
+ }
+ else
+ {
+ data.Add(new { key = item.ToString(), value = item.ToString() });
+ }
+ index++;
+ }
+ }
+
+ result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
+ }
+ break;
+ case "locationStatusEnum":
+ {
+ List<object> data = new List<object>();
+
+ {
+ Type type = typeof(LocationStatusEnum);
+ List<int> enums = Enum.GetValues(typeof(LocationStatusEnum)).Cast<int>().ToList();
+ int index = 0;
+ foreach (var item in enums)
+ {
+ FieldInfo? fieldInfo = typeof(LocationStatusEnum).GetField(((LocationStatusEnum)item).ToString());
+ DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
+ if (description != null)
+ {
+ data.Add(new { key = item.ToString(), value = description.Description });
+ }
+ else
+ {
+ data.Add(new { key = item.ToString(), value = item.ToString() });
+ }
+ index++;
+ }
+ }
+
+ result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
+ }
+ break;
+ case "enableEnum":
+ {
+ List<object> data = new List<object>();
+
+ {
+ Type type = typeof(EnableEnum);
+ List<int> enums = Enum.GetValues(typeof(EnableEnum)).Cast<int>().ToList();
+ int index = 0;
+ foreach (var item in enums)
+ {
+ FieldInfo? fieldInfo = typeof(EnableEnum).GetField(((EnableEnum)item).ToString());
+ DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
+ if (description != null)
+ {
+ data.Add(new { key = item.ToString(), value = description.Description });
+ }
+ else
+ {
+ data.Add(new { key = item.ToString(), value = item.ToString() });
+ }
+ index++;
+ }
+ }
+
+ result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
+ }
+ break;
+ case "locationDepth":
+ {
+ List<object> data = new List<object>();
+
+ {
+ Type type = typeof(LocationDepth);
+ List<int> enums = Enum.GetValues(typeof(LocationDepth)).Cast<int>().ToList();
+ int index = 0;
+ foreach (var item in enums)
+ {
+ FieldInfo? fieldInfo = typeof(LocationDepth).GetField(((LocationDepth)item).ToString());
+ DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
+ if (description != null)
+ {
+ data.Add(new { key = item.ToString(), value = description.Description });
+ }
+ else
+ {
+ data.Add(new { key = item.ToString(), value = item.ToString() });
+ }
+ index++;
+ }
+ }
+
+ result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
+ }
+ break;
+ case "locationTypeEnum":
+ {
+ List<object> data = new List<object>();
+
+ {
+ Type type = typeof(LocationTypeEnum);
+ List<int> enums = Enum.GetValues(typeof(LocationTypeEnum)).Cast<int>().ToList();
+ int index = 0;
+ foreach (var item in enums)
+ {
+ FieldInfo? fieldInfo = typeof(LocationTypeEnum).GetField(((LocationTypeEnum)item).ToString());
+ DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
+ if (description != null)
+ {
+ data.Add(new { key = item.ToString(), value = description.Description });
+ }
+ else
+ {
+ data.Add(new { key = item.ToString(), value = item.ToString() });
+ }
+ index++;
+ }
+ }
+
+ result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
+ }
+ break;
+ case "stockStatusEmun":
+ {
+ List<object> data = new List<object>();
+
+ {
+ Type type = typeof(StockStatusEmun);
+ List<int> enums = Enum.GetValues(typeof(StockStatusEmun)).Cast<int>().ToList();
+ int index = 0;
+ foreach (var item in enums)
+ {
+ FieldInfo? fieldInfo = typeof(StockStatusEmun).GetField(((StockStatusEmun)item).ToString());
+ DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
+ if (description != null)
+ {
+ data.Add(new { key = item.ToString(), value = description.Description });
+ }
+ else
+ {
+ data.Add(new { key = item.ToString(), value = item.ToString() });
+ }
+ index++;
+ }
+ }
+
+ result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
+ }
+ break;
+ case "warehouseEnum":
+ {
+ List<object> data = new List<object>();
+
+ {
+ Type type = typeof(WarehouseEnum);
+ List<int> enums = Enum.GetValues(typeof(WarehouseEnum)).Cast<int>().ToList();
+ int index = 0;
+ foreach (var item in enums)
+ {
+ FieldInfo? fieldInfo = typeof(WarehouseEnum).GetField(((WarehouseEnum)item).ToString());
+ DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>();
+ if (description != null)
+ {
+ data.Add(new { key = item.ToString(), value = description.Description });
+ }
+ else
+ {
+ data.Add(new { key = item.ToString(), value = item.ToString() });
+ }
+ index++;
+ }
+ }
+
+ result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
+ }
+ break;
}
+ return result;
}
catch (Exception ex)
{
--
Gitblit v1.9.3