From b1f5b17a608d3d9c06ce216c7e1effc5edcc7b74 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期一, 06 四月 2026 19:53:31 +0800
Subject: [PATCH] 更新机器人工作流逻辑、配置并添加电子表格

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotWorkflowOrchestrator.cs |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotWorkflowOrchestrator.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotWorkflowOrchestrator.cs
index 3d09639..4f2960d 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotWorkflowOrchestrator.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotWorkflowOrchestrator.cs
@@ -1,6 +1,7 @@
 using Microsoft.Extensions.Logging;
 using WIDESEA_Core;
 using WIDESEAWCS_Common.TaskEnum;
+using WIDESEAWCS_Core.Helper;
 using WIDESEAWCS_Core.LogHelper;
 using WIDESEAWCS_ITaskInfoService;
 using WIDESEAWCS_Model.Models;
@@ -109,16 +110,21 @@
             // 妫�鏌ユ槸鍚︽弧瓒宠嚜鍔ㄦ帶鍒舵潯浠讹細
             // 1. 杩愯妯″紡涓鸿嚜鍔紙2锛�
             // 2. 鎺у埗妯″紡涓哄鎴风鎺у埗锛�1锛�
-            // 3. 杩愯鐘舵�佷笉鏄� Running锛堣鏄庡凡瀹屾垚褰撳墠鍔ㄤ綔锛�
-            if (latestState.RobotRunMode == 2 && latestState.RobotControlMode == 1 && latestState.OperStatus != "Running")
+            // 3. 杩愯鐘舵�佹槸 Running
+            if (latestState.RobotRunMode == 2 /*&& latestState.RobotControlMode == 1*/ && latestState.OperStatus == "Running")
             {
+                if(latestState.CurrentAction == "Picking" ||  latestState.CurrentAction == "Puting")
+                {
+                    return;
+                }
+
                 // ========== 鍙栬揣瀹屾垚鍚庣殑鏀捐揣澶勭悊 ==========
                 // 鏉′欢锛�
                 // - 褰撳墠鍔ㄤ綔鏄� PickFinished 鎴� AllPickFinished锛堝彇璐у畬鎴愶級
                 // - 鎵嬭噦涓婃湁鐗╂枡锛圧obotArmObject == 1锛�
                 // - 浠诲姟鐘舵�佷负 RobotPickFinish锛堝凡璁板綍鍙栬揣瀹屾垚锛�
                 if ((latestState.CurrentAction == "PickFinished" || latestState.CurrentAction == "AllPickFinished")
-                    && latestState.RobotArmObject == 1
+                    && latestState.RobotArmObject == 0
                     && task.RobotTaskState == TaskRobotStatusEnum.RobotPickFinish.GetHashCode())
                 {
                     _logger.LogInformation("ExecuteAsync锛氭弧瓒虫斁璐ф潯浠讹紝寮�濮嬪鐞嗗彇璐у畬鎴愶紝浠诲姟鍙�: {TaskNum}", task.RobotTaskNum);
@@ -126,14 +132,14 @@
                     // 鍙戦�佹斁璐ф寚浠�
                     await HandlePickFinishedStateAsync(task, ipAddress);
                 }
-                // ========== 鏀捐揣瀹屾垚鍚庣殑鍙栬揣澶勭悊 ==========
+
+                // ========== 鍒濆鍖栨垨鑰呮斁璐у畬鎴愬悗鐨勫彇璐у鐞� ==========
                 // 鏉′欢锛�
                 // - 褰撳墠鍔ㄤ綔鏄� PutFinished銆丄llPutFinished 鎴� null锛堟斁璐у畬鎴愶級
                 // - 杩愯鐘舵�佷负 Homed锛堝凡褰掍綅锛�
                 // - 鎵嬭噦涓婃棤鐗╂枡锛圧obotArmObject == 0锛�
                 // - 浠诲姟鐘舵�佷负 RobotPutFinish 鎴栦笉鏄� RobotExecuting
-                else if ((latestState.CurrentAction == "PutFinished" || latestState.CurrentAction == "AllPutFinished" || latestState.CurrentAction == null)
-                    && latestState.OperStatus == "Homed"
+                else if ((latestState.CurrentAction == "PutFinished" || latestState.CurrentAction == "AllPutFinished" || latestState.CurrentAction.IsNullOrEmpty())
                     && latestState.RobotArmObject == 0
                     && (task.RobotTaskState == TaskRobotStatusEnum.RobotPutFinish.GetHashCode()
                     || task.RobotTaskState != TaskRobotStatusEnum.RobotExecuting.GetHashCode()))

--
Gitblit v1.9.3