chore(shipping-notice): 统一货代发货生命周期阶段命名并优化全链路业务逻辑
This commit is contained in:
1 parent
5ef8329bd8
commit
4ec4e57005
183 files changed
+14653
-3936
No files matched your search
@@ -131,6 +131,27 @@ _REVIEW_CASE_STATUS_TODO: dict[str, str] = {
|
||||
}
|
||||
|
||||
|
||||
def _review_case_lifecycle_entries(case: ShippingOrderReviewCase) -> list[dict[str, str]]:
|
||||
"""裁决建单前 Review Case 的生命周期查看入口。
|
||||
|
||||
只有关联当前有效订单 Candidate 的 Case 才能进入订单生命周期工作台;空 Case、
|
||||
已替代 Candidate 与拒绝/过期 Candidate 仍是解析或处置对象,不能因待办列表存在
|
||||
而获得订单复核、库存准备或通知完成入口。
|
||||
"""
|
||||
candidate = (
|
||||
db.session.get(ShippingOrderCandidate, int(case.candidate_id))
|
||||
if case.candidate_id is not None
|
||||
else None
|
||||
)
|
||||
from app.services.shipping_notice.candidate_service import is_current_reviewable_candidate
|
||||
|
||||
if not is_current_reviewable_candidate(candidate):
|
||||
return []
|
||||
from app.services.shipping_notice.lifecycle_projection import lifecycle_entries
|
||||
|
||||
return lifecycle_entries(lifecycle_stage='order_review', has_candidate_context=True)
|
||||
|
||||
|
||||
class TaskProjection(str, Enum):
|
||||
"""任务读模型投影:Tool / 工作台列表 / 工作台详情。"""
|
||||
|
||||
@@ -1318,6 +1339,7 @@ def serialize_review_case_todo(
|
||||
del is_admin
|
||||
run = db.session.get(ShippingOrderProcessingRun, case.run_id) if case.run_id else None
|
||||
document = db.session.get(ShippingOrderDocument, case.document_id) if case.document_id else None
|
||||
lifecycle_entries = _review_case_lifecycle_entries(case)
|
||||
source_name = None
|
||||
if document is not None:
|
||||
source_name = str(getattr(document, "filename", None) or "").strip() or None
|
||||
@@ -1376,6 +1398,10 @@ def serialize_review_case_todo(
|
||||
"created_at": case.created_at.isoformat() if case.created_at else None,
|
||||
"ui_state": {
|
||||
"stage": {"code": "order_review", "label": "订单复核", "index": 2, "total": 4},
|
||||
# [AUTHORITY] 任务中心、批次中心和工作台均消费该入口;禁止前端按 Case
|
||||
# 状态或待办类别补造订单复核权限。
|
||||
"lifecycle_stage": "order_review" if lifecycle_entries else None,
|
||||
"lifecycle_entries": lifecycle_entries,
|
||||
"checkpoint": {"code": "order_review", "kind": str(CheckpointKind.MUST_HUMAN), "label": "订单复核"},
|
||||
"todo": {"title": current_todo, "message": current_todo},
|
||||
"actions": {"primary": ({"code": action_buttons[0], "label": "重试自动建单", "kind": "recovery", "enabled": True, "requires_confirmation": False, "disabled_reason": None, "target_surface": "order_review", "expected_gate_version": None} if action_buttons else None), "secondary": []},
|
||||
@@ -1539,6 +1565,9 @@ def serialize_intake_todo(
|
||||
"created_at": intake.created_at.isoformat() if intake.created_at else None,
|
||||
"ui_state": {
|
||||
"stage": {"code": "intake_parse", "label": "接收解析", "index": 1, "total": 4},
|
||||
# Intake 尚未有当前有效订单 Candidate;只能进入对话查看解析,不能进入生命周期工作台。
|
||||
"lifecycle_stage": "intake_parse",
|
||||
"lifecycle_entries": [],
|
||||
"checkpoint": {"code": "order_field_extraction", "kind": str(
|
||||
CheckpointKind.MUST_HUMAN if failed else CheckpointKind.AUTO_CONTINUE
|
||||
), "label": "订单解析"},
|
||||
|
||||
Reference in new issue
Block a user