Files
Auto-Finance/run.py

60 lines
1.6 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.
#!/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()