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_Server/appsettings.json | 4 +-
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotSimpleCommandHandler.cs | 42 ++++++++++-----------
项目资料/设备协议/机械手协议/交互流程表(1).xlsx | 0
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotJob.cs | 6 +-
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotWorkflowOrchestrator.cs | 18 ++++++---
项目资料/设备协议/机械手协议/~$交互流程表(1).xlsx | 0
6 files changed, 37 insertions(+), 33 deletions(-)
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
index e5b3030..bf7384c 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Server/appsettings.json
@@ -32,8 +32,8 @@
//5.PostgreSQL
"DBType": "SqlServer",
//杩炴帴瀛楃涓�
- //"ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWCS_ShanMei;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
- "ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWCS_ShanMei;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+ "ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWCS_ShanMei;User ID=sa;Password=P@ssw0rd;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
+ //"ConnectionString": "Data Source=.;Initial Catalog=WIDESEAWCS_ShanMei;User ID=sa;Password=123456;Integrated Security=False;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False;ApplicationIntent=ReadWrite;MultiSubnetFailover=False",
//璺ㄥ煙
"Cors": {
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotJob.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotJob.cs
index 08ffb97..ea25892 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotJob.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotJob.cs
@@ -229,12 +229,12 @@
}
// 妫�鏌ヤ换鍔℃�绘暟鏄惁鏈揪鍒颁笂闄�
- if (latestState.RobotTaskTotalNum < MaxTaskTotalNum)
- {
+ //if (latestState.RobotTaskTotalNum < MaxTaskTotalNum)
+ //{
// 璋冪敤宸ヤ綔娴佺紪鎺掑櫒鎵ц浠诲姟
// 缂栨帓鍣ㄤ細鏍规嵁褰撳墠鐘舵�佸喅瀹氫笅涓�姝ュ姩浣�
await _workflowOrchestrator.ExecuteAsync(latestState, task, ipAddress);
- }
+ //}
}
}
catch (Exception ex)
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotSimpleCommandHandler.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotSimpleCommandHandler.cs
index c8887de..0a17d62 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotSimpleCommandHandler.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotSimpleCommandHandler.cs
@@ -79,6 +79,26 @@
state.OperStatus = "Homed";
return true;
+ // 鏈哄櫒浜烘鍦ㄨ繍琛�
+ case "running":
+ state.OperStatus = "Running";
+ return true;
+
+ // 鏈哄櫒浜烘鍦ㄦ殏鍋�
+ case "pausing":
+ state.OperStatus = "Pausing";
+ return true;
+
+ // 鏈哄櫒浜烘鍦ㄩ鐑�
+ case "warming":
+ state.OperStatus = "Warming";
+ return true;
+
+ // 鏈哄櫒浜烘鍦ㄦ�ュ仠
+ case "emstoping":
+ state.OperStatus = "Emstoping";
+ return true;
+
// 鏈哄櫒浜烘鍦ㄥ彇璐�
case "picking":
state.CurrentAction = "Picking";
@@ -158,28 +178,6 @@
}
return false;
}
-
- // ==================== 杩愯鐘舵�佸懡浠わ紙缁級 ====================
-
- // 鏈哄櫒浜烘鍦ㄨ繍琛�
- case "running":
- state.OperStatus = "Running";
- return true;
-
- // 鏈哄櫒浜烘鍦ㄦ殏鍋�
- case "pausing":
- state.OperStatus = "Pausing";
- return true;
-
- // 鏈哄櫒浜烘鍦ㄩ鐑�
- case "warming":
- state.OperStatus = "Warming";
- return true;
-
- // 鏈哄櫒浜烘鍦ㄦ�ュ仠
- case "emstoping":
- state.OperStatus = "Emstoping";
- return true;
// ==================== 妯″紡鍒囨崲鍛戒护 ====================
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()))
diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\350\256\276\345\244\207\345\215\217\350\256\256/\346\234\272\346\242\260\346\211\213\345\215\217\350\256\256/~$\344\272\244\344\272\222\346\265\201\347\250\213\350\241\250\0501\051.xlsx" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\350\256\276\345\244\207\345\215\217\350\256\256/\346\234\272\346\242\260\346\211\213\345\215\217\350\256\256/~$\344\272\244\344\272\222\346\265\201\347\250\213\350\241\250\0501\051.xlsx"
new file mode 100644
index 0000000..236d63d
--- /dev/null
+++ "b/\351\241\271\347\233\256\350\265\204\346\226\231/\350\256\276\345\244\207\345\215\217\350\256\256/\346\234\272\346\242\260\346\211\213\345\215\217\350\256\256/~$\344\272\244\344\272\222\346\265\201\347\250\213\350\241\250\0501\051.xlsx"
Binary files differ
diff --git "a/\351\241\271\347\233\256\350\265\204\346\226\231/\350\256\276\345\244\207\345\215\217\350\256\256/\346\234\272\346\242\260\346\211\213\345\215\217\350\256\256/\344\272\244\344\272\222\346\265\201\347\250\213\350\241\250\0501\051.xlsx" "b/\351\241\271\347\233\256\350\265\204\346\226\231/\350\256\276\345\244\207\345\215\217\350\256\256/\346\234\272\346\242\260\346\211\213\345\215\217\350\256\256/\344\272\244\344\272\222\346\265\201\347\250\213\350\241\250\0501\051.xlsx"
index 3971a56..5b2ba64 100644
--- "a/\351\241\271\347\233\256\350\265\204\346\226\231/\350\256\276\345\244\207\345\215\217\350\256\256/\346\234\272\346\242\260\346\211\213\345\215\217\350\256\256/\344\272\244\344\272\222\346\265\201\347\250\213\350\241\250\0501\051.xlsx"
+++ "b/\351\241\271\347\233\256\350\265\204\346\226\231/\350\256\276\345\244\207\345\215\217\350\256\256/\346\234\272\346\242\260\346\211\213\345\215\217\350\256\256/\344\272\244\344\272\222\346\265\201\347\250\213\350\241\250\0501\051.xlsx"
Binary files differ
--
Gitblit v1.9.3