From 81827a26b91b07c997716f5f595e9e3121c18cf5 Mon Sep 17 00:00:00 2001 From: jiangshuai <291802688@qq.com> Date: 星期五, 17 十一月 2023 18:09:11 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/WMS --- controllers/product_controller.go | 22 +++++++++++++++++++--- 1 files changed, 19 insertions(+), 3 deletions(-) diff --git a/controllers/product_controller.go b/controllers/product_controller.go index 054b4ca..3a40e59 100644 --- a/controllers/product_controller.go +++ b/controllers/product_controller.go @@ -214,6 +214,22 @@ return } + //鏇存柊鍦ㄥ簱鐨勪骇鍝佺被鍨� + if params.CategoryId > 0 { + find, _ := models.NewLocationProductAmountSearch().SetProductId(params.ID).Find() + if len(find) > 0 { + var ids []int + for _, f := range find { + if f.ProductCategoryID != params.CategoryId { + ids = append(ids, f.Id) + } + } + m := make(map[string]interface{}) + m["productCategoryId"] = params.CategoryId + _ = models.NewLocationProductAmountSearch().SetIds(ids).UpdateByMap(m) + } + } + materialAttachmentList := []*models.MaterialAttachment{} for _, v := range params.AttachmentIDs { ma := &models.MaterialAttachment{MaterialID: params.ID, AttachmentID: v} @@ -318,7 +334,7 @@ return } - first, err := models.NewProductCategorySearch().SetID(cast.ToUint(id)).First() + first, err := models.NewProductCategorySearch().SetID(cast.ToInt(id)).First() if err != nil { util.ResponseFormat(c, code.RequestParamError, "鏌ユ壘澶辫触") return @@ -343,7 +359,7 @@ util.ResponseFormat(c, code.RequestParamError, "浜у搧绫诲瀷鍚嶇О涓嶈兘涓虹┖") return } - err := models.NewProductCategorySearch().SetID(params.ID).Save(¶ms) + err := models.NewProductCategorySearch().SetID(params.Id).Save(¶ms) if err != nil { util.ResponseFormat(c, code.RequestParamError, "浜у搧绫诲瀷淇℃伅鏇存柊澶辫触") return @@ -364,7 +380,7 @@ util.ResponseFormat(c, code.RequestParamError, "鏃犳晥id") return } - err := models.NewProductCategorySearch().SetID(cast.ToUint(id)).Delete() + err := models.NewProductCategorySearch().SetID(cast.ToInt(id)).Delete() if err != nil { util.ResponseFormat(c, code.RequestParamError, "鍒犻櫎澶辫触") return -- Gitblit v1.8.0