diff --git a/inbound_verify/runtime.py b/inbound_verify/runtime.py index 5943b23..27c7195 100644 --- a/inbound_verify/runtime.py +++ b/inbound_verify/runtime.py @@ -493,6 +493,23 @@ def _site_undelivered_handler(site): os.remove(stale) return False + # ── 先入库再比对(修复时序:比对须读到本次下载的数据, + # 否则首次/force 时 PG 无当天数据,比对返回 None、不产出 Excel)── + try: + _record_business_date(site, "undelivered", date) + except Exception: + pass + try: + from inbound_verify import store # 懒导入,避免成环 + + if store.ingest_enabled(): + store.ingest_task( + site, "undelivered" + ) # 4 站 = ingest expected + actual + print(f">> [入库] {site} 前置入库完成") + except Exception as e: + print(f">> [入库] {site} 前置入库失败(不影响比对尝试): {e}") + # ── DB 比对(替代旧 Excel 比对)── try: from inbound_verify import db_compare # 懒导入,避免成环