feat(invoice-check): 通过invoice号反查tghx的采购单,生成PO订单

This commit is contained in:
sophie committed 2026-09-15 16:15:08 +08:00
1 parent 1c34ab962f
commit 40cead7430
27 files changed
+792 -74

No files matched your search

@@ -3,8 +3,8 @@ backend/app/services/voucher_check/adapters/erp_po_print.py
用途:ERP 反查 PO 后写入「PO订单」类型目录的 Adapter。
依赖:adapters.base、erp_po_repository、voucher_check.po_order。
逻辑:fetch_documents / publish_for_invoices 已接线(HXJM.oma99 → TGHX.pmm99)。
fetch() 仍占位,周任务不调用。render_given 只出本地 PDF。
逻辑:fetch_documents / publish_for_invoices 由独立排程 accounting-voucher-po-print(周二 05:00)调用。
fetch() 仍占位,检核 runner(周二 06:00)不调用。render_given 只出本地 PDF。
"""
from __future__ import annotations
@@ -30,7 +30,7 @@ class ErpPoPrintAdapter:
def fetch(self, *, period_month: date, subjects: list[SubjectRow]) -> list[ScannedFile]:
"""
周检核入口仍关闭。
【AI 触发时机】不要在周二 runner 中调用。独立抓取请用 fetch_documents / publish_for_invoices。
【AI 触发时机】不要在周二检核 runner 中调用。独立抓取排程请用 fetch_documents / publish_for_invoices。
"""
raise ServiceUnavailableError(
"ERP PO 打印尚未接入周检核",
@@ -50,7 +50,7 @@ class ErpPoPrintAdapter:
) -> list[PoOrderDocument]:
"""
按发票号从 ERP 组装制式采购单数据。
【AI 触发时机】独立抓取 PO、已有 invoice 清单时调用;不要在周二 runner 里调用。
【AI 触发时机】独立抓取 PO、已有 invoice 清单时调用;检核 runner 不要调用。周二 05:00 排程走本方法。
"""
from app.services.voucher_check.config import load_engine_config
from app.services.voucher_check.erp_po_repository import fetch_po_documents_for_invoices
@@ -97,7 +97,7 @@ class ErpPoPrintAdapter:
) -> list[PoOrderPublishResult]:
"""
按发票号查 ERP、生成 PDF 并上传到当月「PO订单」目录。
【AI 触发时机】独立抓取任务要写入文档库时调用;不要在周二 runner 里调用。
【AI 触发时机】独立抓取任务要写入文档库时调用;检核 runner 不要调用。周二 05:00 排程走本方法。
"""
results: list[PoOrderPublishResult] = []
for document in self.fetch_documents(invoice_nos, config=config):