""" backend/app/api/schedule/rpa_workers.py 用途:管理端查询货代库存/收料 RPA Worker 在线状态与就绪摘要。 依赖:schedule.blueprint、rpa_worker_heartbeat.serialize_rpa_worker_status。 逻辑:ScheduleWorkbenchPanel 在库存或收料 RPA 排程工作台展示对应 worker 心跳状态。 """ from __future__ import annotations from flask import request from app.api.schedule.blueprint import schedule_admin_bp from app.core.decorators import require_admin from app.core.response import ok from app.services.shipping_notice.rpa_worker_heartbeat import serialize_rpa_worker_status @schedule_admin_bp.route('/rpa-workers/status', methods=['GET']) @require_admin def get_rpa_workers_status(): """ 返回 RPA Worker 心跳摘要(在线/离线、最后心跳时间、就绪原因)。 Query: scope: inventory(默认)或 receipt。 """ scope = str(request.args.get('scope') or 'inventory').strip().lower() or 'inventory' return ok(serialize_rpa_worker_status(scope=scope))