fix(qc): 我的质检任务关键词与工单列表口径对齐
抽取共用关键词条件,mine 接口在保留任务号/检测项外,按工单号、 协议号、入库编码、母亲姓名、出库申请字段等检索,避免占位符失效。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
0ac8c924aa
commit
5a011926d7
3 files changed
+109
-39
No files matched your search
@@ -0,0 +1,34 @@
|
||||
"""质检工单 / 我的质检任务共用关键词条件(无库路径)。"""
|
||||
|
||||
# qc_work_order ↔ qc_task 存在循环依赖:先经 qc_task 再取 helper
|
||||
import app.crud.qc_task # noqa: F401
|
||||
from app.crud.qc_work_order import build_qc_work_order_keyword_conditions
|
||||
from app.models.models import BizQcWorkOrder
|
||||
|
||||
|
||||
def test_empty_keyword_returns_no_conditions():
|
||||
assert build_qc_work_order_keyword_conditions(
|
||||
None, tenant_no=None, keyword=""
|
||||
) == []
|
||||
assert build_qc_work_order_keyword_conditions(
|
||||
None, tenant_no="t1", keyword=" "
|
||||
) == []
|
||||
|
||||
|
||||
def test_base_conditions_without_tenant_cover_list_fields():
|
||||
conds = build_qc_work_order_keyword_conditions(
|
||||
None,
|
||||
tenant_no=None,
|
||||
keyword="ABC",
|
||||
work_order_type="inbound",
|
||||
reception_source="cell_storage",
|
||||
)
|
||||
assert len(conds) == 4
|
||||
# 与质检工单列表一致的四列(无租户时不做入库/母亲/出库扩展)
|
||||
cols = {str(c.left) for c in conds}
|
||||
assert str(BizQcWorkOrder.work_order_no) in cols or any(
|
||||
"work_order_no" in str(c) for c in conds
|
||||
)
|
||||
assert any("sample_code" in str(c) for c in conds)
|
||||
assert any("protocol_no" in str(c) for c in conds)
|
||||
assert any("external_target_code" in str(c) for c in conds)
|
||||
Reference in new issue
Block a user