feat(shipping-notice): 新增通用解析能力,优化性能并清理遗留废弃代码

This commit is contained in:
hugo committed 2026-08-23 00:27:18 +08:00
1 parent 935bf26fa6
commit 7cfd5d167e
230 files changed
+9337 -10989

No files matched your search

-1
View File
@@ -17,7 +17,6 @@ from app.jobs.handlers import ( # noqa: F401
shipping_notice_run,
shipping_order_extraction,
shipping_process_gate,
shipping_auto_progress,
shipping_stp_auto_create,
shipping_line_auto_fulfill,
shipping_post_ot_wave_progress,
@@ -1,27 +0,0 @@
"""
jobs/handlers/shipping_auto_progress.py
用途:终态化历史 APX AutoProgress Job。
依赖:JobContext、auto_progress_controller。
逻辑:Job 已由通用队列领取为 running;本 Handler 仅委托控制器取消遗留 APX
Job 并保留审计。正式 20-Gate 只能由 shipping_process_gate Handler 执行。
"""
from __future__ import annotations
from app.jobs.context import JobContext
from app.jobs.registry import register_handler
from app.jobs.types import JobType
from app.services.shipping_notice.auto_progress_controller import run_auto_progress_job
@register_handler(JobType.SHIPPING_AUTO_PROGRESS)
def run_shipping_auto_progress(ctx: JobContext, payload: dict) -> None:
"""终态化历史 APX Job;payload 必须含队列注入的 job_id。"""
raw_job_id = payload.get('job_id')
if not raw_job_id:
raise RuntimeError('missing_job_id_for_shipping_auto_progress')
run_auto_progress_job(
job_id=int(raw_job_id),
worker_id=str(ctx.extras.get('worker_label') or f'shipping-auto-progress-{raw_job_id}'),
)
@@ -1018,7 +1018,9 @@ def run_shipping_order_extraction(ctx: JobContext, payload: dict) -> None:
1
for order in merged_unit_orders if isinstance(order, dict)
for conflict in order.get('conflicts') or [] if isinstance(conflict, dict)
if str(conflict.get('reason') or '').strip() == 'supplement_relation_ambiguous'
if str(conflict.get('reason') or '').strip() in {
'supplement_relation_ambiguous', 'supplement_field_conflict',
}
)
supplement_status = (
'conflict'
@@ -1148,7 +1150,7 @@ def run_shipping_order_extraction(ctx: JobContext, payload: dict) -> None:
)
# 收口摘要保留可投影的处理事实,供 Run 级 handling_items 区分待补/冲突/冻结/复核。
summary = {
'run_no': run.run_no, 'batch_no': result.get('batch_no'),
'run_no': run.run_no,
'created_count': int(result.get('created_count') or 0),
'opened_existing_count': int(result.get('opened_existing_count') or 0),
'pending_count': int(result.get('pending_count') or 0),
-3
View File
@@ -22,8 +22,6 @@ class JobType(StrEnum):
SHIPPING_PROCESS_GATE = 'shipping_process_gate'
# RPA 回调 HTTP 只收件;Excel 校验、解析、任务关联由 shipping worker 异步完成。
SHIPPING_INVENTORY_CALLBACK_PROCESS = 'shipping_inventory_callback_process'
# 历史 APX 兼容:Worker 仅终态化,不再执行 Gate。
SHIPPING_AUTO_PROGRESS = 'shipping_auto_progress'
# 统一 PDF 自动标记:按实际证据能力执行坐标重建或 XFA 多源视觉融合。
SHIPPING_PDF_AUTOMARK = 'shipping_pdf_automark'
# 资格达标后的 STP 自动建单入队(先 queued,再由 worker 执行 confirm)
@@ -72,7 +70,6 @@ QUEUE_KB_JOB_TYPES: dict[str, frozenset[str]] = {
'shipping_notice_run', 'shipping_notice_parse', 'shipping_order_extraction',
'shipping_document_layout', 'shipping_process_gate', 'shipping_pdf_automark',
'shipping_inventory_callback_process',
'shipping_auto_progress',
'shipping_stp_auto_create', 'shipping_line_auto_fulfill',
'shipping_post_ot_wave_progress', 'shipping_review_revalidate_progress',
}),