3.1 KiB
3.1 KiB
运转系统 API
参考来源:
docs/superpowers/specs/2026-05-18-operation-system-engine-design.md
健康检查
GET /api/health— 返回应用名称和状态
日志
GET /api/logs— 拉取日志内容GET /api/logs/stream— SSE 增量推送
文档
GET /api/docs/api-md— 获取本 API 文档GET /api/docs/readme-md— 获取 README
平台基础接口
复用 plc_platform_core::handler::platform_routes:源 / 设备 / 点位 / 标签 / 页面。
工位配置(§9.1.1)
GET /api/station— 列出工位(可选?line_code=)POST /api/station— 新建工位GET /api/station/{id}— 工位详情含信号绑定PUT /api/station/{id}— 更新工位DELETE /api/station/{id}POST /api/station/{id}/signal— Upsert 工位信号绑定DELETE /api/station/{id}/signal/{role}
流程段配置(§9.1.1)
GET /api/segment(可选?line_code=)POST /api/segmentGET /api/segment/{id}GET /api/segment/{id}/detail— 包含 step / interlock / resourcePUT /api/segment/{id}DELETE /api/segment/{id}GET /api/segment/{id}/stepPOST /api/segment/{id}/stepPUT /api/segment/{id}/step/{step_no}DELETE /api/segment/{id}/step/{step_no}GET /api/segment/{id}/interlockPOST /api/segment/{id}/interlockDELETE /api/segment/{id}/interlock/{interlock_id}GET /api/segment/{id}/resourcePUT /api/segment/{id}/resource— 用新的resource_keys数组整体替换
段运行控制(§9.2)
POST /api/control/segment/{id}/start-autoPOST /api/control/segment/{id}/stop-autoPOST /api/control/segment/{id}/ack-faultPOST /api/control/segment/{id}/reset— 仅在 Blocked / Faulted / ManualAckRequired 状态允许POST /api/control/segment/batch-start-autoPOST /api/control/segment/batch-stop-auto
运行态查询(§9.3)
GET /api/runtime/overview— 所有段 + 资源占用快照GET /api/runtime/segment/{id}— 单段配置 + runtimeGET /api/runtime/station/{id}— 工位信号 + 最新点位监控值GET /api/event— 事件时间线,参数:event_type— 精确匹配,例如ops.segment.fault_lockedevent_type_prefix— 前缀匹配,例如ops.拉取全部 ops 事件subject_type/subject_id— 设计文档 §4.2.8 归因字段,可按段 / 工位 / 设备过滤- 分页参数
page/page_size
WebSocket(§8.2)
GET /ws/public— 推送point_new_value(核心)event_created(核心)app_event:{ app: "operation-system", event_type: "segment_runtime_changed", data: SegmentRuntime }
环境变量
SIMULATE_PLC=1— 调试模式,引擎发出命令后通过模拟器把确认信号写回监控缓存,使段流程可在无 PLC 现场时端到端运行。OPS_SEED_TEMPLATES=1— 应用启动时自动写入 1 号 / 2 号干燥窑 6 段(infeed / step / outfeed × 2)的段 + 步骤骨架,仅插入缺失的记录,不覆盖已有配置。设备与工位信号绑定仍需通过 CRUD API 完成。