chore(shipping-notice): 统一货代发货生命周期阶段命名并优化全链路业务逻辑
This commit is contained in:
1 parent
5ef8329bd8
commit
4ec4e57005
183 files changed
+14653
-3936
No files matched your search
@@ -23,6 +23,22 @@ from app.services.shipping_notice.intake_service import can_force_create_shippin
|
||||
|
||||
_ACTIONS = frozenset({'open_existing', 'create_revision', 'force_create'})
|
||||
_STP_DUPLICATE_OK = frozenset({'none', 'unchecked'})
|
||||
_LIFECYCLE_ELIGIBLE_STATUSES = frozenset({'provisional', 'accepted'})
|
||||
|
||||
|
||||
def is_current_reviewable_candidate(candidate: ShippingOrderCandidate | None) -> bool:
|
||||
"""判断 Candidate 是否可作为订单生命周期的当前准入事实。
|
||||
|
||||
触发时机:Case、批次投影和 Gate 收口需要决定是否可以从接收解析进入订单复核时。
|
||||
仅当前版本且仍可复核/已接受的 Candidate 可以开放生命周期;已拒绝、过期、被替代
|
||||
或空 Candidate 只能保留审计,不能影响实时阶段或前端入口。
|
||||
"""
|
||||
return bool(
|
||||
candidate is not None
|
||||
and bool(getattr(candidate, 'is_current_version', False))
|
||||
and str(getattr(candidate, 'candidate_status', '') or '').strip().lower()
|
||||
in _LIFECYCLE_ELIGIBLE_STATUSES
|
||||
)
|
||||
|
||||
|
||||
def evaluate_candidate_stp_gate(candidate: ShippingOrderCandidate) -> tuple[bool, list[str]]:
|
||||
|
||||
Reference in new issue
Block a user