From 5f0b4758bed03060fd70b282d7fe56fa02d2f6d0 Mon Sep 17 00:00:00 2001 From: Zhang-Hong-Lin <a3219986988@163.com> Date: 星期三, 16 四月 2025 15:51:43 +0800 Subject: [PATCH] 1 --- 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs | 132 ++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 132 insertions(+), 0 deletions(-) diff --git "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs" "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs" index 4af342e..55f8ee0 100644 --- "a/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs" +++ "b/\351\241\271\347\233\256\344\273\243\347\240\201/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs" @@ -22,6 +22,8 @@ using WIDESEAWCS_Core.Caches; using WIDESEAWCS_QuartzJob.DeviceEnum; using WIDESEAWCS_Core.Enums; +using WIDESEAWCS_Common.LocationEnum; +using WIDESEAWCS_Common.StockEnum; namespace WIDESEAWCS_WCSServer.Controllers.System { @@ -156,6 +158,54 @@ foreach (var item in enums) { FieldInfo? fieldInfo = type.GetField(((DeviceStatusEnum)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 "mateType": + { + List<object> data = new List<object>(); + Type type = typeof(MateTypeEnum); + List<int> enums = Enum.GetValues(type).Cast<int>().ToList(); + int index = 0; + foreach (var item in enums) + { + FieldInfo? fieldInfo = type.GetField(((MateTypeEnum)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 "stock": + { + List<object> data = new List<object>(); + Type type = typeof(stockEnum); + List<int> enums = Enum.GetValues(type).Cast<int>().ToList(); + int index = 0; + foreach (var item in enums) + { + FieldInfo? fieldInfo = type.GetField(((stockEnum)item).ToString()); DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); if (description != null) { @@ -365,6 +415,88 @@ 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 "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; } return result; } -- Gitblit v1.9.3