feat(freight-rpa): 增加出站报表配置与回调支持,重构相关服务
- 将 RPA 管理 API 扩展至出站报表配置,新增出站相关的回调接口。 - 重构 freight_rpa_report_config_service,支持入站与出站报表配置的管理。 - 更新 ORM 模型,增加出站报表相关的持久化模型。 - 统一命名规范,确保在手、入站与出站的概念一致性。
This commit is contained in:
1 parent
39fe3c05f2
commit
911afa0f73
152 files changed
+9861
-2984
No files matched your search
@@ -13,7 +13,7 @@ from pathlib import Path
|
||||
|
||||
|
||||
class NoInboundDataError(RuntimeError):
|
||||
"""收料报表可打开且有表头,但无业务明细行(合法 empty / no_receipt_data)。"""
|
||||
"""入站报表可打开且有表头,但无业务明细行(合法 empty / no_inbound_data)。"""
|
||||
|
||||
|
||||
def _normalize_row_joined(row: tuple | list) -> str:
|
||||
@@ -97,10 +97,10 @@ def inbound_excel_has_detail_rows(path: Path) -> bool | None:
|
||||
|
||||
def enforce_inbound_excel_not_empty(path: Path) -> None:
|
||||
"""
|
||||
有表头无明细时记为无收料(NoInboundDataError → empty / no_receipt_data)。
|
||||
有表头无明细时记为无入站(NoInboundDataError → empty / no_inbound_data)。
|
||||
|
||||
Raises:
|
||||
NoInboundDataError: 可识别表头但无业务行;message 固定为 no_receipt_data。
|
||||
NoInboundDataError: 可识别表头但无业务行;message 固定为 no_inbound_data。
|
||||
"""
|
||||
if inbound_excel_has_detail_rows(path) is False:
|
||||
raise NoInboundDataError('no_receipt_data')
|
||||
raise NoInboundDataError('no_inbound_data')
|
||||
@@ -5,7 +5,7 @@ scripts/freight_rpa/inbound/inbound_rpa_worker.py
|
||||
依赖:rpa_common、trigger_consumer、rpa_heartbeat、download_artifact_fallback、
|
||||
inbound_excel_empty、inbound_dbs_export、inbound_crane_export、connectors/dsv/dsv_report_export。
|
||||
逻辑:排程写入 inbound trigger → 本进程领取并按 connector/profile 分组串行导出 →
|
||||
导出重试只覆盖落盘/校验(对齐库存);有表头无明细 → empty/no_receipt_data;
|
||||
导出重试只覆盖落盘/校验(对齐库存);有表头无明细 → empty/no_inbound_data;
|
||||
成功后先轻量 batch-progress 再 ready 归档回调;ready 超时不得重新下载。
|
||||
"""
|
||||
|
||||
@@ -456,18 +456,18 @@ def _validate_unit(unit: dict[str, Any]) -> None:
|
||||
def _report_failure(unit: dict[str, Any], exc: Exception) -> None:
|
||||
"""失败单元单独回调;callback 本身失败则由 trigger failed 目录留待人工处理。"""
|
||||
print(f'[inbound-unit] failed source={unit.get("source_code")} callback={unit.get("callback_id")} error={str(exc)[:200]}')
|
||||
_post_callback({'schema_version': 'freight_rpa.inbound.v1', 'callback_id': unit.get('callback_id'), 'status': 'failed', 'error_code': 'RPA.RECEIPT_EXPORT_FAILED', 'error_message': str(exc)[:2000]})
|
||||
_post_callback({'schema_version': 'freight_rpa.inbound.v1', 'callback_id': unit.get('callback_id'), 'status': 'failed', 'error_code': 'RPA.INBOUND_EXPORT_FAILED', 'error_message': str(exc)[:2000]})
|
||||
|
||||
|
||||
def _report_empty(unit: dict[str, Any], exc: NoInboundDataError) -> None:
|
||||
"""无业务明细的合法结果:回调 empty + no_receipt_data(后端 finalize 计 skipped)。"""
|
||||
"""无业务明细的合法结果:回调 empty + no_inbound_data(后端 finalize 计 skipped)。"""
|
||||
print(f'[inbound-unit] empty source={unit.get("source_code")} callback={unit.get("callback_id")} message={str(exc)[:200]}')
|
||||
_post_callback({
|
||||
'schema_version': 'freight_rpa.inbound.v1',
|
||||
'callback_id': unit.get('callback_id'),
|
||||
'status': 'empty',
|
||||
'error_code': 'no_receipt_data',
|
||||
'error_message': str(exc)[:2000] or 'no_receipt_data',
|
||||
'error_code': 'no_inbound_data',
|
||||
'error_message': str(exc)[:2000] or 'no_inbound_data',
|
||||
})
|
||||
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Register the test/prod Receipt RPA Worker scheduled tasks in FULL-BACKGROUND mode.
|
||||
Register the test/prod Inbound RPA Worker scheduled tasks in FULL-BACKGROUND mode.
|
||||
|
||||
.DESCRIPTION
|
||||
Runs the Receipt Worker as a background scheduled task with NO visible console and
|
||||
|
||||
Reference in new issue
Block a user