Commit Graph

6 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
96e7018146 定时下载(APScheduler) + 跑比对纯离线 + 偏移拆 expected/actual + 报告下载
定时下载:
- state_store:site_config 加 schedule_enabled/schedule_time(旧库迁移)+ set_schedule/get_all_config
- server:APScheduler BackgroundScheduler,启动按配置注册各站 cron job、改配置重排;job 投 undelivered 任务到队列(错过跳过);/config 扩展 schedule
- runtime:("__compare__","compare") 改纯离线 expected_undelivered.main()(不下载)
- requirements:加 apscheduler

偏移拆分 + 报告下载:
- state_store:date_offset 拆 expected_offset/actual_offset(迁移)+ get_offset(site,kind)/set_offset(site,kind,n)
- 4 站 actual impl 改读 actual 偏移(expected 走默认 kind)
- server:/config 用 expected_offset/actual_offset;新增 GET /report(服务 output/应到未到数据.xlsx)
- paths:加 OUTPUT_DIR

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-18 08:11:18 +08:00
Misaka
66bd8af421 阶段1:服务化骨架(FastAPI + Playwright worker + 任务队列)
- 新增 runtime.py:抽离共享核心 launch_and_prepare / dispatch_task / run_heartbeat /
  probe_* / launch_anneng / RuntimeContext,常量 SITES_CONFIG 等;main_router 复用
- 新增 server.py:FastAPI(主线程)+ Playwright worker(独立线程)+ 任务队列;
  API:POST/GET /tasks、GET /status、GET /data/{file}(防路径穿越)
- state_store:加 task_history 表 + create/update/get/list 接口
- 5 站点 with_retry 改为返回 True/False,供 dispatch_task 判成败
- main_router:重写为复用 runtime 的交互模式(行为不变)
- requirements:加 fastapi、uvicorn
- CLAUDE.md:补充运行模式与共享核心架构说明

线程模型:主线程 FastAPI 不碰 Playwright,worker 线程独占 page,经 Queue + SQLite 通信。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-17 00:04:39 +08:00
Misaka
75abbdf14c Add websocket-client to requirements; sync docs
site_anneng 的 CDP 驱动用到 websocket-client,此前 requirements.txt 缺漏,
需额外手动安装。补进 requirements.txt,并把 README/CLAUDE 里"暂未列入"的
临时提示改为"已包含"。

Co-Authored-By: Claude <noreply@anthropic.com>
2026-07-14 22:48:07 +08:00
Misaka_Company
7cae24fae3 Add PyYAML dependency to fix missing yaml module 2026-06-17 15:11:03 +08:00
Misaka_Company
e5205760a0 Initial commit: InboundVerify automation scripts for logistics data processing 2026-06-15 18:18:51 +08:00