From 0ba846024a89bbdfe2b2e2183d0ed944ac9782bf Mon Sep 17 00:00:00 2001
From: hutongqing <hutongqing@hnkhzn.com>
Date: 星期六, 04 一月 2025 09:52:28 +0800
Subject: [PATCH] 更新

---
 代码管理/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/b28e2128-7595-489a-b656-9987625a9f04.vsidx |    0 
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/R_ConveyorLineDBName.cs                          |    2 
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/测试架仓/GroundStationJob_CSJ.cs                                     |    8 
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/干膜仓/ConveyorLineJob_GM.cs                                        |  141 +++++++++++++++++++++-
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Helper/ConvertHelper.cs                                         |    2 
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs                          |   10 +
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs                                    |    9 +
 /dev/null                                                                                                    |    0 
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs                                      |   18 +++
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/W_ConveyorLineDBName.cs                          |    2 
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/StationTypeEnum.cs                                              |   18 ++
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_Core/AOP/LogAOP.cs                                                        |    6 
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineTaskCommand.cs                       |   62 +++++++---
 代码管理/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs                                          |    9 +
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs                                         |   51 ++++++--
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj                                          |    2 
 16 files changed, 277 insertions(+), 63 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/09203851-2649-4a0f-b696-332fad6125e4.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/09203851-2649-4a0f-b696-332fad6125e4.vsidx"
deleted file mode 100644
index 50a38c3..0000000
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/09203851-2649-4a0f-b696-332fad6125e4.vsidx"
+++ /dev/null
Binary files differ
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/2ce7b081-61db-4780-ab7b-3174d3d998cb.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/2ce7b081-61db-4780-ab7b-3174d3d998cb.vsidx"
deleted file mode 100644
index 6562949..0000000
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/2ce7b081-61db-4780-ab7b-3174d3d998cb.vsidx"
+++ /dev/null
Binary files differ
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/b28e2128-7595-489a-b656-9987625a9f04.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/b28e2128-7595-489a-b656-9987625a9f04.vsidx"
new file mode 100644
index 0000000..13df731
--- /dev/null
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/b28e2128-7595-489a-b656-9987625a9f04.vsidx"
Binary files differ
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/cdf7c705-afc3-490d-b354-0b04d2de9c9b.vsidx" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/cdf7c705-afc3-490d-b354-0b04d2de9c9b.vsidx"
deleted file mode 100644
index a6b983d..0000000
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/.vs/WIDESEAWCS_Server/FileContentIndex/cdf7c705-afc3-490d-b354-0b04d2de9c9b.vsidx"
+++ /dev/null
Binary files differ
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Helper/ConvertHelper.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Helper/ConvertHelper.cs"
index 68e4fe7..6b1bac0 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Helper/ConvertHelper.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/Helper/ConvertHelper.cs"
@@ -24,7 +24,7 @@
         {
             bool[] boolArray = ByteToBoolArray(data);
 
-            Array.Reverse(boolArray);
+            //Array.Reverse(boolArray);
 
             Type type = typeof(T);
             object? obj = Activator.CreateInstance(type);
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/StationTypeEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/StationTypeEnum.cs"
index a29ca87..95b712b 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/StationTypeEnum.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/StationTypeEnum.cs"
@@ -8,8 +8,24 @@
 {
     public enum StationTypeEnum
     {
+        /// <summary>
+        /// 鍏ュ簱绔欏彴
+        /// </summary>
         StationType_OnlyInbound = 1,
+
+        /// <summary>
+        /// 鍑哄簱绔欏彴
+        /// </summary>
         StationType_OnlyOutbound = 2,
-        StationType_InboundAndOutbound = 3
+
+        /// <summary>
+        /// 鍑哄叆搴撶珯鍙�
+        /// </summary>
+        StationType_InboundAndOutbound = 3,
+
+        /// <summary>
+        /// 鍑哄叆搴撳彛
+        /// </summary>
+        StationType_InStartAndOutEnd = 33,
     }
 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs"
index 13280ec..4f1d3ff 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Common/TaskEnum/TaskStatusEnum.cs"
@@ -37,6 +37,24 @@
         SC_Finish = 220,
 
         /// <summary>
+        /// 杈撻�佺嚎寰呮墽琛�
+        /// </summary>
+        [Description("杈撻�佺嚎寰呮墽琛�")]
+        Line_Execute = 400,
+
+        /// <summary>
+        /// 杈撻�佺嚎鎵ц涓�
+        /// </summary>
+        [Description("杈撻�佺嚎鎵ц涓�")]
+        Line_Executing = 410,
+
+        /// <summary>
+        /// 杈撻�佺嚎瀹屾垚
+        /// </summary>
+        [Description("杈撻�佺嚎瀹屾垚")]
+        Line_Finish = 420,
+
+        /// <summary>
         /// AGV寰呮墽琛�
         /// </summary>
         [Description("AGV寰呮墽琛�")]
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj"
index 1894ea5..0da9e1f 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Model/WIDESEAWCS_Model.csproj"
@@ -8,7 +8,7 @@
 
 	<ItemGroup>
 		<PackageReference Include="System.Text.RegularExpressions" Version="4.3.1" />
-		<PackageReference Include="WIDESEAWCS_Core" Version="1.0.10" />
+		<PackageReference Include="WIDESEAWCS_Core" Version="1.0.11" />
 	</ItemGroup>
 
 	<ItemGroup>
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
index 9b5bdcc..248436a 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_TaskInfoService/TaskService.cs"
@@ -161,27 +161,44 @@
 
                     List<Dt_WarehouseDevice> wades = warehouseDevices.Where(x => x.WarehouseId == item.WarehouseId).ToList();
 
-                    Dt_Router? router = new Dt_Router();
+                    Dt_Router? router;
 
+                    TaskTypeGroup taskTypeGroup = item.TaskType.GetTaskTypeGroup();
                     if (string.IsNullOrEmpty(item.AGVArea))
                     {
-                        //task.AgvTaskNum = "AGV-" + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum;
-                        Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == item.SourceAddress || x.StackerCraneCode == item.RoadWay);
+                        Dt_StationManger stationManger;
+                        if (taskTypeGroup == TaskTypeGroup.InboundGroup)
+                        {
+                            stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == item.SourceAddress);
+                        }
+                        else
+                        {
+                            stationManger = _stationMangerRepository.QueryFirst(x => x.StackerCraneCode == item.RoadWay);
+                        }
                         if (stationManger == null)
                         {
                             return WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙伴厤缃俊鎭�");
                         }
 
-                        List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && (stationManger.StationCode == x.StartPosi || stationManger.StackerCraneCode == x.StartPosi));
-                        if (routers.FirstOrDefault() == null)
+                        List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && (item.SourceAddress == x.StartPosi || item.RoadWay == x.StartPosi));
+                        router = routers.FirstOrDefault();
+                        if (router == null)
                         {
                             return WebResponseContent.Instance.Error($"鏈壘鍒拌矾鐢遍厤缃俊鎭�");
                         }
-                        router = routers.FirstOrDefault();
+
                         if (routers.Count == 1)
                         {
-                            task.NextAddress = router?.NextPosi ?? "";
-                            task.DeviceCode = stationManger.StationDeviceCode;
+                            if(taskTypeGroup == TaskTypeGroup.InboundGroup && item.TargetAddress == stationManger.StackerCraneCode)
+                            {
+                                task.NextAddress = router.NextPosi;
+                                task.DeviceCode = stationManger.StationDeviceCode;
+                            }
+                            else
+                            {
+                                task.NextAddress = item.TargetAddress;
+                                task.DeviceCode = stationManger.StationDeviceCode;
+                            }
                         }
                         else
                         {
@@ -191,7 +208,7 @@
                     }
                     else
                     {
-                        if (item.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
+                        if (taskTypeGroup == TaskTypeGroup.OutbondGroup)
                         {
                             task.AgvTaskNum = "AGV-" + DateTime.Now.ToString("yyyyMMdd") + item.TaskNum;
                             List<Dt_Router> routers = _routerRepository.QueryData(x => x.InOutType == item.TaskType && item.AGVArea == x.NextPosi);
@@ -253,17 +270,23 @@
             WebResponseContent content = new WebResponseContent();
             try
             {
-                Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationDeviceCode == sourceAddress);
+                Dt_StationManger stationManger = _stationMangerRepository.QueryFirst(x => x.StationCode == sourceAddress);
                 if (stationManger == null)
                 {
                     return WebResponseContent.Instance.Error($"鏈壘鍒扮珯鍙颁俊鎭�");
                 }
 
-                HttpHelper.Post($"RequestInboundTask?palletCode={palletCode}&stationCode={sourceAddress}");
+                string responseStr = HttpHelper.Get($"http://127.0.0.1:9293/api/Task/DeviceRequestInboundTask?stationCode={sourceAddress}&roadwayNo={stationManger.StackerCraneCode}&palletCode={palletCode}");
+                WebResponseContent? responseContent = JsonConvert.DeserializeObject<WebResponseContent>(responseStr);
+                if (responseContent != null && responseContent.Status && responseContent.Data != null)
+                {
+                    WMSTaskDTO? taskDTO = JsonConvert.DeserializeObject<WMSTaskDTO>(responseContent.Data.ToString());
+                    if (taskDTO != null)
+                    {
+                        content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
+                    }
+                }
 
-                WMSTaskDTO taskDTO = new WMSTaskDTO();
-
-                content = ReceiveWMSTask(new List<WMSTaskDTO> { taskDTO });
             }
             catch (Exception ex)
             {
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineTaskCommand.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineTaskCommand.cs"
index 4e4952a..58371ab 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineTaskCommand.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/ConveyorLineTaskCommand.cs"
@@ -51,6 +51,11 @@
         public byte Status { get; set; }
 
         /// <summary>
+        /// 棰勭暀
+        /// </summary>
+        public byte Undefined { get; set; }
+
+        /// <summary>
         /// 浠诲姟鍙�
         /// </summary>
         public int TaskNum { get; set; }
@@ -100,6 +105,12 @@
         /// 浜や簰淇″彿
         /// </summary>
         public byte Signal { get; set; }
+
+
+        /// <summary>
+        /// 棰勭暀
+        /// </summary>
+        public byte Undefined2 { get; set; }
     }
 
     public class R_ConveyorLineStatus
@@ -147,20 +158,22 @@
         public bool RequestUnpackPellet { get; set; }
     }
 
-    public class R_ConveyorLineSignal
+    public class ConveyorLineSignal
     {
         /// <summary>
         /// 璇锋眰淇″彿
         /// </summary>
+        [BoolIndex(0)]
         public bool STB { get; set; }
 
         /// <summary>
         /// 鍝嶅簲淇″彿
         /// </summary>
+        [BoolIndex(1)]
         public bool ACK { get; set; }
     }
 
-    public class W_ConveyorLineInfo
+    public class W_ConveyorLineInfo : DeviceCommand
     {
 
         /// <summary>
@@ -168,20 +181,9 @@
         /// </summary>
         public short ConveyorNo { get; set; }
 
-        /// <summary>
-        /// 鎻℃墜淇″彿
-        /// </summary>
-        public bool HandShake { get; set; }
+        public byte Operate { get; set; }
 
-        /// <summary>
-        /// 澶嶄綅鎶ヨ
-        /// </summary>
-        public bool ClearAlarm { get; set; }
-
-        /// <summary>
-        /// 閫�鍥�
-        /// </summary>
-        public bool Return { get; set; }
+        public byte Undefined {  get; set; }
 
         /// <summary>
         /// 浠诲姟鍙�
@@ -214,13 +216,35 @@
         public short Sapre2 { get; set; }
 
         /// <summary>
-        /// 璇锋眰淇″彿
+        /// 浜や簰淇″彿
         /// </summary>
-        public bool STB { get; set; }
+        public byte Signal { get; set; }
+
 
         /// <summary>
-        /// 鍝嶅簲淇″彿
+        /// 棰勭暀
         /// </summary>
-        public bool ACK { get; set; }
+        public byte Undefined2 { get; set; }
+    }
+
+    public class W_ConveyorLineOperate
+    {
+        /// <summary>
+        /// 鎻℃墜淇″彿
+        /// </summary>
+        [BoolIndex(0)]
+        public bool HandShake { get; set; }
+
+        /// <summary>
+        /// 澶嶄綅鎶ヨ
+        /// </summary>
+        [BoolIndex(1)]
+        public bool ClearAlarm { get; set; }
+
+        /// <summary>
+        /// 閫�鍥�
+        /// </summary>
+        [BoolIndex(2)]
+        public bool Return { get; set; }
     }
 }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/R_ConveyorLineDBName.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/R_ConveyorLineDBName.cs"
index 10c3c1a..307a869 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/R_ConveyorLineDBName.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/R_ConveyorLineDBName.cs"
@@ -23,7 +23,7 @@
 
 namespace WIDESEAWCS_Tasks.ConveyorLineJob
 {
-    public enum R_ConveyorLineDBName
+    public enum R_ConveyorLineDB
     {
         /// <summary>
         /// 绔欏彴缂栧彿
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/W_ConveyorLineDBName.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/W_ConveyorLineDBName.cs"
index 23a4edb..4d0cd05 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/W_ConveyorLineDBName.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/ConveyorLineJob/W_ConveyorLineDBName.cs"
@@ -6,7 +6,7 @@
 
 namespace WIDESEAWCS_Tasks.ConveyorLineJob
 {
-    public enum W_ConveyorLineDBName
+    public enum W_ConveyorLineDB
     {
         /// <summary>
         /// 绔欏彴缂栧彿
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\345\271\262\350\206\234\344\273\223/ConveyorLineJob_GM.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\345\271\262\350\206\234\344\273\223/ConveyorLineJob_GM.cs"
index 80b7d03..1a2f5e4 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\345\271\262\350\206\234\344\273\223/ConveyorLineJob_GM.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\345\271\262\350\206\234\344\273\223/ConveyorLineJob_GM.cs"
@@ -6,6 +6,8 @@
 using System.Threading.Tasks;
 using WIDESEAWCS_Common;
 using WIDESEAWCS_Common.Helper;
+using WIDESEAWCS_Common.TaskEnum;
+using WIDESEAWCS_Core;
 using WIDESEAWCS_Core.Helper;
 using WIDESEAWCS_IBasicInfoRepository;
 using WIDESEAWCS_ITaskInfoRepository;
@@ -13,6 +15,8 @@
 using WIDESEAWCS_Model.Models;
 using WIDESEAWCS_QuartzJob;
 using WIDESEAWCS_QuartzJob.DTO;
+using WIDESEAWCS_QuartzJob.Models;
+using WIDESEAWCS_QuartzJob.Repository;
 using WIDESEAWCS_Tasks.ConveyorLineJob;
 
 namespace WIDESEAWCS_Tasks
@@ -25,13 +29,15 @@
         private readonly ITaskExecuteDetailService _taskExecuteDetailService;
         private readonly ITaskRepository _taskRepository;
         private readonly IStationMangerRepository _stationMangerRepository;
+        private readonly IRouterRepository _routerRepository;
 
-        public ConveyorLineJob_GM(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository)
+        public ConveyorLineJob_GM(ITaskService taskService, ITaskExecuteDetailService taskExecuteDetailService, ITaskRepository taskRepository, IStationMangerRepository stationMangerRepository,IRouterRepository routerRepository)
         {
             _taskService = taskService;
             _taskExecuteDetailService = taskExecuteDetailService;
             _taskRepository = taskRepository;
             _stationMangerRepository = stationMangerRepository;
+            _routerRepository = routerRepository;
         }
 
         public Task Execute(IJobExecutionContext context)
@@ -44,21 +50,134 @@
                 List<Dt_StationManger> stationMangers = _stationMangerRepository.QueryData(x => x.StationDeviceCode == device.DeviceCode);
                 foreach (var item in stationMangers.Where(x => deviceStations.Contains(x.StationCode)))
                 {
-                    if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt())
+                    DeviceProDTO? deviceProRead = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(R_ConveyorLineDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
+
+                    DeviceProDTO? deviceProWrite = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode && x.DeviceProParamType == nameof(W_ConveyorLineDB)).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
+
+                    if (deviceProRead != null && deviceProWrite != null)
                     {
-                        DeviceProDTO? devicePro = device.DeviceProDTOs.Where(x => x.DeviceChildCode == item.StationCode).OrderBy(x => x.DeviceProOffset).FirstOrDefault();
-                        if (devicePro != null)
-                        {
-                            R_ConveyorLineInfo conveyorLineInfo = device.Communicator.ReadCustomer<R_ConveyorLineInfo>(devicePro.DeviceProAddress);
+                        R_ConveyorLineInfo conveyorLineInfoRead = device.Communicator.ReadCustomer<R_ConveyorLineInfo>(deviceProRead.DeviceProAddress);
 
-                            R_ConveyorLineStatus conveyorLineStatus = conveyorLineInfo.Status.ByteToBoolObject<R_ConveyorLineStatus>();
+                        R_ConveyorLineStatus conveyorLineStatus = conveyorLineInfoRead.Status.ByteToBoolObject<R_ConveyorLineStatus>();
 
-                            bool stb = device.GetValue<R_ConveyorLineDBName, bool>(R_ConveyorLineDBName.STB);
-                        }
-                        else
+                        ConveyorLineSignal conveyorLineSignalRead = conveyorLineInfoRead.Signal.ByteToBoolObject<ConveyorLineSignal>();
+
+                        W_ConveyorLineInfo conveyorLineInfoWrite = device.Communicator.ReadCustomer<W_ConveyorLineInfo>(deviceProWrite.DeviceProAddress);
+
+                        ConveyorLineSignal conveyorLineSignalWrite = conveyorLineInfoWrite.Signal.ByteToBoolObject<ConveyorLineSignal>();
+                        if (item.StationType == StationTypeEnum.StationType_OnlyInbound.ObjToInt())
                         {
-                            WriteInfo(device.DeviceName, $"鏈壘鍒拌澶囧瓙缂栧彿{item.StationCode}鐨勫崗璁俊鎭�");
+                            if (conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK)
+                            {
+                                if (!string.IsNullOrEmpty(conveyorLineInfoRead.Barcode))
+                                {
+                                    WebResponseContent content = _taskService.RequestWMSTask(conveyorLineInfoRead.Barcode, item.StationCode);
+                                    if (content.Status)
+                                    {
+                                        device.SetValue(W_ConveyorLineDB.ACK, true);
+                                    }
+                                }
+                            }
+                            else if (!conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.ACK)
+                            {
+                                device.SetValue(W_ConveyorLineDB.ACK, false);
+                            }
+
                         }
+                        else if (item.StationType == StationTypeEnum.StationType_InboundAndOutbound.ObjToInt())
+                        {
+                            if(conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && !conveyorLineSignalWrite.ACK)
+                            {
+                                Dt_Task task = _taskRepository.QueryFirst(x => x.NextAddress == item.StackerCraneCode);
+                                if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)
+                                {
+                                    Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode);
+                                    if (stationManger == null)
+                                    {
+                                        WriteInfo(item.StationName, $"鏈壘鍒板搴旂珯鍙颁俊鎭�,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}");
+                                        continue;
+                                    }
+                                    string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, stationManger.StackerCraneCode);
+                                    if (string.IsNullOrEmpty(locationCode))
+                                    {
+                                        WriteInfo(item.StationName, $"璇锋眰鍒嗛厤璐т綅杩斿洖淇℃伅閿欒,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}");
+                                        continue;
+                                    }
+                                    string oldAddress = task.NextAddress;
+                                    int oldStatus = task.TaskState;
+                                    task.CurrentAddress = stationManger.StackerCraneStationCode;
+                                    task.TargetAddress = locationCode;
+                                    task.NextAddress = locationCode;
+                                    task.DeviceCode = stationManger.StackerCraneCode;
+                                    task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
+                                    _taskRepository.UpdateData(task);
+
+                                    _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"绯荤粺鑷姩娴佺▼,鐩爣鍦板潃鐢眥oldAddress}鍙樻洿涓簕task.NextAddress},浠诲姟鐘舵�佺敱{oldStatus}鍙樻洿涓簕task.TaskState}");
+
+                                    device.SetValue(W_ConveyorLineDB.ACK, true);
+                                }
+                            }
+                            else if (!conveyorLineSignalRead.STB && conveyorLineStatus.Online && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm && conveyorLineSignalWrite.ACK)
+                            {
+                                device.SetValue(W_ConveyorLineDB.ACK, false);
+                            }
+                            else
+                            {
+                                if (!conveyorLineSignalWrite.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Goods)
+                                {
+                                    Dt_Task task = _taskRepository.QueryFirst(x => x.CurrentAddress == item.StationCode && x.TaskState == TaskStatusEnum.Line_Execute.ObjToInt());
+                                    if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
+                                    {
+                                        Dt_StationManger? stationManger = stationMangers.FirstOrDefault(x => x.StationCode == item.StationCode);
+                                        if (stationManger == null)
+                                        {
+                                            WriteInfo(item.StationName, $"鏈壘鍒板搴旂珯鍙颁俊鎭�,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}");
+                                            continue;
+                                        }
+
+                                        Dt_Router router = _routerRepository.QueryFirst(x => x.InOutType == task.TaskType && (task.CurrentAddress == x.StartPosi));
+                                        if (router == null)
+                                        {
+                                            WriteInfo(item.StationName, $"鏈壘鍒拌矾鐢遍厤缃俊鎭�,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}");
+                                            continue;
+                                        }
+
+                                        string oldAddress = task.NextAddress;
+                                        int oldStatus = task.TaskState;
+                                        task.NextAddress = router.NextPosi;
+                                        task.TargetAddress = router.NextPosi;
+                                        task.TaskState = TaskStatusEnum.Line_Executing.ObjToInt();
+                                        _taskRepository.UpdateData(task);
+
+                                        _taskExecuteDetailService.AddTaskExecuteDetail(task.TaskNum, $"绯荤粺鑷姩娴佺▼,鐩爣鍦板潃鐢眥oldAddress}鍙樻洿涓簕task.NextAddress},浠诲姟鐘舵�佺敱{oldStatus}鍙樻洿涓簕task.TaskState}");
+
+                                        device.SetValue(W_ConveyorLineDB.TaskNum, task.TaskNum);
+                                        device.SetValue(W_ConveyorLineDB.EndPos, task.NextAddress);
+                                        device.SetValue(W_ConveyorLineDB.StartPos, task.CurrentAddress);
+                                        device.SetValue(W_ConveyorLineDB.STB, true);
+                                    }
+                                }
+                                else if(conveyorLineSignalWrite.STB && conveyorLineSignalRead.ACK && conveyorLineStatus.Goods)
+                                {
+                                    //todo 浠诲姟瀹屾垚
+                                }
+                            }
+                        }
+                        else if (item.StationType == StationTypeEnum.StationType_InStartAndOutEnd.ObjToInt())
+                        {
+                            if(!conveyorLineSignalWrite.STB && !conveyorLineSignalWrite.ACK && !conveyorLineSignalRead.STB && !conveyorLineSignalRead.ACK && conveyorLineStatus.Goods && !conveyorLineStatus.Alarm)
+                            {
+                                Dt_Task task = _taskRepository.QueryFirst(x => x.TaskState == TaskStatusEnum.New.ObjToInt() && string.IsNullOrEmpty(x.TargetAddress) && x.SourceAddress == item.StationCode && _taskService.TaskInboundTypes.Contains(x.TaskType));
+                                if(task != null)
+                                {
+                                    device.SetValue(W_ConveyorLineDB.STB, true);
+                                }
+                            }
+                        }
+                    }
+                    else
+                    {
+                        WriteInfo(device.DeviceName, $"鏈壘鍒拌澶囧瓙缂栧彿{item.StationCode}鐨勫崗璁俊鎭�");
                     }
                 }
             }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/GroundStationJob_CSJ.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/GroundStationJob_CSJ.cs"
index e635bdd..adaece9 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/GroundStationJob_CSJ.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/\346\265\213\350\257\225\346\236\266\344\273\223/GroundStationJob_CSJ.cs"
@@ -83,13 +83,13 @@
                                 if (stationManger == null)
                                 {
                                     WriteInfo(item.StationName, $"鏈壘鍒板搴旂珯鍙颁俊鎭�,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}");
-                                    break;
+                                    continue;
                                 }
                                 string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, stationManger.StackerCraneCode);
                                 if (string.IsNullOrEmpty(locationCode))
                                 {
                                     WriteInfo(item.StationName, $"璇锋眰鍒嗛厤璐т綅杩斿洖淇℃伅閿欒,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}");
-                                    break;
+                                    continue;
                                 }
                                 task.TaskState = TaskStatusEnum.SC_Execute.ObjToInt();
                                 task.CurrentAddress = stationManger.StackerCraneStationCode;
@@ -118,13 +118,13 @@
                             if (stationManger == null)
                             {
                                 WriteInfo(item.StationName, $"鏈壘鍒板搴旂珯鍙颁俊鎭�,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}");
-                                break;
+                                continue;
                             }
                             string? locationCode = _taskService.RequestAssignLocation(task.TaskNum, stationManger.StackerCraneCode);
                             if (string.IsNullOrEmpty(locationCode))
                             {
                                 WriteInfo(item.StationName, $"璇锋眰鍒嗛厤璐т綅杩斿洖淇℃伅閿欒,璁惧缂栧彿:{item.StationCode},浠诲姟鍙�:{task.TaskNum}");
-                                break;
+                                continue;
                             }
                             string oldAddress = task.NextAddress;
                             int oldStatus = task.TaskState;
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/AOP/LogAOP.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/AOP/LogAOP.cs"
index 1e80595..f86165d 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/AOP/LogAOP.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_Core/AOP/LogAOP.cs"
@@ -155,7 +155,7 @@
                     apiLogAopInfo.ResponseJsonData = jsonResult;
                     Parallel.For(0, 1, e =>
                     {
-                        LogLock.OutLogAOP("AOPLog", new string[] { apiLogAopInfo.GetType().ToString(), JsonConvert.SerializeObject(apiLogAopInfo) });
+                        LogLock.OutLogAOP("鍏ㄥ眬鏃ュ織AOP", new string[] { apiLogAopInfo.GetType().ToString(), JsonConvert.SerializeObject(apiLogAopInfo) });
                     });
                 }
             }
@@ -179,7 +179,7 @@
                 Parallel.For(0, 1, e =>
                 {
                     //LogLock.OutSql2Log("AOPLog", new string[] { JsonConvert.SerializeObject(apiLogAopInfo) });
-                    LogLock.OutLogAOP("AOPLog", new string[] { apiLogAopInfo.GetType().ToString(), JsonConvert.SerializeObject(apiLogAopInfo) });
+                    LogLock.OutLogAOP("鍏ㄥ眬鏃ュ織AOP", new string[] { apiLogAopInfo.GetType().ToString(), JsonConvert.SerializeObject(apiLogAopInfo) });
                 });
             });
         }
@@ -201,7 +201,7 @@
                 // 寮傚父鏃ュ織閲屾湁璇︾粏鐨勫爢鏍堜俊鎭�
                 Parallel.For(0, 1, e =>
                 {
-                    LogLock.OutLogAOP("AOPLogEx", new string[] { apiLogAopExInfo.GetType().ToString(), JsonConvert.SerializeObject(apiLogAopExInfo) });
+                    LogLock.OutLogAOP("鍏ㄥ眬寮傚父閿欒鏃ュ織AOP", new string[] { apiLogAopExInfo.GetType().ToString(), JsonConvert.SerializeObject(apiLogAopExInfo) });
                 });
             }
         }
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs"
index 6cd6c6d..20a0073 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_ITaskInfoService/ITaskService.cs"
@@ -53,6 +53,15 @@
         WebResponseContent RequestInboundTask(SaveModel saveModel);
 
         /// <summary>
+        /// WCS鐢宠鍏ュ簱
+        /// </summary>
+        /// <param name="stationCode"></param>
+        /// <param name="roadwayNo"></param>
+        /// <param name="palletCode"></param>
+        /// <returns></returns>
+        WebResponseContent DeviceRequestInboundTask(string stationCode, string roadwayNo, string palletCode);
+
+        /// <summary>
         /// 鍏ュ簱浠诲姟鐢宠鍒嗛厤璐т綅
         /// </summary>
         /// <param name="taskNum">浠诲姟鍙�</param>
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
index 25f273f..2da55a0 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_TaskInfoService/TaskService_Inbound.cs"
@@ -9,6 +9,7 @@
 using WIDESEA_Common.TaskEnum;
 using WIDESEA_Core;
 using WIDESEA_Core.Helper;
+using WIDESEA_DTO.Task;
 using WIDESEA_Model.Models;
 
 namespace WIDESEA_TaskInfoService
@@ -102,7 +103,7 @@
                 Dt_Task task = Repository.QueryFirst(x => x.PalletCode == palletCode);
                 if (task != null)
                 {
-                    return WebResponseContent.Instance.Error($"璇ユ墭鐩樺凡鐢熸垚浠诲姟");
+                    return WebResponseContent.Instance.OK($"璇ユ墭鐩樺凡鐢熸垚浠诲姟", _mapper.Map<WMSTaskDTO>(task));
                 }
 
                 if (Repository.QueryFirst(x => x.SourceAddress == stationCode && x.TaskStatus == TaskStatusEnum.New.ObjToInt()) != null)
@@ -158,8 +159,10 @@
                 newTask.TaskId = taskId;
                 _stockRepository.StockInfoRepository.UpdateData(stockInfo);
                 _unitOfWorkManage.CommitTran();
-                PushTasksToWCS(new List<Dt_Task> { newTask });
-                return WebResponseContent.Instance.OK(data: newTask);
+                WMSTaskDTO wMSTaskDTO = _mapper.Map<WMSTaskDTO>(newTask);
+
+                //PushTasksToWCS(new List<Dt_Task> { newTask });
+                return WebResponseContent.Instance.OK(data: wMSTaskDTO);
             }
             catch (Exception ex)
             {
diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs"
index a42aa83..8eb93fc 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WMS/WIDESEA_WMSServer/WIDESEA_WMSServer/Controllers/TaskInfo/TaskController.cs"
@@ -42,10 +42,12 @@
         {
             return Service.RequestInboundTask(saveModel);
         }
-        //public WebResponseContent RequestInboundTask(string palletCode, string stationCode)
-        //{
-        //    return Service.RequestInboundTask(palletCode, stationCode);
-        //}
+
+        [HttpPost, HttpGet, Route("DeviceRequestInboundTask"), AllowAnonymous]
+        public WebResponseContent DeviceRequestInboundTask(string stationCode, string roadwayNo, string palletCode)
+        {
+            return Service.DeviceRequestInboundTask(stationCode, roadwayNo, palletCode);
+        }
 
         /// <summary>
         /// 鍏ュ簱浠诲姟鐢宠鍒嗛厤璐т綅

--
Gitblit v1.9.3