| | |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Authorization; |
| | | using Microsoft.AspNetCore.Mvc; |
| | | using Newtonsoft.Json; |
| | | using Quartz; |
| | | using System.ComponentModel; |
| | | using System.Reflection; |
| | | using WIDESEA_Common.CommonEnum; |
| | | using WIDESEA_Common.LocationEnum; |
| | | using WIDESEA_Common.MaterielEnum; |
| | | using WIDESEA_Common.StockEnum; |
| | | using WIDESEA_Common.TaskEnum; |
| | | using WIDESEA_Core.BaseController; |
| | | using WIDESEA_Core.BaseServices; |
| | | using WIDESEA_Core.Caches; |
| | | using WIDESEA_Core.Helper; |
| | | using WIDESEA_DTO.System; |
| | | using WIDESEA_ISystemService; |
| | | using WIDESEA_Model.Models; |
| | | using WIDESEA_DTO.System; |
| | | |
| | | namespace WIDESEA_WMSServer.Controllers |
| | | { |
| | |
| | | public class Sys_DictionaryController : ApiBaseController<ISys_DictionaryService, Sys_Dictionary> |
| | | { |
| | | private readonly IHttpContextAccessor _httpContextAccessor; |
| | | public Sys_DictionaryController(ISys_DictionaryService service, IHttpContextAccessor httpContextAccessor) : base(service) |
| | | private readonly ICacheService _cacheService; |
| | | |
| | | public Sys_DictionaryController(ISys_DictionaryService service, IHttpContextAccessor httpContextAccessor, ICacheService cacheService) : base(service) |
| | | { |
| | | _httpContextAccessor = httpContextAccessor; |
| | | _cacheService = cacheService; |
| | | } |
| | | |
| | | [HttpPost, Route("GetVueDictionary"), AllowAnonymous] |
| | | public IActionResult GetVueDictionary([FromBody] string[] dicNos) |
| | | { |
| | | return Json(Service.GetVueDictionary(dicNos)); |
| | | List<VueDictionaryDTO> vueDictionaryDTOs = Service.GetVueDictionary(dicNos); |
| | | try |
| | | { |
| | | List<string> selectDicNos = vueDictionaryDTOs.Select(x => x.DicNo).ToList(); |
| | | List<string> cacheDicNos = new List<string>(); |
| | | foreach (string n in dicNos.Where(x => !selectDicNos.Contains(x))) |
| | | { |
| | | string? str = _cacheService.Get(n); |
| | | if (!string.IsNullOrEmpty(str)) |
| | | { |
| | | VueDictionaryDTO? vueDictionary = JsonConvert.DeserializeObject<VueDictionaryDTO>(str); |
| | | |
| | | if (vueDictionary != null) |
| | | { |
| | | vueDictionaryDTOs.Add(vueDictionary); |
| | | cacheDicNos.Add(n); |
| | | } |
| | | } |
| | | } |
| | | List<string> dicList = dicNos.ToList(); |
| | | List<string> otherDicNos = dicNos.Where(x => !cacheDicNos.Contains(x) && !selectDicNos.Contains(x)).ToList(); |
| | | if (otherDicNos.Count() > 0) |
| | | { |
| | | string str = AppSettings.Configuration["dics"]; |
| | | if (!string.IsNullOrEmpty(str)) |
| | | { |
| | | List<string> cusDics = new List<string>(); |
| | | |
| | | List<string> dics = str.Split(",").ToList(); |
| | | |
| | | foreach (var item in otherDicNos) |
| | | { |
| | | if (dics.Contains(item)) |
| | | { |
| | | cusDics.Add(item); |
| | | } |
| | | } |
| | | |
| | | foreach (var item in cusDics) |
| | | { |
| | | VueDictionaryDTO? vueDictionaryDTO = GetVueDictionary(item.Trim()); |
| | | if (vueDictionaryDTO != null) |
| | | { |
| | | vueDictionaryDTOs.Add(vueDictionaryDTO); |
| | | if (!_cacheService.Exists(item)) |
| | | { |
| | | _cacheService.Add(item, vueDictionaryDTO.Serialize()); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | } |
| | | catch |
| | | { |
| | | |
| | | } |
| | | return Json(vueDictionaryDTOs); |
| | | } |
| | | |
| | | private VueDictionaryDTO? GetVueDictionary(string key) |
| | | { |
| | | VueDictionaryDTO? result = null; |
| | | try |
| | | { |
| | | switch (key) |
| | | { |
| | | case "jobAssembly": |
| | | { |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = new List<object>() { new { key = "WIDESEAWCS_Tasks", value = "WIDESEAWCS_Tasks" } } }; |
| | | |
| | | } |
| | | break; |
| | | case "jobClassName": |
| | | { |
| | | Type type = typeof(IJob); |
| | | var basePath = AppContext.BaseDirectory; |
| | | string path = Path.Combine(basePath, $"WIDESEAWCS_Tasks"); |
| | | Assembly assembly = Assembly.LoadFrom(path); |
| | | List<Type> types = assembly.GetTypes().Where(x => type.IsAssignableFrom(x) && !x.IsAbstract && !x.IsInterface).ToList(); |
| | | |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = types.Select(x => new { key = x.Name, value = x.Name }) }; |
| | | } |
| | | 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 |
| | | |
| | | #region TaskRelocationStatusEnum |
| | | { |
| | | Type type = typeof(TaskRelocationStatusEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskRelocationStatusEnum)).Cast<int>().ToList(); |
| | | int index = 0; |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TaskRelocationStatusEnum).GetField(((TaskRelocationStatusEnum)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 "taskInStatus": |
| | | { |
| | | List<object> data = new List<object>(); |
| | | List<int> enums = Enum.GetValues(typeof(TaskInStatusEnum)).Cast<int>().ToList(); |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TaskInStatusEnum).GetField(((TaskInStatusEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | data.Add(new { key = item.ToString(), value = description != null ? description.Description : item.ToString() }); |
| | | } |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "taskOutStatus": |
| | | { |
| | | List<object> data = new List<object>(); |
| | | List<int> enums = Enum.GetValues(typeof(TaskOutStatusEnum)).Cast<int>().ToList(); |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TaskOutStatusEnum).GetField(((TaskOutStatusEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | data.Add(new { key = item.ToString(), value = description != null ? description.Description : item.ToString() }); |
| | | } |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "taskRelocationStatus": |
| | | { |
| | | List<object> data = new List<object>(); |
| | | List<int> enums = Enum.GetValues(typeof(TaskRelocationStatusEnum)).Cast<int>().ToList(); |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TaskRelocationStatusEnum).GetField(((TaskRelocationStatusEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | data.Add(new { key = item.ToString(), value = description != null ? description.Description : item.ToString() }); |
| | | } |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "taskInboundType": |
| | | { |
| | | List<object> data = new List<object>(); |
| | | List<int> enums = Enum.GetValues(typeof(TaskInboundTypeEnum)).Cast<int>().ToList(); |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TaskInboundTypeEnum).GetField(((TaskInboundTypeEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | data.Add(new { key = item.ToString(), value = description != null ? description.Description : item.ToString() }); |
| | | } |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "taskOutboundType": |
| | | { |
| | | List<object> data = new List<object>(); |
| | | List<int> enums = Enum.GetValues(typeof(TaskOutboundTypeEnum)).Cast<int>().ToList(); |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TaskOutboundTypeEnum).GetField(((TaskOutboundTypeEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | data.Add(new { key = item.ToString(), value = description != null ? description.Description : item.ToString() }); |
| | | } |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "taskRelocationType": |
| | | { |
| | | List<object> data = new List<object>(); |
| | | List<int> enums = Enum.GetValues(typeof(TaskRelocationTypeEnum)).Cast<int>().ToList(); |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TaskRelocationTypeEnum).GetField(((TaskRelocationTypeEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | data.Add(new { key = item.ToString(), value = description != null ? description.Description : item.ToString() }); |
| | | } |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "taskTypeGroup": |
| | | { |
| | | List<object> data = new List<object>(); |
| | | List<int> enums = Enum.GetValues(typeof(TaskTypeGroup)).Cast<int>().ToList(); |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(TaskTypeGroup).GetField(((TaskTypeGroup)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | data.Add(new { key = item.ToString(), value = description != null ? description.Description : ((TaskTypeGroup)item).ToString() }); |
| | | } |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "taskTypeEnum": |
| | | { |
| | | // åå¹¶å
¥åº/åºåº/ç§»åºä»»å¡ç±»å |
| | | List<object> data = new List<object>(); |
| | | foreach (var item in Enum.GetValues(typeof(TaskInboundTypeEnum)).Cast<int>()) |
| | | { |
| | | var field = typeof(TaskInboundTypeEnum).GetField(((TaskInboundTypeEnum)item).ToString()); |
| | | var desc = field?.GetCustomAttribute<DescriptionAttribute>()?.Description ?? item.ToString(); |
| | | data.Add(new { key = item.ToString(), value = desc }); |
| | | } |
| | | foreach (var item in Enum.GetValues(typeof(TaskOutboundTypeEnum)).Cast<int>()) |
| | | { |
| | | var field = typeof(TaskOutboundTypeEnum).GetField(((TaskOutboundTypeEnum)item).ToString()); |
| | | var desc = field?.GetCustomAttribute<DescriptionAttribute>()?.Description ?? item.ToString(); |
| | | data.Add(new { key = item.ToString(), value = desc }); |
| | | } |
| | | foreach (var item in Enum.GetValues(typeof(TaskRelocationTypeEnum)).Cast<int>()) |
| | | { |
| | | var field = typeof(TaskRelocationTypeEnum).GetField(((TaskRelocationTypeEnum)item).ToString()); |
| | | var desc = field?.GetCustomAttribute<DescriptionAttribute>()?.Description ?? item.ToString(); |
| | | data.Add(new { key = item.ToString(), value = desc }); |
| | | } |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "taskStatusEnum": |
| | | { |
| | | // åå¹¶å
¥åº/åºåº/ç§»åºä»»å¡ç¶æ |
| | | List<object> data = new List<object>(); |
| | | foreach (var item in Enum.GetValues(typeof(TaskInStatusEnum)).Cast<int>()) |
| | | { |
| | | var field = typeof(TaskInStatusEnum).GetField(((TaskInStatusEnum)item).ToString()); |
| | | var desc = field?.GetCustomAttribute<DescriptionAttribute>()?.Description ?? item.ToString(); |
| | | data.Add(new { key = item.ToString(), value = desc }); |
| | | } |
| | | foreach (var item in Enum.GetValues(typeof(TaskOutStatusEnum)).Cast<int>()) |
| | | { |
| | | var field = typeof(TaskOutStatusEnum).GetField(((TaskOutStatusEnum)item).ToString()); |
| | | var desc = field?.GetCustomAttribute<DescriptionAttribute>()?.Description ?? item.ToString(); |
| | | data.Add(new { key = item.ToString(), value = desc }); |
| | | } |
| | | foreach (var item in Enum.GetValues(typeof(TaskRelocationStatusEnum)).Cast<int>()) |
| | | { |
| | | var field = typeof(TaskRelocationStatusEnum).GetField(((TaskRelocationStatusEnum)item).ToString()); |
| | | var desc = field?.GetCustomAttribute<DescriptionAttribute>()?.Description ?? item.ToString(); |
| | | data.Add(new { key = item.ToString(), value = desc }); |
| | | } |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "stockChangeTypeEnum": |
| | | { |
| | | List<object> data = new List<object>(); |
| | | List<int> enums = Enum.GetValues(typeof(StockChangeTypeEnum)).Cast<int>().ToList(); |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(StockChangeTypeEnum).GetField(((StockChangeTypeEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo?.GetCustomAttribute<DescriptionAttribute>(); |
| | | data.Add(new { key = item.ToString(), value = description != null ? description.Description : item.ToString() }); |
| | | } |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "stockStatusEmun": |
| | | { |
| | | List<object> data = new List<object>(); |
| | | List<int> enums = Enum.GetValues(typeof(StockStatusEmun)).Cast<int>().ToList(); |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(StockStatusEmun).GetField(((StockStatusEmun)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo?.GetCustomAttribute<DescriptionAttribute>(); |
| | | data.Add(new { key = item.ToString(), value = description != null ? description.Description : item.ToString() }); |
| | | } |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "yesno": |
| | | { |
| | | // 使ç¨çå®çæ¯å¦æä¸¾ |
| | | List<object> data = new List<object>(); |
| | | List<int> enums = Enum.GetValues(typeof(WhetherEnum)).Cast<int>().ToList(); |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(WhetherEnum).GetField(((WhetherEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo?.GetCustomAttribute<DescriptionAttribute>(); |
| | | string displayName = description?.Description ?? ((WhetherEnum)item).ToString(); |
| | | // æ ¹æ®æä¸¾å¼æä¾ä¸æåç§° |
| | | switch ((WhetherEnum)item) |
| | | { |
| | | case WhetherEnum.True: |
| | | displayName = "æ¯"; |
| | | break; |
| | | case WhetherEnum.False: |
| | | displayName = "å¦"; |
| | | break; |
| | | } |
| | | data.Add(new { key = item.ToString(), value = displayName }); |
| | | } |
| | | // 为å
¼å®¹æ§ï¼åæ¶æ¯æ true/false å符串 |
| | | data.Add(new { key = "true", value = "æ¯" }); |
| | | data.Add(new { key = "false", value = "å¦" }); |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "InventoryMaterialType": |
| | | { |
| | | // 使ç¨çå®çç©æç±»åæä¸¾ |
| | | List<object> data = new List<object>(); |
| | | List<int> enums = Enum.GetValues(typeof(MaterielTypeEnum)).Cast<int>().ToList(); |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(MaterielTypeEnum).GetField(((MaterielTypeEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo?.GetCustomAttribute<DescriptionAttribute>(); |
| | | string displayName = description?.Description ?? ((MaterielTypeEnum)item).ToString(); |
| | | // æ ¹æ®æä¸¾å¼æä¾ä¸æåç§° |
| | | switch ((MaterielTypeEnum)item) |
| | | { |
| | | case MaterielTypeEnum.FinishProduct: |
| | | displayName = "æå"; |
| | | break; |
| | | case MaterielTypeEnum.HalfProduct: |
| | | displayName = "åæå"; |
| | | break; |
| | | case MaterielTypeEnum.RawMateriel: |
| | | displayName = "åææ"; |
| | | break; |
| | | case MaterielTypeEnum.SpareParts: |
| | | displayName = "å¤ä»¶"; |
| | | break; |
| | | } |
| | | data.Add(new { key = item.ToString(), value = displayName }); |
| | | } |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "MaterielSourceType": |
| | | { |
| | | // ç©ææ¥æºç±»åæä¸¾ |
| | | List<object> data = new List<object>(); |
| | | List<int> enums = Enum.GetValues(typeof(MaterielSourceTypeEnum)).Cast<int>().ToList(); |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(MaterielSourceTypeEnum).GetField(((MaterielSourceTypeEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo?.GetCustomAttribute<DescriptionAttribute>(); |
| | | string displayName = description?.Description ?? ((MaterielSourceTypeEnum)item).ToString(); |
| | | // æ ¹æ®æä¸¾å¼æä¾ä¸æåç§° |
| | | switch ((MaterielSourceTypeEnum)item) |
| | | { |
| | | case MaterielSourceTypeEnum.PurchasePart: |
| | | displayName = "éè´ä»¶"; |
| | | break; |
| | | case MaterielSourceTypeEnum.SelfMadePart: |
| | | displayName = "èªå¶ä»¶"; |
| | | break; |
| | | case MaterielSourceTypeEnum.PurchaseAndSelf: |
| | | displayName = "éè´&èªå¶ä»¶"; |
| | | break; |
| | | } |
| | | data.Add(new { key = item.ToString(), value = displayName }); |
| | | } |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "InventoryMaterialStatus": |
| | | { |
| | | // ç©æç¶æåå
¸ - æ ¹æ®ä¸å¡éæ±å®ä¹ |
| | | List<object> data = new List<object> |
| | | { |
| | | new { key = "1", value = "æ£å¸¸" }, |
| | | new { key = "2", value = "å¾
æ£" }, |
| | | new { key = "3", value = "åæ ¼" }, |
| | | new { key = "4", value = "ä¸åæ ¼" }, |
| | | new { key = "5", value = "å»ç»" }, |
| | | new { key = "6", value = "æ¥åº" }, |
| | | new { key = "7", value = "è¿æ" }, |
| | | new { key = "8", value = "æå" } |
| | | }; |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "locationStatusEnum": |
| | | { |
| | | // è´§ä½ç¶ææä¸¾ |
| | | List<object> data = new List<object>(); |
| | | List<int> enums = Enum.GetValues(typeof(LocationStatusEnum)).Cast<int>().ToList(); |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(LocationStatusEnum).GetField(((LocationStatusEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo?.GetCustomAttribute<DescriptionAttribute>(); |
| | | data.Add(new { key = item.ToString(), value = description != null ? description.Description : item.ToString() }); |
| | | } |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "locationTypeEnum": |
| | | { |
| | | // è´§ä½ç±»åæä¸¾ |
| | | List<object> data = new List<object>(); |
| | | List<int> enums = Enum.GetValues(typeof(LocationTypeEnum)).Cast<int>().ToList(); |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(LocationTypeEnum).GetField(((LocationTypeEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo?.GetCustomAttribute<DescriptionAttribute>(); |
| | | data.Add(new { key = item.ToString(), value = description != null ? description.Description : item.ToString() }); |
| | | } |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "enableStatusEnum": |
| | | { |
| | | // è´§ä½ç¦ç¨ç¶ææä¸¾ |
| | | List<object> data = new List<object>(); |
| | | List<int> enums = Enum.GetValues(typeof(EnableStatusEnum)).Cast<int>().ToList(); |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(EnableStatusEnum).GetField(((EnableStatusEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo?.GetCustomAttribute<DescriptionAttribute>(); |
| | | data.Add(new { key = item.ToString(), value = description != null ? description.Description : item.ToString() }); |
| | | } |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | } |
| | | return result; |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return null; |
| | | } |
| | | } |
| | | } |
| | | } |