From 1444c7c800fc042cd99213e901d6ad3722d0f03f Mon Sep 17 00:00:00 2001
From: jiangshuai <291802688@qq.com>
Date: 星期三, 27 九月 2023 16:13:53 +0800
Subject: [PATCH] 1.二期一部分代码

---
 controllers/product_controller.go |   23 +++++++++++------------
 1 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/controllers/product_controller.go b/controllers/product_controller.go
index 126a539..c1f3d00 100644
--- a/controllers/product_controller.go
+++ b/controllers/product_controller.go
@@ -76,7 +76,7 @@
 	if params.PageInfo.Check() {
 		search.SetPage(params.Page, params.PageSize)
 	}
-	products, total, err := search.SetKeyword(params.KeyWord).SetOrder("created_at desc").Find()
+	products, total, err := search.SetKeyword(params.KeyWord).SetCategoryId(params.CategoryId).SetOrder("created_at desc").Find()
 	if err != nil {
 		util.ResponseFormat(c, code.RequestParamError, "鏌ユ壘澶辫触")
 		return
@@ -360,19 +360,18 @@
 	}
 	detail := &models.OperationDetails{
 		ProductId: params.ProductId,
-		//ProductName: params.ProductName,
-		Amount: params.Amount,
-		//Unit:        params.Unit,
+		Amount:    params.Amount,
 	}
 	operation := models.Operation{
-		Number:          strconv.FormatInt(time.Now().Unix(), 10),
-		SourceNumber:    params.SourceNumber,
-		OperationTypeId: 0,
-		Status:          constvar.OperationStatus_Ready,
-		FromLocationID:  params.FromLocationId,
-		ToLocationID:    params.ToLocationId,
-		OperationDate:   time.Now().Format("2006-01-02 15:04:05"),
-		Details:         []*models.OperationDetails{detail},
+		Number:            strconv.FormatInt(time.Now().Unix(), 10),
+		SourceNumber:      params.SourceNumber,
+		OperationTypeId:   0,
+		Status:            constvar.OperationStatus_Ready,
+		FromLocationID:    params.FromLocationId,
+		ToLocationID:      params.ToLocationId,
+		OperationDate:     time.Now().Format("2006-01-02 15:04:05"),
+		Details:           []*models.OperationDetails{detail},
+		BaseOperationType: constvar.BaseOperationTypeDisuse,
 	}
 	if err := models.NewOperationSearch().Create(&operation); err != nil {
 		logx.Errorf("Operation create err: %v", err)

--
Gitblit v1.8.0