From fffee9d964fc27b6d434a9b2473c72c392c89cd5 Mon Sep 17 00:00:00 2001 From: DXC Date: Thu, 4 Jun 2026 11:31:44 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A5=E5=BA=93=E7=AE=A1=E7=90=86=E4=B8=89?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E7=B1=BB=E5=88=AB=E6=90=9C=E7=B4=A2=E4=B8=AD?= =?UTF-8?q?=E9=97=B4=E8=8A=82=E7=82=B9=E6=94=AF=E6=8C=81=E5=AD=90=E7=BA=A7?= =?UTF-8?q?=E5=8C=B9=E9=85=8D=EF=BC=88buy/semi/product=20=E7=B1=BB?= =?UTF-8?q?=E5=88=AB=E8=BF=87=E6=BB=A4=E6=94=B9=E4=B8=BA=20ilike=20?= =?UTF-8?q?=E5=89=8D=E7=BC=80=EF=BC=8C=E4=B8=8E=E5=9F=BA=E7=A1=80=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E9=A1=B5=E4=B8=80=E8=87=B4=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- inventory-backend/app/services/inbound/buy_service.py | 3 ++- inventory-backend/app/services/inbound/product_service.py | 3 ++- inventory-backend/app/services/inbound/semi_service.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/inventory-backend/app/services/inbound/buy_service.py b/inventory-backend/app/services/inbound/buy_service.py index 521a2e3..b4b3654 100644 --- a/inventory-backend/app/services/inbound/buy_service.py +++ b/inventory-backend/app/services/inbound/buy_service.py @@ -382,7 +382,8 @@ class BuyInboundService: # 2. 类别独立搜索 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. 类型独立搜索 if material_type and material_type.strip(): diff --git a/inventory-backend/app/services/inbound/product_service.py b/inventory-backend/app/services/inbound/product_service.py index b5a7eda..fe5dddf 100644 --- a/inventory-backend/app/services/inbound/product_service.py +++ b/inventory-backend/app/services/inbound/product_service.py @@ -349,7 +349,8 @@ class ProductInboundService: sku_str = f'%{sku.strip()}%' query = query.filter(StockProduct.sku.ilike(sku_str)) 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(): query = query.filter(MaterialBase.material_type == material_type.strip()) diff --git a/inventory-backend/app/services/inbound/semi_service.py b/inventory-backend/app/services/inbound/semi_service.py index beeb0ce..03b6ec5 100644 --- a/inventory-backend/app/services/inbound/semi_service.py +++ b/inventory-backend/app/services/inbound/semi_service.py @@ -439,7 +439,8 @@ class SemiInboundService: sku_str = f'%{sku.strip()}%' query = query.filter(StockSemi.sku.ilike(sku_str)) 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(): query = query.filter(MaterialBase.material_type == material_type.strip())