Files
puddy cf86b568f0 feat(plugin): 新增 XQ0012 EHR 预支及支付报酬自动发起 ERP 付款申请(0.1.0)
- 读 EHR 预支台账 → 按 ERP 付款申请单口径逐行建单,默认试算不写库
- 可选建单后自动提交、按套打样例生成 PDF 直连网络打印,打印完成钉钉提醒领取
- 含幂等查重与异常清单,业务口径与字段顺序按生产单核对
- 依赖 erpsdk / printkit / dingtalk_sdk(plugin.json requires.sdks 声明)
- 需求单文档同步:开发/流程/评分/需求文档更新,新增交接文档
2026-11-16 11:27:38 +08:00

40 lines
1.4 KiB
Python
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# -*- coding: utf-8 -*-
"""发布打包辅助(`_` 前缀,运行时不会被插件扫描加载)。
把插件压成 dist-plugin/xq0012_v<版本>.zip(zip 根含 plugin.json)。
排除:ui-src(前端源码)、__pycache__、_selftest*、本脚本、*.pyc。
"""
import json
import sys
import zipfile
from pathlib import Path
_HERE = Path(__file__).resolve().parent
_OUT_DIR = _HERE.parents[2] / "dist-plugin"
_EXCLUDE_DIRS = {"ui-src", "__pycache__", "debug", ".sessions"}
_EXCLUDE_FILES = {"_pack.py"}
_EXCLUDE_PREFIXES = ("_selftest",)
def main():
manifest = json.loads((_HERE / "plugin.json").read_text(encoding="utf-8"))
pid, ver = manifest["id"], manifest["version"]
if manifest.get("ui") and not (_HERE / "ui" / "index.html").is_file():
sys.exit("缺少 ui/index.html:请先在 ui-src 下执行 npm install && npm run build")
_OUT_DIR.mkdir(exist_ok=True)
out = _OUT_DIR / f"{pid}_v{ver}.zip"
with zipfile.ZipFile(out, "w", zipfile.ZIP_DEFLATED) as zf:
for p in sorted(_HERE.rglob("*")):
rel = p.relative_to(_HERE)
if set(rel.parts) & _EXCLUDE_DIRS or p.name in _EXCLUDE_FILES:
continue
if p.name.startswith(_EXCLUDE_PREFIXES) or p.suffix == ".pyc":
continue
if p.is_file():
zf.write(p, str(rel))
print(f"已打包: {out}({out.stat().st_size / 1024:.0f} KB)")
if __name__ == "__main__":
main()