Procurement invoice toolkit: orders, e-invoices, issuing tracker, price comparison, tax verification and monthly reports.
Install
# from GitHub (first run asks for allowBuilds approval — follow the hint, retry)
dsh plugin --profile web add github:kikyo-krein/dsh-proc-invoice
Any plugin you install runs third-party code with your own permissions — it can read your files, use your credentials, and reach the network, and tool approvals don’t sandbox it. GitHub-sourced plugins also run build scripts at install time — pnpm blocks those until you allow them, so an install can stop with ERR_PNPM_GIT_DEP_PREPARE_NOT_ALLOWED or ERR_PNPM_IGNORED_BUILDS; dsh prints the exact key to add under allowBuilds in your profile’s pnpm-workspace.yaml, and the install works on the next run. Allowing a build is a trust decision: only install sources you trust, and pin a commit (github:owner/repo#sha).
README
This plugin publishes its README in Chinese only.
把「电商订单 → 电子发票 → 申请开票 → 税局查验 → 台账/汇编」这一整套采购报销流程做成 DSH 工具。
最初为解决一家物业公司每月几十单京东采购的发票归集与查验而写,逻辑与平台无关的部分(台账、单票 PDF、月度汇编、税局查验)可直接给任何采购岗位复用;电商侧目前实现的是京东,其他平台按 lib/jd.mjs 的接口加适配即可。
1. 能力一览
| 工具 | 作用 |
|---|---|
proc_env |
环境自检:Python/Node、依赖包(PIL/pypdf/python-docx/openpyxl/pymupdf/ddddocr)、浏览器、已抓数据量 |
proc_config |
配置开票抬头(名称/税号/地址/电话/开户行/账号/收票邮箱/收票手机)与运行参数 |
proc_orders |
抓订单:订单号、时间、商品、店铺、金额、状态,以及带签名 token 的「查看发票」链接 |
proc_invoices |
发票阶段:探状态 / 下 PDF / 解析清单 / 批量申请开票 |
proc_verify |
国家税务总局查验平台逐张查验,抓接口结论 + 截查验弹窗 |
proc_report |
生成台账(CSV/XLSX)、单票 PDF、原件合集、月度三段式 Word 汇编 |
proc_track |
开票跟踪台账:按时间沉淀每单开票状态,记代申请时间、算等待天数与催办级别,导出 CSV |
proc_compare |
比价:按商品标题搜同款,比实付价与当前最低/中位价,标出可申请价保或买贵的单 |
2. 安装
# 在 DSH 工作区根目录
node scripts/link-plugin.mjs dsh-proc-invoice
# 然后在该 profile 的 package.json 的 dsh.profile.bundles 数组里追加 "dsh-proc-invoice"
# 重启 DSH 生效
Python 依赖(缺了 proc_env 会提示):
python -m pip install pillow pypdf python-docx openpyxl pymupdf ddddocr onnxruntime \
-i https://pypi.tuna.tsinghua.edu.cn/simple
浏览器:Windows 自带 Edge 即可(插件自己找 msedge.exe,也可用环境变量 PROC_BROWSER 指定 Chrome)。
3. 首次使用
1) proc_config action=set buyer={ name, taxNo, address, phone, bank, account, email, mobile }
2) proc_orders scope=year visible=true # 浏览器会打开电商登录页,人工扫码/账密登录一次
3) proc_orders scope=year # 登录态已存在,无头模式抓单
4) proc_invoices action=status # 逐单探发票状态
5) proc_invoices action=download # 已开票的 PDF 下到 output/发票原件
6) proc_invoices action=apply # 待开票的按配置抬头批量申请
7) proc_verify action=run start=0 limit=10 # 分批查验(单票每天最多 5 次)
8) proc_report kind=all month=2026-10 # 台账 + 单票 PDF + 月度汇编
登录态保存在 .proc-invoice/browser-shop(电商)与 .proc-invoice/browser-tax(税局),是普通 Chromium profile,可整目录迁移。
京东 查看发票 链接带服务端签名 token(tagStr),会过期;过期后重跑 proc_orders 重新抓即可。
工作区解析顺序:环境变量 PROC_INVOICE_WS → DSH_SESSION_CWD / DSH_WORKSPACE / INIT_CWD / PWD → 当前目录。
若 DSH 宿主的当前目录是 profile 目录(~/.dsh/profiles/<name>),请在 <workspace>/.proc-invoice/ws.json 写入 {"workspace":"D:/你的工作区"},
或设置 PROC_INVOICE_WS;proc_env 的 wsDebug 会显示实际取到的值。
4. 数据布局
<workspace>/
.proc-invoice/
config.json # 抬头与参数
orders.json # 订单台账(含发票状态、票号、签名链接)
invoices.json # 发票清单(票号/日期/价税合计/PDF 路径/订单号)
track.json # 开票跟踪台账(每单状态轨迹、代申请时间、首末次采集)
prices.json # 比价历史(每单每次比价的最低价/中位价/结论)
verify/<票号>.json # 税局查验原始返回(含 CyjgDm、查验时间、查验次数)
shots/<票号>.png # 查验弹窗截图(2320×2304)
shots/orders/<订单号>.png # 订单卡片截图
browser-shop/ browser-tax/ # 浏览器登录态
output/
发票原件/ # <下单日期>_<商品前50字>_<票号后8位>.pdf
发票台账_2026-10.xlsx
逐张查验PDF/ # 每票一页:信息表 + 查验截图
发票查验记录2026-10.pdf
2026年10月京东采购订单发票查验汇编.docx
5. 模块
| 文件 | 职责 |
|---|---|
lib/cdp.mjs |
零依赖 CDP 客户端:启动/接管浏览器、发命令、截图、取 cookie |
lib/jd.mjs |
京东适配:抓单(拦截 window.open 拿签名链接)、探状态、下 PDF、填申请表单、订单卡片截图 |
lib/tax.mjs |
税局查验:填单、日历选日期、按提示色识别验证码、拦接口响应、等弹窗稳定后截图 |
lib/captcha.py |
彩色验证码 OCR(ddddocr + 颜色掩膜 + 双模型投票),常驻进程按行通信 |
lib/report.py |
parse 解析发票 PDF(号码/日期/价税合计)、ledger、pdfs、docx |
lib/track.mjs |
开票跟踪:状态归一、轨迹沉淀、等待天数与催办级别、CSV |
lib/compare.mjs |
比价:标题清洗与相似度、搜索结果解析、价差判定、历史快照 |
lib/paths.mjs |
工作区/配置/依赖定位 |
6. 已知限制
- 京东侧未登录会返回登录页,
proc_orders会抓到 0 单;先在visible=true下人工登录。 - 一张发票每天最多查验 5 次,超过平台直接拒;
proc_verify请分批、失败隔天补。 - 验证码是双色混排,只识别页面提示的颜色;OCR 单次成功率约 25%–50%,插件会自动换图重试。
- 「补开中」的订单必须等商家出票,插件只能反复探状态。
- 月度汇编里的"订单状态"取自订单卡片文本;拆单子单可能没有金额,需要人工在
orders.json里补amount。 proc_report kind=docx依赖 python-docx 与中文字体(微软雅黑)。
7. 开票跟踪与比价
7.1 开票跟踪(proc_track)
发票不是下单就有,常见状态是「待开票 → 已申请/补开中 → 已开票」,商家拖延很普遍。proc_track 把每次采集到的状态按订单沉淀成一条轨迹,用来回答「这单等了几天、要不要催」:
proc_track action=refresh scope=year # 抓单 + 逐单探发票状态,并入 track.json
proc_track action=apply-note orderIds=["3651431007885779"] # 记录我们代申请开票的时间
proc_track action=list stages=["补开中","待开票"] # 只看还没出票的
proc_track action=export # output/开票跟踪台账_<日期>.csv
提醒级别:完成(已开票/已换开)、待申请(可申请未申请)、等出票、催办(代申请满 30 天或下单满 60 天仍无票)、需处理(驳回,看原因)、不适用(取消单/虚拟商品)、待刷新(超过 staleDays 天没采)。
7.2 比价(proc_compare)
proc_compare action=run month=2026-11 maxOrders=10 # 按订单商品标题搜同款
proc_compare action=list # 看历史比价快照
判定:实付比当前最低同款高 ≥5 元且 ≥3% → 实付高于当前最低价,可申请价保/补差(京东自营一般 7–15 天内可申请);实付比最低价低 ≥5 元 → 实付低于当前市场价(买得划算);差额在 5 元内 → 与市场价基本持平。搜索页需要登录态,未登录会提示「需先登录电商账号后再比价」。
8. 许可与来源
内部通用插件,按现场实践沉淀;不含任何账号、token 或公司抬头信息,抬头由 proc_config 现场配置。
9. 图标与显示名
icon.png:512×512 插件图标(红底票据 + 发票章 + 蓝色对勾)。package.json的icon/displayName字段:给包清单与市场列表用。dsh-plugin.json:DSH 插件清单(manifest v0.15),其中contributes["x-display"]声明 Plugins 页面显示的图标、中文名与一句话说明,写法与官方插件 dsh-ops 一致:
"contributes": {
"x-display": [
{ "icon": "./icon.png", "title": "采购发票管家", "description": "抓电商订单 → 下载电子发票 → 批量申请开票 → 国家税务总局查验 → 台账与月度汇编" }
]
}
改完 icon.png 或 dsh-plugin.json 需要重启 DSH 才会在插件页刷新。
10. 自测
cd plugins\dsh-proc-invoice
node test\smoke.mjs # 离线:不开浏览器、不联网,验证 8 个工具注册、跟踪/比价纯逻辑与配置读写
冒烟脚本用临时目录当工作区(PROC_INVOICE_WS),不会污染真实的 .proc-invoice/。改完 lib/track.mjs、lib/compare.mjs 或 index.js 先跑一遍再重启 DSH。
9. 上架 DSH 插件市场
市场(dshmarket)不直接收稿:它在 GitHub 仓库 awesome-dsh-plugin 的 data/plugins/ 下读一份 YAML 条目,通常一天内生效,无需发 npm。本目录已备好:
MARKET.md:前置条件、推送命令、提 PR 四步;scripts/make-market-entry.mjs:node scripts/make-market-entry.mjs <GitHub 用户名> dsh-proc-invoice tools,会写market/<用户名>__dsh-proc-invoice.yml并补齐 package.json 的 repository/homepage/bugs;LICENSE(MIT)、.gitignore,package.json已去掉private、补dsh.bundle与files。
推送与提 PR 需要 GitHub 账号凭证(本机没有),所以最后一步由账号持有人完成,命令见 MARKET.md。
Links
More in this category
Tencent/WeKnora#dsh-weknora★ 38705
Four read-only tools over a WeKnora knowledge base: list knowledge bases, hybrid passage search, reassemble one document's chunks in order, and WeKnora's own cited RAG or ReAct-agent answer with a resumable session id.
DayuanJiang/next-ai-draw-io#dsh-plugin★ 37321
Draws draw.io diagrams in DeepSeek Harness through the next-ai-drawio MCP server: the link in the reply opens a live preview in the right sidebar, you can edit the diagram by hand, and each AI change is a version you can restore. Node.js 18+; npx downloads the MCP server on first use.
yikart/AiToEarn#dsh-plugin-aitoearn★ 28986
Generate copy, images and short videos, and publish with one click to Douyin, Kuaishou, Xiaohongshu, WeChat Official, Bilibili, Facebook, TikTok and more, covering the full content lifecycle from creation to publishing and monetization.
superdesigndev/treg★ 10137
Tool catalog for agents: search ~2,600 external endpoints (SEO and SERP, backlinks, social, people and company enrichment, ad libraries, scraping) by the task you want done, read each one's parameters and per-call price, then call it with the credential injected server-side. Ships the skill plus an MCP row that stays disabled until TREG_TOKEN is set.
T-Auto/dsh-ops★ 6125
Provides bash, PowerShell 7, and high-performance Rust tools for DSH on Windows to reduce token usage.
Hithink-Tech-Org/Financial-API#hithink-finance★ 4781
Query Hithink Finance data in DeepSeek Harness, view charts in chat, and save refreshable dashboards.
Community comments
Comments are public GitHub Discussions. Loading them connects to GitHub and Giscus; a GitHub account is required to post.