Commit Graph

7 Commits

Author SHA1 Message Date
Misaka
d4a9fb3b4a Harden Yunda export dialog with two-layer reset and plain wording
- Add a two-layer reset engine to the export dialog (both expected and
  actual arrival): an outer 3x reopen loop with a field-list presence
  check (交接单号 / 扫描类型 as per-page anchor), and an inner 4x
  submit loop that distinguishes a missed field (re-click 全选) from a
  vanished field list (reopen the whole dialog), recovering from
  empty/ghost-cleared export dialogs
- Keep log/comment wording plain and factual (no hyperbole)

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-21 12:19:51 +08:00
Misaka
229e474b58 Add cross-flow automation test and tone down log/comment wording
- main_router: add run_automation_test that runs each site's download
  flows in a cross sequence (expected/actual) plus a pass/fail report
  with timings; expose it as menu [8]
- Site download functions now return False on their exception paths so
  the test harness can record failures (baishi also flags config-read
  failure)
- Replace overblown log/comment phrasing across all modules with plain
  statements; trim docstrings

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-20 23:33:22 +08:00
Misaka
ab3f25a10e Centralize paths in paths.py and harden waybill-number handling
- Add paths.py: BASE_DIR/DOWNLOAD_DIR/CONFIG_PATH anchored on __file__
  so paths resolve regardless of the launch cwd
- Route main_router and all site modules through DOWNLOAD_DIR/CONFIG_PATH,
  replacing os.getcwd()-based download dirs and the "config.yaml" literal
- main_router compare engine: read Excel as str with keep_default_na,
  strip/normalize 运单号, drop blanks, and isin against a set so
  int/float-vs-str mismatches no longer produce false "undelivered"
- Shunxin: give downloaded files unique microsecond temp names and read
  Excel as str to preserve long-waybill precision
- Normalize bare except: to except Exception: across affected files

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-20 22:28:30 +08:00
Misaka
a67b64f8f8 Auto-login Yunda and switch router to ready-guard polling
- Add yunda_login: probe the login page, fill credentials from
  config.yaml (yunda.username/password), submit; no-op if already
  logged in
- main_router: register per-site READY_SELECTORS and replace the
  blocking input() with a ready-guard poll loop; invoke Yunda
  auto-login up front; simplify site-init cleanup
- site_yunda: drop the custom frame probes in favor of native
  frame_locator("section iframe")
- Skip handover rows already marked 已绑定; abort the export harvest
  when no tasks were submitted
- Fix NameError from undefined username/password fallback

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-20 21:33:09 +08:00
Misaka
e8b789e906 Add anti-collapse menu nav and fix multi-tab Strict Mode leakage
- Rewrite yunda_smart_menu_click to check each parent submenu's
  is-opened state before clicking (skip if already open), using XPath
  parent-child isolation to avoid collapsing accordion menus
- Scope the expected/actual-arrival loading mask, #sum panel, and
  empty-record hint to #tab-1 and add .first to fix Playwright Strict
  Mode (5 elements found) leaks across multiple open tabs
- Move _yunda_poll_and_download_tasks above yunda_actual_download for
  definition order

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-20 19:22:01 +08:00
Misaka
604d1822e4 Implement Yunda actual-arrival download and harden query loading
- Implement yunda_actual_download via the 报表管理 -> 扫描记录查询
  menu: set date range, switch scan type to 到件, then reuse the
  shared poll/download/merge engine
- Add a three-stage query buffer (yield, wait for the Bootstrap Table
  loading mask, settle) before the data/empty verdict to avoid stale
  DOM reads in the expected-arrival flow
- Trim the offline-export retry state machine's verbose logs
- Fix a typo (研编 -> 研判) and drop the 待开发 tag on menu [7]

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-20 18:59:49 +08:00
Misaka
194fbc7cda Integrate Yunda site module and rewire router menu numbering
- Add site_yunda.py: Yunda expected-arrival download (进站交接单查询)
  with Layui date-range setup, row double-click export, a retry state
  machine for the offline-export dialog, and a shared poll/download/
  merge engine; actual-arrival is a placeholder
- Wire Yunda into main_router: site URL, login detection, menu items,
  and read yunda.query_days from config.yaml
- Rework the hub menu: drop the standalone Shunxin local-compare entry,
  renumber modules (百世 3, 中通 4/5, 韵达 6/7), keep global compare [9]
- Streamline site-init cleanup and log wording

Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-20 18:20:46 +08:00