| | |
| | | using Quartz; |
| | | using WIDESEAWCS_QuartzJob; |
| | | using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime; |
| | | using WIDESEAWCS_Core.Enums; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_Core.Caches; |
| | | using WIDESEAWCS_QuartzJob.DeviceEnum; |
| | | using WIDESEAWCS_Common.TaskEnum; |
| | | using WIDESEAWCS_DTO.Enum; |
| | | using WIDESEAWCS_Core.Enums; |
| | | |
| | | 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) && vueDictionaryDTO.SaveCache) |
| | | if (!_cacheService.Exists(item)) |
| | | { |
| | | _cacheService.Add(item, vueDictionaryDTO.Serialize()); |
| | | } |
| | |
| | | { |
| | | Type type = typeof(IDevice); |
| | | var basePath = AppContext.BaseDirectory; |
| | | //string path = Path.Combine("", Assembly.GetAssembly(type).GetName()); |
| | | Assembly assembly = Assembly.GetAssembly(type); |
| | | 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) |
| | | { |
| | |
| | | { |
| | | List<object> data = new List<object>(); |
| | | |
| | | #region TaskInboundTypeEnum |
| | | #region TaskTypeEnum |
| | | { |
| | | Type type = typeof(TaskInboundTypeEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskInboundTypeEnum)).Cast<int>().ToList(); |
| | | Type type = typeof(TaskTypeEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskTypeEnum)).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()); |
| | | FieldInfo? fieldInfo = typeof(TaskTypeEnum).GetField(((TaskTypeEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (description != null) |
| | | { |
| | |
| | | |
| | | #region TaskInStatusEnum |
| | | { |
| | | Type type = typeof(TaskInStatusEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskInStatusEnum)).Cast<int>().ToList(); |
| | | Type type = typeof(TaskStatusEnum); |
| | | List<int> enums = Enum.GetValues(typeof(TaskStatusEnum)).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()); |
| | | FieldInfo? fieldInfo = typeof(TaskStatusEnum).GetField(((TaskStatusEnum)item).ToString()); |
| | | DescriptionAttribute? description = fieldInfo.GetCustomAttribute<DescriptionAttribute>(); |
| | | if (description != null) |
| | | { |
| | |
| | | { |
| | | data.Add(new { key = deviceType.Name, value = deviceType.Name }); |
| | | } |
| | | } |
| | | |
| | | result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data }; |
| | | } |
| | | break; |
| | | case "PlatformStationEnum": |
| | | { |
| | | List<object> data = new List<object>(); |
| | | Type type = typeof(PlatformStationEnum); |
| | | List<int> enums = Enum.GetValues(typeof(PlatformStationEnum)).Cast<int>().ToList(); |
| | | int index = 0; |
| | | foreach (var item in enums) |
| | | { |
| | | FieldInfo? fieldInfo = typeof(PlatformStationEnum).GetField(((PlatformStationEnum)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 }; |