From 0b2869539598059704e1d208e2bcb18603b0fe0f Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期五, 01 五月 2026 00:00:30 +0800
Subject: [PATCH] feat(出库时效): 添加出库时效配置功能

---
 Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotWorkflowOrchestrator.cs |   26 ++++++++++++++++++++------
 1 files changed, 20 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 2567908..6d8f9a7 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotWorkflowOrchestrator.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotWorkflowOrchestrator.cs
@@ -169,6 +169,9 @@
 
                 bool isFlowA = task.RobotSourceAddressLineCode is "11001" or "11010";
 
+                await _taskProcessor.SendSocketRobotNumAsync(task, state, false);
+                Thread.Sleep(500);
+
                 // ==================== Phase 2: 鏀炬甯哥數鑺埌鐩爣鎵樼洏锛堜袱娴佸悜鐩稿悓锛�====================
                 // PickFinished 鍒拌揪锛歅hase 1 鐨� Pick 鍛戒护瀹屾垚锛岀幇鍦ㄤ笅鍙� Put 鍛戒护鏀炬甯哥數鑺�
                 if (state?.ChangePalletPhase == 2)
@@ -239,8 +242,6 @@
                     return;
                 }
 
-                // 闈炴壒娆℃ā寮忔垨鍏朵粬闃舵涓嶄笅鍙戞寚浠�
-                return;
             }
 
             // 闈炴崲鐩樹换鍔★細浣跨敤鍘熸湁鏍煎紡
@@ -270,6 +271,7 @@
                 if (stateToUpdate != null)
                 {
                     stateToUpdate.CurrentTask = task;
+                    stateToUpdate.CurrentTaskNum = task.RobotTaskNum;
 
                     if (_stateManager.TryUpdateStateSafely(ipAddress, stateToUpdate))
                     {
@@ -355,10 +357,16 @@
 
                         QuartzLogHelper.LogInfo(_logger, $"HandlePutFinishedStateAsync锛氳鍙栫殑鐢佃姱鏉$爜鍞竴锛岀户缁墽琛岋紝浠诲姟鍙�: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress);
 
-                        // 灏嗘潯鐮佹坊鍔犲埌鐘舵�佷腑锛屼緵鍚庣画鏀捐揣鏃朵娇鐢�
-                        stateForUpdate.CellBarcode = new List<string>()
+                        // 灏嗘潯鐮佺疮绉埌 CellBarcode锛堝幓閲嶏級锛屽苟璁剧疆褰撳墠鎵规鏉$爜
+                        if (!stateForUpdate.CellBarcode.Contains(trayBarcode1))
+                            stateForUpdate.CellBarcode.Add(trayBarcode1);
+                        if (!stateForUpdate.CellBarcode.Contains(trayBarcode2))
+                            stateForUpdate.CellBarcode.Add(trayBarcode2);
+
+                        // 璁剧疆褰撳墠鎵规鏉$爜锛岀敤浜� WMS 鎻愪氦
+                        stateForUpdate.CurrentBatchBarcodes = new List<string>()
                         {
-                            trayBarcode1,trayBarcode2
+                            trayBarcode1, trayBarcode2
                         };
                     }
 
@@ -389,13 +397,19 @@
                 // 鍒ゆ柇娴佸悜锛坣ull-safe锛�
                 bool isFlowA = task.RobotSourceAddressLineCode is "11001" or "11010";
 
+                await _taskProcessor.SendSocketRobotNumAsync(task, stateForUpdate);
+                Thread.Sleep(500);
+
                 // 鐩爣鏁伴噺涓�48锛氱洿鎺ヨ蛋鍘熸湁閫昏緫锛屼笉杩涘叆鎵规妯″紡
-                if (targetNormalCount == targetTotal)
+                if (targetNormalCount + currentCompletedCount == targetTotal)
                 {
+                    QuartzLogHelper.LogInfo(_logger, $"HandlePutFinishedStateAsync锛氱洰鏍囨暟閲忓凡杈�48锛岀洿鎺ヤ笅鍙戝彇璐ф寚浠わ紝浠诲姟鍙�: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress);
                     await _taskProcessor.SendSocketRobotPickAsync(task, stateForUpdate);
                     return;
                 }
 
+                QuartzLogHelper.LogDebug(_logger,$"HandlePutFinishedStateAsync锛氭崲鐩樹换鍔$洰鏍囨暟閲�: {targetNormalCount}锛屽綋鍓嶅凡瀹屾垚鏁伴噺: {currentCompletedCount}锛屾祦鍚�: {(isFlowA ? "A" : "B")}锛屼换鍔″彿: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress);
+
                 // 鍒濆鍖栨壒娆℃ā寮�
                 if (stateForUpdate.ChangePalletPhase == 0)
                 {

--
Gitblit v1.9.3