Commit Graph

23 Commits

Author SHA1 Message Date
caoqianming 737f32af8f fix(event): rem_recovered as warn with manual restart reminder
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 10:47:44 +08:00
caoqianming 7ae952f93e feat(event): add RemLocal/RemRecovered events for REM-triggered auto-stop
When any equipment's REM signal switches to local mode, fire a dedicated
`unit.rem_local` event (with unit + equipment context) and record it to
the event log. Also fire `unit.rem_recovered` when all REM signals return
to remote. AutoControlStopped is still fired alongside RemLocal when
auto was running at the time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 10:39:17 +08:00
caoqianming 9d787e452b feat(events): use Chinese messages with entity names
Event messages are now stored and displayed in Chinese. Names/codes are
resolved via lightweight DB lookups in persist_event_if_needed (entities
still exist at processing time). SourceDelete passes the name explicitly
since the source is deleted before the async event is processed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 09:53:26 +08:00
caoqianming 8c1b7b636d refactor(engine): replace 500ms ticker with per-unit event-driven tasks
- Engine now spawns one async task per enabled unit (supervised every 10s)
- wait_phase uses sleep_until + select! for precise timing; 500ms fault-tick
  runs inside each phase so fault/comm is still checked promptly
- WS UnitRuntimeChanged pushed only on state transitions, not every tick
- ControlRuntimeStore gains notify_unit/get_or_create_notify for instant
  wake-up when handlers change auto_enabled or fault_locked
- UnitRuntime: remove last_tick_at, current_run/stop/distributor_elapsed_sec;
  add display_acc_sec (snapshot at transition, avoids mid-cycle jitter)
- accumulated_run_sec now increments by exact run_time_sec*1000 per cycle
- unit.state_changed events no longer written to DB (too frequent)
- Frontend: show display_acc_sec instead of accumulated_run_sec
- styles: event-card flex-shrink:0 fixes text overlap under flex column

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-26 08:33:00 +08:00
caoqianming 68e724898c feat(event): add business control events (fault, comm, auto, state change) 2026-03-24 14:46:25 +08:00
caoqianming c50127b9d0 feat(event): stream created events over websocket 2026-03-24 12:28:12 +08:00
caoqianming 97d2f6ebf8 feat(control): add manual equipment pulse commands 2026-03-24 11:16:50 +08:00
caoqianming 4e3d325437 feat(control): add unit and event foundation 2026-03-24 10:20:23 +08:00
caoqianming 503aefc4cb refactor(event): rename ReloadEvent to AppEvent and split event channels
Clarify event semantics by renaming ReloadEvent to AppEvent and route control vs telemetry traffic through dedicated channels. This keeps control events isolated from high-frequency PointNewValue updates while preserving the existing send() call pattern.

Made-with: Cursor
2026-03-13 14:44:30 +08:00
caoqianming 5fa63ad6dd fix(opcua): stabilize reconnect loop and coalesce telemetry events
Always clear reconnect-in-progress markers after reconnect attempts so heartbeat-triggered retries are not blocked. Reduce high-frequency event overhead by coalescing consecutive point updates in the event worker and processing only the latest value per source/client handle.

Made-with: Cursor
2026-03-13 14:26:50 +08:00
caoqianming 5406568969 fix: harden event handling and source safety
Improve runtime resilience by bounding the reload event queue and processing telemetry updates without per-point spawned tasks. Also reduce security risk by sanitizing source responses, avoiding internal error detail leaks, and standardizing write-key configuration with backward compatibility.

Made-with: Cursor
2026-03-13 14:22:16 +08:00
caoqianming efed6aa816 feat: add page 2026-03-11 13:23:05 +08:00
caoqianming 8e4abd0af9 feat: 添加重连保护机制修复重复重连问题 2026-03-06 09:01:15 +08:00
caoqianming aaf887a6fc 优化PointNewValue事件处理:并行执行update_point_monitor_data和send_to_public,移除不必要的ws_manager_clone 2026-03-05 15:28:04 +08:00
caoqianming 114d350e5b refactor: 移除 ReloadEvent::PointCreate,统一使用 PointCreateBatch 2026-03-05 09:31:52 +08:00
caoqianming 1ddb707a9b 优化 WebSocket 消息发送:移除不必要的 clone,注释掉 send_to_client 2026-03-04 12:35:22 +08:00
caoqianming 173814416f 修复潜在的死锁问题:将读锁的作用域限制在块内,避免在持有读锁时尝试获取写锁 2026-03-04 12:20:13 +08:00
caoqianming 4bb9bdd27d 优化 event.rs 中的克隆操作,减少 monitor 的克隆次数从 3 次减少到 1 次 2026-03-04 08:47:24 +08:00
caoqianming 562a2d566b feat: 为 PointMonitorInfo 添加旧值追踪和值变化检测 2026-03-04 08:35:28 +08:00
caoqianming 8127d04855 refactor: 将 PointValueChange 重命名为 PointNewValue 2026-03-03 16:56:37 +08:00
caoqianming cc7142e556 refactor: 统一使用 PointMonitorInfo,移除 WsPointMonitorInfo 2026-03-03 16:51:18 +08:00
caoqianming a82921193c PointNewValue 2026-03-03 16:44:53 +08:00
caoqianming 44f4a794d3 feat: 软件第一个版本 2026-03-03 13:32:05 +08:00