From ed81fc8d860adb66676d4990e4ce0ff56cff79a6 Mon Sep 17 00:00:00 2001 From: jiangshuai <291802688@qq.com> Date: 星期三, 22 十一月 2023 19:48:16 +0800 Subject: [PATCH] Merge branch 'master' of http://192.168.5.5:10010/r/aps/WMS --- controllers/product_controller.go | 24 ++++++++++++++++++++---- 1 files changed, 20 insertions(+), 4 deletions(-) diff --git a/controllers/product_controller.go b/controllers/product_controller.go index 35c9c98..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 @@ -575,7 +591,7 @@ locAmount, res := models.NewLocationProductAmountSearch(). SetProductId(v.ID). - SetLocationId(operation.ToLocationID). + SetLocationId(operation.FromLocationID). FirstRes() if res.Error != nil { return err -- Gitblit v1.8.0