From 02a4fdd78cef9c7d2a26bfb9aa187179cf0baac3 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期三, 25 二月 2026 17:44:26 +0800
Subject: [PATCH] 1

---
 Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs |   52 ++++++++++++++++++++++++++++++++++++----------------
 1 files changed, 36 insertions(+), 16 deletions(-)

diff --git a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
index 5d5f6c9..4109752 100644
--- a/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
+++ b/Code Management/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -173,21 +173,28 @@
 
                     if (commonStackerCrane.DeviceCode.Contains("CW") && task.TaskType==(int)TaskOutboundTypeEnum.InToOut)
                     {
-                        var stationinfo = _stationManagerRepository.QueryFirst(x => x.stationPLC == "1017" && x.stationType == 10 && x.Roadway == commonStackerCrane.DeviceCode);
+                        var stationinfo = _stationManagerRepository.QueryFirst(x => (x.stationPLC == "1017"||x.stationPLC=="1024") && x.stationType == 10 && x.Roadway == commonStackerCrane.DeviceCode);
 
                         IDevice? device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == stationinfo.stationPLC);
                         if (device != null)
                         {
-                            CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device;
-                            conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(1815), stationinfo.stationChildCode);
-                            Thread.Sleep(100);
-                            conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 1000, stationinfo.stationChildCode);
+                            if (device.DeviceCode == "1024" || device.DeviceCode == "1023")
+                            {
+                                CommonConveyorLine_NewCW conveyorLine = (CommonConveyorLine_NewCW)device;
+                                conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(4000), stationinfo.stationChildCode);
+                                Thread.Sleep(100);
+                                conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 1000, stationinfo.stationChildCode);
+                            }
+                            else
+                            {
+                                CommonConveyorLine_CW conveyorLine = (CommonConveyorLine_CW)device;
+                                conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTargetAddress, Convert.ToInt16(4000), stationinfo.stationChildCode);
+                                Thread.Sleep(100);
+                                conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 1000, stationinfo.stationChildCode);
+                            }
                         }
-                        WriteInfo(commonStackerCrane.DeviceName, $"銆愭墜鍔ㄥ嚭搴撹褰曘��");
+                        WriteInfo(commonStackerCrane.DeviceName, $"銆愭墜鍔ㄥ嚭搴撹褰曘�戜换鍔″彿銆恵e.TaskNum}銆戞墭鐩樺彿銆恵task.PalletCode}銆�");
                     }
-
-
-
 
                     if (commonStackerCrane.DeviceCode.Contains("GW") && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                     {
@@ -281,7 +288,7 @@
                     _noticeService.Logs(userTokenIds, new { commonStackerCrane.DeviceName, log = log, time = DateTime.Now.ToString("G"), color = "red" });
                     WriteInfo(commonStackerCrane.DeviceName, log);
 
-                    task = FindAnotherOutboundTask(commonStackerCrane.DeviceCode, task.TaskId);
+                    task = FindAnotherOutboundTask(commonStackerCrane.DeviceCode, task);
 
                     if (task == null)
                     {
@@ -319,10 +326,21 @@
                         device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == router.ChildPosiDeviceCode);
                         if (device != null)
                         {
-                            CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device;
-                            if (conveyorLine.IsOccupied(task.NextAddress))//鍑哄簱绔欏彴鏈鍗犵敤
+                            if (device.DeviceCode == "1024" || device.DeviceCode == "1023")
                             {
-                                return task;
+                                CommonConveyorLine_NewCW conveyorLine = (CommonConveyorLine_NewCW)device;
+                                if (conveyorLine.IsOccupied(task.NextAddress))//鍑哄簱绔欏彴鏈鍗犵敤
+                                {
+                                    return task;
+                                }
+                            }
+                            else
+                            {
+                                CommonConveyorLine_CW conveyorLine = (CommonConveyorLine_CW)device;
+                                if (conveyorLine.IsOccupied(task.NextAddress))//鍑哄簱绔欏彴鏈鍗犵敤
+                                {
+                                    return task;
+                                }
                             }
                         }
                         else
@@ -336,7 +354,9 @@
                     IDevice? device = null;
                     if (task.Roadway.Contains("GW"))
                     {
-                        device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == "1015");
+                        string targetDeviceCode = task.Roadway == "GWSC3" ? "2025" : "1015";
+                        device = Storage.Devices.FirstOrDefault(x => x.DeviceCode == targetDeviceCode);
+
                         if (device != null)
                         {
                             CommonConveyorLine_GW conveyorLine = (CommonConveyorLine_GW)device;
@@ -393,11 +413,11 @@
         /// <param name="deviceCode">璁惧浠g爜</param>
         /// <param name="excludedTaskId">瑕佹帓闄ょ殑浠诲姟ID</param>
         /// <returns></returns>
-        private Dt_Task? FindAnotherOutboundTask(string deviceCode, int excludedTaskId)
+        private Dt_Task? FindAnotherOutboundTask(string deviceCode, Dt_Task task)
         {
             // 鍏堣幏鍙栨墍鏈夌鍚堟潯浠讹紙鎺掗櫎鎸囧畾浠诲姟ID锛夌殑鍑哄簱浠诲姟鍒楄〃
             var allOutboundTasks = _taskService.QueryAllOutboundTasks(deviceCode);
-            var availableTasks = allOutboundTasks?.Where(t => excludedTaskId != t.TaskId && t.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup).ToList();
+            var availableTasks = allOutboundTasks?.Where(t => t.TargetAddress != task.TargetAddress && t.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup).ToList();
 
             if (availableTasks == null || availableTasks.Count == 0)
             {

--
Gitblit v1.9.3