test(shipping): 更新订单复核库存与通知流程测试
This commit is contained in:
1 parent
8ec028e6a3
commit
265a6e179a
168 files changed
+9420
-4613
No files matched your search
@@ -12,10 +12,10 @@ from __future__ import annotations
|
||||
from typing import TYPE_CHECKING, Any
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from app.models import ShippingNotice
|
||||
from app.models import ShippingNotice, ShippingOrderTask
|
||||
|
||||
|
||||
def _task_has_process_execution(task: ShippingNotice | None) -> bool:
|
||||
def _task_has_process_execution(task: ShippingOrderTask | ShippingNotice | None) -> bool:
|
||||
"""
|
||||
判断任务是否已绑定 ProcessExecution(Gate 为恢复真相源)。
|
||||
|
||||
@@ -27,11 +27,17 @@ def _task_has_process_execution(task: ShippingNotice | None) -> bool:
|
||||
"""
|
||||
if task is None or getattr(task, 'id', None) is None:
|
||||
return False
|
||||
from app.models import ShippingProcessExecution
|
||||
from app.models import ShippingNotice, ShippingProcessExecution
|
||||
|
||||
if isinstance(task, ShippingNotice):
|
||||
task_id = int(task.order_task_id) if task.order_task_id is not None else None
|
||||
else:
|
||||
task_id = int(task.id) if getattr(task, 'id', None) is not None else None
|
||||
if task_id is None:
|
||||
return False
|
||||
return (
|
||||
ShippingProcessExecution.query
|
||||
.filter_by(task_id=int(task.id))
|
||||
.filter_by(task_id=task_id)
|
||||
.filter(ShippingProcessExecution.status != 'superseded')
|
||||
.first()
|
||||
is not None
|
||||
|
||||
Reference in new issue
Block a user