入库管理三页面类别搜索中间节点支持子级匹配(buy/semi/product 类别过滤改为 ilike 前缀,与基础信息页一致)

This commit is contained in:
DXC
2026-06-04 11:31:44 +08:00
parent a3d47f6328
commit fffee9d964
3 changed files with 6 additions and 3 deletions

View File

@ -382,7 +382,8 @@ class BuyInboundService:
# 2. 类别独立搜索 # 2. 类别独立搜索
if category and category.strip(): if category and category.strip():
query = query.filter(MaterialBase.category == category.strip()) # 级联选择器:中间节点用前缀匹配,与 base_service.get_list 行为一致
query = query.filter(MaterialBase.category.ilike(f"{category.strip()}%"))
# 3. 类型独立搜索 # 3. 类型独立搜索
if material_type and material_type.strip(): if material_type and material_type.strip():

View File

@ -349,7 +349,8 @@ class ProductInboundService:
sku_str = f'%{sku.strip()}%' sku_str = f'%{sku.strip()}%'
query = query.filter(StockProduct.sku.ilike(sku_str)) query = query.filter(StockProduct.sku.ilike(sku_str))
if category and category.strip(): if category and category.strip():
query = query.filter(MaterialBase.category == category.strip()) # 级联选择器:中间节点用前缀匹配,与 base_service.get_list 行为一致
query = query.filter(MaterialBase.category.ilike(f"{category.strip()}%"))
if material_type and material_type.strip(): if material_type and material_type.strip():
query = query.filter(MaterialBase.material_type == material_type.strip()) query = query.filter(MaterialBase.material_type == material_type.strip())

View File

@ -439,7 +439,8 @@ class SemiInboundService:
sku_str = f'%{sku.strip()}%' sku_str = f'%{sku.strip()}%'
query = query.filter(StockSemi.sku.ilike(sku_str)) query = query.filter(StockSemi.sku.ilike(sku_str))
if category and category.strip(): if category and category.strip():
query = query.filter(MaterialBase.category == category.strip()) # 级联选择器:中间节点用前缀匹配,与 base_service.get_list 行为一致
query = query.filter(MaterialBase.category.ilike(f"{category.strip()}%"))
if material_type and material_type.strip(): if material_type and material_type.strip():
query = query.filter(MaterialBase.material_type == material_type.strip()) query = query.filter(MaterialBase.material_type == material_type.strip())