From 25cb7cd50d12f48e93d6cde47420ca3458e9c47a Mon Sep 17 00:00:00 2001
From: helongyang <647556386@qq.com>
Date: 星期四, 12 六月 2025 21:39:43 +0800
Subject: [PATCH] 1

---
 代码管理/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP仓/StackerCraneJob_PP.cs |   59 ++++++++++++++++++++++++++++++++++++-----------------------
 1 files changed, 36 insertions(+), 23 deletions(-)

diff --git "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP\344\273\223/StackerCraneJob_PP.cs" "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP\344\273\223/StackerCraneJob_PP.cs"
index b40aadf..ddfcdab 100644
--- "a/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP\344\273\223/StackerCraneJob_PP.cs"
+++ "b/\344\273\243\347\240\201\347\256\241\347\220\206/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/PP\344\273\223/StackerCraneJob_PP.cs"
@@ -22,6 +22,7 @@
 using WIDESEAWCS_Tasks;
 using WIDESEAWCS_Core;
 using SqlSugar.Extensions;
+using WIDESEAWCS_Tasks.ConveyorLineJob;
 
 namespace WIDESEAWCS_Tasks
 {
@@ -71,7 +72,12 @@
                                     if (sendFlag)
                                     {
                                         commonStackerCrane.LastTaskType = task.TaskType;
-                                        // _taskService.UpdateTaskStatusToNext(task.TaskNum);
+                                        task.Dispatchertime = DateTime.Now;
+                                        task.ExceptionMessage = "";
+                                        _taskService.UpdateTask(task, TaskStatusEnum.SC_Executing);
+                                        commonStackerCrane.Communicator.Write("DB105.54", (short)1);
+                                        //寤舵椂1s
+                                        Thread.Sleep(1000);
                                     }
                                 }
                             }
@@ -225,20 +231,22 @@
                 if (device != null)
                 {
                     OtherDevice client = (OtherDevice)device;
-                    if (client.GetValue<GroundStationDBName, bool>(GroundStationDBName.R_IsCanPut, stationManger.StationCode))//鍑哄簱绔欏彴鏈鍗犵敤
+                    if (!client.GetValue<R_ConveyorLineDB, bool>(R_ConveyorLineDB.Goods, stationManger.StationCode))//鍑哄簱绔欏彴鏈鍗犵敤
                     {
-                        task.TargetAddress = stationManger.StackerCraneStationCode;
+                        task.NextAddress = stationManger.StackerCraneStationCode;
                         _taskRepository.UpdateData(task);
                         return task;
                     }
                 }
                 else
                 {
+                    WriteInfo(task.DeviceCode, $"鏈壘鍒板嚭搴撶珯鍙般�恵stationManger.StationDeviceCode}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤");
                     _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒板嚭搴撶珯鍙般�恵stationManger.StationDeviceCode}銆戝搴旂殑閫氳瀵硅薄锛屾棤娉曞垽鏂嚭搴撶珯鍙版槸鍚﹁鍗犵敤");
                 }
             }
             else
             {
+                WriteInfo(task.DeviceCode, $"鏈壘鍒扮珯鍙般�恵task.NextAddress}銆戜俊鎭紝鏃犳硶鏍¢獙绔欏彴");
                 _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鏈壘鍒扮珯鍙般�恵task.NextAddress}銆戜俊鎭紝鏃犳硶鏍¢獙绔欏彴");
             }
             return null;
@@ -264,8 +272,6 @@
                 string[] startCodes = task.CurrentAddress.Split("-");
                 if (startCodes.Length == 3)
                 {
-
-
                     stackerCraneTaskCommand.StartRow = Convert.ToInt16(startCodes[0]);
                     stackerCraneTaskCommand.StartColumn = Convert.ToInt16(startCodes[1]);
                     stackerCraneTaskCommand.StartLayer = Convert.ToInt16(startCodes[2]);
@@ -292,17 +298,24 @@
             else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
             {
                 string[] targetCodes = task.NextAddress.Split("-");
-
-                stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]);
-                stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]);
-                stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]);
-
-                string[] sourceCodes = task.CurrentAddress.Split("-");
-                if (sourceCodes.Length == 3)
+                if (targetCodes.Length == 3)
                 {
-                    stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]);
-                    stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]);
-                    stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]);
+                    stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]);
+                    stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]);
+                    stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]);
+                }
+                else
+                {
+                    //鏁版嵁閰嶇疆閿欒
+                    _taskService.UpdateTaskExceptionMessage(task.TaskNum, $"鍑哄簱浠诲姟涓嬩竴鍦板潃鐐归敊璇紝璧风偣锛氥�恵task.NextAddress}銆�");
+                    return null;
+                }
+                string[] sourceCodes = task.CurrentAddress.Split("-");
+                if (sourceCodes.Length == 5)
+                {
+                    stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[1]);
+                    stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[2]);
+                    stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[3]);
                 }
                 else
                 {
@@ -314,11 +327,11 @@
             else if (task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.RelocationGroup)
             {
                 string[] targetCodes = task.NextAddress.Split("-");
-                if (targetCodes.Length == 3)
+                if (targetCodes.Length == 5)
                 {
-                    stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[0]);
-                    stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[1]);
-                    stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[2]);
+                    stackerCraneTaskCommand.EndRow = Convert.ToInt16(targetCodes[1]);
+                    stackerCraneTaskCommand.EndColumn = Convert.ToInt16(targetCodes[2]);
+                    stackerCraneTaskCommand.EndLayer = Convert.ToInt16(targetCodes[3]);
                 }
                 else
                 {
@@ -327,11 +340,11 @@
                     return null;
                 }
                 string[] sourceCodes = task.CurrentAddress.Split("-");
-                if (sourceCodes.Length == 3)
+                if (sourceCodes.Length == 5)
                 {
-                    stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[0]);
-                    stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[1]);
-                    stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[2]);
+                    stackerCraneTaskCommand.StartRow = Convert.ToInt16(sourceCodes[1]);
+                    stackerCraneTaskCommand.StartColumn = Convert.ToInt16(sourceCodes[2]);
+                    stackerCraneTaskCommand.StartLayer = Convert.ToInt16(sourceCodes[3]);
                 }
                 else
                 {

--
Gitblit v1.9.3