feat(db_compare): DB-based full summary report + wire 跑比对 to it
新增 build_full_report:4 站走 compare_site_date、百世走 baishi_daily_stats(基数) + undelivered_record(按 ingested_at 日期过滤),复用 compare.build_summary 渲染 KPI/柱状图/口径说明,产 output/应到未到数据.xlsx。跑比对入口(__compare__)从 compare.main() Excel 路径切换到 build_full_report。百世未到件用基数差(undelivered_pieces)与应到/已到自洽。 集成验证:前端跑比对 -> build_full_report -> /report 下载,各站未到件 顺心8/中通10/韵达2/安能0/百世8。 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -535,7 +535,19 @@ def _site_undelivered_handler(site):
|
||||
return handler
|
||||
|
||||
|
||||
# 「跑比对」= 纯离线比对(用 downloads/ 现有文件生成全站汇总;下载交由各站定时/手动)。
|
||||
# 「跑比对」= DB 版全站汇总报表(替代旧 compare.main Excel 路径;下载交由各站定时/手动)。
|
||||
|
||||
|
||||
def _run_db_full_report(date=None):
|
||||
"""生成 DB 版全站汇总报表(output/应到未到数据.xlsx)。
|
||||
懒导入 db_compare,best-effort:失败只告警,返回 True(与旧 lambda 契约一致)。"""
|
||||
try:
|
||||
from inbound_verify import db_compare
|
||||
|
||||
db_compare.build_full_report(date)
|
||||
except Exception as e:
|
||||
print(f">> [跑比对] DB 汇总报表生成失败: {e}")
|
||||
return True
|
||||
|
||||
|
||||
TASK_HANDLERS = {
|
||||
@@ -564,8 +576,8 @@ TASK_HANDLERS = {
|
||||
force=force, date=date
|
||||
),
|
||||
("安能", "undelivered"): _site_undelivered_handler("安能"),
|
||||
("__compare__", "compare"): lambda ctx, force=False, date=None: (
|
||||
compare.main() or True
|
||||
("__compare__", "compare"): lambda ctx, force=False, date=None: _run_db_full_report(
|
||||
date
|
||||
),
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user