feat(shipping-notice): 增强订单文档 Profile 管理功能,新增复核与草稿管理

- 添加订单复核相关模型及 API,支持复核案例的创建、更新和确认
- 实现复核草稿的管理功能,允许用户对复核内容进行编辑和保存
- 引入复核事件审计,确保复核过程的可追溯性
- 更新数据库模型以支持复核和草稿的关系管理
- 完善相关服务逻辑,确保复核与草稿的状态管理和数据一致性
- 增强文档模板的管理能力,支持更复杂的业务场景
This commit is contained in:
hugo committed 2026-07-29 09:50:25 +08:00
1 parent 61ac6403c4
commit b7307fc573
147 files changed
+15108 -1522

No files matched your search

@@ -608,6 +608,10 @@ def test_workspace_documents_include_unit_selection_and_retry_facts(monkeypatch)
'app.services.shipping_notice.order_extraction_workspace_projection._latest_progress_events',
lambda _run: ({}, None),
)
monkeypatch.setattr(
'app.services.shipping_notice.order_extraction_workspace_projection._latest_layout_document_events',
lambda _run: {},
)
items = serialize_workspace_run_documents(run)
@@ -638,4 +642,52 @@ def test_workspace_documents_include_unit_selection_and_retry_facts(monkeypatch)
'reason_code': 'technical_failure',
'review_details': [],
'available_actions': [],
'activity_event_code': None,
'started_at': None,
'last_activity_at': None,
'finished_at': None,
}]
def test_workspace_documents_show_selected_pdfs_while_layout_is_pending(monkeypatch):
"""等待版面解析时仍返回已选 PDF,避免处理详情误报“暂无结果”。"""
run = SimpleNamespace(
id=1,
input_snapshot_json={
'attachment_selection': {
'items': [{
'selected': True,
'filename': 'po-pending.pdf',
'content_hash': 'pending-hash',
'selection_batch': 1,
'group_key': 'PO-PENDING',
}],
},
'intakes': [{
'intake_id': 11,
'documents': [{
'document_id': 101,
'document_type': 'attachment',
'filename': 'po-pending.pdf',
'content_hash': 'pending-hash',
}],
}],
},
extraction_plan=None,
)
monkeypatch.setattr(
'app.services.shipping_notice.order_extraction_workspace_projection._latest_progress_events',
lambda _run: ({}, None),
)
monkeypatch.setattr(
'app.services.shipping_notice.order_extraction_workspace_projection._latest_layout_document_events',
lambda _run: {},
)
items = serialize_workspace_run_documents(run)
# 关键断言:Unit 延后创建时,用户仍能看到正在等待版面解析的具体 PDF。
assert items[0]['file_name'] == 'po-pending.pdf'
assert items[0]['status'] == 'pending'
assert items[0]['document_id'] == 101
assert items[0]['activity_event_code'] is None