refactor(shipping-inventory): 统一库存准备事实来源与门禁状态

This commit is contained in:
hugo committed 2026-09-04 20:23:00 +08:00
1 parent 761a06e21a
commit eb55f407ae
62 files changed
+4242 -1471

No files matched your search

@@ -84,6 +84,18 @@ def run_shipping_process_gate(ctx: JobContext, payload: dict) -> None:
attempt_id = int(payload.get('attempt_id') or 0)
raw_job_id = payload.get('job_id')
job = db.session.get(Job, int(raw_job_id)) if raw_job_id else None
external_wait_poll_gate_id = int(payload.get('external_wait_poll_gate_id') or 0)
if external_wait_poll_gate_id and job is not None:
from app.services.shipping_notice.process_gate_job_service import run_inventory_external_wait_poll
result = run_inventory_external_wait_poll(gate_id=external_wait_poll_gate_id)
finish_job(job.id, result=result, owned_attempt=int(job.attempts or 0))
if str(result.get('gate_status') or '') == 'waiting_external':
gate = db.session.get(ShippingProcessGate, external_wait_poll_gate_id)
if gate is not None and gate.latest_attempt_id:
schedule_waiting_external_poll(attempt_id=int(gate.latest_attempt_id))
db.session.commit()
return
if attempt_id <= 0 or job is None:
raise RuntimeError('missing_attempt_id_or_job_id')