fix(db_compare): anchor comparison on actual_offset so yunda reads fresh data
比对以实到扫描日(actual.scan_time::date)为锚,锚点日期必须等于实到下载日 = actual_offset。 原 _site_undelivered_handler(runtime.py)与 _target_date_for(db_compare.py)误用 expected_offset 算锚点:韵达 exp=1 / act=0,锚点落到 today-1(昨天),读到历史数据。 两处改用 actual_offset 后韵达锚点 = today,反推出 expected 的昨天批次正确参与比对。 其余 3 站 exp == act == 0,锚点不变。 5 站真机验证:韵达 07-31 比对现读新鲜数据 107/104/3(修复前读昨天 116/115/1); 中通/安能/顺心 不变;全站汇总报表重新生成。 Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -517,7 +517,7 @@ def _site_undelivered_handler(site):
|
||||
if date:
|
||||
target_date = date
|
||||
else:
|
||||
offset = state_store.get_offset(site, "expected")
|
||||
offset = state_store.get_offset(site, "actual")
|
||||
target_date = (datetime.now().date() - timedelta(days=offset)).strftime(
|
||||
"%Y-%m-%d"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user