feat(shipping-notice): 添加识别定义和规则集管理功能,支持客户和站点的可配置识别规则
This commit is contained in:
1 parent
88408490d7
commit
34d489a2d1
167 files changed
+10365
-7978
No files matched your search
@@ -559,38 +559,6 @@ def test_workspace_create_batch_from_notices_rejects_all_failed_files_without_cr
|
||||
assert not (tmp_path / "notice_uploads" / "_tmp").exists()
|
||||
|
||||
|
||||
def test_parse_notice_empty_result_requires_reupload_instead_of_review(app):
|
||||
"""无订单行且无单头字段时,不应生成空审核卡片,应停在重新上传/清洗节点。"""
|
||||
with app.app_context():
|
||||
user = User(username="shipping_empty_parse_user", email="shipping_empty_parse_user@example.com")
|
||||
db.session.add(user)
|
||||
db.session.flush()
|
||||
task = ShippingTask(
|
||||
task_no="SN-EMPTY-PARSE-001",
|
||||
user_id=user.id,
|
||||
source_type="pdf",
|
||||
process_status="created",
|
||||
raw_content="This PDF extraction contains no order table.",
|
||||
)
|
||||
db.session.add(task)
|
||||
db.session.commit()
|
||||
|
||||
result = shipping_tools.parse_notice({"task_id": task.task_no})
|
||||
|
||||
db.session.refresh(task)
|
||||
assert result["status"] == "needs_human"
|
||||
assert result["checkpoint"] == "notice_text_extraction_failed"
|
||||
assert [button["id"] for button in result["action_buttons"]] == [
|
||||
"replace_notice_file",
|
||||
"reparse",
|
||||
"reject",
|
||||
]
|
||||
assert task.pending_human_reason == "notice_text_extraction_failed"
|
||||
assert task.review_status is None
|
||||
assert task.lines_json == []
|
||||
assert "重新上传" in result["message"]
|
||||
|
||||
|
||||
def test_workspace_replace_notice_overwrites_current_task_without_new_batch(app, client):
|
||||
"""重新上传当前任务通知应保留 task_no/batch_no,只覆盖正文并清理旧解析结果。"""
|
||||
headers = _workspace_headers(app)
|
||||
|
||||
Reference in new issue
Block a user