feat(shipping-notice): 落地字段资产治理与唯一 Schema,自动建单随版本冻结
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
b7307fc573
commit
3a1dbf7ce5
144 files changed
+15167
-4480
No files matched your search
@@ -118,6 +118,35 @@ def test_layout_schedule_is_idempotent_and_force_creates_next_version(app):
|
||||
assert job.payload_json == {'layout_version_id': forced.id}
|
||||
|
||||
|
||||
def test_layout_schedule_reuses_same_owner_completed_layout_for_duplicate_document(app):
|
||||
"""相同管理员重复上传相同文件时,新 Document 必须直接复用可用布局。"""
|
||||
app.config['SHIPPING_NOTICE_LAYOUT_MINERU_ENABLED'] = True
|
||||
with app.app_context():
|
||||
original = _document()
|
||||
ready = record_inline_layout_snapshot(original, _snapshot())
|
||||
duplicate_intake = ShippingNoticeIntake(
|
||||
intake_no='SNI-LAYOUT-DUPLICATE', asset_id=original.asset_id,
|
||||
user_id=db.session.get(ShippingNoticeIntake, original.intake_id).user_id,
|
||||
purpose='order_document_profile_sample', parse_status='parsed', parser_version='v6',
|
||||
)
|
||||
db.session.add(duplicate_intake)
|
||||
db.session.flush()
|
||||
duplicate = ShippingNoticeDocument(
|
||||
intake_id=duplicate_intake.id, asset_id=original.asset_id, document_type='attachment',
|
||||
attachment_key='duplicate.pdf', filename='duplicate.pdf', content_hash=original.content_hash,
|
||||
classification='order_notice', parse_status='parsed',
|
||||
)
|
||||
db.session.add(duplicate)
|
||||
db.session.flush()
|
||||
|
||||
reused = schedule_layout_version(duplicate)
|
||||
db.session.commit()
|
||||
|
||||
assert reused.id == ready.id
|
||||
assert duplicate.current_layout_version_id == ready.id
|
||||
assert ShippingDocumentLayoutVersion.query.count() == 1
|
||||
|
||||
|
||||
def test_layout_parser_revision_change_creates_new_version_without_force(app):
|
||||
"""运维提升 parser revision 后不得复用旧 Provider/模型结果。"""
|
||||
app.config['SHIPPING_NOTICE_LAYOUT_MINERU_ENABLED'] = True
|
||||
|
||||
Reference in new issue
Block a user