Commit Graph

7 Commits

Author SHA1 Message Date
Misaka
b9f726c30a 引入 PostgreSQL 持久化:到货核销数据入库管道
- 新增 db_store.py:解析 downloads/ 下各站应到/实到/未到 Excel,幂等 UPSERT 入库(统一核心列 + raw JSONB 兜底,单号按文本存)
- 新增 schema.sql:三表(expected/actual/undelivered_record),隔离到专用 schema inbound_verify(CREATE SCHEMA + search_path)
- 韵达实到业务清洗:抛弃「交接单号」为空行 + 按子单号去重
- 同步 config.example.yaml(postgres 配置)与 requirements.txt(psycopg[binary])

本次仅手动入库管道;自动挂载到下载流程留待后续。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-22 23:04:21 +08:00
Misaka
26a94999dc 按站点指定下载日期偏移(0=今天…30)+ 修复启动陈旧登录态
偏移量功能(前端/API 可配,服务端持久化、多用户共享):
- state_store:新增 site_config 表 + get_offset / set_offset(0..30 钳制) / get_all_offsets
- server:新增 GET/PUT /config(百世锁定当天,不可配置)
- 顺心/中通/韵达/安能(各 expected+actual):日期逻辑由 query_days 范围改为读 offset
  算单日 target=今天-offset,起止同日;百世仍走当日
- config.example.yaml:query_days 标记为已废弃

修复启动时显示上一会话陈旧登录态:
- state_store:新增 reset_login_states(登录态会话级,启动重置为 unknown;数据态会话无关、保留)
- runtime.launch_and_prepare:启动时对各站重置登录态,心跳就绪后重新探测写真实值

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-17 21:27:52 +08:00
Misaka
9d3d3cbb78 Add Anneng (Electron) site: expected-data download + main_router integration
安能站点第一阶段:把应到数据(运单信息)下载流程接入主路由。

- site_anneng.py:用页面级 CDP 驱动「安能全网门户」Electron 应用(Playwright
  connect_over_cdp 被 Electron 浏览器域 CDP 拦截,故走页面级)。完整应到流程:
  菜单导航 → 进站交接单查询 → 设日期查询(“带小数点的 0”为加载完成判据)
  → 逐条交接单双击进运单信息并核对单号 → 导出(选中字段+→箭头转移全部列)
  → 关闭查询 tab → 导出下载页轮询 → 免对话框下载(x-auth+TGC 直连 GET)
  → 合并为 安能-应到货物数据.xlsx。CDP 端口可配;anneng_ready() 供路由就绪轮询。
- main_router.py:以调试模式启动安能(动态空闲端口,避免端口冲突),经 CDP
  判断首页就绪,菜单加 [10] 应到下载,退出时关闭应用;网页站点逻辑不变。
- config.example.yaml:补充 anneng.query_days 与 anneng.app_path 说明。
- docs/安能门户CDP连接指南.md:连接方案、独立 webContents/tab 处理、免对话框下载。
- .gitignore:忽略 Archive/(早期探查脚本归档)。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-21 19:38:44 +08:00
Misaka
5b7a024fa8 Parameterize Shunxin query window and document it in example config
- site_shunxin: replace the hardcoded 1天 radio with config-driven
  shunxin.query_days, set the date range via the ant-picker, and add a
  two-pass query/retry to clear stale "暂无数据" DOM state; return True
  on completion
- config.example.yaml: add the shunxin section (query_days) so the
  example matches what the code reads

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-21 10:43:55 +08:00
Misaka
f4f9f520e1 Document yunda config and remove dead main_task.py
- config.example.yaml: add the yunda section (username/password for
  auto-login, query_days) and list 韵达 as a valid debug target_site
- Delete main_task.py: early single-site (顺心-only) prototype whose
  every function is superseded by main_router.py + site_shunxin.py;
  nothing imports it, and it predates paths.py / multi-site / the
  automation test

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-20 23:35:42 +08:00
Misaka
9375b6efd6 Integrate ZTO site module and add debug/single-site mode
- Add site_zto.py: ZTO expected-arrival data download with menu
  navigation, export polling, and Excel merge
- Wire ZTO into main_router: site URL, login detection, menu items
  [5]/[6], and a global offline Left Anti-Join compare entry [9]
- Read config.yaml debug flags to launch only the target site for
  focused debugging; guard each site init and route handler behind
  site-loaded checks via is_site_ready()
- Expand config.example.yaml with documented debug, baishi, and zto
  config keys

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-20 12:46:46 +08:00
Misaka
ec1a9d9fbc 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>
2026-06-16 21:58:02 +08:00