Add per-site file prefix for undelivered-data comparison

- task_process_undelivered_data now accepts site_name (default 顺心)
  and reads/writes {site}-{应到/实到/应到未到}货物数据.xlsx
- Menu option 5 prompts for site name before running reconciliation
- Update 顺心 site outputs to 顺心-应到/实到货物数据.xlsx naming
- Remove redundant inline comments in site_shunxin.py

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Misaka
2026-06-15 22:09:12 +08:00
parent 411a2487fc
commit 497fd11674
2 changed files with 18 additions and 30 deletions

View File

@@ -15,21 +15,22 @@ SITES_CONFIG = {
}
def task_process_undelivered_data():
"""全局模块:应到未到异常件比对引擎"""
print("\n▶ 开始执行【应到未到数据处理】任务...")
def task_process_undelivered_data(site_name="顺心"):
"""全局模块:应到未到异常件比对引擎 (支持动态网点前缀)"""
print(f"\n▶ 开始执行【{site_name} - 应到未到数据处理】任务...")
download_dir = os.path.join(os.getcwd(), "downloads")
expected_path = os.path.join(download_dir, "应到货物数据.xlsx")
actual_path = os.path.join(download_dir, "到货物数据.xlsx")
output_path = os.path.join(download_dir, "应到未到货物数据.xlsx")
# 动态拼接带网点前缀的文件路径
expected_path = os.path.join(download_dir, f"{site_name}-应到货物数据.xlsx")
actual_path = os.path.join(download_dir, f"{site_name}-实到货物数据.xlsx")
output_path = os.path.join(download_dir, f"{site_name}-应到未到货物数据.xlsx")
if not os.path.exists(expected_path):
print(f"❌ 错误:找不到【应到货物数据】主文档:{expected_path}")
print(f"❌ 错误:找不到【{site_name}-应到货物数据】主文档:{expected_path}")
return
if not os.path.exists(actual_path):
print(f"❌ 错误:找不到【实到货物数据】主文档:{actual_path}")
print(f"❌ 错误:找不到【{site_name}-实到货物数据】主文档:{actual_path}")
return
try:
@@ -143,7 +144,7 @@ def run_multi_site_daemon():
try:
if choice == "1":
pages_map["顺心"].bring_to_front() # 切换到对应标签页
pages_map["顺心"].bring_to_front()
site_shunxin.shunxin_expected_download(pages_map["顺心"])
elif choice == "2":
pages_map["顺心"].bring_to_front()
@@ -155,7 +156,10 @@ def run_multi_site_daemon():
pages_map["百世"].bring_to_front()
site_baishi.baishi_actual_download(pages_map["百世"])
elif choice == "5":
task_process_undelivered_data()
site_name = input("请输入要比对的网点名称 (默认: 顺心): ").strip()
if not site_name:
site_name = "顺心"
task_process_undelivered_data(site_name)
elif choice == "0":
print("\n准备退出程序,释放浏览器资源...")
break