From c15bffb8522417ef4d9885d8a5e4a2aeb79831ea Mon Sep 17 00:00:00 2001 From: hutongqing <hutongqing@hnkhzn.com> Date: 星期四, 28 十一月 2024 15:46:21 +0800 Subject: [PATCH] 更新 --- WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs | 220 ++++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 files changed, 216 insertions(+), 4 deletions(-) diff --git a/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs b/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs index db7dab4..be0efdc 100644 --- a/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs +++ b/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs @@ -19,9 +19,13 @@ using WIDESEAWCS_QuartzJob; using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; using WIDESEAWCS_Common.TaskEnum; -using WIDESEAWCS_Core.Enums; using WIDESEAWCS_Core.Caches; using WIDESEAWCS_QuartzJob.DeviceEnum; +using WIDESEAWCS_Core.Enums; +using WIDESEAWCS_Common.CommonEnum; +using WIDESEAWCS_Common.LocationEnum; +using WIDESEAWCS_Common.OrderEnum; +using WIDESEAWCS_Common.StockEnum; namespace WIDESEAWCS_WCSServer.Controllers.System { @@ -85,7 +89,7 @@ if (vueDictionaryDTO != null) { vueDictionaryDTOs.Add(vueDictionaryDTO); - if (!_cacheService.Exists(item)) + if (!_cacheService.Exists(item) && vueDictionaryDTO.SaveCache) { _cacheService.Add(item, vueDictionaryDTO.Serialize()); } @@ -126,8 +130,6 @@ data.Add(new { key = deviceType.Name, value = deviceType.Name }); } } - - data.Add(new { key = "", value = "鏃�" }); result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; } @@ -367,6 +369,216 @@ result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; } break; + case "outboundStatusEnum": + { + List<object> data = new List<object>(); + Type type = typeof(OutboundStatusEnum); + List<int> enums = Enum.GetValues(typeof(OutboundStatusEnum)).Cast<int>().ToList(); + int index = 0; + foreach (var item in enums) + { + FieldInfo? fieldInfo = typeof(OutboundStatusEnum).GetField(((OutboundStatusEnum)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 "outOrderType": + { + List<object> data = new List<object>(); + + { + Type type = typeof(OutOrderTypeEnum); + List<int> enums = Enum.GetValues(typeof(OutOrderTypeEnum)).Cast<int>().ToList(); + int index = 0; + foreach (var item in enums) + { + FieldInfo? fieldInfo = typeof(OutOrderTypeEnum).GetField(((OutOrderTypeEnum)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 "orderDetailStatusEnum": + { + List<object> data = new List<object>(); + + { + Type type = typeof(OrderDetailStatusEnum); + List<int> enums = Enum.GetValues(typeof(OrderDetailStatusEnum)).Cast<int>().ToList(); + int index = 0; + foreach (var item in enums) + { + FieldInfo? fieldInfo = typeof(OrderDetailStatusEnum).GetField(((OrderDetailStatusEnum)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 "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; + 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; } return result; } -- Gitblit v1.9.3