wanshenmean
2026-03-06 a07b52190a674033b505f00d7c1e3347cb550676
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`: