feat(shipping-order): 迭代货代订单提取与履约全流程功能
添加订单字段自动标注配置,默认仅关键字段参与自动框选 完善字段规范化逻辑,支持更多日期格式解析 添加订单候选人工采纳、驳回的完整流程,包含API、前端交互与状态管理 完善盲测功能,支持订单级字段真值校验,调整盲测集唯一性约束 加固库存校验逻辑,防止重复预约与数量不一致问题 优化坐标匹配逻辑,支持表格外的锚点定位 新增上传结果未知的状态处理,完善任务状态机 更新多语言文案与文档说明,补充功能细节 修复订单合并、重解析的边缘情况问题 补充相关测试用例,完善质量保障
This commit is contained in:
1 parent
11079910ec
commit
90f77634d6
76 files changed
+5056
-338
No files matched your search
@@ -117,6 +117,7 @@ def test_candidate_review_duplicate_api_and_access_guards(app, client):
|
||||
},
|
||||
validation_status='needs_review',
|
||||
conflicts_json=[{'field': 'qty'}],
|
||||
extraction_source='dify_workflow',
|
||||
selected=True,
|
||||
duplicate_resolution='open_existing',
|
||||
duplicate_target_task_no=existing.task_no,
|
||||
@@ -143,10 +144,40 @@ def test_candidate_review_duplicate_api_and_access_guards(app, client):
|
||||
patched = patch_response.get_json()['data']
|
||||
assert patched['selected'] is False
|
||||
assert patched['validation_status'] == 'ready'
|
||||
|
||||
# 模拟重复任务在审核完成前被关闭,采纳必须重新通过实时重复门禁。
|
||||
with app.app_context():
|
||||
existing = ShippingTask.query.filter_by(task_no='SN-CANDIDATE-EXISTING-001').one()
|
||||
db.session.delete(existing)
|
||||
db.session.commit()
|
||||
|
||||
promote_response = client.post(
|
||||
'/api/workspace/shipping-notice/candidates/SNC-CANDIDATE-API-001/promote',
|
||||
headers=owner_headers,
|
||||
)
|
||||
assert promote_response.status_code == 200
|
||||
promoted = promote_response.get_json()['data']
|
||||
assert promoted['candidate_status'] == 'accepted'
|
||||
assert promoted['acceptance_mode'] == 'manual'
|
||||
assert promoted['selected'] is True
|
||||
|
||||
repeated = client.post(
|
||||
'/api/workspace/shipping-notice/candidates/SNC-CANDIDATE-API-001/promote',
|
||||
headers=owner_headers,
|
||||
)
|
||||
assert repeated.status_code == 200
|
||||
assert repeated.get_json()['data']['candidate_status'] == 'accepted'
|
||||
assert patched['conflicts'] == []
|
||||
assert patched['content_fingerprint']
|
||||
assert patched['duplicate_resolution'] is None
|
||||
|
||||
with app.app_context():
|
||||
db.session.add(ShippingTask(
|
||||
task_no='SN-CANDIDATE-EXISTING-001', user_id=owner.id,
|
||||
source_content_hash='candidate-api-content-hash', process_status='created',
|
||||
))
|
||||
db.session.commit()
|
||||
|
||||
forbidden = client.patch(
|
||||
'/api/workspace/shipping-notice/candidates/SNC-CANDIDATE-API-001',
|
||||
json={'selected': True},
|
||||
@@ -349,6 +380,7 @@ def test_candidate_batch_gate_rejects_incomplete_expired_and_selection_drift(app
|
||||
validation_status='ready',
|
||||
conflicts_json=[],
|
||||
selected=True,
|
||||
candidate_status='accepted',
|
||||
duplicate_status='none',
|
||||
)
|
||||
db.session.add(candidate)
|
||||
@@ -402,6 +434,25 @@ def test_candidate_batch_gate_rejects_incomplete_expired_and_selection_drift(app
|
||||
assert none_selected.value.code == 'SHIPPING_NOTICE.CANDIDATE_NOT_SELECTED'
|
||||
|
||||
|
||||
def test_candidate_batch_gate_requires_accepted_lifecycle(app, shipping_user):
|
||||
"""provisional Candidate 即使保留旧 selected 标记,也绝不能绕过履约门禁。"""
|
||||
from app.services.shipping_notice.candidate_service import ensure_candidate_fulfillment_ready
|
||||
|
||||
with app.app_context():
|
||||
candidate = ShippingNoticeCandidate(
|
||||
candidate_no='SNC-ACCEPTANCE-GATE', candidate_key='acceptance-gate',
|
||||
intake_id=1, primary_document_id=1, selected=True,
|
||||
candidate_status='provisional', is_current_version=True,
|
||||
validation_status='ready', conflicts_json=[],
|
||||
)
|
||||
with pytest.raises(ConflictError) as provisional:
|
||||
ensure_candidate_fulfillment_ready(candidate)
|
||||
assert provisional.value.code == 'SHIPPING_NOTICE.CANDIDATE_ACCEPTANCE_REQUIRED'
|
||||
|
||||
candidate.candidate_status = 'accepted'
|
||||
ensure_candidate_fulfillment_ready(candidate)
|
||||
|
||||
|
||||
def test_candidate_era_intake_without_candidates_cannot_fallback_to_single_eml_task(app, shipping_user):
|
||||
"""v6 Intake 无 Candidate 时必须阻断,不得退回整封 EML 建一个旧式 Task。"""
|
||||
with app.app_context():
|
||||
@@ -551,6 +602,7 @@ def test_one_eml_intake_candidates_create_one_batch_multiple_tasks(app, shipping
|
||||
validation_status='ready',
|
||||
conflicts_json=[],
|
||||
selected=True,
|
||||
candidate_status='accepted',
|
||||
business_fingerprint=identity['fingerprint'],
|
||||
fingerprint_version=identity['version'],
|
||||
fingerprint_strength=identity['strength'],
|
||||
|
||||
Reference in new issue
Block a user