From e2bf7bc6b494439e182d333041e22b2774056fc3 Mon Sep 17 00:00:00 2001
From: wanshenmean <cathay_xy@163.com>
Date: 星期日, 19 四月 2026 19:26:47 +0800
Subject: [PATCH] refactor(RobotJob): 构造函数从 ICacheService 改为 IRobotStateRepository
---
Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotJob.cs | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotJob.cs b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotJob.cs
index c35e485..f472356 100644
--- a/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotJob.cs
+++ b/Code/WCS/WIDESEAWCS_Server/WIDESEAWCS_Tasks/RobotJob/RobotJob.cs
@@ -7,6 +7,7 @@
using WIDESEAWCS_Core.LogHelper;
using WIDESEAWCS_ITaskInfoService;
using WIDESEAWCS_QuartzJob;
+using WIDESEAWCS_RedisService;
using WIDESEAWCS_Tasks.SocketServer;
using WIDESEAWCS_Tasks.Workflow;
using WIDESEAWCS_Tasks.Workflow.Abstractions;
@@ -95,19 +96,20 @@
/// <param name="tcpSocket">TCP Socket 鏈嶅姟鍣ㄥ疄渚�</param>
/// <param name="robotTaskService">鏈哄櫒浜轰换鍔℃湇鍔�</param>
/// <param name="taskService">閫氱敤浠诲姟鏈嶅姟</param>
- /// <param name="cache">缂撳瓨鏈嶅姟</param>
+ /// <param name="robotStateRepository">鏈哄櫒浜虹姸鎬佷粨鍌�</param>
/// <param name="httpClientHelper">HTTP 瀹㈡埛绔府鍔╃被锛岀敤浜庤皟鐢� WMS 鎺ュ彛</param>
/// <param name="logger">鏃ュ織璁板綍鍣�</param>
public RobotJob(
TcpSocketServer tcpSocket,
IRobotTaskService robotTaskService,
ITaskService taskService,
- ICacheService cache,
+ IRobotStateRepository robotStateRepository,
HttpClientHelper httpClientHelper,
- ILogger<RobotJob> logger)
+ ILogger<RobotJob> logger,
+ IFakeBatteryPositionService fakeBatteryPositionService)
{
- // 鍒濆鍖栫姸鎬佺鐞嗗櫒锛屼紶鍏ョ紦瀛樻湇鍔�
- _stateManager = new RobotStateManager(cache, _logger);
+ // 鍒濆鍖栫姸鎬佺鐞嗗櫒锛屼紶鍏ヤ粨鍌ㄦ湇鍔�
+ _stateManager = new RobotStateManager(robotStateRepository, _logger);
_logger = logger;
// 鍒涘缓 Socket 缃戝叧锛屽皝瑁� TcpSocketServer 鐨勮闂�
@@ -115,7 +117,7 @@
ISocketClientGateway socketGateway = new SocketClientGateway(tcpSocket);
// 鍒濆鍖栦换鍔″鐞嗗櫒
- _taskProcessor = new RobotTaskProcessor(socketGateway, _stateManager, robotTaskService, taskService, httpClientHelper, _logger);
+ _taskProcessor = new RobotTaskProcessor(socketGateway, _stateManager, robotTaskService, taskService, httpClientHelper, _logger, fakeBatteryPositionService);
// 鍒濆鍖栧鎴风绠$悊鍣�
_clientManager = new RobotClientManager(tcpSocket, _stateManager, _logger);
@@ -124,7 +126,7 @@
// 绠�鍗曞懡浠ゅ鐞嗗櫒锛氬鐞嗙姸鎬佹洿鏂扮瓑绠�鍗曞懡浠�
var simpleCommandHandler = new RobotSimpleCommandHandler(_taskProcessor, socketGateway);
// 鍓嶇紑鍛戒护澶勭悊鍣細澶勭悊 pickfinished銆乸utfinished 绛夊甫鍙傛暟鐨勫懡浠�
- var prefixCommandHandler = new RobotPrefixCommandHandler(robotTaskService, _taskProcessor, _stateManager, socketGateway);
+ var prefixCommandHandler = new RobotPrefixCommandHandler(robotTaskService, _taskProcessor, _stateManager, socketGateway, fakeBatteryPositionService);
// 鍒濆鍖栨秷鎭矾鐢卞櫒
_messageRouter = new RobotMessageHandler(socketGateway, _stateManager, cache, simpleCommandHandler, prefixCommandHandler, logger);
--
Gitblit v1.9.3