From a07b52190a674033b505f00d7c1e3347cb550676 Mon Sep 17 00:00:00 2001 From: wanshenmean <cathay_xy@163.com> Date: 星期五, 06 三月 2026 10:36:56 +0800 Subject: [PATCH] 更新项目文档:新增机器人通信系统与常量说明 --- Code/WCS/WIDESEAWCS_Server/CLAUDE.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 50 insertions(+), 0 deletions(-) diff --git a/Code/WCS/WIDESEAWCS_Server/CLAUDE.md b/Code/WCS/WIDESEAWCS_Server/CLAUDE.md index e2e08a3..ddc1bc4 100644 --- a/Code/WCS/WIDESEAWCS_Server/CLAUDE.md +++ b/Code/WCS/WIDESEAWCS_Server/CLAUDE.md @@ -133,6 +133,56 @@ - Client connections stored in `ConcurrentDictionary<string, TcpClient>` - Messages handled via `OnDataReceived` event +## Robot Communication System + +The robot crane system uses a modular architecture with specialized components. + +**Components:** + +- `RobotClientManager` - Manages TCP client connections and subscriptions +- `RobotStateManager` - Manages robot state cache with safe concurrent updates +- `RobotMessageHandler` - Processes incoming TCP messages from robots +- `RobotTaskProcessor` - Handles task execution and state transitions +- `RobotBarcodeGenerator` - Generates tray/barcode identifiers + +**Task Types** (from `RobotTaskTypeEnum`): + +- `GroupPallet (500)` - 缁勭洏浠诲姟 +- `ChangePallet (510)` - 鎹㈢洏浠诲姟 +- `SplitPallet (520)` - 鎷嗙洏浠诲姟 + +**State Flow:** + +1. Robot connects via TCP 鈫� ClientManager tracks connection +2. Job polls for tasks 鈫� TaskProcessor gets pending tasks +3. Message received 鈫� MessageHandler parses and updates state +4. State transitions 鈫� TaskProcessor sends commands back to robot + +## Common Constants + +**Communication Timeouts** (`CommunicationConst`): + +- `WaitIntervalMs: 500` - Device wait interval +- `WaitTimeoutBaseMs: 6000` - Timeout base +- `WaitTotalTimeoutMs: 60000` - Total timeout (10 脳 base) +- `PingIntervalMs: 100` - Ping check interval +- `HttpDefaultTimeoutSeconds: 60` - HTTP timeout + +**System Integration URLs** (`BaseAPI`): + +- `WMSBaseUrl: "http://localhost:9291/api/"` - WMS system +- `WCSBaseUrl: "http://localhost:9292/api/"` - WCS system (this server) +- `MESBaseUrl: "http://localhost:9293/api/"` - MES system +- `ERPBaseUrl: "http://localhost:9294/api/"` - ERP system + +**Redis Cache Prefixes** (`RedisPrefix`): + +- `System: "System"` - System-level cache +- `User: "User"` - User-specific cache +- `Code: "Code"` - Code/configuration cache + +Use these prefixes with `ICacheService.RemoveByPrefix()` for bulk cache invalidation. + ## Configuration Settings Key settings in `appsettings.json`: -- Gitblit v1.9.3