Initial commit: Auto-Finance 财务报销自动化系统

This commit is contained in:
wandering
2026-05-25 11:18:12 +08:00
commit f754386695
25 changed files with 3040 additions and 0 deletions

60
run.py Normal file
View File

@@ -0,0 +1,60 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
财务报销自动化
依次执行:
1. 发票提取 — 从 PDF 发票提取信息,生成 invoice_summary.csv
2. OCR 识别 — 从支付截图识别刷卡信息,回填 CSV
3. 报销提交 — 打开浏览器登录财务系统并自动填报
用法:
python run.py # 全流程
python run.py --step invoice # 仅发票提取
python run.py --step ocr # 仅 OCR 识别
python run.py --step submit # 仅浏览器填报
python run.py -u 工号 -p 密码 # 覆盖登录凭据
"""
import argparse
import sys
from pathlib import Path
# 确保项目根目录在 sys.path 中
sys.path.insert(0, str(Path(__file__).parent.resolve()))
from app.pipeline import run_pipeline
def main():
parser = argparse.ArgumentParser(
description="财务报销自动化 - 发票提取 → OCR 识别 → 浏览器填报",
)
parser.add_argument(
"--step",
choices=["all", "invoice", "ocr", "submit"],
default="all",
help="执行步骤 (默认: all)",
)
parser.add_argument(
"-u", "--username",
default=None,
help="信息门户登录账号(覆盖 config.json",
)
parser.add_argument(
"-p", "--password",
default=None,
help="信息门户登录密码(覆盖 config.json",
)
args = parser.parse_args()
exit_code = run_pipeline(
step=args.step,
username=args.username,
password=args.password,
)
sys.exit(exit_code)
if __name__ == "__main__":
main()