Implement Baishi undelivered-data extraction and restructure menu by site

- Replace Baishi placeholders with full download flow (scan-rate query, export modal, password auth via config.yaml)
- Reorganize router menu into 顺心 / 百世 modules; move undelivered-data compare into 顺心 flow
- Add config.example.yaml and ignore config.yaml to keep credentials out of VCS

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Misaka
2026-06-16 21:58:02 +08:00
parent 497fd11674
commit ec1a9d9fbc
4 changed files with 113 additions and 38 deletions

View File

@@ -16,7 +16,7 @@ SITES_CONFIG = {
def task_process_undelivered_data(site_name="顺心"):
"""全局模块:应到未到异常件比对引擎 (支持动态网点前缀)"""
"""全局模块:应到未到异常件比对引擎 (本地离线比对)"""
print(f"\n▶ 开始执行【{site_name} - 应到未到数据处理】任务...")
download_dir = os.path.join(os.getcwd(), "downloads")
@@ -118,27 +118,35 @@ def run_multi_site_daemon():
sx_page.get_by_role("button", name="不再询问").click()
sx_page.wait_for_timeout(1000)
print(" ✅ 【顺心】弹窗清理完毕,状态就绪!")
except Exception as e:
print(f" ⚠️ 【顺心】初始化或弹窗清理异常 (无弹窗可忽略): {e}")
print(f" ⚠️ 【顺心】初始化异常 (无弹窗可忽略): {e}")
# 未来如果要加【百世】的弹窗清理,可以直接在这里依葫芦画瓢加上
# try:
# bs_page = pages_map["百世"]
# bs_page.bring_to_front()
# ...
# 百世环境检测
try:
bs_page = pages_map["百世"]
bs_page.bring_to_front()
print(">> 正在处理【百世】网点初始状态...")
bs_page.wait_for_selector('h1[title="百世快运"]', timeout=30000)
print(" 🎉 登录成功!系统已接管百世浏览器。")
print(" ✅ 【百世】状态就绪!")
except Exception as e:
print(f" ⚠️ 【百世】初始化异常: {e}")
while True:
print("\n==============================")
print(" 物流数据多端提取总枢纽 ")
print("==============================")
print("1. [顺心] - 执行【应到货物数据下载】")
print("2. [顺心] - 执行【实到货物数据下载")
print("3. [百世] - 执行【应到货物数据下载")
print("4. [百世] - 执行【实到货物数据下载】")
print("5. [全局] - 执行【应到未到数据清洗比对】")
print("0. 退出系统")
print("==============================")
print("\n====================================================")
print(" 物流数据多端提取总枢纽 ")
print("====================================================")
print(" 模块一:【顺心】数据处理流")
print(" [1] 执行 - 应到货物数据下载")
print(" [2] 执行 - 实到货物数据下载")
print(" [3] 执行 - 应到未到数据清洗比对 (本地运算)")
print("-" * 52)
print(" 模块二:【百世】数据处理流")
print(" [4] 执行 - 一键提取应到未到异常数据")
print("-" * 52)
print(" [0] 退出系统")
print("====================================================")
choice = input("请输入任务编号并回车: ")
@@ -150,16 +158,10 @@ def run_multi_site_daemon():
pages_map["顺心"].bring_to_front()
site_shunxin.shunxin_actual_download(pages_map["顺心"])
elif choice == "3":
pages_map["百世"].bring_to_front()
site_baishi.baishi_expected_download(pages_map["百世"])
task_process_undelivered_data("顺心")
elif choice == "4":
pages_map["百世"].bring_to_front()
site_baishi.baishi_actual_download(pages_map["百世"])
elif choice == "5":
site_name = input("请输入要比对的网点名称 (默认: 顺心): ").strip()
if not site_name:
site_name = "顺心"
task_process_undelivered_data(site_name)
site_baishi.baishi_download_undelivered_data(pages_map["百世"])
elif choice == "0":
print("\n准备退出程序,释放浏览器资源...")
break
@@ -168,7 +170,6 @@ def run_multi_site_daemon():
except Exception as e:
print(f"❌ 调度执行异常: {e}")
# 退出循环后关闭浏览器
browser.close()
print("系统已安全关闭。")