From 419159c8611dca81b94b3103cdeaeb9272aed5ea Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期四, 23 四月 2026 16:40:32 +0800
Subject: [PATCH] feat(机器人任务): 实现本地创建机器人任务功能
---
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotWorkflowOrchestrator.cs | 21 ++++++++++++++-------
1 files changed, 14 insertions(+), 7 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 158d35c..ec3d757 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotWorkflowOrchestrator.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotWorkflowOrchestrator.cs
@@ -118,7 +118,7 @@
// - 鎵嬭噦涓婃湁鐗╂枡锛圧obotArmObject == 1锛�
// - 浠诲姟鐘舵�佷负 RobotPickFinish锛堝凡璁板綍鍙栬揣瀹屾垚锛�
if ((latestState.CurrentAction == "PickFinished" || latestState.CurrentAction == "AllPickFinished")
- && (latestState.RobotArmObject.IsNullOrEmpty() || latestState.RobotArmObject == 1)
+ //&& (latestState.RobotArmObject.IsNullOrEmpty() || latestState.RobotArmObject == 1)
&& task.RobotTaskState == TaskRobotStatusEnum.RobotPickFinish.GetHashCode())
{
QuartzLogHelper.LogInfo(_logger, $"ExecuteAsync锛氭弧瓒虫斁璐ф潯浠讹紝寮�濮嬩笅鍙戞斁璐т换鍔�,浠诲姟鍙�: {task.RobotTaskNum}", latestState.RobotCrane?.DeviceName ?? ipAddress);
@@ -133,7 +133,7 @@
// - 鎵嬭噦涓婃棤鐗╂枡锛圧obotArmObject == 0锛�
// - 浠诲姟鐘舵�佷负 RobotPutFinish 鎴栦笉鏄� RobotExecuting
else if ((latestState.CurrentAction == "PutFinished" || latestState.CurrentAction == "AllPutFinished" || latestState.CurrentAction.IsNullOrEmpty())
- && (latestState.RobotArmObject.IsNullOrEmpty() || latestState.RobotArmObject == 0)
+ //&& (latestState.RobotArmObject.IsNullOrEmpty() || latestState.RobotArmObject == 0)
&& (task.RobotTaskState == TaskRobotStatusEnum.RobotPutFinish.GetHashCode() || task.RobotTaskState != TaskRobotStatusEnum.RobotExecuting.GetHashCode()))
{
QuartzLogHelper.LogInfo(_logger, $"ExecuteAsync锛氭弧瓒冲彇璐ф潯浠讹紝寮�濮嬩笅鍙戝彇璐т换鍔★紝浠诲姟鍙�: {task.RobotTaskNum}", latestState.RobotCrane?.DeviceName ?? ipAddress);
@@ -327,18 +327,19 @@
// 妫�鏌ョ數姹犳槸鍚﹀凡鍒颁綅
if (!stateForUpdate.BatteryArrived)
{
+ QuartzLogHelper.LogError(_logger, $"HandlePutFinishedStateAsync锛氱數鑺湭鍒颁綅锛屼换鍔″彿: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress);
return;
}
// 璇诲彇绾夸綋鐢佃姱鏉$爜
- string trayBarcode1 = RobotBarcodeGenerator.GenerateTrayBarcode("DB40.990");
- string trayBarcode2 = RobotBarcodeGenerator.GenerateTrayBarcode("DB40.1020");
+ string trayBarcode2 = RobotBarcodeGenerator.GenerateTrayBarcode("DB40.990");
+ string trayBarcode1 = RobotBarcodeGenerator.GenerateTrayBarcode("DB40.1020");
// 濡傛灉鏉$爜鐢熸垚鎴愬姛
if (!string.IsNullOrEmpty(trayBarcode1) && !string.IsNullOrEmpty(trayBarcode2))
{
if (stateForUpdate.CellBarcode.Contains(trayBarcode1) || stateForUpdate.CellBarcode.Contains(trayBarcode2))
{
- QuartzLogHelper.LogInfo(_logger, $"HandlePutFinishedStateAsync锛氳鍙栫殑鎵樼洏鏉$爜宸插瓨鍦紝鍙兘瀛樺湪閲嶅锛屼换鍔″彿: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress);
+ QuartzLogHelper.LogInfo(_logger, $"HandlePutFinishedStateAsync锛氳鍙栫殑鐢佃姱鏉$爜宸插瓨鍦紝鍙兘瀛樺湪閲嶅锛屼换鍔″彿: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress);
// 鍙戦�佸彇璐ф寚浠� 鏍囪鎵爜NG锛屾斁璐ф椂涓嶄娇鐢ㄨ繖浜涙潯鐮侊紝骞舵斁鍏G鍙�
//await _taskProcessor.SendSocketRobotPickAsync(task, stateForUpdate, true);
@@ -346,7 +347,13 @@
}
else
{
- QuartzLogHelper.LogInfo(_logger, $"HandlePutFinishedStateAsync锛氳鍙栫殑鎵樼洏鏉$爜鍞竴锛岀户缁墽琛岋紝浠诲姟鍙�: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress);
+ if (trayBarcode1.Length < 13 || trayBarcode2.Length < 13)
+ {
+ QuartzLogHelper.LogError(_logger, $"HandlePutFinishedStateAsync锛氱數鑺潯鐮侀暱搴︿笉杈炬爣锛屼换鍔″彿: {task.RobotTaskNum}锛岃鍙栫數鑺潯鐮佹垚鍔�: 銆恵trayBarcode1}銆�-----銆恵trayBarcode2}銆�", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress);
+ return;
+ }
+
+ QuartzLogHelper.LogInfo(_logger, $"HandlePutFinishedStateAsync锛氳鍙栫殑鐢佃姱鏉$爜鍞竴锛岀户缁墽琛岋紝浠诲姟鍙�: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress);
// 灏嗘潯鐮佹坊鍔犲埌鐘舵�佷腑锛屼緵鍚庣画鏀捐揣鏃朵娇鐢�
stateForUpdate.CellBarcode = new List<string>()
@@ -356,7 +363,7 @@
}
// 璁板綍鏃ュ織锛氳鍙栨墭鐩樻潯鐮佹垚鍔�
- QuartzLogHelper.LogInfo(_logger, $"HandlePutFinishedStateAsync锛氳鍙栨墭鐩樻潯鐮佹垚鍔�: 銆恵trayBarcode1}銆�-----銆恵trayBarcode2}銆戯紝浠诲姟鍙�: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress);
+ QuartzLogHelper.LogInfo(_logger, $"HandlePutFinishedStateAsync锛氳鍙栫數鑺潯鐮佹垚鍔�: 銆恵trayBarcode1}銆�-----銆恵trayBarcode2}銆戯紝浠诲姟鍙�: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress);
// 鍙戦�佸彇璐ф寚浠�
await _taskProcessor.SendSocketRobotPickAsync(task, stateForUpdate);
--
Gitblit v1.9.3