feat(freight-rpa): 库存/收料改名在手/入站,报表归属RPA,类名统一FreightRpa
把 shipping 侧 inventory/receipt 词根迁到 onhand/inbound,29 张表与 枚举/权限/前端/i18n 同步改名;在手与入站报表配置及文件改由 freight_rpa 持有,发货与调拨仅按 source_code 消费;ORM 类加 FreightRpa 前缀, 上传动作改为 freight_rpa_upload。含类名与上传动作改名规格文档。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
ffc0d4a430
commit
39fe3c05f2
453 files changed
+17945
-8646
No files matched your search
@@ -3,8 +3,8 @@ services/shipping_notice/tool_common.py
|
||||
|
||||
用途:发货通知 Tool 链共享配置、payload 合并、消息拼接与任务事件写入(无阶段业务编排)。
|
||||
依赖:constants、models.ShippingTaskEvent、fulfillment_audit、stp_progress_contract、progress_audit_contract。
|
||||
逻辑:task_workflow / inventory_workflow / fulfillment_workflow / decision_workflow 共用;
|
||||
log_task_event 对 inventory_rpa_/inventory_source_/export_/notice_replace/
|
||||
逻辑:task_workflow / onhand_workflow / fulfillment_workflow / decision_workflow 共用;
|
||||
log_task_event 对 onhand_rpa_/inventory_source_/export_/notice_replace/
|
||||
freight_cancellation_/STP 事件同步投影到 ShippingAuditEvent;
|
||||
另提供 generic/XFA/LLM 等主链灰度开关读取。
|
||||
"""
|
||||
@@ -76,9 +76,9 @@ def auto_progress_enabled() -> bool:
|
||||
return cfg_bool("SHIPPING_NOTICE_AUTO_PROGRESS_ENABLED", False)
|
||||
|
||||
|
||||
def auto_rpa_inventory_enabled() -> bool:
|
||||
"""是否允许自动触发 RPA 导出库存。"""
|
||||
return cfg_bool("SHIPPING_NOTICE_AUTO_RPA_INVENTORY_ENABLED", True)
|
||||
def auto_rpa_onhand_enabled() -> bool:
|
||||
"""是否允许自动触发 RPA 导出在手库存(SHIPPING_NOTICE_AUTO_RPA_ONHAND_ENABLED)。"""
|
||||
return cfg_bool("SHIPPING_NOTICE_AUTO_RPA_ONHAND_ENABLED", True)
|
||||
|
||||
|
||||
def rpa_inventory_timeout_seconds() -> int:
|
||||
@@ -236,7 +236,7 @@ def set_task_step_progress(
|
||||
stage 序号不小于旧值才覆盖,保证进度上报永远不会把订单拉回早期阶段。
|
||||
|
||||
Args:
|
||||
stage: 15 阶契约码(如 inventory_fetching / inventory_matching /
|
||||
stage: 15 阶契约码(如 onhand_fetching / onhand_matching /
|
||||
excel_generating / freight_uploading);禁止传入 CheckPoint 时代
|
||||
stepN_* 遗留键(已全部清除)。
|
||||
step_title: 展示用步骤名。
|
||||
@@ -404,7 +404,7 @@ def log_task_event(
|
||||
|
||||
event_name = str(event_type or '')
|
||||
dual_write = event_name.startswith((
|
||||
'inventory_rpa_',
|
||||
'onhand_rpa_',
|
||||
'inventory_source_',
|
||||
'export_',
|
||||
'notice_replace',
|
||||
@@ -512,11 +512,11 @@ def _audit_reason_code_for_task_event(event_type: str, detail: dict[str, Any]) -
|
||||
name = str(event_type or '').strip()
|
||||
err_blob = f"{detail.get('error') or ''} {detail.get('error_code') or ''}".lower()
|
||||
mapping = {
|
||||
'inventory_rpa_queued': 'inventory_rpa_queued',
|
||||
'inventory_rpa_started': 'inventory_rpa_queued',
|
||||
'inventory_rpa_timeout': 'inventory_rpa_timeout',
|
||||
'inventory_rpa_exhausted': 'inventory_rpa_exhausted',
|
||||
'inventory_rpa_failed': 'inventory_rpa_export_failed',
|
||||
'onhand_rpa_queued': 'onhand_rpa_queued',
|
||||
'onhand_rpa_started': 'onhand_rpa_queued',
|
||||
'onhand_rpa_timeout': 'onhand_rpa_timeout',
|
||||
'onhand_rpa_exhausted': 'onhand_rpa_exhausted',
|
||||
'onhand_rpa_failed': 'onhand_rpa_export_failed',
|
||||
'notice_replaced': 'attachment_replaced',
|
||||
'notice_replace_extract_failed': 'document_text_unavailable',
|
||||
'freight_cancellation_completed': 'task_voided_for_correction',
|
||||
@@ -528,14 +528,14 @@ def _audit_reason_code_for_task_event(event_type: str, detail: dict[str, Any]) -
|
||||
}
|
||||
if name in mapping:
|
||||
code = mapping[name]
|
||||
if name == 'inventory_rpa_failed':
|
||||
if name == 'onhand_rpa_failed':
|
||||
if 'timeout' in err_blob or ('not ready' in err_blob and 'within' in err_blob):
|
||||
return 'inventory_rpa_timeout'
|
||||
return 'onhand_rpa_timeout'
|
||||
if 'login' in err_blob or 'auth' in err_blob:
|
||||
return 'inventory_rpa_login_failed'
|
||||
return 'onhand_rpa_login_failed'
|
||||
if 'export' in err_blob:
|
||||
return 'inventory_rpa_export_failed'
|
||||
return 'inventory_rpa_export_failed'
|
||||
return 'onhand_rpa_export_failed'
|
||||
return 'onhand_rpa_export_failed'
|
||||
if name == 'notice_replace_extract_failed':
|
||||
from app.services.shipping_notice.error_explainability_contract import (
|
||||
primary_attachment_reason_from_warnings,
|
||||
@@ -545,8 +545,8 @@ def _audit_reason_code_for_task_event(event_type: str, detail: dict[str, Any]) -
|
||||
)
|
||||
return from_warnings or code
|
||||
return code
|
||||
if name.startswith('inventory_rpa_') and name.endswith('_failed'):
|
||||
return 'inventory_rpa_export_failed'
|
||||
if name.startswith('onhand_rpa_') and name.endswith('_failed'):
|
||||
return 'onhand_rpa_export_failed'
|
||||
if name.startswith('upload_rpa') and 'fail' in name:
|
||||
return 'upload_rpa_failed'
|
||||
return None
|
||||
|
||||
Reference in new issue
Block a user