feat: 采购/半成品/成品列表拆分SKU独立搜索框
This commit is contained in:
@ -270,11 +270,12 @@ class ProductInboundService:
|
||||
return []
|
||||
|
||||
@staticmethod
|
||||
def get_list(page, limit, keyword=None, statuses=None, category=None, material_type=None, company=None,
|
||||
def get_list(page, limit, keyword=None, sku=None, statuses=None, category=None, material_type=None, company=None,
|
||||
order_by_column=None, is_asc=None, advanced_filters=None):
|
||||
from app.models.inbound.product import StockProduct
|
||||
try:
|
||||
query = db.session.query(StockProduct).outerjoin(MaterialBase, StockProduct.base_id == MaterialBase.id)
|
||||
# 1. 通用关键词搜索(名称、规格、公司)
|
||||
if keyword:
|
||||
kw = f'%{keyword}%'
|
||||
query = query.filter(or_(
|
||||
@ -283,9 +284,12 @@ class ProductInboundService:
|
||||
MaterialBase.company_name.ilike(kw),
|
||||
StockProduct.serial_number.ilike(kw),
|
||||
StockProduct.work_order_code.ilike(kw),
|
||||
StockProduct.order_id.ilike(kw),
|
||||
StockProduct.sku.ilike(kw)
|
||||
StockProduct.order_id.ilike(kw)
|
||||
))
|
||||
# 1.1 SKU 独立搜索
|
||||
if sku and sku.strip():
|
||||
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())
|
||||
if material_type and material_type.strip():
|
||||
|
||||
Reference in New Issue
Block a user