From c278d736f5f9c0ab4a64540aa1a6b89984b0cd2c Mon Sep 17 00:00:00 2001
From: jiangshuai <291802688@qq.com>
Date: 星期四, 19 十月 2023 15:52:37 +0800
Subject: [PATCH] 1.wms业务调整及bug修改

---
 controllers/product_controller.go |    7 ++-----
 1 files changed, 2 insertions(+), 5 deletions(-)

diff --git a/controllers/product_controller.go b/controllers/product_controller.go
index 333d2b0..c1f0d71 100644
--- a/controllers/product_controller.go
+++ b/controllers/product_controller.go
@@ -403,11 +403,8 @@
 
 	db := models.NewOperationSearch().Orm.Table("wms_operation").Select("wms_operation.id,wms_operation.number,wms_operation.source_number,wms_operation.status,wms_operation.from_location_id,wms_operation.to_location_id,wms_operation.operation_date,wms_operation.contacter_id,wms_operation.contacter_name,wms_operation.company_id,wms_operation.company_name,wms_operation.comment,wms_operation_details.product_id,material.name as product_name,material.unit,wms_operation_details.amount").InnerJoins("inner join wms_operation_details on wms_operation_details.operation_id=wms_operation.id").InnerJoins("inner join material on material.id=wms_operation_details.product_id")
 
-	if params.SourceNumber != "" {
-		db = db.Where("wms_operation.source_number like ?", fmt.Sprintf("%%%v%%", params.SourceNumber))
-	}
 	if params.Number != "" {
-		db = db.Where("wms_operation.number like ?", fmt.Sprintf("%%%v%%", params.Number))
+		db = db.Where("wms_operation.number like ? or wms_operation.source_number like ? or material.name like ?", fmt.Sprintf("%%%v%%", params.Number), fmt.Sprintf("%%%v%%", params.Number), fmt.Sprintf("%%%v%%", params.Number))
 	}
 	db = db.Where("wms_operation.operation_type_id=?", 0)
 	var (
@@ -425,7 +422,7 @@
 	if params.Page*params.PageSize > 0 {
 		db = db.Offset((params.Page - 1) * params.PageSize).Limit(params.PageSize)
 	}
-	if err := db.Find(&records).Error; err != nil {
+	if err := db.Order("wms_operation.created_at desc").Find(&records).Error; err != nil {
 		util.ResponseFormat(c, code.RequestError, fmt.Errorf("find count err: %v", err))
 		return
 	}

--
Gitblit v1.8.0