wanshenmean
3 天以前 b690250002ee04f4309e6a90fd16fbfd9bd959e2
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/Workflow/RobotWorkflowOrchestrator.cs
@@ -1,3 +1,4 @@
using Masuit.Tools;
using Serilog;
using WIDESEAWCS_Common.TaskEnum;
using WIDESEAWCS_Core.Helper;
@@ -241,7 +242,6 @@
                    }
                    return;
                }
            }
            // 非换盘任务:使用原有格式
@@ -271,6 +271,7 @@
                if (stateToUpdate != null)
                {
                    stateToUpdate.CurrentTask = task;
                    stateToUpdate.CurrentTaskNum = task.RobotTaskNum;
                    if (_stateManager.TryUpdateStateSafely(ipAddress, stateToUpdate))
                    {
@@ -336,7 +337,7 @@
                string trayBarcode1 = RobotBarcodeGenerator.GenerateTrayBarcode("DB40.1020");
                // 如果条码生成成功
                if (!string.IsNullOrEmpty(trayBarcode1) && !string.IsNullOrEmpty(trayBarcode2))
                if (!trayBarcode1.IsNullOrEmpty() && !trayBarcode2.IsNullOrEmpty())
                {
                    //if (stateForUpdate.CellBarcode.Contains(trayBarcode1) || stateForUpdate.CellBarcode.Contains(trayBarcode2))
                    //{
@@ -356,15 +357,23 @@
                        QuartzLogHelper.LogInfo(_logger, $"HandlePutFinishedStateAsync:读取的电芯条码唯一,继续执行,任务号: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress);
                        // 将条码添加到状态中,供后续放货时使用
                        stateForUpdate.CellBarcode = new List<string>()
                        {
                            trayBarcode1,trayBarcode2
                        };
                    }
                        // 记录日志:读取托盘条码成功
                        QuartzLogHelper.LogInfo(_logger, $"HandlePutFinishedStateAsync:读取电芯条码成功: 【{trayBarcode1}】-----【{trayBarcode2}】,任务号: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress);
                    // 记录日志:读取托盘条码成功
                    QuartzLogHelper.LogInfo(_logger, $"HandlePutFinishedStateAsync:读取电芯条码成功: 【{trayBarcode1}】-----【{trayBarcode2}】,任务号: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress);
                        // 将条码累积到 CellBarcode(去重),并设置当前批次条码
                        if (!stateForUpdate.CellBarcode.Contains(trayBarcode1) || !stateForUpdate.CellBarcode.Contains(trayBarcode2))
                        {
                            stateForUpdate.CellBarcode.Add(trayBarcode1);
                            stateForUpdate.CellBarcode.Add(trayBarcode2);
                            // 设置当前批次条码,用于 WMS 提交
                            stateForUpdate.CurrentBatchBarcodes = new List<string>()
                            {
                                trayBarcode1, trayBarcode2
                            };
                        }
                    }
                    // 发送取货指令
                    await _taskProcessor.SendSocketRobotPickAsync(task, stateForUpdate);
@@ -401,7 +410,7 @@
                    return;
                }
                QuartzLogHelper.LogDebug(_logger,$"HandlePutFinishedStateAsync:换盘任务目标数量: {targetNormalCount},当前已完成数量: {currentCompletedCount},流向: {(isFlowA ? "A" : "B")},任务号: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress);
                QuartzLogHelper.LogDebug(_logger, $"HandlePutFinishedStateAsync:换盘任务目标数量: {targetNormalCount},当前已完成数量: {currentCompletedCount},流向: {(isFlowA ? "A" : "B")},任务号: {task.RobotTaskNum}", stateForUpdate?.RobotCrane?.DeviceName ?? ipAddress);
                // 初始化批次模式
                if (stateForUpdate.ChangePalletPhase == 0)