| | |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core.Enums; |
| | | using WIDESEAWCS_Core.Caches; |
| | | using WIDESEAWCS_QuartzJob.DeviceEnum; |
| | | |
| | | namespace WIDESEAWCS_WCSServer.Controllers.System |
| | | { |
| | |
| | | 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) |
| | | foreach (string n in dicNos.Where(x => !selectDicNos.Contains(x))) |
| | | { |
| | | string str = _cacheService.Get(n); |
| | | string? str = _cacheService.Get(n); |
| | | if (!string.IsNullOrEmpty(str)) |
| | | { |
| | | VueDictionaryDTO? vueDictionary = JsonConvert.DeserializeObject<VueDictionaryDTO>(str); |
| | |
| | | } |
| | | } |
| | | List<string> dicList = dicNos.ToList(); |
| | | if (dicNos.Where(x => !cacheDicNos.Contains(x)).Count() > 0) |
| | | 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> dics = str.Split(",").ToList(); |
| | | |
| | | foreach (var item in dics) |
| | | foreach (var item in otherDicNos) |
| | | { |
| | | dicList.Remove(item); |
| | | cusDics.Add(item); |
| | | if (dics.Contains(item)) |
| | | { |
| | | cusDics.Add(item); |
| | | } |
| | | } |
| | | |
| | | foreach (var item in cusDics) |
| | | { |
| | | VueDictionaryDTO vueDictionaryDTO = GetVueDictionary(item.Trim()); |
| | | VueDictionaryDTO? vueDictionaryDTO = GetVueDictionary(item.Trim()); |
| | | if (vueDictionaryDTO != null) |
| | | { |
| | | vueDictionaryDTOs.Add(vueDictionaryDTO); |
| | | if (!_cacheService.Exists(item)) |
| | | if (!_cacheService.Exists(item) && vueDictionaryDTO.SaveCache) |
| | | { |
| | | _cacheService.Add(item, vueDictionaryDTO.Serialize()); |
| | | } |
| | |
| | | { |
| | | Type type = typeof(IDevice); |
| | | var basePath = AppContext.BaseDirectory; |
| | | string path = Path.Combine(basePath, Assembly.GetExecutingAssembly().GetName().Name); |
| | | Assembly assembly = Assembly.LoadFrom(path); |
| | | List<Type> types = assembly.GetTypes().Where(x => type.IsAssignableFrom(x) && !x.IsAbstract && !x.IsInterface).ToList(); |
| | | List<Type> types = type.Assembly.GetTypes().Where(x => type.IsAssignableFrom(x) && !x.IsAbstract && !x.IsInterface).ToList(); |
| | | List<object> data = new List<object>(); |
| | | foreach (var deviceType in types) |
| | | { |
| | |
| | | data.Add(new { key = deviceType.Name, value = deviceType.Name }); |
| | | } |
| | | } |
| | | |
| | | data.Add(new { key = "", value = "无" }); |
| | | |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | |
| | | case "deviceStatus": |
| | | { |
| | | List<object> data = new List<object>(); |
| | | Type type = Type.GetType("WIDESEAWCS_QuartzJob.DeviceEnum.DeviceStatusEnum"); |
| | | Type type = typeof(DeviceStatusEnum); |
| | | List<int> enums = Enum.GetValues(type).Cast<int>().ToList(); |
| | | int index = 0; |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = type.GetField((item).ToString()); |
| | | FieldInfo? fieldInfo = type.GetField(((DeviceStatusEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (description != null) |
| | | { |