feat(shipping-notice): 新增通用解析能力,优化性能并清理遗留废弃代码
This commit is contained in:
1 parent
935bf26fa6
commit
7cfd5d167e
230 files changed
+9337
-10989
No files matched your search
@@ -19,7 +19,6 @@ from flask import current_app
|
||||
|
||||
from app import db
|
||||
from app.models import ShippingNotice, ShippingTaskEvent
|
||||
from app.services.shipping_notice.batch_legacy_removed import raise_shipping_batches_removed
|
||||
from app.services.shipping_notice.constants import AUTO_CHAIN_FALLBACK
|
||||
|
||||
|
||||
@@ -267,12 +266,6 @@ def _clean_event_value(value: Any) -> str:
|
||||
return str(value or "").strip()
|
||||
|
||||
|
||||
def _task_batch_no(task: ShippingNotice | None) -> str:
|
||||
"""从任务关系中提取批次号。"""
|
||||
batch = getattr(task, "batch", None)
|
||||
return _clean_event_value(getattr(batch, "batch_no", None))
|
||||
|
||||
|
||||
def build_task_action_event_detail(
|
||||
task: ShippingNotice,
|
||||
*,
|
||||
@@ -284,7 +277,7 @@ def build_task_action_event_detail(
|
||||
"""
|
||||
构建任务动作类事件详情。
|
||||
|
||||
核心逻辑:统一补齐 action/source/target/batch/conversation 等字段,保证 reference_context 后续可以稳定消费本地动作事件。
|
||||
核心逻辑:统一补齐 action/source/target/conversation 等字段,保证 reference_context 后续可以稳定消费本地动作事件。
|
||||
|
||||
Args:
|
||||
task: 动作作用的目标任务。
|
||||
@@ -301,7 +294,6 @@ def build_task_action_event_detail(
|
||||
"source": _clean_event_value(source),
|
||||
"target_type": "task",
|
||||
"target_id": _clean_event_value(getattr(task, "task_no", None)),
|
||||
"batch_no": _task_batch_no(task),
|
||||
"conversation_id": _clean_event_value(getattr(task, "conversation_id", None)),
|
||||
}
|
||||
normalized_comment = _clean_event_value(comment)
|
||||
@@ -588,21 +580,3 @@ def log_task_action_event(
|
||||
)
|
||||
|
||||
|
||||
def switch_batch_focus(
|
||||
batch: Any,
|
||||
task: ShippingNotice,
|
||||
*,
|
||||
source: str,
|
||||
event_type: str = "focus_switched",
|
||||
comment: str | None = None,
|
||||
emit_when_unchanged: bool = True,
|
||||
extra: dict[str, Any] | None = None,
|
||||
) -> bool:
|
||||
"""
|
||||
切换批次焦点任务并写入标准事件。
|
||||
|
||||
Raises:
|
||||
ValidationError: shipping_batches 表已物理删除(co8e9f0a1b2c)。
|
||||
"""
|
||||
del batch, task, source, event_type, comment, emit_when_unchanged, extra
|
||||
raise_shipping_batches_removed()
|
||||
Reference in new issue
Block a user