From 5171d3f59b89389bf75293afd210cfa6de4ccff7 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期五, 10 四月 2026 23:03:49 +0800
Subject: [PATCH] feat: 添加堆垛机相关常量类并重构代码使用常量

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneCommandBuilder.cs |   38 ++++++++++++++++++++------------------
 1 files changed, 20 insertions(+), 18 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneCommandBuilder.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneCommandBuilder.cs
index aa463f3..a8637cb 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneCommandBuilder.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/StackerCraneJob/StackerCraneCommandBuilder.cs
@@ -1,6 +1,7 @@
 using Microsoft.Extensions.Logging;
 using System;
 using System.Diagnostics.CodeAnalysis;
+using WIDESEAWCS_Common.Constants;
 using WIDESEAWCS_Common.TaskEnum;
 using WIDESEAWCS_Core.LogHelper;
 using WIDESEAWCS_ITaskInfoService;
@@ -74,18 +75,19 @@
         /// <returns>鍫嗗灈鏈哄懡浠ゅ璞★紝杞崲澶辫触杩斿洖 null</returns>
         public object? ConvertToStackerCraneTaskCommand([NotNull] Dt_Task task)
         {
+            return  BuildCommand(task, CreateStandardCommand(task));
             // 鏍规嵁宸烽亾鑾峰彇鍛戒护绫诲瀷
-            string commandType = GetCommandType(task.Roadway);
+            //string commandType = GetCommandType(task.Roadway);
 
-            _logger.LogInformation("ConvertToStackerCraneTaskCommand锛氭瀯寤哄懡浠わ紝浠诲姟鍙�: {TaskNum}锛屽贩閬�: {Roadway}锛屽懡浠ょ被鍨�: {CommandType}", task.TaskNum, task.Roadway, commandType);
-            QuartzLogger.Info($"鏋勫缓鍛戒护锛屼换鍔″彿: {task.TaskNum}锛屽贩閬�: {task.Roadway}锛屽懡浠ょ被鍨�: {commandType}", task.Roadway);
+            //_logger.LogInformation("ConvertToStackerCraneTaskCommand锛氭瀯寤哄懡浠わ紝浠诲姟鍙�: {TaskNum}锛屽贩閬�: {Roadway}锛屽懡浠ょ被鍨�: {CommandType}", task.TaskNum, task.Roadway, commandType);
+            //QuartzLogger.Info($"鏋勫缓鍛戒护锛屼换鍔″彿: {task.TaskNum}锛屽贩閬�: {task.Roadway}锛屽懡浠ょ被鍨�: {commandType}", task.Roadway);
 
-            // 鏍规嵁鍛戒护绫诲瀷璋冪敤鐩稿簲鐨勬瀯寤烘柟娉�
-            return commandType switch
-            {
-                "Formation" => BuildCommand(task, CreateFormationCommand(task)),  // 鎴愬瀷鍛戒护
-                _ => BuildCommand(task, CreateStandardCommand(task))              // 鏍囧噯鍛戒护
-            };
+            //// 鏍规嵁鍛戒护绫诲瀷璋冪敤鐩稿簲鐨勬瀯寤烘柟娉�
+            //return commandType switch
+            //{
+            //    "Formation" => BuildCommand(task, CreateFormationCommand(task)),  // 鎴愬瀷鍛戒护
+            //    _ => BuildCommand(task, CreateStandardCommand(task))              // 鏍囧噯鍛戒护
+            //};
         }
 
         /// <summary>
@@ -127,8 +129,8 @@
             return new StackerCraneTaskCommand
             {
                 TaskNum = task.TaskNum,   // 浠诲姟鍙�
-                WorkType = 1,             // 浣滀笟绫诲瀷
-                WorkAction = 1            // 浣滀笟鎸囦护锛氬紑濮嬫墽琛�
+                WorkType = StackerCraneConst.WorkTypeInbound,  // 浣滀笟绫诲瀷锛氬叆搴�
+                //WorkAction = StackerCraneWorkActionEnum.StartTask  // 浣滀笟鎸囦护锛氬紑濮嬫墽琛�
             };
         }
 
@@ -147,10 +149,10 @@
             {
                 Barcode = task.PalletCode,   // 鎵樼洏鏉$爜
                 TaskNum = task.TaskNum,      // 浠诲姟鍙�
-                WorkType = 1,               // 浣滀笟绫诲瀷
-                WorkAction = 1,             // 浣滀笟鎸囦护锛氬紑濮嬫墽琛�
-                FireAlarm = 0,              // 鐏锛氭甯�
-                HeartBeat = 0,              // 蹇冭烦
+                WorkType = StackerCraneConst.WorkTypeInbound,  // 浣滀笟绫诲瀷锛氬叆搴�
+                WorkAction = (short)StackerCraneWorkActionEnum.StartTask,  // 浣滀笟鎸囦护锛氬紑濮嬫墽琛�
+                FireAlarm = StackerCraneConst.FireAlarmNormal,  // 鐏锛氭甯�
+                HeartBeat = StackerCraneConst.HeartBeatInitial,  // 蹇冭烦
                 FieldName = string.Empty     // 淇濈暀瀛楁
             };
         }
@@ -201,11 +203,11 @@
             _logger.LogInformation("BuildInboundCommand锛氭瀯寤哄叆搴撳懡浠わ紝浠诲姟鍙�: {TaskNum}", task.TaskNum);
             QuartzLogger.Info($"BuildInboundCommand锛氭瀯寤哄叆搴撳懡浠わ紝浠诲姟鍙�: {task.TaskNum}", task.Roadway);
 
-            // 纭畾浠诲姟绫诲瀷锛堢┖鎵樼洏鐢ㄧ壒娈婄被鍨� 100锛�
+            // 纭畾浠诲姟绫诲瀷锛堢┖鎵樼洏鐢ㄧ壒娈婄被鍨嬶級
             int taskType = 0;
             if (task.TaskType == (int)TaskOutboundTypeEnum.OutEmpty)
             {
-                taskType = 100;
+                taskType = StackerCraneConst.EmptyPalletTaskType;
             }
             else
                 taskType = task.TaskType;
@@ -269,7 +271,7 @@
             int taskType = 0;
             if (task.TaskType == (int)TaskOutboundTypeEnum.OutEmpty)
             {
-                taskType = 100;
+                taskType = StackerCraneConst.EmptyPalletTaskType;
             }
             else
                 taskType = task.TaskType;

--
Gitblit v1.9.3