From 745aa71a76544989535ff193f3ede69200bab2db Mon Sep 17 00:00:00 2001 From: z8018 <1282578289@qq.com> Date: 星期二, 20 五月 2025 14:08:33 +0800 Subject: [PATCH] 未优化的稳定版本 --- 项目代码/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs | 218 +++-------------------------------------------------- 1 files changed, 15 insertions(+), 203 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 e4b2121..a7df80f 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" @@ -21,8 +21,8 @@ using WIDESEAWCS_Core.Enums; using WIDESEAWCS_Core.Caches; using WIDESEAWCS_QuartzJob.DeviceEnum; -using WIDESEAWCS_Common.TaskEnum; -using WIDESEAWCS_DTO.Enum; +using OfficeOpenXml.FormulaParsing.Excel.Functions.Information; +using WIDESEAWCS_Common; namespace WIDESEAWCS_WCSServer.Controllers.System { @@ -48,6 +48,10 @@ List<string> cacheDicNos = new List<string>(); foreach (string n in dicNos) { + if(vueDictionaryDTOs.Where(x => x.DicNo == n).Count() > 0) + { + continue; + } string str = _cacheService.Get(n); if (!string.IsNullOrEmpty(str)) { @@ -78,6 +82,10 @@ foreach (var item in cusDics) { + if (vueDictionaryDTOs.Where(x => x.DicNo == item).Count() > 0) + { + continue; + } VueDictionaryDTO vueDictionaryDTO = GetVueDictionary(item.Trim()); if (vueDictionaryDTO != null) { @@ -170,153 +178,6 @@ result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; } break; - case "taskType": - { - List<object> data = new List<object>(); - - #region TaskInboundTypeEnum - { - Type type = typeof(TaskInboundTypeEnum); - List<int> enums = Enum.GetValues(typeof(TaskInboundTypeEnum)).Cast<int>().ToList(); - int index = 0; - foreach (var item in enums) - { - FieldInfo? fieldInfo = typeof(TaskInboundTypeEnum).GetField(((TaskInboundTypeEnum)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++; - } - } - #endregion - - #region TaskOutboundTypeEnum - { - Type type = typeof(TaskOutboundTypeEnum); - List<int> enums = Enum.GetValues(typeof(TaskOutboundTypeEnum)).Cast<int>().ToList(); - int index = 0; - foreach (var item in enums) - { - FieldInfo? fieldInfo = typeof(TaskOutboundTypeEnum).GetField(((TaskOutboundTypeEnum)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++; - } - } - #endregion - - #region TaskRelocationTypeEnum - { - Type type = typeof(TaskRelocationTypeEnum); - List<int> enums = Enum.GetValues(typeof(TaskRelocationTypeEnum)).Cast<int>().ToList(); - int index = 0; - foreach (var item in enums) - { - FieldInfo? fieldInfo = typeof(TaskRelocationTypeEnum).GetField(((TaskRelocationTypeEnum)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++; - } - } - #endregion - - #region TaskOtherTypeEnum - { - Type type = typeof(TaskOtherTypeEnum); - List<int> enums = Enum.GetValues(typeof(TaskOtherTypeEnum)).Cast<int>().ToList(); - int index = 0; - foreach (var item in enums) - { - FieldInfo? fieldInfo = typeof(TaskOtherTypeEnum).GetField(((TaskOtherTypeEnum)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++; - } - } - #endregion - - result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; - } - break; - case "taskState": - { - List<object> data = new List<object>(); - - #region TaskInStatusEnum - { - 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++; - } - } - #endregion - - #region TaskOutStatusEnum - { - 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++; - } - } - #endregion - - result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; - } - break; - case "devicePlcType": { Type type = typeof(BaseCommunicator); @@ -341,15 +202,15 @@ result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; } break; - case "inOutType": + case "taskState": { - List<object> data = new List<object>(); - Type type = typeof(RouterInOutType); - List<int> enums = Enum.GetValues(typeof(RouterInOutType)).Cast<int>().ToList(); + Type type = typeof(TaskStatusEnum); + List<int> enums = Enum.GetValues(typeof(TaskStatusEnum)).Cast<int>().ToList(); int index = 0; + List<object> data = new List<object>(); foreach (var item in enums) { - FieldInfo? fieldInfo = typeof(RouterInOutType).GetField(((RouterInOutType)item).ToString()); + FieldInfo? fieldInfo = typeof(TaskStatusEnum).GetField(((TaskStatusEnum)item).ToString()); DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); if (description != null) { @@ -361,55 +222,6 @@ } index++; } - - result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; - } - break; - case "agvStationEnum": - { - List<object> data = new List<object>(); - Type type = typeof(AgvStationEnum); - List<int> enums = Enum.GetValues(typeof(AgvStationEnum)).Cast<int>().ToList(); - int index = 0; - foreach (var item in enums) - { - FieldInfo? fieldInfo = typeof(AgvStationEnum).GetField(((AgvStationEnum)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 "agvareaEnum": - { - List<object> data = new List<object>(); - Type type = typeof(AgvareaEnum); - List<int> enums = Enum.GetValues(typeof(AgvareaEnum)).Cast<int>().ToList(); - int index = 0; - foreach (var item in enums) - { - FieldInfo? fieldInfo = typeof(AgvareaEnum).GetField(((AgvareaEnum)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; -- Gitblit v1.9.3