refactor: rename expected_undelivered to compare
git mv expected_undelivered.py -> compare.py; update the 3 importers (store/runtime/router) to import compare. All public names (main, write_site_file, _read_business_dates) unchanged. Also add the Tier 2 plan doc. Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -24,14 +24,14 @@ from inbound_verify import state_store
|
||||
|
||||
# 各站点模块(自动化测试 + 比对用;任务派发在 runtime)
|
||||
from inbound_verify.sites import shunxin, baishi, zto, yunda, anneng
|
||||
from inbound_verify import expected_undelivered
|
||||
from inbound_verify import compare
|
||||
|
||||
|
||||
def run_undelivered_compare():
|
||||
"""应到未到比对(全站点):调用 expected_undelivered,读 downloads/ 下的应到/实到
|
||||
"""应到未到比对(全站点):调用 compare,读 downloads/ 下的应到/实到
|
||||
数据,生成 output/应到未到数据.xlsx(汇总报表 + 各站明细)。"""
|
||||
print("\n▶ 开始执行【应到未到比对(全站点)】任务 ...")
|
||||
expected_undelivered.main()
|
||||
compare.main()
|
||||
|
||||
|
||||
# ====================================================================
|
||||
|
||||
@@ -26,7 +26,7 @@ from inbound_verify.domain import SITE_UNDELIVERED_FILE
|
||||
|
||||
from inbound_verify import state_store
|
||||
from inbound_verify.sites import shunxin, baishi, zto, yunda, anneng
|
||||
from inbound_verify import expected_undelivered # dispatch 的 compare 任务用
|
||||
from inbound_verify import compare # dispatch 的 compare 任务用
|
||||
|
||||
# 各网页站点首页 URL(单一来源,取自各站点模块 HOME_URL)
|
||||
SITES_CONFIG = {
|
||||
@@ -444,7 +444,7 @@ def _site_undelivered_handler(site):
|
||||
(TASK_HANDLERS[(site, "actual")](ctx) is not False) if exp_ok else False
|
||||
)
|
||||
if exp_ok and act_ok:
|
||||
return expected_undelivered.write_site_file(site)
|
||||
return compare.write_site_file(site)
|
||||
stale = os.path.join(DOWNLOAD_DIR, SITE_UNDELIVERED_FILE.format(name=site))
|
||||
if os.path.exists(stale):
|
||||
os.remove(stale)
|
||||
@@ -472,7 +472,7 @@ TASK_HANDLERS = {
|
||||
("安能", "expected"): lambda ctx: anneng.anneng_expected_download(),
|
||||
("安能", "actual"): lambda ctx: anneng.anneng_actual_download(),
|
||||
("安能", "undelivered"): _site_undelivered_handler("安能"),
|
||||
("__compare__", "compare"): lambda ctx: (expected_undelivered.main() or True),
|
||||
("__compare__", "compare"): lambda ctx: (compare.main() or True),
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -34,9 +34,7 @@ from inbound_verify.domain import (
|
||||
_site_cfg,
|
||||
) # 站点 / 文件名配置(单一来源)
|
||||
|
||||
from inbound_verify import (
|
||||
expected_undelivered as eu,
|
||||
) # _read_business_dates(比对侧业务日期读取)
|
||||
from inbound_verify import compare # _read_business_dates(比对侧业务日期读取)
|
||||
|
||||
SCHEMA_PATH = os.path.join(BASE_DIR, "schema.sql")
|
||||
|
||||
@@ -111,7 +109,7 @@ def init_schema():
|
||||
|
||||
# ============================== 解析辅助 ==============================
|
||||
|
||||
# 实到单号列 / 基号列映射(口径取自 expected_undelivered):
|
||||
# 实到单号列 / 基号列映射(口径取自 domain,与 STATIONS 对齐):
|
||||
# piece = 实到表里「每件」的单号列(扫描单号 / 子单号 / 复合串)
|
||||
# waybill = 与应到运单号对齐的干净列(中通无干净列,由 piece 复合串 v[:-8] 推导)
|
||||
# scan_time = 扫描时间列(缺失则不填,原始值仍在 raw)
|
||||
@@ -214,7 +212,7 @@ def _raw_row(row):
|
||||
def _read_business_dates():
|
||||
"""从状态库读各站本次业务日期(与报告口径一致;读不到返回空 dict)。"""
|
||||
try:
|
||||
return eu._read_business_dates(ALL_SITES + ["百世"]) or {}
|
||||
return compare._read_business_dates(ALL_SITES + ["百世"]) or {}
|
||||
except Exception as e:
|
||||
print(f">> [warn] 读取业务日期失败(不影响入库): {e}")
|
||||
return {}
|
||||
|
||||
Reference in New Issue
Block a user