From dd2868457ea031e8f9bc538d05a98921968e9ba5 Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期二, 29 十月 2024 17:38:48 +0800
Subject: [PATCH] 1
---
WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusGroup.cs | 15 +
WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/fdf4ad03-f87a-4809-832b-50e9cd301540.vsidx | 0
WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskEnumHelper.cs | 63 +++++
WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs | 348 +++++++++++++++++++++++++++--
WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs | 1
WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs | 1
WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs | 2
WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskExecuteDetailService.cs | 1
/dev/null | 0
WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs | 76 ++++++
WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs | 1
WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj | 2
WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeGroup.cs | 16 +
WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs | 147 ++++++++++++
WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/c37ec95c-ca36-40d5-988e-41ceb36fe9a6.vsidx | 0
WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_DictionaryService.cs | 1
16 files changed, 647 insertions(+), 27 deletions(-)
diff --git a/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/2e039f01-75fb-4752-a777-4084d6de71ac.vsidx b/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/2e039f01-75fb-4752-a777-4084d6de71ac.vsidx
deleted file mode 100644
index 6ea196f..0000000
--- a/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/2e039f01-75fb-4752-a777-4084d6de71ac.vsidx
+++ /dev/null
Binary files differ
diff --git a/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/c37ec95c-ca36-40d5-988e-41ceb36fe9a6.vsidx b/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/c37ec95c-ca36-40d5-988e-41ceb36fe9a6.vsidx
new file mode 100644
index 0000000..71a418d
--- /dev/null
+++ b/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/c37ec95c-ca36-40d5-988e-41ceb36fe9a6.vsidx
Binary files differ
diff --git a/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/fdf4ad03-f87a-4809-832b-50e9cd301540.vsidx b/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/fdf4ad03-f87a-4809-832b-50e9cd301540.vsidx
new file mode 100644
index 0000000..c7ba437
--- /dev/null
+++ b/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/fdf4ad03-f87a-4809-832b-50e9cd301540.vsidx
Binary files differ
diff --git a/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskEnumHelper.cs b/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskEnumHelper.cs
new file mode 100644
index 0000000..98a8147
--- /dev/null
+++ b/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskEnumHelper.cs
@@ -0,0 +1,63 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEAWCS_Common.TaskEnum;
+
+namespace WIDESEAWCS_Common.TaskEnum
+{
+ public static class TaskEnumHelper
+ {
+ public static List<int> GetEnumIndexList(this Type type)
+ {
+ if (type is null) throw new ArgumentNullException("type");
+ if (!type.IsEnum) return new List<int>();
+ return Enum.GetValues(type).Cast<int>().ToList();
+ }
+
+ public static TaskTypeGroup GetTaskTypeGroup(this int taskType)
+ {
+ if (!int.TryParse(Enum.Parse<TaskOutboundTypeEnum>(taskType.ToString()).ToString(), out int result))
+ {
+ return TaskTypeGroup.OutbondGroup;
+ }
+ else if (!int.TryParse(Enum.Parse<TaskInStatusEnum>(taskType.ToString()).ToString(), out result))
+ {
+ return TaskTypeGroup.InboundGroup;
+ }
+ else if (!int.TryParse(Enum.Parse<TaskRelocationTypeEnum>(taskType.ToString()).ToString(), out result))
+ {
+ return TaskTypeGroup.RelocationGroup;
+ }
+ else if (!int.TryParse(Enum.Parse<TaskOtherTypeEnum>(taskType.ToString()).ToString(), out result))
+ {
+ return TaskTypeGroup.OtherGroup;
+ }
+ else
+ {
+ throw new NotImplementedException();
+ }
+ }
+
+ public static int GetNextNotCompletedStatus<T>(this int currentStatus) where T : Enum
+ {
+ Type type = typeof(T);
+ if (type is null) throw new ArgumentNullException();
+ if (!type.IsEnum) return 0;
+ if (type == typeof(TaskInStatusEnum))
+ {
+ List<int> taskInboundTypes = type.GetEnumIndexList();
+ return taskInboundTypes.Where(x => x > currentStatus && x < (int)TaskInStatusEnum.InFinish).OrderBy(x => x).FirstOrDefault();
+ }
+ else if (type == typeof(TaskOutStatusEnum))
+ {
+ return type.GetEnumIndexList().Where(x => x > currentStatus && x < (int)TaskOutStatusEnum.OutFinish).OrderBy(x => x).FirstOrDefault();
+ }
+ else
+ {
+ throw new NotImplementedException();
+ }
+ }
+ }
+}
diff --git a/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs b/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs
new file mode 100644
index 0000000..1919700
--- /dev/null
+++ b/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs
@@ -0,0 +1,147 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEAWCS_Common.TaskEnum
+{
+ public enum TaskInStatusEnum
+ {
+ /// <summary>
+ /// 鏂板缓鍏ュ簱浠诲姟
+ /// </summary>
+ [Description("鏂板缓鍏ュ簱浠诲姟")]
+ InNew = 200,
+
+ ///// <summary>
+ ///// AGV鍏ュ簱鎵ц涓�
+ ///// </summary>
+ //[Description("AGV鍏ュ簱鎵ц涓�")]
+ //AGV_InExecuting = 210,
+
+ ///// <summary>
+ ///// AGV鍏ュ簱瀹屾垚
+ ///// </summary>
+ //[Description("AGV鎼繍瀹屾垚")]
+ //AGV_InFinish = 215,
+
+ /// <summary>
+ /// 杈撻�佺嚎鍏ュ簱鎵ц涓�
+ /// </summary>
+ [Description("杈撻�佺嚎鍏ュ簱鎵ц涓�")]
+ Line_InExecuting = 220,
+
+ /// <summary>
+ /// 杈撻�佺嚎鍏ュ簱瀹屾垚
+ /// </summary>
+ [Description("杈撻�佺嚎杈撻�佸畬鎴�")]
+ Line_InFinish = 225,
+
+ /// <summary>
+ /// 鍫嗗灈鏈哄叆搴撴墽琛屼腑
+ /// </summary>
+ [Description("鍫嗗灈鏈哄叆搴撴墽琛屼腑")]
+ SC_InExecuting = 230,
+
+ /// <summary>
+ /// 鍫嗗灈鏈哄叆搴撳畬鎴�
+ /// </summary>
+ [Description("鍫嗗灈鏈哄叆搴撳畬鎴�")]
+ SC_InFinish = 235,
+
+ /// <summary>
+ /// 鍏ュ簱浠诲姟瀹屾垚
+ /// </summary>
+ [Description("鍏ュ簱浠诲姟瀹屾垚")]
+ InFinish = 290,
+
+ /// <summary>
+ /// 鍏ュ簱浠诲姟鎸傝捣
+ /// </summary>
+ [Description("鍏ュ簱浠诲姟鎸傝捣")]
+ InPending = 297,
+
+ /// <summary>
+ /// 鍏ュ簱浠诲姟鍙栨秷
+ /// </summary>
+ [Description("鍏ュ簱浠诲姟鍙栨秷")]
+ InCancel = 298,
+
+ /// <summary>
+ /// 鍏ュ簱浠诲姟寮傚父
+ /// </summary>
+ [Description("鍏ュ簱浠诲姟寮傚父")]
+ InException = 299,
+ }
+
+ public enum TaskOutStatusEnum
+ {
+ /// <summary>
+ /// 鏂板缓鍑哄簱浠诲姟
+ /// </summary>
+ [Description("鏂板缓鍑哄簱浠诲姟")]
+ OutNew = 100,
+
+ /// <summary>
+ /// 鍫嗗灈鏈哄嚭搴撴墽琛屼腑
+ /// </summary>
+ [Description("鍫嗗灈鏈哄嚭搴撴墽琛屼腑")]
+ SC_OutExecuting = 110,
+
+ /// <summary>
+ /// 鍫嗗灈鏈哄嚭搴撳畬鎴�
+ /// </summary>
+ [Description("鍫嗗灈鏈哄嚭搴撳畬鎴�")]
+ SC_OutFinish = 115,
+
+ /// <summary>
+ /// 杈撻�佺嚎鍑哄簱鎵ц涓�
+ /// </summary>
+ [Description("杈撻�佺嚎鍑哄簱鎵ц涓�")]
+ Line_OutExecuting = 120,
+
+ /// <summary>
+ /// 杈撻�佺嚎鍑哄簱瀹屾垚
+ /// </summary>
+ [Description("杈撻�佺嚎杈撻�佸畬鎴�")]
+ Line_OutFinish = 125,
+
+ ///// <summary>
+ ///// AGV鍑哄簱鎵ц涓�
+ ///// </summary>
+ //[Description("AGV鍑哄簱鎵ц涓�")]
+ //AGV_OutExecuting = 130,
+
+ ///// <summary>
+ ///// AGV鍑哄簱瀹屾垚
+ ///// </summary>
+ //[Description("AGV鎼繍瀹屾垚")]
+ //AGV_OutFinish = 135,
+
+ /// <summary>
+ /// 鍑哄簱浠诲姟瀹屾垚
+ /// </summary>
+ [Description("鍑哄簱浠诲姟瀹屾垚")]
+ OutFinish = 190,
+
+ /// <summary>
+ /// 鍑哄簱浠诲姟鎸傝捣
+ /// </summary>
+ [Description("鍑哄簱浠诲姟鎸傝捣")]
+ OutPending = 197,
+
+ /// <summary>
+ /// 鍑哄簱浠诲姟鍙栨秷
+ /// </summary>
+ [Description("鍑哄簱浠诲姟鍙栨秷")]
+ OutCancel = 198,
+
+ /// <summary>
+ /// 鍑哄簱浠诲姟寮傚父
+ /// </summary>
+ [Description("鍑哄簱浠诲姟寮傚父")]
+ OutException = 199,
+ }
+}
diff --git a/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusGroup.cs b/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusGroup.cs
new file mode 100644
index 0000000..459adce
--- /dev/null
+++ b/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusGroup.cs
@@ -0,0 +1,15 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEAWCS_Common.TaskEnum
+{
+ public enum TaskStatusGroup
+ {
+ NotCompleted,
+ Completed,
+ Exception
+ }
+}
diff --git a/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs b/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs
new file mode 100644
index 0000000..33dfdfc
--- /dev/null
+++ b/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeEnum.cs
@@ -0,0 +1,76 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEAWCS_Common.TaskEnum
+{
+ public enum TaskInboundTypeEnum
+ {
+ /// <summary>
+ /// 鍏ュ簱
+ /// </summary>
+ [Description("鍏ュ簱")]
+ Inbound = 200,
+ /// <summary>
+ /// 鐩樼偣鍏ュ簱
+ /// </summary>
+ [Description("鐩樼偣鍏ュ簱")]
+ InInventory = 201,
+ /// <summary>
+ /// 鍒嗘嫞鍏ュ簱
+ /// </summary>
+ [Description("鍒嗘嫞鍏ュ簱")]
+ InPick = 202,
+ /// <summary>
+ /// 璐ㄦ鍏ュ簱
+ /// </summary>
+ [Description("璐ㄦ鍏ュ簱")]
+ InQuality = 203
+ }
+
+ public enum TaskOutboundTypeEnum
+ {
+ /// <summary>
+ /// 鍑哄簱
+ /// </summary>
+ [Description("鍑哄簱")]
+ Outbound = 100,
+ /// <summary>
+ /// 鐩樼偣鍑哄簱
+ /// </summary>
+ [Description("鐩樼偣鍑哄簱")]
+ OutInventory = 101,
+ /// <summary>
+ /// 鍒嗘嫞鍑哄簱
+ /// </summary>
+ [Description("鍒嗘嫞鍑哄簱")]
+ OutPick = 102,
+ /// <summary>
+ /// 璐ㄦ鍑哄簱
+ /// </summary>
+ [Description("璐ㄦ鍑哄簱")]
+ OutQuality = 103,
+ }
+
+ public enum TaskRelocationTypeEnum
+ {
+ /// <summary>
+ /// 搴撳唴绉诲簱
+ /// </summary>
+ [Description("搴撳唴绉诲簱")]
+ Relocation = 300,
+ /// <summary>
+ /// 搴撳绉诲簱
+ /// </summary>
+ [Description("搴撳绉诲簱")]
+ RelocationIn = 301
+ }
+
+ public enum TaskOtherTypeEnum
+ {
+
+ }
+}
diff --git a/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeGroup.cs b/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeGroup.cs
new file mode 100644
index 0000000..cb22aea
--- /dev/null
+++ b/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskTypeGroup.cs
@@ -0,0 +1,16 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEAWCS_Common.TaskEnum
+{
+ public enum TaskTypeGroup
+ {
+ InboundGroup,
+ OutbondGroup,
+ RelocationGroup,
+ OtherGroup
+ }
+}
diff --git a/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs b/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
index 535f501..aad8fe0 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
@@ -22,6 +22,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseServices;
using WIDESEAWCS_Core.Enums;
diff --git a/WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj b/WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj
index a77ecc6..80a43fc 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj
+++ b/WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj
@@ -8,7 +8,7 @@
<ItemGroup>
<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
- <PackageReference Include="WIDESEAWCS_Core" Version="1.0.4" />
+ <PackageReference Include="WIDESEAWCS_Core" Version="1.0.5" />
</ItemGroup>
<ItemGroup>
diff --git a/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs b/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs
index 520f0ca..4af342e 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_Server/Controllers/System/Sys_DictionaryController.cs
@@ -18,6 +18,10 @@
using Quartz;
using WIDESEAWCS_QuartzJob;
using OfficeOpenXml.FormulaParsing.Excel.Functions.DateTime;
+using WIDESEAWCS_Common.TaskEnum;
+using WIDESEAWCS_Core.Caches;
+using WIDESEAWCS_QuartzJob.DeviceEnum;
+using WIDESEAWCS_Core.Enums;
namespace WIDESEAWCS_WCSServer.Controllers.System
{
@@ -26,52 +30,348 @@
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)
{
List<VueDictionaryDTO> vueDictionaryDTOs = Service.GetVueDictionary(dicNos);
- #region
try
{
- List<string> dicList = dicNos.ToList();
-
- string str = AppSettings.Configuration["dics"];
- if (!string.IsNullOrEmpty(str))
+ 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 st = vueDictionaryDTOs[0].Data.Serialize();
-
- List<string> cusDics = new List<string>();
-
- List<string> dics = str.Split(",").ToList();
-
- foreach (var item in dics)
+ string? str = _cacheService.Get(n);
+ if (!string.IsNullOrEmpty(str))
{
- dicList.Remove(item);
- cusDics.Add(item);
- }
+ VueDictionaryDTO? vueDictionary = JsonConvert.DeserializeObject<VueDictionaryDTO>(str);
- foreach (var item in cusDics)
- {
- string dic = QuartzJobCommonMethod.GetVueDictionary(item.Trim());
- if (!string.IsNullOrEmpty(dic))
+ if (vueDictionary != null)
{
- VueDictionaryDTO vueDictionaryDTO = JsonConvert.DeserializeObject<VueDictionaryDTO>(dic);
- vueDictionaryDTOs.Add(vueDictionaryDTO);
+ 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 (Exception ex)
+ catch
{
}
- #endregion
return Json(vueDictionaryDTOs);
}
+
+ private VueDictionaryDTO? GetVueDictionary(string key)
+ {
+ VueDictionaryDTO? result = null;
+ try
+ {
+ switch (key)
+ {
+ case "deviceType":
+ {
+ Type type = typeof(IDevice);
+ var basePath = AppContext.BaseDirectory;
+ 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)
+ {
+ DescriptionAttribute? description = deviceType.GetCustomAttribute<DescriptionAttribute>();
+ if (description != null)
+ {
+ data.Add(new { key = deviceType.Name, value = description.Description });
+ }
+ else
+ {
+ data.Add(new { key = deviceType.Name, value = deviceType.Name });
+ }
+ }
+
+ result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
+ }
+ break;
+ 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 "deviceStatus":
+ {
+ List<object> data = new List<object>();
+ 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(((DeviceStatusEnum)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 "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);
+ var basePath = AppContext.BaseDirectory;
+ string path = Path.Combine(basePath, $"WIDESEAWCS_Communicator.dll");
+ Assembly assembly = Assembly.LoadFrom(path);
+ List<Type> types = assembly.GetTypes().Where(x => type.IsAssignableFrom(x) && !x.IsAbstract && !x.IsInterface).ToList();
+ List<object> data = new List<object>();
+ foreach (var deviceType in types)
+ {
+ DescriptionAttribute? description = deviceType.GetCustomAttribute<DescriptionAttribute>();
+ if (description != null)
+ {
+ data.Add(new { key = deviceType.Name, value = description.Description });
+ }
+ else
+ {
+ data.Add(new { key = deviceType.Name, value = deviceType.Name });
+ }
+ }
+
+ result = new VueDictionaryDTO { DicNo = key, Config = "", Data = data };
+ }
+ break;
+ case "inOutType":
+ {
+ List<object> data = new List<object>();
+ Type type = typeof(RouterInOutType);
+ List<int> enums = Enum.GetValues(typeof(RouterInOutType)).Cast<int>().ToList();
+ int index = 0;
+ foreach (var item in enums)
+ {
+ FieldInfo? fieldInfo = typeof(RouterInOutType).GetField(((RouterInOutType)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;
+ }
+ catch (Exception ex)
+ {
+ return null;
+ }
+ }
}
}
diff --git a/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs b/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs
index 4f4e913..fd5dc39 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_Server/Program.cs
@@ -119,7 +119,7 @@
//todo
//app.UseRecordAccessLogsMiddle();
-app.UseCors(AppSettings.app(new string[] { "Cors", "PolicyName" }));
+app.UseCors(AppSettings.Get(new string[] { "Cors", "PolicyName" }));
DefaultFilesOptions defaultFilesOptions = new DefaultFilesOptions();
defaultFilesOptions.DefaultFileNames.Clear();
diff --git a/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_DictionaryService.cs b/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_DictionaryService.cs
index e04fe7a..ebb2da4 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_DictionaryService.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_DictionaryService.cs
@@ -7,7 +7,6 @@
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
-using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core.BaseRepository;
using WIDESEAWCS_Core.BaseServices;
using WIDESEAWCS_Core.Caches;
diff --git a/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskExecuteDetailService.cs b/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskExecuteDetailService.cs
index d2e92d9..9d23f8a 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskExecuteDetailService.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskExecuteDetailService.cs
@@ -22,6 +22,7 @@
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
+using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseServices;
using WIDESEAWCS_Core.Enums;
diff --git a/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
index 5a0ccf0..231fa5d 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -26,6 +26,7 @@
using System.Reflection;
using System.Text;
using System.Threading.Tasks;
+using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core;
using WIDESEAWCS_Core.BaseServices;
using WIDESEAWCS_Core.Enums;
diff --git a/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
index 5e14f93..1f79946 100644
--- a/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
+++ b/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -6,6 +6,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
+using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core.Enums;
using WIDESEAWCS_ITaskInfoRepository;
using WIDESEAWCS_ITaskInfoService;
--
Gitblit v1.9.3