feat(shipping-notice): 完善发货通知自动推进与多库存源复核闭环
This commit is contained in:
1 parent
cfa19a0b7b
commit
8e0bbf7a81
180 files changed
+31210
-1864
No files matched your search
@@ -0,0 +1,47 @@
|
||||
"""
|
||||
scripts/rpa/dsv_export_timeout_diagnostics.py
|
||||
|
||||
用途:汇总 DSV Excel 导出等待超时现场,输出适合直接写入 worker.log 的诊断字符串。
|
||||
依赖:json、标准库。
|
||||
逻辑:由 dsv_report_export 在 `page.expect_download(...)` 超时时调用;不参与任何业务判断。
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from typing import Any
|
||||
|
||||
|
||||
def build_download_timeout_log(
|
||||
*,
|
||||
report_name: str,
|
||||
error_type: str,
|
||||
error_message: str,
|
||||
selected_frame_index: int | None,
|
||||
selected_frame_name: str,
|
||||
selected_frame_url: str,
|
||||
report_state: dict[str, Any] | None,
|
||||
export_controls: dict[str, Any] | None,
|
||||
page_snapshot: str,
|
||||
) -> str:
|
||||
"""
|
||||
生成 DSV 导出等待超时诊断日志。
|
||||
|
||||
核心逻辑:把当前报表、选中结果 frame、导出控件探针和页面快照压成一条 JSON,
|
||||
便于在不接 Debug Server 的情况下,直接从 worker.log 反推出导出按钮是否真实可见。
|
||||
|
||||
Returns:
|
||||
str: 以 `[dsv-download-timeout]` 开头的单行日志。
|
||||
"""
|
||||
payload = {
|
||||
"report_name": str(report_name or ""),
|
||||
"error_type": str(error_type or ""),
|
||||
"error_message": str(error_message or "")[:500],
|
||||
"selected_frame_index": selected_frame_index,
|
||||
"selected_frame_name": str(selected_frame_name or "")[:120],
|
||||
"selected_frame_url": str(selected_frame_url or "")[:300],
|
||||
"report_state": report_state or {},
|
||||
"export_controls": export_controls or {},
|
||||
"page_snapshot": str(page_snapshot or "")[:2500],
|
||||
}
|
||||
return "[dsv-download-timeout] " + json.dumps(payload, ensure_ascii=False, default=str)
|
||||
Reference in new issue
Block a user