From 4d61fe8d8755ff2166ce7ac6adaa16c5f917fd33 Mon Sep 17 00:00:00 2001
From: liujiandao <274878379@qq.com>
Date: 星期三, 18 十月 2023 16:28:40 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/WMS

---
 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..c2dae50 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 ?", 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