From c3de7bb2097aa347a1f92c2f640d18753aff633a Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期六, 28 二月 2026 13:41:26 +0800
Subject: [PATCH] 添加HTTP客户端助手、枚举、DTO;更新URL

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs |   34 ++++++++++++++++++++++------------
 1 files changed, 22 insertions(+), 12 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
index 147c902..132566c 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/CommonStackerCraneJob.cs
@@ -86,10 +86,10 @@
                     Dt_Task? task = GetTask(commonStackerCrane);
                     if (task != null)
                     {
-                        var stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task);
+                        object? stackerCraneTaskCommand = ConvertToStackerCraneTaskCommand(task);
                         if (stackerCraneTaskCommand != null)
                         {
-                            bool sendFlag = commonStackerCrane.SendCommand(stackerCraneTaskCommand);
+                            bool sendFlag = SendStackerCraneCommand(commonStackerCrane, stackerCraneTaskCommand);
                             if (sendFlag)
                             {
                                 commonStackerCrane.LastTaskType = task.TaskType;
@@ -116,12 +116,12 @@
             CommonStackerCrane? commonStackerCrane = sender as CommonStackerCrane;
             if (commonStackerCrane != null)
             {
-                if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
-                {
+                //if (commonStackerCrane.GetValue<StackerCraneDBName, short>(StackerCraneDBName.WorkType) != 5)
+                //{
                     Console.Out.WriteLine("TaskCompleted" + e.TaskNum);
                     _taskService.StackCraneTaskCompleted(e.TaskNum);
                     commonStackerCrane.SetValue(StackerCraneDBName.WorkType, 5);
-                }
+                //}
             }
         }
 
@@ -152,10 +152,10 @@
 
             if (task != null && task.TaskType.GetTaskTypeGroup() == TaskTypeGroup.OutbondGroup)
             {
-                if (IsOutTaskStationAvailable(task))
-                {
+                //if (IsOutTaskStationAvailable(task))
+                //{
                     return task;
-                }
+                //}
 
                 List<string> otherOutStationCodes = _routerService.QueryNextRoutes(commonStackerCrane.DeviceCode, task.NextAddress, task.TaskType)
                     .Select(x => x.ChildPosi).ToList();
@@ -201,7 +201,7 @@
         /// <summary>
         /// 浠诲姟瀹炰綋杞崲鎴愬懡浠odel
         /// </summary>
-        public dynamic? ConvertToStackerCraneTaskCommand([NotNull] Dt_Task task)
+        public object? ConvertToStackerCraneTaskCommand([NotNull] Dt_Task task)
         {
             // 鏍规嵁閰嶇疆鍒ゆ柇鍛戒护绫诲瀷
             string commandType = GetCommandType(task.Roadway);
@@ -211,6 +211,16 @@
             {
                 "Formation" => BuildCommand(task, CreateFormationCommand(task)),
                 _ => BuildCommand(task, CreateStandardCommand(task))
+            };
+        }
+
+        private static bool SendStackerCraneCommand(IStackerCrane commonStackerCrane, object command)
+        {
+            return command switch
+            {
+                FormationStackerCraneTaskCommand formationCommand => commonStackerCrane.SendCommand(formationCommand),
+                StackerCraneTaskCommand standardCommand => commonStackerCrane.SendCommand(standardCommand),
+                _ => false
             };
         }
 
@@ -236,15 +246,15 @@
         {
             return new StackerCraneTaskCommand
             {
-                Barcode = task.PalletCode,
+                //Barcode = task.PalletCode,
                 TaskNum = task.TaskNum,
                 WorkType = 1,
-                TrayType = 0
+                WorkAction = 1
             };
         }
 
         /// <summary>
-        /// 鍒涘缓缁勭洏鍫嗗灈鏈哄懡浠�
+        /// 鍒涘缓鍒嗗鍫嗗灈鏈哄懡浠�
         /// </summary>
         private static FormationStackerCraneTaskCommand CreateFormationCommand(Dt_Task task)
         {

--
Gitblit v1.9.3