From f1cad31b8247a57699c34067cfc0cd31cf0a91c8 Mon Sep 17 00:00:00 2001
From: huangxiaoqiang <huangxiaoqiang@hnkhzn.com>
Date: 星期五, 18 七月 2025 16:06:53 +0800
Subject: [PATCH] 更新任务逻辑、版本号及发布历史记录

---
 CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs |   45 +++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 41 insertions(+), 4 deletions(-)

diff --git a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
index d74ab47..adcf4e2 100644
--- a/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
+++ b/CodeManagement/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -113,7 +113,9 @@
                                             //builder.AppendLine();
                                             //ConsoleHelper.WriteColorLine(builder, ConsoleColor.Blue);
                                             commonStackerCrane.LastTaskType = task.TaskType;
+
                                             _taskService.UpdateTaskStatusToNext(task.TaskNum);
+
                                         }
                                     }
                                     else
@@ -183,6 +185,22 @@
 
                     if (task == null) commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5);
 
+                    if (commonStackerCrane.DeviceCode.Contains("CW") && task.TaskType == (int)TaskOutboundTypeEnum.InToOut)
+                    {
+                        var stationinfo = _stationManagerRepository.QueryFirst(x => x.stationPLC == "1006" && 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(3292), stationinfo.stationChildCode);
+                            Thread.Sleep(100);
+                            conveyorLine.SetValue(ConveyorLineDBName_After.ConveyorLineTaskNum, 1000, stationinfo.stationChildCode);
+                        }
+                        WriteInfo(commonStackerCrane.DeviceName, $"銆愭墜鍔ㄥ嚭搴撹褰曘�戜换鍔″彿銆恵e.TaskNum}銆戞墭鐩樺彿銆恵task.PalletCode}銆�");
+                    }
+
+
                     if (commonStackerCrane.DeviceCode.Contains("GW") && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
                     {
                         var station = _stationManagerRepository.QueryFirst(x => x.stationChildCode == task.TargetAddress);
@@ -212,7 +230,7 @@
                         Dt_Task? newTask = _taskService.UpdatePosition(task.TaskNum, task.CurrentAddress);
                         _taskService.UpdateData(newTask);
                     }
-                    if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup && (task.TargetAddress == "002-071-001" || task.TargetAddress == "001-061-001"))
+                    if ((task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup && (task.TargetAddress == "002-071-001" || task.TargetAddress == "001-061-001"))||task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm)
                     {
                         var TASKHTY = task.Adapt<Dt_Task_Hty>();
                         _taskRepository.DeleteData(task);
@@ -234,6 +252,12 @@
         private Dt_Task? GetTask(CommonStackerCrane commonStackerCrane)
         {
             Dt_Task task = null;
+
+            task = _taskService.QueryOutFireAlarmTask(commonStackerCrane.DeviceCode);
+            if (task != null)
+            {
+                return task;
+            }
             if (commonStackerCrane.LastTaskType == null)
             {
                 task = _taskService.QueryStackerCraneTask(commonStackerCrane.DeviceCode);
@@ -258,7 +282,7 @@
             if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
             {
                 #region 闈欑疆鍑哄簱鍒ゆ柇鏄惁鑳芥墽琛屼换鍔�
-                if (task != null && task.Roadway.Contains("JZ") && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
+                if (task != null && task.Roadway.Contains("JZ") && task.TaskType==(int)TaskOutboundTypeEnum.Outbound)
                 {
                     // 鏌ヨ鏄惁瀛樺湪闈欑疆鍏ュ簱浠诲姟
                     var inJZTask = _taskRepository.QueryData(x => x.Roadway == task.Roadway &&
@@ -452,6 +476,8 @@
             stackerCraneTaskCommand.WorkType = 1;
             stackerCraneTaskCommand.TrayType = 0;
             stackerCraneTaskCommand.StartCommand = 1;
+            stackerCraneTaskCommand.FireCommand = Convert.ToInt16(task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm ? 2 : 0);
+
             if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.InboundGroup)//鍒ゆ柇鏄惁鏄叆搴撲换鍔�
             {
                 var value = _sys_ConfigService.GetByConfigKey(CateGoryConst.CONFIG_SYS_InStation, SysConfigKeyConst.JZNGInBoundStation).ConfigValue;
@@ -546,7 +572,18 @@
             }
             else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
             {
-                if (task.Roadway.Contains("GW"))
+                if (task.TaskType == (int)TaskOutboundTypeEnum.InToOut)
+                {
+                    string[] endCodes = task.TargetAddress.Split("-");
+                    stackerCraneTaskCommand.EndRow = Convert.ToInt16(endCodes[0]);
+                    stackerCraneTaskCommand.EndColumn = Convert.ToInt16(endCodes[1]);
+                    stackerCraneTaskCommand.EndLayer = Convert.ToInt16(endCodes[2]);
+                    string[] sourceCodes = task.SourceAddress.Split("-");
+                    stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]) % 2 != 0 ? (short)1 : (short)2;
+                    stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]);
+                    stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]);
+                }
+                else if (task.Roadway.Contains("GW") || task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm)
                 {
                     string[] endCodes = task.NextAddress.Split("-");
                     stackerCraneTaskCommand.EndRow = Convert.ToInt16(endCodes[0]);
@@ -559,7 +596,7 @@
                 }
                 else
                 {
-                    if ((task.TargetAddress == "002-071-001" || task.TargetAddress == "001-061-001") && (task.Roadway.Contains("JZ") || task.Roadway.Contains("CH")))
+                    if (((task.TargetAddress == "002-071-001" || task.TargetAddress == "001-061-001") && (task.Roadway.Contains("JZ") || task.Roadway.Contains("CH"))) || task.TaskType == (int)TaskOutboundTypeEnum.OutFireAlarm)
                     {
                         string[] endCodes = task.NextAddress.Split("-");
                         stackerCraneTaskCommand.EndRow = Convert.ToInt16(endCodes[0]);

--
Gitblit v1.9.3