From 3fb6bfc7d068cafa47906eb6f22d8e2989426f32 Mon Sep 17 00:00:00 2001
From: 陈勇 <chenyong@hnkhzn.com>
Date: 星期二, 19 十一月 2024 09:03:17 +0800
Subject: [PATCH] 合并

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs                                 |    2 
 .gitignore                                                                                                                    |  107 ++++-
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs                                      |   67 ++-
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemRepository/Sys_ConfigRepository.cs                                     |   19 +
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs                     |    9 
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/Unbind/UnbindService.cs                           |    4 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ISystemServices/ISys_ConfigService.cs                                        |   36 ++
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs                                               |  212 +++++------
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs                                             |    2 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/WIDESEAWCS_TaskInfoService.csproj                            |    1 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs                                 |  102 ++---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/CateGoryConst.cs                                                |   19 +
 /dev/null                                                                                                                     |   16 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs                               |  309 ++++++----------
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/AgingInOrOutInput/AgingInOrOutInputService.cs     |    4 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/WIDESEAWCS_Server.MvcApplicationPartsAssemblyInfo.cs |    2 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/SysConfigKeyConst.cs                                            |   47 ++
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ISystemRepository/ISys_ConfigRepository.cs                                   |   14 
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_ConfigService.cs                                          |   38 ++
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/System/Sys_Config.cs                                            |   54 +++
 Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs               |    2 
 21 files changed, 643 insertions(+), 423 deletions(-)

diff --git a/.gitignore b/.gitignore
index 09af769..3c927c1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1237,25 +1237,76 @@
 /Code Management/WMS/WIDESEA_WMSServer/LogLibrary/obj/Debug/net6.0/LogLibrary.GeneratedMSBuildEditorConfig.editorconfig
 /Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/obj/Debug/net6.0/WIDESEA_IStoragIntegrationServices.GeneratedMSBuildEditorConfig.editorconfig
 /Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Tasks/obj/Debug/net6.0/WIDESEA_Tasks.GeneratedMSBuildEditorConfig.editorconfig
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Core/obj/Debug/net6.0/WIDESEA_Core.GeneratedMSBuildEditorConfig.editorconfig
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_DTO/obj/Debug/net6.0/WIDESEA_DTO.GeneratedMSBuildEditorConfig.editorconfig
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IBusinessesRepository/obj/Debug/net6.0/WIDESEA_IBusinessesRepository.GeneratedMSBuildEditorConfig.editorconfig
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IBusinessServices/obj/Debug/net6.0/WIDESEA_IBusinessServices.GeneratedMSBuildEditorConfig.editorconfig
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IRepository/obj/Debug/net6.0/WIDESEA_IRepository.GeneratedMSBuildEditorConfig.editorconfig
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IServices/obj/Debug/net6.0/WIDESEA_IServices.GeneratedMSBuildEditorConfig.editorconfig
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicRepository/obj/Debug/net6.0/WIDESEA_IStorageBasicRepository.GeneratedMSBuildEditorConfig.editorconfig
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageBasicService/obj/Debug/net6.0/WIDESEA_IStorageBasicServices.GeneratedMSBuildEditorConfig.editorconfig
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageOutOrderRepository/obj/Debug/net6.0/WIDESEA_IStorageOutOrderRepository.GeneratedMSBuildEditorConfig.editorconfig
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageOutOrderService/obj/Debug/net6.0/WIDESEA_IStorageOutOrderServices.GeneratedMSBuildEditorConfig.editorconfig
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskRepository/obj/Debug/net6.0/WIDESEA_IStorageTaskRepository.GeneratedMSBuildEditorConfig.editorconfig
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStorageTaskService/obj/Debug/net6.0/WIDESEA_IStorageTaskServices.GeneratedMSBuildEditorConfig.editorconfig
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/obj/Debug/net6.0/WIDESEA_IStoragIntegrationServices.assets.cache
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/obj/Debug/net6.0/WIDESEA_IStoragIntegrationServices.csproj.FileListAbsolute.txt
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/obj/project.assets.json
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/obj/project.nuget.cache
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/obj/WIDESEA_IStoragIntegrationServices.csproj.nuget.dgspec.json
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_IStoragIntegrationServices/obj/WIDESEA_IStoragIntegrationServices.csproj.nuget.g.props
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Model/obj/Debug/net6.0/WIDESEA_Model.GeneratedMSBuildEditorConfig.editorconfig
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoRepository/obj/WIDESEAWCS_IBasicInfoRepository.csproj.nuget.dgspec.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoRepository/obj/WIDESEAWCS_IBasicInfoRepository.csproj.nuget.g.props
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoService/obj/Debug/net6.0/WIDESEAWCS_IBasicInfoService.assets.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoService/obj/Debug/net6.0/WIDESEAWCS_IBasicInfoService.GeneratedMSBuildEditorConfig.editorconfig
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoService/obj/project.assets.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoService/obj/project.nuget.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoService/obj/WIDESEAWCS_IBasicInfoService.csproj.nuget.dgspec.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_IBasicInfoService/obj/WIDESEAWCS_IBasicInfoService.csproj.nuget.g.props
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ISystemRepository/obj/Debug/net6.0/WIDESEAWCS_ISystemRepository.assets.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ISystemRepository/obj/Debug/net6.0/WIDESEAWCS_ISystemRepository.GeneratedMSBuildEditorConfig.editorconfig
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ISystemRepository/obj/project.assets.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ISystemRepository/obj/project.nuget.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ISystemRepository/obj/WIDESEAWCS_ISystemRepository.csproj.nuget.dgspec.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ISystemRepository/obj/WIDESEAWCS_ISystemRepository.csproj.nuget.g.props
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessParameters/obj/project.assets.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessParameters/obj/project.nuget.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessParameters/obj/WIDESEAWCS_IProcessRepository.csproj.nuget.dgspec.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessParameters/obj/WIDESEAWCS_IProcessRepository.csproj.nuget.g.props
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessRepository/obj/Debug/net6.0/WIDESEAWCS_ProcessRepository.assets.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessRepository/obj/Debug/net6.0/WIDESEAWCS_ProcessRepository.GeneratedMSBuildEditorConfig.editorconfig
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessRepository/obj/project.assets.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessRepository/obj/project.nuget.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessRepository/obj/WIDESEAWCS_ProcessRepository.csproj.nuget.dgspec.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ProcessRepository/obj/WIDESEAWCS_ProcessRepository.csproj.nuget.g.props
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/obj/Debug/net6.0/WIDESEAWCS_QuartzJob.assets.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/obj/Debug/net6.0/WIDESEAWCS_QuartzJob.GeneratedMSBuildEditorConfig.editorconfig
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/obj/project.assets.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/obj/project.nuget.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/obj/WIDESEAWCS_QuartzJob.csproj.nuget.dgspec.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/obj/WIDESEAWCS_QuartzJob.csproj.nuget.g.props
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/staticwebassets.removed.txt
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/WIDESEAWCS_Server.assets.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/WIDESEAWCS_Server.GeneratedMSBuildEditorConfig.editorconfig
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/project.assets.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/project.nuget.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/WIDESEAWCS_Server.csproj.nuget.dgspec.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/WIDESEAWCS_Server.csproj.nuget.g.props
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemRepository/obj/Debug/net6.0/WIDESEAWCS_SystemRepository.assets.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemRepository/obj/Debug/net6.0/WIDESEAWCS_SystemRepository.GeneratedMSBuildEditorConfig.editorconfig
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemRepository/obj/project.assets.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemRepository/obj/project.nuget.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemRepository/obj/WIDESEAWCS_SystemRepository.csproj.nuget.dgspec.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemRepository/obj/WIDESEAWCS_SystemRepository.csproj.nuget.g.props
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/obj/Debug/net6.0/WIDESEAWCS_SystemServices.assets.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/obj/Debug/net6.0/WIDESEAWCS_SystemServices.GeneratedMSBuildEditorConfig.editorconfig
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/obj/project.assets.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/obj/project.nuget.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/obj/WIDESEAWCS_SystemServices.csproj.nuget.dgspec.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/obj/WIDESEAWCS_SystemServices.csproj.nuget.g.props
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/obj/Debug/net6.0/WIDESEAWCS_TaskInfoRepository.assets.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/obj/Debug/net6.0/WIDESEAWCS_TaskInfoRepository.GeneratedMSBuildEditorConfig.editorconfig
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/obj/project.assets.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/obj/project.nuget.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/obj/WIDESEAWCS_TaskInfoRepository.csproj.nuget.dgspec.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoRepository/obj/WIDESEAWCS_TaskInfoRepository.csproj.nuget.g.props
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/obj/project.assets.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/obj/project.nuget.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/obj/WIDESEAWCS_TaskInfoService.csproj.nuget.dgspec.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/obj/WIDESEAWCS_TaskInfoService.csproj.nuget.g.props
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/obj/Debug/net6.0/WIDESEAWCS_Tasks.assets.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/obj/Debug/net6.0/WIDESEAWCS_Tasks.GeneratedMSBuildEditorConfig.editorconfig
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/obj/project.assets.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/obj/project.nuget.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/obj/WIDESEAWCS_Tasks.csproj.nuget.dgspec.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/obj/WIDESEAWCS_Tasks.csproj.nuget.g.props
+/Code Management/WMS/WIDESEA_WMSServer/LogLibrary/obj/Debug/net6.0/LogLibrary.assets.cache
+/Code Management/WMS/WIDESEA_WMSServer/LogLibrary/obj/LogLibrary.csproj.nuget.dgspec.json
+/Code Management/WMS/WIDESEA_WMSServer/LogLibrary/obj/LogLibrary.csproj.nuget.g.props
+/Code Management/WMS/WIDESEA_WMSServer/LogLibrary/obj/project.assets.json
+/Code Management/WMS/WIDESEA_WMSServer/LogLibrary/obj/project.nuget.cache
 /Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Repository/obj/Debug/net6.0/WIDESEA_Repository.GeneratedMSBuildEditorConfig.editorconfig
 /Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Services/obj/Debug/net6.0/WIDESEA_Services.GeneratedMSBuildEditorConfig.editorconfig
 /Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageBasicRepository/obj/Debug/net6.0/WIDESEA_StorageBasicRepository.GeneratedMSBuildEditorConfig.editorconfig
@@ -1267,8 +1318,24 @@
 /Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/obj/Debug/net6.0/WIDESEA_StoragIntegrationServices.assets.cache
 /Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/obj/Debug/net6.0/WIDESEA_StoragIntegrationServices.GeneratedMSBuildEditorConfig.editorconfig
 /Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/obj/WIDESEA_StoragIntegrationServices.csproj.nuget.g.props
-/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/WIDESEA_StoragIntegrationServices.csproj
 /Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Tasks/obj/Debug/net6.0/WIDESEA_Tasks.assets.cache
 /Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Tasks/obj/project.assets.json
 /Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Tasks/obj/project.nuget.cache
 /Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Tasks/obj/WIDESEA_Tasks.csproj.nuget.dgspec.json
+/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/obj/Debug/net6.0/staticwebassets.removed.txt
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/bin/Debug/net6.0/Log_PLCReadWrite/鍖栨垚鍏ュ簱杈撻�佺嚎/Logs_20241118165252.txt
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/bin/Debug/net6.0/Log_PLCReadWrite/闄堝寲1鍙峰爢鍨涙満/Logs_20241118165246.txt
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/bin/Debug/net6.0/Log_PLCReadWrite/闄堝寲鍏ュ簱杈撻�佺嚎/Logs_20241118165251.txt
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/bin/Debug/net6.0/Log_PLCReadWrite/闄堝寲鍑哄簱杈撻�佺嚎/Logs_20241118165251.txt
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/bin/Debug/net6.0/Log_PLCReadWrite/闈欑疆1鍙峰爢鍨涙満/Logs_20241118165301.txt
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/bin/Debug/net6.0/Log_PLCReadWrite/闈欑疆杈撻�佺嚎/Logs_20241118165311.txt
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/bin/Debug/net6.0/WIDESEAWCS_Server.staticwebassets.endpoints.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/EndpointInfo/WIDESEAWCS_Server.OpenApiFiles.cache
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/EndpointInfo/WIDESEAWCS_Server_V1.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/EndpointInfo/WIDESEAWCS_Server_V2.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/staticwebassets/msbuild.build.WIDESEAWCS_Server.props
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/staticwebassets/msbuild.WIDESEAWCS_Server.Microsoft.AspNetCore.StaticWebAssetEndpoints.props
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/staticwebassets/msbuild.WIDESEAWCS_Server.Microsoft.AspNetCore.StaticWebAssets.props
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/staticwebassets.build.endpoints.json
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/staticwebassets.references.upToDateCheck.txt
+/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/staticwebassets.upToDateCheck.txt
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/CateGoryConst.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/CateGoryConst.cs
new file mode 100644
index 0000000..97e05b7
--- /dev/null
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/CateGoryConst.cs
@@ -0,0 +1,19 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEAWCS_Common
+{
+    /// <summary>
+    /// 鍒嗙被甯搁噺
+    /// </summary>
+    public class CateGoryConst
+    {
+        /// <summary>
+        /// IP鎺ュ彛鍦板潃
+        /// </summary>
+        public const string CONFIG_SYS_IPAddress = "SYS_IPAddress";
+    }
+}
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/SysConfigKeyConst.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/SysConfigKeyConst.cs
new file mode 100644
index 0000000..78d6eb9
--- /dev/null
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Const/SysConfigKeyConst.cs
@@ -0,0 +1,47 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace WIDESEAWCS_Common
+{
+    public class SysConfigKeyConst
+    {
+        /// <summary>
+        /// WMS BASE
+        /// </summary>
+        public const string WMSIP_BASE = "WMSIPBASE";
+
+        /// <summary>
+        /// 璇锋眰浠诲姟
+        /// </summary>
+        public const string RequestTask = "RequestTask";
+
+        /// <summary>
+        /// 璇锋眰浠诲姟璐т綅
+        /// </summary>
+        public const string RequestLocation = "RequestLocation";
+
+        /// <summary>
+        /// 淇敼浠诲姟鐘舵��
+        /// </summary>
+
+        public const string UpdateTask = "UpdateTask";
+
+        /// <summary>
+        /// 浠诲姟瀹屾垚
+        /// </summary>
+        public const string CompleteTask = "CompleteTask";
+
+        /// <summary>
+        /// 璇锋眰绌烘墭鐩樹换鍔�
+        /// </summary>
+        public const string RequestTrayInTask = "RequestTrayInTask";
+
+        /// <summary>
+        /// 绌烘墭鐩樺疄鐩樺嚭搴撲换鍔�
+        /// </summary>
+        public const string RequestTrayOutTask = "RequestTrayOutTask";
+    }
+}
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ISystemRepository/ISys_ConfigRepository.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ISystemRepository/ISys_ConfigRepository.cs
new file mode 100644
index 0000000..2d55ffb
--- /dev/null
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ISystemRepository/ISys_ConfigRepository.cs
@@ -0,0 +1,14 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEAWCS_Core.BaseRepository;
+using WIDESEAWCS_Model.Models;
+
+namespace WIDESEAWCS_ISystemRepository
+{
+    public interface ISys_ConfigRepository : IRepository<Sys_Config>
+    {
+    }
+}
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ISystemServices/ISys_ConfigService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ISystemServices/ISys_ConfigService.cs
new file mode 100644
index 0000000..4796527
--- /dev/null
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ISystemServices/ISys_ConfigService.cs
@@ -0,0 +1,36 @@
+锘縰sing Microsoft.AspNetCore.Mvc;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEA_Core;
+using WIDESEAWCS_Core.BaseServices;
+using WIDESEAWCS_Model.Models;
+
+namespace WIDESEAWCS_ISystemServices
+{
+    public interface ISys_ConfigService : IService<Sys_Config>
+    {
+        /// <summary>
+        /// 鑾峰彇鎵�鏈夌郴缁熼厤缃�
+        /// </summary>
+        /// <returns></returns>
+        List<Sys_Config> GetAll();
+
+        /// <summary>
+        /// 鏍规嵁绫诲埆鑾峰彇绯荤粺閰嶇疆
+        /// </summary>
+        /// <param name="category">绫诲埆</param>
+        /// <returns></returns>
+        List<Sys_Config> GetConfigsByCategory(string category);
+
+        /// <summary>
+        /// 鏍规嵁绫诲埆鍜孠ey鑾峰彇绯荤粺閰嶇疆
+        /// </summary>
+        /// <param name="category">绫诲埆</param>
+        /// <param name="configKey">閰嶇疆Key</param>
+        /// <returns></returns>
+        Sys_Config GetByConfigKey(string category, string configKey);
+    }
+}
\ No newline at end of file
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
index 1a50def..8a41a26 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_ITaskInfoService/ITaskService.cs
@@ -63,7 +63,7 @@
         /// <param name="palletCode">鎵樼洏鍙�</param>
         /// <param name="sourceAddress">璧峰鍦板潃</param>
         /// <returns></returns>
-        WebResponseContent RequestWMSTask(string palletCode, string sourceAddress);
+        Task<WebResponseContent> RequestWMSTask(string palletCode, string sourceAddress);
 
         /// <summary>
         /// 鏍规嵁璁惧缂栧彿銆佸綋鍓嶅湴鍧�鏌ヨ杈撻�佺嚎鏈墽琛岀殑浠诲姟
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/System/Sys_Config.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/System/Sys_Config.cs
new file mode 100644
index 0000000..bf89f4b
--- /dev/null
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/Models/System/Sys_Config.cs
@@ -0,0 +1,54 @@
+锘縰sing SqlSugar;
+using WIDESEAWCS_Core.DB.Models;
+using WIDESEAWCS_Core.Tenants;
+
+namespace WIDESEAWCS_Model.Models;
+
+/// <summary>
+/// 绯荤粺閰嶇疆琛�
+/// </summary>
+[SugarTable("Sys_Config", "绯荤粺閰嶇疆琛�"), MultiTenant]
+public class Sys_Config : BaseEntity
+{
+    /// <summary>
+    /// 涓婚敭
+    /// </summary>
+    [SugarColumn(IsPrimaryKey = true, IsIdentity = true, ColumnDescription = "涓婚敭")]
+    public int Id { get; set; }
+
+    /// <summary>
+    /// 閰嶇疆閿�
+    /// </summary>
+    [SugarColumn(ColumnDescription = "閰嶇疆閿�", Length = 255, IsNullable = false)]
+    public string ConfigKey { get; set; }
+
+    /// <summary>
+    /// 閰嶇疆鍊�
+    /// </summary>
+    [SugarColumn(ColumnDescription = "閰嶇疆鍊�", IsNullable = false, ColumnDataType = "text")]
+    public string ConfigValue { get; set; }
+
+    /// <summary>
+    /// 鍒嗙被
+    /// </summary>
+    [SugarColumn(ColumnDescription = "鍒嗙被", Length = 255, IsNullable = false)]
+    public string Category { get; set; }
+
+    /// <summary>
+    /// 澶囨敞
+    /// </summary>
+    [SugarColumn(ColumnDescription = "澶囨敞", Length = 255, IsNullable = true)]
+    public string Remark { get; set; }
+
+    /// <summary>
+    /// 鎺掑簭鐮�
+    /// </summary>
+    [SugarColumn(ColumnDescription = "鎺掑簭鐮�", IsNullable = true)]
+    public int? SortCode { get; set; }
+
+    /// <summary>
+    /// 鐘舵��
+    /// </summary>
+    [SugarColumn(ColumnDescription = "鐘舵��", Length = 20, IsNullable = true)]
+    public string Status { get; set; }
+}
\ No newline at end of file
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs
index d0c9f6f..3a729f2 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_QuartzJob/ConveyorLine/CommonConveyorLine.cs
@@ -242,7 +242,7 @@
         /// <exception cref="Exception"></exception>
         public T ReadCustomer<T>(string deviceChildCode, string deviceProParamType) where T : IDataTransfer, new()
         {
-            if (!IsConnected) throw new Exception($"閫氳杩炴帴閿欒锛岃妫�鏌ョ綉缁�");
+            if (!IsConnected) throw new Exception($"閫氳杩炴帴閿欒锛岃妫�鏌ョ綉缁�:" + DeviceName);
             DeviceProDTO? devicePro = _deviceProDTOs.Where(x => x.DeviceProParamType == deviceProParamType && x.DeviceChildCode == deviceChildCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
 
             if (devicePro == null)
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/WIDESEAWCS_Server.MvcApplicationPartsAssemblyInfo.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/WIDESEAWCS_Server.MvcApplicationPartsAssemblyInfo.cs
index 5233109..3d23fae 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/WIDESEAWCS_Server.MvcApplicationPartsAssemblyInfo.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/WIDESEAWCS_Server.MvcApplicationPartsAssemblyInfo.cs
@@ -28,7 +28,7 @@
 [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("WIDESEAWCS_SystemRepository")]
 [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("WIDESEAWCS_SystemServices")]
 [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("WIDESEAWCS_TaskInfoRepository")]
-[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("WIDESEAWCS_TaskInfoService")]
+[assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("WIDESEAWCs_TaskInfoService")]
 [assembly: Microsoft.AspNetCore.Mvc.ApplicationParts.ApplicationPartAttribute("WIDESEAWCS_Tasks")]
 
 // 鐢� MSBuild WriteCodeFragment 绫荤敓鎴愩��
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/staticwebassets/msbuild.WIDESEAWCS_Server.Microsoft.AspNetCore.StaticWebAssets.props b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/staticwebassets/msbuild.WIDESEAWCS_Server.Microsoft.AspNetCore.StaticWebAssets.props
deleted file mode 100644
index 056a461..0000000
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/staticwebassets/msbuild.WIDESEAWCS_Server.Microsoft.AspNetCore.StaticWebAssets.props
+++ /dev/null
@@ -1,84 +0,0 @@
-锘�<Project>
-  <ItemGroup>
-    <StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\css\style.css))">
-      <SourceType>Package</SourceType>
-      <SourceId>WIDESEAWCS_Server</SourceId>
-      <ContentRoot>$(MSBuildThisFileDirectory)..\staticwebassets\</ContentRoot>
-      <BasePath>_content/WIDESEAWCS_Server</BasePath>
-      <RelativePath>css/style.css</RelativePath>
-      <AssetKind>All</AssetKind>
-      <AssetMode>All</AssetMode>
-      <AssetRole>Primary</AssetRole>
-      <RelatedAsset></RelatedAsset>
-      <AssetTraitName></AssetTraitName>
-      <AssetTraitValue></AssetTraitValue>
-      <CopyToOutputDirectory>Never</CopyToOutputDirectory>
-      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
-      <OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\css\style.css))</OriginalItemSpec>
-    </StaticWebAsset>
-    <StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\favicon.ico))">
-      <SourceType>Package</SourceType>
-      <SourceId>WIDESEAWCS_Server</SourceId>
-      <ContentRoot>$(MSBuildThisFileDirectory)..\staticwebassets\</ContentRoot>
-      <BasePath>_content/WIDESEAWCS_Server</BasePath>
-      <RelativePath>favicon.ico</RelativePath>
-      <AssetKind>All</AssetKind>
-      <AssetMode>All</AssetMode>
-      <AssetRole>Primary</AssetRole>
-      <RelatedAsset></RelatedAsset>
-      <AssetTraitName></AssetTraitName>
-      <AssetTraitValue></AssetTraitValue>
-      <CopyToOutputDirectory>Never</CopyToOutputDirectory>
-      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
-      <OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\favicon.ico))</OriginalItemSpec>
-    </StaticWebAsset>
-    <StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\js\anime.min.js))">
-      <SourceType>Package</SourceType>
-      <SourceId>WIDESEAWCS_Server</SourceId>
-      <ContentRoot>$(MSBuildThisFileDirectory)..\staticwebassets\</ContentRoot>
-      <BasePath>_content/WIDESEAWCS_Server</BasePath>
-      <RelativePath>js/anime.min.js</RelativePath>
-      <AssetKind>All</AssetKind>
-      <AssetMode>All</AssetMode>
-      <AssetRole>Primary</AssetRole>
-      <RelatedAsset></RelatedAsset>
-      <AssetTraitName></AssetTraitName>
-      <AssetTraitValue></AssetTraitValue>
-      <CopyToOutputDirectory>Never</CopyToOutputDirectory>
-      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
-      <OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\js\anime.min.js))</OriginalItemSpec>
-    </StaticWebAsset>
-    <StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\logo.jpg.jpg))">
-      <SourceType>Package</SourceType>
-      <SourceId>WIDESEAWCS_Server</SourceId>
-      <ContentRoot>$(MSBuildThisFileDirectory)..\staticwebassets\</ContentRoot>
-      <BasePath>_content/WIDESEAWCS_Server</BasePath>
-      <RelativePath>logo.jpg.jpg</RelativePath>
-      <AssetKind>All</AssetKind>
-      <AssetMode>All</AssetMode>
-      <AssetRole>Primary</AssetRole>
-      <RelatedAsset></RelatedAsset>
-      <AssetTraitName></AssetTraitName>
-      <AssetTraitValue></AssetTraitValue>
-      <CopyToOutputDirectory>Never</CopyToOutputDirectory>
-      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
-      <OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\logo.jpg.jpg))</OriginalItemSpec>
-    </StaticWebAsset>
-    <StaticWebAsset Include="$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\swg-login.html))">
-      <SourceType>Package</SourceType>
-      <SourceId>WIDESEAWCS_Server</SourceId>
-      <ContentRoot>$(MSBuildThisFileDirectory)..\staticwebassets\</ContentRoot>
-      <BasePath>_content/WIDESEAWCS_Server</BasePath>
-      <RelativePath>swg-login.html</RelativePath>
-      <AssetKind>All</AssetKind>
-      <AssetMode>All</AssetMode>
-      <AssetRole>Primary</AssetRole>
-      <RelatedAsset></RelatedAsset>
-      <AssetTraitName></AssetTraitName>
-      <AssetTraitValue></AssetTraitValue>
-      <CopyToOutputDirectory>Never</CopyToOutputDirectory>
-      <CopyToPublishDirectory>PreserveNewest</CopyToPublishDirectory>
-      <OriginalItemSpec>$([System.IO.Path]::GetFullPath($(MSBuildThisFileDirectory)..\staticwebassets\swg-login.html))</OriginalItemSpec>
-    </StaticWebAsset>
-  </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/staticwebassets/msbuild.build.WIDESEAWCS_Server.props b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/staticwebassets/msbuild.build.WIDESEAWCS_Server.props
deleted file mode 100644
index 5a6032a..0000000
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/obj/Debug/net6.0/staticwebassets/msbuild.build.WIDESEAWCS_Server.props
+++ /dev/null
@@ -1,3 +0,0 @@
-锘�<Project>
-  <Import Project="Microsoft.AspNetCore.StaticWebAssets.props" />
-</Project>
\ No newline at end of file
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemRepository/Sys_ConfigRepository.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemRepository/Sys_ConfigRepository.cs
new file mode 100644
index 0000000..c0f6b58
--- /dev/null
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemRepository/Sys_ConfigRepository.cs
@@ -0,0 +1,19 @@
+锘縰sing System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using WIDESEAWCS_Core.BaseRepository;
+using WIDESEAWCS_ISystemRepository;
+using WIDESEAWCS_Model.Models;
+
+namespace WIDESEAWCS_SystemRepository
+{
+    public class Sys_ConfigRepository : RepositoryBase<Sys_Config>, ISys_ConfigRepository
+    {
+        public Sys_ConfigRepository(IUnitOfWorkManage unitOfWorkManage) : base(unitOfWorkManage)
+        {
+
+        }
+    }
+}
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_ConfigService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_ConfigService.cs
new file mode 100644
index 0000000..b70e48d
--- /dev/null
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_SystemServices/Sys_ConfigService.cs
@@ -0,0 +1,38 @@
+锘�
+using System.Net;
+using WIDESEAWCS_Core.BaseServices;
+using WIDESEAWCS_ISystemRepository;
+using WIDESEAWCS_ISystemServices;
+using WIDESEAWCS_Core.BaseRepository;
+using WIDESEAWCS_Model.Models;
+
+namespace WIDESEA_Services
+{
+    public class Sys_ConfigService : ServiceBase<Sys_Config, ISys_ConfigRepository>, ISys_ConfigService
+    {
+        private readonly IUnitOfWorkManage _unitOfWorkManage;
+
+        public Sys_ConfigService(ISys_ConfigRepository repository, IUnitOfWorkManage unitOfWorkManage) : base(repository)
+        {
+            _unitOfWorkManage = unitOfWorkManage;
+        }
+
+        /// <inheritdoc/>
+        public List<Sys_Config> GetAll()
+        {
+            return BaseDal.QueryData();
+        }
+
+        /// <inheritdoc/>
+        public List<Sys_Config> GetConfigsByCategory(string category)
+        {
+            return BaseDal.QueryData(x => x.Category == category).ToList();
+        }
+
+        /// <inheritdoc/>
+        public Sys_Config GetByConfigKey(string category, string configKey)
+        {
+            return BaseDal.QueryData(x => x.Category == category && x.ConfigKey == configKey).FirstOrDefault();
+        }
+    }
+}
\ No newline at end of file
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
index 830c4ce..95ef445 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs
@@ -1,34 +1,18 @@
-锘�#region << 鐗� 鏈� 娉� 閲� >>
-
-/*----------------------------------------------------------------
- * 鍛藉悕绌洪棿锛歐IDESEAWCS_TaskInfoService
- * 鍒涘缓鑰咃細鑳$搴�
- * 鍒涘缓鏃堕棿锛�2024/8/2 16:13:36
- * 鐗堟湰锛歏1.0.0
- * 鎻忚堪锛�
- *
- * ----------------------------------------------------------------
- * 淇敼浜猴細
- * 淇敼鏃堕棿锛�
- * 鐗堟湰锛歏1.0.1
- * 淇敼璇存槑锛�
- *
- *----------------------------------------------------------------*/
-
-#endregion << 鐗� 鏈� 娉� 閲� >>
-
+锘�
 using AutoMapper;
 using HslCommunication;
 using Newtonsoft.Json;
 using SqlSugar;
 using System.Diagnostics.CodeAnalysis;
 using System.Threading.Tasks;
+using WIDESEAWCS_Common;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.BaseServices;
 using WIDESEAWCS_Core.Helper;
 using WIDESEAWCS_DTO.TaskInfo;
 using WIDESEAWCS_DTO.WMS;
+using WIDESEAWCS_ISystemServices;
 using WIDESEAWCS_ITaskInfoRepository;
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
@@ -42,13 +26,14 @@
         private readonly IRouterService _routerService;
         private readonly ITaskExecuteDetailService _taskExecuteDetailService;
         private readonly ITaskExecuteDetailRepository _taskExecuteDetailRepository;
+        private readonly ISys_ConfigService _sys_ConfigService;
         private readonly IMapper _mapper;
 
         private Dictionary<string, OrderByType> _taskOrderBy = new()
-            {
-                {nameof(Dt_Task.Grade),OrderByType.Desc },
-                {nameof(Dt_Task.CreateDate),OrderByType.Asc},
-            };
+        {
+            {nameof(Dt_Task.Grade), OrderByType.Desc },
+            {nameof(Dt_Task.CreateDate), OrderByType.Asc},
+        };
 
         public Dictionary<string, OrderByType> TaskOrderBy
         { get { return _taskOrderBy; } set { _taskOrderBy = value; } }
@@ -57,12 +42,13 @@
 
         public List<int> TaskOutboundTypes => typeof(TaskOutboundTypeEnum).GetEnumIndexList();
 
-        public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper) : base(BaseDal)
+        public TaskService(ITaskRepository BaseDal, IRouterService routerService, ITaskExecuteDetailService taskExecuteDetailService, ITaskExecuteDetailRepository taskExecuteDetailRepository, IMapper mapper, ISys_ConfigService sys_ConfigService) : base(BaseDal)
         {
             _routerService = routerService;
             _taskExecuteDetailService = taskExecuteDetailService;
             _taskExecuteDetailRepository = taskExecuteDetailRepository;
             _mapper = mapper;
+            _sys_ConfigService = sys_ConfigService;
         }
 
         /// <summary>
@@ -87,7 +73,6 @@
                     if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                     {
                         List<Dt_Router> routers = _routerService.QueryNextRoutes(item.RoadWay, item.TargetAddress);
-                        //鏆備笉鑰冭檻澶氳矾寰�
                         if (routers.Count > 0)
                         {
                             task.TaskState = (int)TaskOutStatusEnum.OutNew;
@@ -98,7 +83,6 @@
                     else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
                     {
                         List<Dt_Router> routers = _routerService.QueryNextRoutes(item.SourceAddress, item.TargetAddress);
-                        //鏆備笉鑰冭檻澶氳矾寰�
                         if (routers.Count > 0)
                         {
                             task.TaskState = (int)TaskInStatusEnum.InNew;
@@ -127,66 +111,42 @@
         /// <param name="palletCode">鎵樼洏鍙�</param>
         /// <param name="sourceAddress">璧峰鍦板潃</param>
         /// <returns></returns>
-        public WebResponseContent RequestWMSTask(string palletCode, string sourceAddress)
+        public async Task<WebResponseContent> RequestWMSTask(string palletCode, string sourceAddress)
         {
             WebResponseContent content = new WebResponseContent();
             try
             {
-                #region 璇锋眰鍏ュ簱浠诲姟宸烽亾
-                // TODO: 璋冪敤鎺ュ彛鑾峰彇涓嬩竴涓湴鍧�
-                // 鍒涘缓璇锋眰瀵硅薄
-                RequestTaskDto request = new RequestTaskDto()
+                var hasTask = await BaseDal.QueryFirstAsync(x => x.PalletCode == palletCode);
+                if (hasTask != null)
                 {
-                    Position = sourceAddress,
-                    PalletCode = palletCode,
-                };
+                    return content.Error("褰撳墠鎵樼洏瀛樺湪浠诲姟");
+                }
 
-                // 鍙戦�佽姹傚苟绛夊緟鍝嶅簲
-                var result = HttpHelper.PostAsync("http://127.0.0.1:5000/api/Task/RequestTaskAsync", request.ToJsonString()).Result;
+                var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+                var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
+                var requestTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.RequestTask)?.ConfigValue;
+                if (wmsBase == null || requestTask == null)
+                {
+                    throw new InvalidOperationException("WMS IP 鏈厤缃�");
+                }
+                var wmsIpAddrss = wmsBase + requestTask;
 
-                // 鍙嶅簭鍒楀寲鍝嶅簲鍐呭
+                var result = await HttpHelper.PostAsync(wmsIpAddrss, new { Position = sourceAddress, PalletCode = palletCode }.ToJsonString());
                 content = JsonConvert.DeserializeObject<WebResponseContent>(result);
 
-                WMSTaskDTO task = new WMSTaskDTO();
-                // 妫�鏌ョ姸鎬佸苟杩斿洖
                 if (!content.Status)
                 {
-                    task = new WMSTaskDTO()
-                    {
-                        TaskNum = Convert.ToInt32(DateTime.Now.ToString("HHmmss")),
-                        Grade = 1,
-                        PalletCode = palletCode,
-                        RoadWay = "CHSC01",
-                        SourceAddress = sourceAddress,
-                        TargetAddress = "1020",
-                        TaskState = (int)TaskOutStatusEnum.Line_OutExecuting,
-                        Id = 0,
-                        TaskType = (int)TaskOutboundTypeEnum.Outbound
-                    };
-
-                    Dt_Task task1 = _mapper.Map<Dt_Task>(task);
-                    task1.CurrentAddress = task.SourceAddress;
-                    task1.NextAddress = "1020";
-                    BaseDal.AddData(task1);
-                    return content.OK();
-                }
-                else
-                {
-                    // 鍙嶅簭鍒楀寲浠诲姟鏁版嵁
-                    task = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
-                    // 澶勭悊浠诲姟骞惰繑鍥炵粨鏋�
-                    content = ReceiveWMSTask(new List<WMSTaskDTO> { task });
+                    // wms澶辫触杩斿洖鍘籒G鍙d换鍔�
+                    return content;
                 }
 
-
-
-                #endregion
+                var task = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
+                return ReceiveWMSTask(new List<WMSTaskDTO> { task });
             }
             catch (Exception ex)
             {
-                content = WebResponseContent.Instance.Error(ex.Message);
+                return WebResponseContent.Instance.Error(ex.Message);
             }
-            return content;
         }
 
         /// <summary>
@@ -335,7 +295,7 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
-                Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
+                var task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
                 if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
                 if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                 {
@@ -367,7 +327,7 @@
         /// <param name="status">浠诲姟鐘舵��</param>
         public void UpdateTaskStatus(int taskNum, int status)
         {
-            Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
+            var task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
             if (task == null) return;
             task.TaskState = status;
             task.ModifyDate = DateTime.Now;
@@ -383,7 +343,7 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
-                Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
+                var task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
                 if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
                 return UpdateTaskStatusToNext(task);
             }
@@ -407,22 +367,19 @@
                 int oldState = task.TaskState;
                 if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                 {
-                    if (task.TaskState >= (int)TaskOutStatusEnum.OutFinish)
-                    {
-                        return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
-                    }
-
                     int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>();
 
                     task.TaskState = nextStatus;
+
+                    if (task.TaskState == (int)TaskOutStatusEnum.Line_OutFinish)
+                    {
+                        task.ModifyDate = DateTime.Now;
+                        task.Modifier = "System";
+                        BaseDal.DeleteData(task);
+                    }
                 }
                 else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
                 {
-                    if (task.TaskState >= (int)TaskInStatusEnum.InFinish)
-                    {
-                        return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙烦杞埌涓嬩竴姝�,浠诲姟鍙�:銆恵task.TaskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
-                    }
-
                     int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskInStatusEnum>();
                     task.TaskState = nextStatus;
 
@@ -432,14 +389,24 @@
                         #region 鍏ュ簱璋冪敤鎺ュ彛鑾峰彇璐т綅鍦板潃
                         // TODO: 璋冪敤鎺ュ彛鑾峰彇璐т綅鍦板潃
                         // 鍒涘缓璇锋眰瀵硅薄
-                        RequestTaskDto taskDto = new RequestTaskDto()
+                        var taskDto = new RequestTaskDto()
                         {
                             Position = task.NextAddress,
                             PalletCode = task.PalletCode,
                         };
 
+                        // 鑾峰彇WMSip鍦板潃
+                        var configz = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+                        var wmsBasez = configz.Where(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE).FirstOrDefault()?.ConfigValue;
+                        var requestLocation = configz.Where(x => x.ConfigKey == SysConfigKeyConst.RequestLocation).FirstOrDefault()?.ConfigValue;
+                        if (wmsBasez == null || requestLocation == null)
+                        {
+                            throw new InvalidOperationException("WMS IP 鏈厤缃�");
+                        }
+                        var wmsIpAddrss = wmsBasez + requestLocation;
+
                         // 鍙戦�佽姹傚苟绛夊緟鍝嶅簲
-                        var abc = HttpHelper.PostAsync("http://127.0.0.1:5000/api/Task/RequestLocationTaskAsync", taskDto.ToJsonString()).Result;
+                        var abc = HttpHelper.PostAsync(wmsIpAddrss, taskDto.ToJsonString()).Result;
                         if (abc == null)
                             return content.Error();
                         // 鍙嶅簭鍒楀寲鍝嶅簲鍐呭
@@ -450,13 +417,21 @@
                             return content;
 
                         // 鍙嶅簭鍒楀寲浠诲姟鏁版嵁
-                        WMSTaskDTO taskResult = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
+                        var taskResult = JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
 
                         task.CurrentAddress = task.NextAddress;
                         task.NextAddress = taskResult.TargetAddress;
                         task.TargetAddress = task.NextAddress;
                         #endregion
 
+                    }
+                    else if (task.TaskState == (int)TaskInStatusEnum.SC_InFinish)
+                    {
+
+                        task.ModifyDate = DateTime.Now;
+                        task.Modifier = "System";
+
+                        BaseDal.DeleteData(task);
                     }
                 }
                 else
@@ -476,12 +451,17 @@
                 _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, App.User.UserId > 0 ? $"浜哄伐鎵嬪姩灏嗕换鍔$姸鎬佷粠銆恵oldState}銆戣烦杞埌銆恵task.TaskState}銆�" : $"绯荤粺鑷姩娴佺▼锛屼换鍔$姸鎬佷粠銆恵oldState}銆戣浆鍒般�恵task.TaskState}銆�");
 
                 #region  鏇存柊浠诲姟鐘舵��
-                object request = new
+                // 鑾峰彇WMSip鍦板潃
+                var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+                var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
+                var updateTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.UpdateTask)?.ConfigValue;
+                if (wmsBase == null || updateTask == null)
                 {
-                    TaskNum = task.TaskNum,
-                    TaskState = task.TaskState
-                };
-                var result = HttpHelper.PostAsync("http://127.0.0.1:5000/api/Task/UpdateTaskStatus", request.ToJsonString()).Result;
+                    throw new InvalidOperationException("WMS IP 鏈厤缃�");
+                }
+                var wmsIpAddress = wmsBase + updateTask;
+
+                var result = HttpHelper.PostAsync(wmsIpAddress, new { TaskNum = task.TaskNum, TaskState = task.TaskState }.ToJsonString()).Result;
                 content = JsonConvert.DeserializeObject<WebResponseContent>(result);
                 #endregion
 
@@ -504,13 +484,13 @@
         {
             try
             {
-                Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.CurrentAddress == currentAddress);
+                var task = BaseDal.QueryFirst(x => x.TaskNum == taskNum && x.CurrentAddress == currentAddress);
                 if (task == null) throw new Exception($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
 
                 string oldCurrentPos = task.CurrentAddress;
                 string oldNextPos = task.NextAddress;
 
-                List<Dt_Router> routers = _routerService.QueryNextRoutes(task.NextAddress, task.TargetAddress);
+                var routers = _routerService.QueryNextRoutes(task.NextAddress, task.TargetAddress);
                 if (!routers.Any()) throw new Exception($"鏈壘鍒拌澶囪矾鐢变俊鎭�");
 
                 task.CurrentAddress = task.NextAddress;
@@ -539,12 +519,12 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
-                Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
+                var task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
                 if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
 
                 if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup && task.TaskState == (int)TaskOutStatusEnum.SC_OutExecuting)
                 {
-                    List<Dt_Router> routers = _routerService.QueryNextRoutes(task.NextAddress, task.TargetAddress);
+                    var routers = _routerService.QueryNextRoutes(task.NextAddress, task.TargetAddress);
                     if (!routers.Any()) return WebResponseContent.Instance.Error($"鏈壘鍒拌澶囪矾鐢变俊鎭�");
 
                     int nextStatus = task.TaskState.GetNextNotCompletedStatus<TaskOutStatusEnum>();
@@ -569,8 +549,6 @@
                     task.Modifier = "System";
                     BaseDal.UpdateData(task);
                     _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskId, $"鍫嗗灈鏈哄叆搴撳畬鎴�");
-
-
                 }
                 else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
                 {
@@ -587,19 +565,34 @@
 
                 #region WMS鍚屾浠诲姟瀹屾垚
                 var keys = new Dictionary<string, object>()
+            {
+                {"taskNum", taskNum}
+            };
+                // 鑾峰彇WMSip鍦板潃
+                var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+                var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
+                var completeTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.CompleteTask)?.ConfigValue;
+                if (wmsBase == null || completeTask == null)
                 {
-                    {"taskNum", taskNum}
-                };
-                var result = HttpHelper.GetAsync($"http://127.0.0.1:5000/api/Task/CompleteTaskAsync", keys).Result;
+                    throw new InvalidOperationException("WMS IP 鏈厤缃�");
+                }
+                var wmsIpAddress = wmsBase + completeTask;
+
+                var result = HttpHelper.GetAsync(wmsIpAddress, keys).Result;
                 content = JsonConvert.DeserializeObject<WebResponseContent>(result);
                 #endregion
+
+
                 #region  鏇存柊浠诲姟鐘舵��
-                object request = new
+
+                var updateTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.CompleteTask)?.ConfigValue;
+                if (wmsBase == null || updateTask == null)
                 {
-                    TaskNum = task.TaskNum,
-                    TaskState = task.TaskState
-                };
-                result = HttpHelper.PostAsync("http://127.0.0.1:5000/api/Task/UpdateTaskStatus", request.ToJsonString()).Result;
+                    throw new InvalidOperationException("WMS IP 鏈厤缃�");
+                }
+                wmsIpAddress = wmsBase + updateTask;
+
+                result = HttpHelper.PostAsync(wmsIpAddress, new { TaskNum = task.TaskNum, TaskState = task.TaskState }.ToJsonString()).Result;
                 content = JsonConvert.DeserializeObject<WebResponseContent>(result);
                 #endregion
                 //content = WebResponseContent.Instance.OK();
@@ -621,14 +614,14 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
-                Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
+                var task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
                 if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
                 if (task.TaskState != (int)TaskInStatusEnum.InPending && task.TaskState != (int)TaskOutStatusEnum.OutPending)
                 {
                     return content = WebResponseContent.Instance.Error($"璇ヤ换鍔$姸鎬佷笉鍙仮澶�,浠诲姟鍙�:銆恵taskNum}銆�,浠诲姟鐘舵��:銆恵task.TaskState}銆�");
                 }
 
-                Dt_TaskExecuteDetail taskExecuteDetail = _taskExecuteDetailRepository.QueryFirst(x => x.TaskId == task.TaskId && x.IsNormal, new Dictionary<string, OrderByType> { { nameof(Dt_TaskExecuteDetail.TaskDetailId), OrderByType.Desc } });
+                var taskExecuteDetail = _taskExecuteDetailRepository.QueryFirst(x => x.TaskId == task.TaskId && x.IsNormal, new Dictionary<string, OrderByType> { { nameof(Dt_TaskExecuteDetail.TaskDetailId), OrderByType.Desc } });
                 if (taskExecuteDetail != null)
                 {
                     task.TaskState = taskExecuteDetail.TaskState;
@@ -643,7 +636,6 @@
                     {
                         task.TaskState = (int)TaskInStatusEnum.InNew;
                     }
-                    //todo
                 }
 
                 task.ExceptionMessage = string.Empty;
@@ -668,14 +660,14 @@
         /// <returns>杩斿洖澶勭悊缁撴灉</returns>
         public WebResponseContent RollbackTaskStatusToLast(int taskNum)
         {
-            WebResponseContent content = new();
+            WebResponseContent content = new WebResponseContent();
             try
             {
-                Dt_Task task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
+                var task = BaseDal.QueryFirst(x => x.TaskNum == taskNum);
                 if (task == null) return WebResponseContent.Instance.Error($"鏈壘鍒拌浠诲姟淇℃伅,浠诲姟鍙�:銆恵taskNum}銆�");
 
                 int oldState = task.TaskState;
-                Dt_TaskExecuteDetail taskExecuteDetail = _taskExecuteDetailRepository.QueryFirst(x => x.TaskId == task.TaskId && x.TaskState < task.TaskState && x.TaskState > 0, new Dictionary<string, OrderByType> { { nameof(Dt_TaskExecuteDetail.TaskDetailId), OrderByType.Desc } });
+                var taskExecuteDetail = _taskExecuteDetailRepository.QueryFirst(x => x.TaskId == task.TaskId && x.TaskState < task.TaskState && x.TaskState > 0, new Dictionary<string, OrderByType> { { nameof(Dt_TaskExecuteDetail.TaskDetailId), OrderByType.Desc } });
                 if (taskExecuteDetail != null)
                 {
                     task.TaskState = taskExecuteDetail.TaskState;
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/WIDESEAWCS_TaskInfoService.csproj b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/WIDESEAWCS_TaskInfoService.csproj
index f1fe745..a3b8daf 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/WIDESEAWCS_TaskInfoService.csproj
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/WIDESEAWCS_TaskInfoService.csproj
@@ -9,6 +9,7 @@
 	<ItemGroup>
 		<ProjectReference Include="..\WIDESEAWCS_BasicInfoService\WIDESEAWCS_BasicInfoService.csproj" />
 		<ProjectReference Include="..\WIDESEAWCS_ITaskInfoService\WIDESEAWCS_ITaskInfoService.csproj" />
+		<ProjectReference Include="..\WIDESEAWCS_SystemServices\WIDESEAWCS_SystemServices.csproj" />
 	</ItemGroup>
 
 </Project>
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
index 3bd8816..246cca2 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/CommonConveyorLineJob.cs
@@ -1,33 +1,16 @@
-锘�#region << 鐗� 鏈� 娉� 閲� >>
-
-/*----------------------------------------------------------------
- * 鍛藉悕绌洪棿锛歐IDESEAWCS_Tasks.ConveyorLineJob
- * 鍒涘缓鑰咃細鑳$搴�
- * 鍒涘缓鏃堕棿锛�2024/8/2 16:13:36
- * 鐗堟湰锛歏1.0.0
- * 鎻忚堪锛�
- *
- * ----------------------------------------------------------------
- * 淇敼浜猴細
- * 淇敼鏃堕棿锛�
- * 鐗堟湰锛歏1.0.1
- * 淇敼璇存槑锛�
- *
- *----------------------------------------------------------------*/
-
-#endregion << 鐗� 鏈� 娉� 閲� >>
-
-using AutoMapper;
+锘縰sing AutoMapper;
 using HslCommunication;
 using Newtonsoft.Json;
 using Quartz;
 using SqlSugar;
 using System.Reflection;
+using WIDESEAWCS_Common;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.Helper;
 using WIDESEAWCS_DTO.TaskInfo;
 using WIDESEAWCS_IProcessRepository;
+using WIDESEAWCS_ISystemServices;
 using WIDESEAWCS_ITaskInfoRepository;
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
@@ -47,9 +30,10 @@
         private readonly ITaskExecuteDetailService _taskExecuteDetailService;
         private readonly IRouterService _routerService;
         private readonly IPlatFormRepository _platFormRepository;
+        private readonly ISys_ConfigService _sys_ConfigService;
         private readonly IMapper _mapper;
 
-        public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository)
+        public CommonConveyorLineJob(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, IRouterService routerService, IMapper mapper, ITaskRepository taskRepository, IPlatFormRepository platFormRepository, ISys_ConfigService sys_ConfigService)
         {
             _taskService = taskService;
             _taskExecuteDetailService = taskExecuteDetailService;
@@ -57,9 +41,10 @@
             _mapper = mapper;
             _taskRepository = taskRepository;
             _platFormRepository = platFormRepository;
+            _sys_ConfigService = sys_ConfigService;
         }
 
-        public Task Execute(IJobExecutionContext context)
+        public async Task Execute(IJobExecutionContext context)
         {
             try
             {
@@ -67,89 +52,9 @@
                 if (conveyorLine != null)
                 {
                     List<string> childDeviceCodes = _routerService.QueryAllPositions(conveyorLine.DeviceCode);
-                    List<Task> tasks = new List<Task>();
                     foreach (string childDeviceCode in childDeviceCodes)
                     {
-                        //Task task = Task.Run(() =>
-                        //{
-                        ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(childDeviceCode);
-                        ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(childDeviceCode, "DeviceCommand");
-                        if (command != null && commandWrite != null)
-                        {
-                            var structs = BitConverter.GetBytes(commandWrite.WriteInteractiveSignal).Reverse().ToArray().ToBoolArray();
-
-                            List<DeviceProtocolDetailDTO>? deviceProtocolDetails = conveyorLine.DeviceProtocolDetailDTOs.Where(x => x.DeviceProParamName == nameof(ConveyorLineTaskCommand.InteractiveSignal)).ToList();
-
-                            if (deviceProtocolDetails != null)
-                            {
-                                foreach (var item in deviceProtocolDetails)
-                                {
-                                    var outDeviceCodes = _routerService.QueryOutDeviceCodes(conveyorLine.DeviceCode);
-                                    if (structs[item.ProtocalDetailValue.ObjToInt()] == true)
-                                    {
-                                        MethodInfo? method = GetType().GetMethod(item.ProtocolDetailType);
-                                        if (method != null)
-                                        {
-                                            command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
-                                            method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, item.ProtocalDetailValue.ObjToInt() });
-                                        }
-                                    }
-                                    else
-                                    {
-                                        DeviceProDTO? devicePro = conveyorLine.DeviceProDTOs.Where(x => x.DeviceProParamType == nameof(DeviceCommand) && x.DeviceChildCode == childDeviceCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
-                                        string[] x = devicePro.DeviceProAddress.Split('.');
-                                        x[x.Length - 1] = (item.ProtocalDetailValue.ObjToInt() + 1).ToString();
-                                        string DeviceProAddress = string.Join(".", x);
-                                        var writeRead = conveyorLine.Communicator.Read<bool>(DeviceProAddress);
-                                        if (writeRead)
-                                        {
-                                            ConveyorLineSendFinish(conveyorLine, childDeviceCode, item.ProtocalDetailValue.ObjToInt(), false);
-                                        }
-                                    }
-                                }
-                            }
-
-                            Platform platform = _platFormRepository.QueryFirst(x => x.PLCCode == conveyorLine.DeviceCode && x.PlatCode == childDeviceCode && x.Status == "Active");
-                            if (platform != null)
-                            {
-                                if (command.InteractiveSignal != 2)
-                                {
-                                    MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod);
-                                    if (method != null)
-                                    {
-                                        command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
-                                        int count = string.IsNullOrEmpty(platform.Location) ? 0 + 1 : platform.Location.Split(',').Count() + 1;
-                                        method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform });
-                                    }
-                                }
-                                else
-                                {
-                                    if (!string.IsNullOrEmpty(platform.Location))
-                                    {
-                                        var strings = platform.Location.Split(',').ToList();
-                                        foreach (var ite in strings)
-                                        {
-                                            int index = strings.FindIndex(p => p == ite);
-                                            ConveyorLineTaskCommand command1 = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(ite);
-                                            if (command1.InteractiveSignal != 2)
-                                            {
-                                                MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod);
-                                                if (method != null)
-                                                {
-                                                    command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
-                                                    int count = strings.Count - index;
-                                                    method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform });
-                                                }
-                                            }
-                                        }
-                                    }
-                                }
-                            }
-                        }
-                        //});
-
-                        //tasks.Add(task);
-                        Task.WaitAll(tasks.ToArray());
+                        await ProcessDeviceAsync(conveyorLine, childDeviceCode);
                     }
                 }
             }
@@ -157,13 +62,84 @@
             {
                 Console.Out.WriteLine(nameof(CommonConveyorLineJob) + ":" + ex.ToString());
             }
-            finally
-            {
-                //WriteDebug("CommonConveyorLineJob", "test");
-                //Console.Out.WriteLine(DateTime.Now);
-            }
+        }
 
-            return Task.CompletedTask;
+        private async Task ProcessDeviceAsync(CommonConveyorLine conveyorLine, string childDeviceCode)
+        {
+            ConveyorLineTaskCommand command = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(childDeviceCode);
+            ConveyorLineTaskCommandWrite commandWrite = conveyorLine.ReadCustomer<ConveyorLineTaskCommandWrite>(childDeviceCode, "DeviceCommand");
+            if (command != null && commandWrite != null)
+            {
+                var structs = BitConverter.GetBytes(commandWrite.WriteInteractiveSignal).Reverse().ToArray().ToBoolArray();
+
+                List<DeviceProtocolDetailDTO>? deviceProtocolDetails = conveyorLine.DeviceProtocolDetailDTOs.Where(x => x.DeviceProParamName == nameof(ConveyorLineTaskCommand.InteractiveSignal)).ToList();
+
+                if (deviceProtocolDetails != null)
+                {
+                    foreach (var item in deviceProtocolDetails)
+                    {
+                        var outDeviceCodes = _routerService.QueryOutDeviceCodes(conveyorLine.DeviceCode);
+                        if (structs[item.ProtocalDetailValue.ObjToInt()] == true)
+                        {
+                            MethodInfo? method = GetType().GetMethod(item.ProtocolDetailType);
+                            if (method != null)
+                            {
+                                command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
+                                method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, item.ProtocalDetailValue.ObjToInt() });
+                            }
+                        }
+                        else
+                        {
+                            DeviceProDTO? devicePro = conveyorLine.DeviceProDTOs.Where(x => x.DeviceProParamType == nameof(DeviceCommand) && x.DeviceChildCode == childDeviceCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
+                            string[] x = devicePro.DeviceProAddress.Split('.');
+                            x[x.Length - 1] = (item.ProtocalDetailValue.ObjToInt() + 1).ToString();
+                            string DeviceProAddress = string.Join(".", x);
+                            var writeRead = conveyorLine.Communicator.Read<bool>(DeviceProAddress);
+                            if (writeRead)
+                            {
+                                ConveyorLineSendFinish(conveyorLine, childDeviceCode, item.ProtocalDetailValue.ObjToInt(), false);
+                            }
+                        }
+                    }
+                }
+
+                Platform platform = _platFormRepository.QueryFirst(x => x.PLCCode == conveyorLine.DeviceCode && x.PlatCode == childDeviceCode && x.Status == "Active");
+                if (platform != null)
+                {
+                    if (command.InteractiveSignal != 2)
+                    {
+                        MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod);
+                        if (method != null)
+                        {
+                            command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
+                            int count = string.IsNullOrEmpty(platform.Location) ? 0 + 1 : platform.Location.Split(',').Count() + 1;
+                            method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform });
+                        }
+                    }
+                    else
+                    {
+                        if (!string.IsNullOrEmpty(platform.Location))
+                        {
+                            var strings = platform.Location.Split(',').ToList();
+                            foreach (var ite in strings)
+                            {
+                                int index = strings.FindIndex(p => p == ite);
+                                ConveyorLineTaskCommand command1 = conveyorLine.ReadCustomer<ConveyorLineTaskCommand>(ite);
+                                if (command1.InteractiveSignal != 2)
+                                {
+                                    MethodInfo? method = GetType().GetMethod(platform.ExecutionMethod);
+                                    if (method != null)
+                                    {
+                                        command.InteractiveSignal = commandWrite.WriteInteractiveSignal;
+                                        int count = strings.Count - index;
+                                        method.Invoke(this, new object[] { conveyorLine, command, childDeviceCode, count, platform });
+                                    }
+                                }
+                            }
+                        }
+                    }
+                }
+            }
         }
 
         /// <summary>
@@ -177,14 +153,9 @@
         {
             try
             {
-                // 鑾峰彇涓嬩竴涓换鍔�
                 var task = _taskService.QueryBarCodeConveyorLineTask(command.Barcode, childDeviceCode);
-                //var taskOut = _taskService.QueryNextConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
-                //return;
-                // 澶勭悊鍑哄簱浠诲姟
                 HandleTaskOut(conveyorLine, command, childDeviceCode, ProtocalDetailValue, task);
 
-                // 濡傛灉娌℃湁鍑哄簱浠诲姟锛屽鐞嗘柊浠诲姟
                 if (task == null && command.Barcode != "NoRead")
                 {
                     HandleNewTask(conveyorLine, command, childDeviceCode, ProtocalDetailValue);
@@ -192,34 +163,9 @@
             }
             catch (Exception ex)
             {
-                return;
+                Console.Out.WriteLine(ex.ToString());
             }
         }
-
-        #region 杈撻�佺嚎璇锋眰鍏ュ簱涓嬩竴鍦板潃
-
-        /// <summary>
-        /// 杈撻�佺嚎璇锋眰鍏ュ簱涓嬩竴鍦板潃
-        /// </summary>
-        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
-        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
-        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
-        //public void RequestInNextAddress(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode)
-        //{
-        //    Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
-        //    if (task != null)
-        //    {
-        //        Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress);
-        //        if (newTask != null)
-        //        {
-        //            ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(newTask);
-        //            taskCommand.InteractiveSignal = command.InteractiveSignal;
-        //            conveyorLine.SendCommand(taskCommand, childDeviceCode);
-        //        }
-        //    }
-        //}
-
-        #endregion
 
         /// <summary>
         /// 杈撻�佺嚎鍏ュ簱瀹屾垚
@@ -230,15 +176,14 @@
         /// <param name="ProtocalDetailValue">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
         public void ConveyorLineInFinish(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue)
         {
-            Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+            var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
             if (task != null && task.TaskState != (int)TaskInStatusEnum.Line_InFinish)
             {
                 ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
 
-                //conveyorLine.SetValue(ConveyorLineDBName.WriteInteractiveSignal, 0, childDeviceCode);
                 WebResponseContent content = _taskService.UpdateTaskStatusToNext(task);
 
-                //Console.Out.WriteLine(content.Serialize());
+                Console.Out.WriteLine(content.Serialize());
             }
         }
 
@@ -251,7 +196,7 @@
         /// <param name="ProtocalDetailValue">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
         public void RequestOutbound(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue)
         {
-            Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
+            var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
             if (task != null)
             {
                 ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(task);
@@ -262,28 +207,6 @@
                 _taskService.UpdateTaskStatusToNext(task);
             }
         }
-
-        /// <summary>
-        /// 杈撻�佺嚎璇锋眰鍑哄簱涓嬩竴鍦板潃
-        /// </summary>
-        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
-        /// <param name="command">璇诲彇鐨勮姹備俊鎭�</param>
-        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
-        public void RequestOutNextAddress(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode)
-        {
-            Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
-            if (task != null)
-            {
-                Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress);
-                if (newTask != null)
-                {
-                    ConveyorLineTaskCommand taskCommand = _mapper.Map<ConveyorLineTaskCommand>(newTask);
-                    taskCommand.InteractiveSignal = command.InteractiveSignal;
-                    conveyorLine.SendCommand(taskCommand, childDeviceCode);
-                }
-            }
-        }
-
         /// <summary>
         /// 杈撻�佺嚎鍑哄簱瀹屾垚
         /// </summary>
@@ -292,7 +215,7 @@
         /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
         public void ConveyorLineOutFinish(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue)
         {
-            Dt_Task task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
+            var task = _taskService.QueryExecutingConveyorLineTask(command.TaskNum, childDeviceCode);
             if (task != null)
             {
                 WebResponseContent content = new WebResponseContent();
@@ -312,6 +235,22 @@
                 ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
                 content = _taskService.UpdateTaskStatusToNext(task);
             }
+        }
+
+        /// <summary>
+        /// 杈撻�佺嚎浜や簰瀹屾垚
+        /// </summary>
+        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
+        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
+        /// <param name="ProtocalDetailValue">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
+        /// <param name="value">鍊�</param>
+        public void ConveyorLineSendFinish(CommonConveyorLine conveyorLine, string childDeviceCode, int ProtocalDetailValue, bool value)
+        {
+            DeviceProDTO? devicePro = conveyorLine.DeviceProDTOs.Where(x => x.DeviceProParamType == nameof(DeviceCommand) && x.DeviceChildCode == childDeviceCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
+            string[] x = devicePro.DeviceProAddress.Split('.');
+            x[x.Length - 1] = (ProtocalDetailValue + 1).ToString();
+            string DeviceProAddress = string.Join(".", x);
+            conveyorLine.Communicator.Write(DeviceProAddress, value);
         }
 
         /// <summary>
@@ -348,14 +287,20 @@
                 #region 璋冪敤WMS鑾峰彇鍑哄簱浠诲姟
 
                 WMSTaskDTO taskDTO = new WMSTaskDTO();
-                object dynamic = new
+
+                // 鑾峰彇WMSip鍦板潃
+                var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+                var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
+                var requestTrayOutTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.RequestTrayOutTask)?.ConfigValue;
+                if (wmsBase == null || requestTrayOutTask == null)
                 {
-                    position = childDeviceCode,
-                    tag = (int)taskType,
-                    areaCdoe = roadWay,
-                    roadways = roadways
-                };
-                var result = await HttpHelper.PostAsync("http://localhost:5000/api/Task/RequestTrayOutTaskAsync", dynamic.ToJsonString());
+                    throw new InvalidOperationException("WMS IP 鏈厤缃�");
+                }
+                var wmsIpAddress = wmsBase + requestTrayOutTask;
+
+
+                var result = await HttpHelper.PostAsync(wmsIpAddress, new { position = childDeviceCode, tag = (int)taskType, areaCdoe = roadWay, roadways = roadways }.ToJsonString());
+                //var result = await HttpHelper.PostAsync("http://localhost:5000/api/Task/RequestTrayOutTaskAsync", dynamic.ToJsonString());
 
                 WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
 
@@ -382,22 +327,6 @@
                 Console.WriteLine($"{taskDTO.TaskType}鍛煎彨鎴愬姛");
             }
             return content;
-        }
-
-        /// <summary>
-        /// 杈撻�佺嚎浜や簰瀹屾垚
-        /// </summary>
-        /// <param name="conveyorLine">杈撻�佺嚎瀹炰緥瀵硅薄</param>
-        /// <param name="childDeviceCode">瀛愯澶囩紪鍙�</param>
-        /// <param name="ProtocalDetailValue">绾夸綋褰撳墠bool璇诲彇鍋忕Щ鍦板潃</param>
-        /// <param name="value">鍊�</param>
-        public void ConveyorLineSendFinish(CommonConveyorLine conveyorLine, string childDeviceCode, int ProtocalDetailValue, bool value)
-        {
-            DeviceProDTO? devicePro = conveyorLine.DeviceProDTOs.Where(x => x.DeviceProParamType == nameof(DeviceCommand) && x.DeviceChildCode == childDeviceCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
-            string[] x = devicePro.DeviceProAddress.Split('.');
-            x[x.Length - 1] = (ProtocalDetailValue + 1).ToString();
-            string DeviceProAddress = string.Join(".", x);
-            conveyorLine.Communicator.Write(DeviceProAddress, value);
         }
     }
 }
\ No newline at end of file
diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs
index ba0e4d3..45729cc 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/Task/RequestInbound.cs
@@ -12,8 +12,8 @@
 using WIDESEAWCS_QuartzJob;
 using WIDESEAWCS_Tasks.ConveyorLineJob;
 using HslCommunication;
-using OfficeOpenXml.ConditionalFormatting;
 using WIDESEAWCS_DTO.WMS;
+using WIDESEAWCS_Common;
 
 namespace WIDESEAWCS_Tasks
 {
@@ -24,29 +24,22 @@
         /// </summary>
         private void HandleTaskOut(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue, Dt_Task taskOut)
         {
-            // 濡傛灉娌℃湁浠诲姟锛岀洿鎺ヨ繑鍥�
             if (taskOut == null) return;
 
-            // 鏄犲皠浠诲姟鍛戒护
             var taskCommand = MapTaskCommand(taskOut, command);
 
-            // 鏍规嵁涓嶅悓鐨勪换鍔$被鍨嬪拰鐘舵�佹墽琛屼笉鍚岀殑閫昏緫
             bool isOutTray = taskOut.TaskType == (int)TaskOutboundTypeEnum.OutTray;
             bool isOutboundAndOutFinish = taskOut.TaskType == (int)TaskOutboundTypeEnum.Outbound && taskOut.TaskState == (int)TaskOutStatusEnum.SC_OutFinish;
             bool isOutboundAndLineOutExecuting = taskOut.TaskType == (int)TaskOutboundTypeEnum.Outbound && taskOut.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting;
 
             if (isOutTray || isOutboundAndOutFinish || !isOutboundAndLineOutExecuting)
             {
-                // 鍙戦�佸懡浠ゅ埌杈撻�佺嚎
                 conveyorLine.SendCommand(taskCommand, childDeviceCode);
-                // 鏍囪鍙戦�佸畬鎴�
                 ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-                // 鏇存柊浠诲姟鐘舵��
                 _taskService.UpdateTaskStatusToNext(taskOut);
             }
             else if (taskOut.TaskType == (int)TaskOutboundTypeEnum.OutTray && taskOut.TaskState == (int)TaskOutStatusEnum.Line_OutExecuting)
             {
-                // 瀹屾垚WMS浠诲姟
                 CompleteWmsTask(taskOut, command, conveyorLine, childDeviceCode, ProtocalDetailValue);
             }
         }
@@ -56,20 +49,13 @@
         /// </summary>
         private void HandleNewTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue)
         {
-            // 鐗瑰畾鏉′欢涓嬪垱寤哄苟鍙戦�佺┖鎵樼洏鍏ュ簱浠诲姟
             if ((conveyorLine.DeviceCode == "1003" && childDeviceCode == "1016") || (conveyorLine.DeviceCode == "1005" && childDeviceCode == "1048"))
             {
-                // 璇锋眰WMS绌烘墭鐩樹换鍔�
                 CreateAndSendEmptyTrayTask(conveyorLine, command, childDeviceCode, ProtocalDetailValue);
             }
             else if ((conveyorLine.DeviceCode == "1001" && childDeviceCode == "1088") || (conveyorLine.DeviceCode == "1004" && childDeviceCode == "1339"))
             {
-                // 璇锋眰WMS鍏ュ簱浠诲姟
                 RequestWmsTask(conveyorLine, command, childDeviceCode, ProtocalDetailValue);
-            }
-            else if ((conveyorLine.DeviceCode == "1001" && childDeviceCode == "1073") || (conveyorLine.DeviceCode == "1003" && childDeviceCode == "1002"))
-            {
-                //TODO 鍙戦�佺洿鎺ュ幓NG鍙d换鍔�
             }
         }
 
@@ -78,7 +64,6 @@
         /// </summary>
         private ConveyorLineTaskCommand MapTaskCommand(Dt_Task task, ConveyorLineTaskCommand command)
         {
-            // 浣跨敤mapper鏄犲皠浠诲姟鍛戒护
             var comm = _mapper.Map<ConveyorLineTaskCommand>(task);
             comm.InteractiveSignal = command.InteractiveSignal;
             return comm;
@@ -89,25 +74,30 @@
         /// </summary>
         private void CompleteWmsTask(Dt_Task taskOut, ConveyorLineTaskCommand command, CommonConveyorLine conveyorLine, string childDeviceCode, int ProtocalDetailValue)
         {
-            // 濡傛灉娌℃湁鏉$爜淇℃伅锛屽垯璁剧疆鐩爣鍦板潃涓篘G鍦板潃
             if (command.Barcode == "NoRead")
             {
                 var NGAddress = _platFormRepository.QueryFirst(x => x.PlatCode == taskOut.TargetAddress).Capacity;
                 taskOut.TargetAddress = NGAddress.ToString();
             }
 
-            // TODO璋冪敤WMS浠诲姟瀹屾垚鎺ュ彛
             var keys = new Dictionary<string, object>()
-                {
-                    {"taskNum", taskOut.TaskNum}
-                };
-            var result = HttpHelper.GetAsync($"http://127.0.0.1:5000/api/Task/CompleteTaskAsync", keys).Result;
+            {
+                {"taskNum", taskOut.TaskNum}
+            };
+            var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+            var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
+            var completeTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.CompleteTask)?.ConfigValue;
+            if (wmsBase == null || completeTask == null)
+            {
+                throw new InvalidOperationException("WMS IP 鏈厤缃�");
+            }
+            var wmsIpAddress = wmsBase + completeTask;
+
+            var result = HttpHelper.GetAsync(wmsIpAddress, keys).Result;
             WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
             if (content.Status)
             {
-                // 鏍囪鍙戦�佸畬鎴�
                 ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-                // 鏇存柊浠诲姟鐘舵��
                 _taskService.UpdateTaskStatusToNext(taskOut);
             }
         }
@@ -119,23 +109,23 @@
         {
             if (command.Barcode != "NoRead")
             {
-                // 鍒涘缓绌烘墭鐩樹换鍔TO
-                WMSTaskDTO taskDTO = CreateEmptyTrayTaskDto(command.Barcode, childDeviceCode);
-                // 鍒涘缓骞跺彂閫佷换鍔�
-                WebResponseContent content = CreateAndSendTask(taskDTO);
+                var taskDTO = CreateEmptyTrayTaskDto(command.Barcode, childDeviceCode);
+
+                if (_taskRepository.QueryFirst(x => x.PalletCode == taskDTO.PalletCode) != null)
+                {
+                    WriteInfo(conveyorLine.DeviceName, "褰撳墠鎵樼洏瀛樺湪浠诲姟");
+                    return;
+                }
+
+                var content = CreateAndSendTask(taskDTO);
                 if (content.Status)
                 {
-                    // 鏌ヨ浠诲姟
-                    Dt_Task task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
+                    var task = _taskService.QueryConveyorLineTask(conveyorLine.DeviceCode, childDeviceCode);
                     if (task != null)
                     {
-                        // 鏄犲皠浠诲姟鍛戒护
-                        ConveyorLineTaskCommand taskCommand = MapTaskCommand(task, command);
-                        // 鍙戦�佸懡浠ゅ埌杈撻�佺嚎
+                        var taskCommand = MapTaskCommand(task, command);
                         conveyorLine.SendCommand(taskCommand, childDeviceCode);
-                        // 鏍囪鍙戦�佸畬鎴�
                         ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-                        // 鏇存柊浠诲姟鐘舵��
                         _taskService.UpdateTaskStatusToNext(task);
                     }
                 }
@@ -147,49 +137,51 @@
         /// </summary>
         private WMSTaskDTO CreateEmptyTrayTaskDto(string barcode, string childDeviceCode)
         {
-            #region 鍚慦MS璇锋眰绌烘墭鐩樹换鍔�
-            WMSTaskDTO wMSTaskDTO = new WMSTaskDTO();
-            RequestTaskDto request = new RequestTaskDto()
+            var request = new RequestTaskDto()
             {
                 Position = childDeviceCode,
                 PalletCode = barcode,
             };
-            var result = HttpHelper.PostAsync("http://127.0.0.1:5000/api/Task/RequestTrayInTaskAsync", request.ToJsonString()).Result;
+
+            var config = _sys_ConfigService.GetConfigsByCategory(CateGoryConst.CONFIG_SYS_IPAddress);
+            var wmsBase = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.WMSIP_BASE)?.ConfigValue;
+            var requestTrayInTask = config.FirstOrDefault(x => x.ConfigKey == SysConfigKeyConst.RequestTrayInTask)?.ConfigValue;
+            if (wmsBase == null || requestTrayInTask == null)
+            {
+                throw new InvalidOperationException("WMS IP 鏈厤缃�");
+            }
+            var wmsIpAddrss = wmsBase + requestTrayInTask;
+            var result = HttpHelper.PostAsync(wmsIpAddrss, request.ToJsonString()).Result;
             if (result == null)
-                return wMSTaskDTO;
+                return new WMSTaskDTO();
 
             WebResponseContent content = JsonConvert.DeserializeObject<WebResponseContent>(result);
-            // 妫�鏌ョ姸鎬佸苟杩斿洖
             if (!content.Status)
-                return wMSTaskDTO;
+                return new WMSTaskDTO();
 
             return JsonConvert.DeserializeObject<WMSTaskDTO>(content.Data.ToString());
-
-            #endregion 鍚慦MS璇锋眰绌烘墭鐩樹换鍔�
         }
 
         /// <summary>
         /// 璇锋眰WMS浠诲姟
         /// </summary>
-        private void RequestWmsTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue)
+        private async void RequestWmsTask(CommonConveyorLine conveyorLine, ConveyorLineTaskCommand command, string childDeviceCode, int ProtocalDetailValue)
         {
-            // 璇锋眰WMS浠诲姟
-            if (_taskService.RequestWMSTask(command.Barcode, childDeviceCode).Status)
+            var content = await _taskService.RequestWMSTask(command.Barcode, childDeviceCode);
+            if (content.Status)
             {
-                // 鏌ヨ浠诲姟
-                Dt_Task task = _taskService.QueryBarCodeConveyorLineTask(command.Barcode, childDeviceCode);
+                var task = _taskService.QueryBarCodeConveyorLineTask(command.Barcode, childDeviceCode);
                 if (task != null)
                 {
-                    // 鏄犲皠浠诲姟鍛戒护
-                    ConveyorLineTaskCommand taskCommand = MapTaskCommand(task, command);
-                    // 鍙戦�佸懡浠ゅ埌杈撻�佺嚎
+                    var taskCommand = MapTaskCommand(task, command);
                     conveyorLine.SendCommand(taskCommand, childDeviceCode);
-                    // 鏍囪鍙戦�佸畬鎴�
                     ConveyorLineSendFinish(conveyorLine, childDeviceCode, ProtocalDetailValue, true);
-                    // 鏇存柊浠诲姟鐘舵��
                     _taskService.UpdateTaskStatusToNext(task);
                 }
             }
+            else
+                WriteInfo(conveyorLine.DeviceName, content.Message);
         }
     }
-}
\ No newline at end of file
+}
+           
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/obj/Debug/net6.0/WIDESEA_Common.GeneratedMSBuildEditorConfig.editorconfig b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/obj/Debug/net6.0/WIDESEA_Common.GeneratedMSBuildEditorConfig.editorconfig
deleted file mode 100644
index c260318..0000000
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/obj/Debug/net6.0/WIDESEA_Common.GeneratedMSBuildEditorConfig.editorconfig
+++ /dev/null
@@ -1,13 +0,0 @@
-is_global = true
-build_property.TargetFramework = net6.0
-build_property.TargetPlatformMinVersion = 
-build_property.UsingMicrosoftNETSdkWeb = 
-build_property.ProjectTypeGuids = 
-build_property.InvariantGlobalization = 
-build_property.PlatformNeutralAssembly = 
-build_property.EnforceExtendedAnalyzerRules = 
-build_property._SupportedPlatformList = Linux,macOS,Windows
-build_property.RootNamespace = WIDESEA_Common
-build_property.ProjectDir = F:\BaiBuLiKu\Code Management\WMS\WIDESEA_WMSServer\WIDESEA_Common\
-build_property.EnableComHosting = 
-build_property.EnableGeneratedComInterfaceComImportInterop = 
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/obj/WIDESEA_Common.csproj.nuget.g.props b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/obj/WIDESEA_Common.csproj.nuget.g.props
deleted file mode 100644
index adaddbd..0000000
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_Common/obj/WIDESEA_Common.csproj.nuget.g.props
+++ /dev/null
@@ -1,16 +0,0 @@
-锘�<?xml version="1.0" encoding="utf-8" standalone="no"?>
-<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-  <PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
-    <RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
-    <RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
-    <ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">$(MSBuildThisFileDirectory)project.assets.json</ProjectAssetsFile>
-    <NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">$(UserProfile)\.nuget\packages\</NuGetPackageRoot>
-    <NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">C:\Users\绔炵敺\.nuget\packages\;E:\vsTOOl\NuGetPackages</NuGetPackageFolders>
-    <NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">PackageReference</NuGetProjectStyle>
-    <NuGetToolVersion Condition=" '$(NuGetToolVersion)' == '' ">6.11.1</NuGetToolVersion>
-  </PropertyGroup>
-  <ItemGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
-    <SourceRoot Include="C:\Users\绔炵敺\.nuget\packages\" />
-    <SourceRoot Include="E:\vsTOOl\NuGetPackages\" />
-  </ItemGroup>
-</Project>
\ No newline at end of file
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/AgingInOrOutInput/AgingInOrOutInputService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/AgingInOrOutInput/AgingInOrOutInputService.cs
index b33d0ed..8d204a7 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/AgingInOrOutInput/AgingInOrOutInputService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/AgingInOrOutInput/AgingInOrOutInputService.cs
@@ -23,7 +23,7 @@
         try
         {
             input.SessionId = Guid.NewGuid().ToString();
-            input.EmployeeNo = "T00001";
+            input.EmployeeNo = "MITest";
             input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
             var inputJson = input.ToDictionary();
             var x = await HttpsClient.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/AgingInput", inputJson);
@@ -52,7 +52,7 @@
         try
         {
             input.SessionId = Guid.NewGuid().ToString();
-            input.EmployeeNo = "T00001";
+            input.EmployeeNo = "MITest";
             input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ"); 
             var inputJson = input.ToDictionary();
             var x = await HttpsClient.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/AgingOutput", inputJson);
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs
index 1459cc2..f0ccf06 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/CellState/CellStateService.cs
@@ -1,5 +1,6 @@
 锘縰sing LogLibrary.Log;
 using Masuit.Tools;
+using Newtonsoft.Json;
 using WIDESEA_Common;
 using WIDESEA_Core;
 using WIDESEA_DTO;
@@ -30,7 +31,7 @@
         try
         {
             input.SessionId = Guid.NewGuid().ToString();
-            input.EmployeeNo = "T00001";
+            input.EmployeeNo = "MITest";
             input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
             var inputJson = input.ToDictionary();
             var x = await HttpsClient.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/CellState", inputJson);
@@ -71,6 +72,8 @@
         {
             Console.WriteLine(err.Message.ToString());
             LogFactory.GetLog("鍗曠數鑺睘鎬ц幏鍙�").Error(true, $"\r\r--------------------------------------");
+            LogFactory.GetLog("鍗曠數鑺睘鎬ц幏鍙�").Error(true, $"璇锋眰鍙傛暟: {JsonConvert.SerializeObject(input)}");
+            LogFactory.GetLog("鍗曠數鑺睘鎬ц幏鍙�").Error(true, err.Message);
             LogFactory.GetLog("鍗曠數鑺睘鎬ц幏鍙�").Error(true, err.StackTrace);
         }
         return Task.FromResult<dynamic>(null);
@@ -87,7 +90,7 @@
         try
         {
             input.SessionId = Guid.NewGuid().ToString();
-            input.EmployeeNo = "T00001";
+            input.EmployeeNo = "MITest";
             input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
             var inputJson = input.ToDictionary();
             var x = await HttpsClient.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/TrayCellsStatus", inputJson);
@@ -125,6 +128,8 @@
         {
             Console.WriteLine(err.Message.ToString());
             LogFactory.GetLog("鏁寸洏鐢佃姱灞炴�ц幏鍙�").Error(true, $"\r\r--------------------------------------");
+            LogFactory.GetLog("鏁寸洏鐢佃姱灞炴�ц幏鍙�").Error(true, $"璇锋眰鍙傛暟: {JsonConvert.SerializeObject(input)}");
+            LogFactory.GetLog("鏁寸洏鐢佃姱灞炴�ц幏鍙�").Error(true, err.Message);
             LogFactory.GetLog("鏁寸洏鐢佃姱灞炴�ц幏鍙�").Error(true, err.StackTrace);
         }
         return content;
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs
index 2a36c02..46170cc 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/ProcessApply/ProcessApplyService.cs
@@ -24,7 +24,7 @@
         try
         {
             input.SessionId = Guid.NewGuid().ToString();
-            input.EmployeeNo = "T00001";
+            input.EmployeeNo = "MITest";
             input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
             var inputIson = input.ToDictionary();
             var x = await HttpsClient.PostAsync("http://ts-momapp01:12020/api/MachineIntegration/ProcessApply", inputIson);
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/Unbind/UnbindService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/Unbind/UnbindService.cs
index f4f8c6e..4d71a53 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/Unbind/UnbindService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StoragIntegrationServices/MOM/Unbind/UnbindService.cs
@@ -28,7 +28,7 @@
             input.SessionId = Guid.NewGuid().ToString();
             input.Software = "WMS";
             input.EquipmentCode = "ECH001-B";
-            input.EmployeeNo = "T00001";
+            input.EmployeeNo = "MITest";
             input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
             var inputJson = input.ToDictionary();
             LogFactory.GetLog("鎵樼洏鍗曠數鑺В缁�1").Info(true, JsonConvert.SerializeObject(inputJson));
@@ -57,7 +57,7 @@
             input.SessionId = Guid.NewGuid().ToString();
             input.Software = "WMS";
             input.EquipmentCode = "ECH001-B";
-            input.EmployeeNo = "T00001";
+            input.EmployeeNo = "MITest";
             input.RequestTime = TimeZoneInfo.ConvertTimeToUtc(DateTime.Now).ToString("yyyy-MM-ddTHH:mm:ss.fffZ");
             var inputJson = input.ToDictionary();
             Console.WriteLine(inputJson);
diff --git a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
index dbe3053..177bc6e 100644
--- a/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
+++ b/Code Management/WMS/WIDESEA_WMSServer/WIDESEA_StorageTaskServices/Task/Dt_TaskService.cs
@@ -144,7 +144,7 @@
                     ParameterCode = y.ParameterCode,
                     ParameterDesc = y.Description,
                     TargetValue = y.TargetValue,
-                    Value = ( DateTime.Parse(stock.LinedProcessFeedbackTime, null, System.Globalization.DateTimeStyles.RoundtripKind).ToLocalTime() - stock.CreateDate).TotalMinutes.ToString(),
+                    Value = (DateTime.Parse(stock.LinedProcessFeedbackTime, null, System.Globalization.DateTimeStyles.RoundtripKind).ToLocalTime() - stock.CreateDate).TotalMinutes.ToString(),
                     DefectCode = y.UOMCode
                 }).ToList()
             }).ToList()
@@ -396,6 +396,7 @@
                 {
                     MaterielCode = "绌烘墭鐩�",
                     Id = 0,
+                    Status = (int)StockStateEmun.宸插叆搴�
                 }
             }
         };
@@ -407,6 +408,7 @@
     private DtStockInfo CreateFullPalletStock(Dt_Task task, DtLocationInfo locationInf, DtBoxingInfo boxing)
     {
         var boxDetail = boxing.BoxingInfoDetails.Adapt<List<DtStockInfoDetail>>();
+        boxDetail.ForEach(x => { x.Status = (int)StockStateEmun.宸插叆搴�; });
         var stock = new DtStockInfo()
         {
             PalletCode = task.PalletCode,
@@ -529,6 +531,7 @@
             {
                 Software = "WMS",
                 TrayBarcode = input.PalletCode,
+                //EquipmentCode = "EQ_CWJZ01"
                 EquipmentCode = "ECH001-B"
             };
 
@@ -544,9 +547,9 @@
                 return content.Error(result.MOMMessage);
 
             // TODO 鑾峰彇鏈湴鏂欐灞炴�т笌鏁寸洏鐢佃姱灞炴�ц幏鍙栫殑鍊艰繘琛屽姣旓紝濡傛灉涓�鑷村垯缁х画锛屽惁鍒欒繑鍥為敊璇俊鎭�
-            var productions = await _productionRepository.QueryDataAsync(x => result.TrayBarcodePropertys.Select(x => x.TrayBarcodeProperty).ToList().Contains(x.TrayBarcodeProperty));
-            if (productions.Count <= 0)
-                return content.Error("鏂欐灞炴�т笉瀛樺湪");
+            //var productions = await _productionRepository.QueryDataAsync(x => result.TrayBarcodePropertys.Select(x => x.TrayBarcodeProperty).ToList().Contains(x.TrayBarcodeProperty));
+            //if (productions.Count <= 0)
+            //    return content.Error("鏂欐灞炴�т笉瀛樺湪");
 
             // 璋冪敤CreateBoxingInfo鏂规硶锛屽垱寤虹粍鐩樹俊鎭�
 
@@ -570,7 +573,7 @@
 
             List<string> strings = input.Position == "1088" ? new List<string>() { "CHSC01" } : new List<string>() { "JZSC01" };
             // 璋冪敤CreateNewTask鏂规硶锛屽垱寤烘柊浠诲姟
-            content =  await CreateNewTask(input, strings);
+            content = await CreateNewTask(input, strings);
             if (content.Status)
             {
                 var isBox = await _boxingInfoRepository.AddDataNavAsync(boxing);
@@ -642,7 +645,11 @@
                 return content.OK(data: task);
             }
 
-            return await CreateNewTask(input, null, 1);
+            // 鑾峰彇鐩爣鍦板潃
+            List<string> strings = input.Position == "1016" ? new List<string>() { "CHSC01" } : new List<string>() { "JZSC01" };
+
+            return await CreateNewTask(input, strings, 1);
+            //return await CreateNewTask(input, null, 1);
         }
         catch (Exception)
         {
@@ -743,12 +750,20 @@
         {
             // 鏍规嵁鎵樼洏绫诲瀷鏌ヨ搴撳瓨淇℃伅
             DtStockInfo stockInfo = tag == (int)TaskOutboundTypeEnum.Outbound
-                ? QueryStockInfoForRealTray(areaCode, roadways)
-                : QueryStockInfoForEmptyTray(areaCode, roadways);
+                ? QueryStockInfoForRealTrayAsync(areaCode, roadways).Result
+                : QueryStockInfoForEmptyTrayAsync(areaCode, roadways).Result;
 
             if (stockInfo == null)
             {
                 return content.Error("搴撳瓨淇℃伅涓嶅瓨鍦�");
+            }
+
+            // 鏂板閲嶅浠诲姟鏍¢獙
+            var hasTask = BaseDal.QueryFirst(x => x.PalletCode == stockInfo.PalletCode);
+            if (hasTask != null)
+            {
+                WMSTaskDTO taskDTO1 = CreateTaskDTO(hasTask);
+                return content.OK("宸插瓨鍦ㄧ┖鐩樺嚭搴撲换鍔�", data: taskDTO1);
             }
 
             // 鍒涘缓鏂颁换鍔″疄渚�
@@ -783,26 +798,33 @@
     /// <summary>
     /// 鏌ヨ瀹炵洏搴撳瓨淇℃伅
     /// </summary>
-    private DtStockInfo QueryStockInfoForRealTray(string areaCode, List<string> roadways)
+    private async Task<DtStockInfo> QueryStockInfoForRealTrayAsync(string areaCode, List<string> roadways)
     {
         // TODO鏃堕棿鏍规嵁MOM绯荤粺閰嶇疆鐨勫嚭搴撴椂闂存潵鑾峰彇,鏆傛椂涓嶇煡閬揗OM杩斿洖鐨勬椂闂存槸浠�涔堟墍浠ヨ繖閲屾祴璇曟椂鍊欏湪鏀�
-        return _stockInfoRepository.Db.Queryable<DtStockInfo>().Where(x => x.AreaCode == areaCode && Convert.ToDateTime(x.LinedProcessFeedbackTime) < DateTime.Now && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && roadways.Contains(x.LocationInfo.RoadwayNo))
-                                   .Includes(x => x.LocationInfo)
-                                   .Includes(x => x.StockInfoDetails)
-                                   .OrderBy(x => x.CreateDate)
-                                   .First();
+        //return _stockInfoRepository.QueryFirstNavAsync(x => x.AreaCode == areaCode && Convert.ToDateTime(x.LinedProcessFeedbackTime).AddHours(Convert.ToDouble(x.SpecialParameterDuration)) < DateTime.Now
+        //                        && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock && roadways.Contains(x.LocationInfo.RoadwayNo) && x.StockInfoDetails.Any(x => x.Status == (int)StockStateEmun.宸插叆搴�) && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock).Result;
+
+        var result = await _stockInfoRepository.QueryFirstNavAsync(x =>
+            x.AreaCode == areaCode &&
+            Convert.ToDateTime(x.LinedProcessFeedbackTime).AddHours(Convert.ToDouble(x.SpecialParameterDuration)) < DateTime.Now &&
+            x.LocationInfo != null && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock &&
+            roadways.Contains(x.LocationInfo.RoadwayNo) &&
+            x.StockInfoDetails != null && x.StockInfoDetails.Any(detail => detail.Status == (int)StockStateEmun.宸插叆搴�));
+        return result;
     }
 
     /// <summary>
     /// 鏌ヨ绌虹洏搴撳瓨淇℃伅
     /// </summary>
-    private DtStockInfo QueryStockInfoForEmptyTray(string areaCode, List<string> roadways)
+    private async Task<DtStockInfo> QueryStockInfoForEmptyTrayAsync(string areaCode, List<string> roadways)
     {
-        return _stockInfoRepository.Db.Queryable<DtStockInfo>().Where(x => x.AreaCode == areaCode && x.StockInfoDetails.Any(z => z.MaterielCode == "绌烘墭鐩�") && roadways.Contains(x.LocationInfo.RoadwayNo))
-                                   .Includes(x => x.LocationInfo)
-                                   .Includes(x => x.StockInfoDetails)
-                                   .OrderBy(x => x.CreateDate)
-                                   .First();
+        //return _stockInfoRepository.QueryFirstNavAsync(x => x.StockInfoDetails.Any(x => x.MaterielCode == "绌烘墭鐩�") && roadways.Contains(x.LocationInfo.RoadwayNo) && x.StockInfoDetails.Any(x => x.Status == (int)StockStateEmun.宸插叆搴�) && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock).Result;
+        var result = await _stockInfoRepository.QueryFirstNavAsync(x =>
+            x.StockInfoDetails != null && x.StockInfoDetails.Any(detail => detail.MaterielCode == "绌烘墭鐩�") &&
+            roadways.Contains(x.LocationInfo.RoadwayNo) &&
+            x.StockInfoDetails.Any(detail => detail.Status == (int)StockStateEmun.宸插叆搴�) &&
+            x.LocationInfo != null && x.LocationInfo.LocationStatus == (int)LocationEnum.InStock);
+        return result;
     }
 
     /// <summary>
@@ -1296,7 +1318,8 @@
         WebResponseContent content = new WebResponseContent();
 
         // 鑾峰彇鐩爣鍦板潃
-        string ToAddress = await GetRoadWayAsync(process);
+        //string ToAddress = await GetRoadWayAsync(process);
+        string ToAddress = await GetRoadWayAsync(input, process);
 
         // 鍒涘缓鏂颁换鍔″疄渚�
         var task = new Dt_Task
@@ -1386,7 +1409,7 @@
     /// <param name="Direction">鏂瑰悜</param>
     /// <param name="area">鍏崇郴鍖哄煙</param>
     /// <returns></returns>
-    public async Task<string> GetRoadWayAsync(List<string> process)
+    public async Task<string> GetRoadWayAsync(RequestTaskDto input, List<string> process)
     {
         var minGroup = _locationRepository.QueryData(x => process.Contains(x.RoadwayNo) && x.LocationStatus == (int)LocationEnum.Free)
             .GroupBy(x => x.RoadwayNo)

--
Gitblit v1.9.3