feat(shipping-notice): 添加识别定义和规则集管理功能,支持客户和站点的可配置识别规则
This commit is contained in:
1 parent
88408490d7
commit
34d489a2d1
167 files changed
+10365
-7978
No files matched your search
@@ -2,9 +2,9 @@
|
||||
services/shipping_notice/state_machine.py
|
||||
|
||||
用途:发货通知人工节点(checkpoint)与动作按钮的单一注册表,负责任务 DB 字段与 UI 状态的映射。
|
||||
依赖:models.ShippingTask、constants(CP_*/PH_*/RS_*)、rpa_attempts、task_line_store。
|
||||
依赖:models.ShippingTask、constants(CP_*/PH_*/RS_*)、rpa_attempts、order_field_purposes。
|
||||
逻辑:tools.py 通过 apply_task_transition 写库并返回 checkpoint;ui_state.py 与历史兼容模块都从本文件读取按钮/状态;新增人工节点时仅改本文件与测试;
|
||||
是否具备可匹配订单行经 read_task_order_lines 判断。
|
||||
是否具备可匹配订单行经锁定 Extraction 的 FieldValue 判断。
|
||||
|
||||
扩展说明(开发者):
|
||||
- checkpoint id 即 API `checkpoint` / Dify `flow_ckpt`
|
||||
@@ -19,7 +19,7 @@ from enum import StrEnum
|
||||
from typing import Any
|
||||
|
||||
from app.models import ShippingTask
|
||||
from app.services.shipping_notice.task_line_store import read_task_order_lines
|
||||
from app.services.shipping_notice.order_field_purposes import task_line_purpose_values
|
||||
from app.services.shipping_notice.constants import (
|
||||
CP_EXPORT_READY,
|
||||
CP_EXPORT_GENERATED,
|
||||
@@ -53,6 +53,14 @@ from app.services.shipping_notice.constants import (
|
||||
RS_RSV_REQ,
|
||||
RS_SHORTAGE_REVIEW,
|
||||
)
|
||||
|
||||
|
||||
def _task_has_dynamic_order_lines(task: ShippingTask) -> bool:
|
||||
"""仅在当前已接受 Extraction 含行 FieldValue 时开放库存匹配检查点。"""
|
||||
try:
|
||||
return bool(task_line_purpose_values(task))
|
||||
except ValueError:
|
||||
return False
|
||||
from app.services.shipping_notice.rpa_attempts import (
|
||||
inventory_rpa_attempts,
|
||||
max_rpa_inventory_attempts,
|
||||
@@ -290,7 +298,7 @@ def resolve_task_ui_state(task: ShippingTask) -> TaskUiState:
|
||||
and not task.review_status
|
||||
and not task.pending_human_reason
|
||||
and not task.match_status
|
||||
and len(read_task_order_lines(task)) > 0
|
||||
and bool(_task_has_dynamic_order_lines(task))
|
||||
):
|
||||
return TaskUiState(
|
||||
checkpoint=CP_READY_MATCH,
|
||||
|
||||
Reference in new issue
Block a user