AutoRpa/rpa_rebate/run_header.py

27 lines
913 B
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.

"""页面总单入口。不连 Oracle、不导细单、不送审。验收只看 ACCEPT.txt。"""
from __future__ import annotations
import os
from apa_browser_adapter import ApaBrowserAdapter
from db import load_runtime_env
from rebate_finder import context_from_env
from rebate_flow_steps import header_draft_for_contract, run_header_flow
def main() -> int:
load_runtime_env()
contract_no = (os.getenv("REBATE_ACCEPT_CONTRACT_NO") or "").strip()
if not contract_no:
print("缺少 REBATE_ACCEPT_CONTRACT_NO,总单验收需要已搜到的合同号", flush=True)
return 1
ctx = context_from_env()
draft = header_draft_for_contract(contract_no)
browser = ApaBrowserAdapter(url=ctx.rebate_url, flow="REBATE_HEADER")
order_no = run_header_flow(browser, ctx, contract_no, draft)
return 0 if order_no else 1
if __name__ == "__main__":
raise SystemExit(main())