From 96844c22ef3fba86a55e0af1b51bc1009d6fa950 Mon Sep 17 00:00:00 2001 From: jiangshuai <291802688@qq.com> Date: 星期五, 20 十月 2023 11:57:48 +0800 Subject: [PATCH] 1.库存盘点bug修改 --- controllers/location_product.go | 19 ++++++++++++++++--- 1 files changed, 16 insertions(+), 3 deletions(-) diff --git a/controllers/location_product.go b/controllers/location_product.go index 59cf228..ca86491 100644 --- a/controllers/location_product.go +++ b/controllers/location_product.go @@ -2,7 +2,9 @@ import ( "github.com/gin-gonic/gin" + "github.com/shopspring/decimal" "strconv" + "time" "wms/extend/code" "wms/extend/util" "wms/models" @@ -44,11 +46,22 @@ util.ResponseFormat(c, code.RequestParamError, "璇烽�夋嫨浜у搧") return } - if params.ProductCategoryID == 0 { - util.ResponseFormat(c, code.RequestParamError, "璇烽�夋嫨浜у搧绫诲埆") + //if params.ProductCategoryID == 0 { + // util.ResponseFormat(c, code.RequestParamError, "璇烽�夋嫨浜у搧绫诲埆") + // return + //} + + if err := models.NewLocationProductSearch().Create(¶ms); err != nil { + logx.Errorf("Operation create err: %v", err) + util.ResponseFormat(c, code.SaveFail, "娣诲姞澶辫触锛�"+err.Error()) return } - if err := models.NewLocationProductSearch().Create(¶ms); err != nil { + locationProductAmount := &models.LocationProductAmount{ + LocationProductId: params.Id, + Amount: decimal.NewFromFloat(0), + CreateDate: time.Now().Format("2006-01-02 15:04:05"), + } + if err := models.NewLocationProductAmountSearch().Create(locationProductAmount); err != nil { logx.Errorf("Operation create err: %v", err) util.ResponseFormat(c, code.SaveFail, "娣诲姞澶辫触锛�"+err.Error()) return -- Gitblit v1.8.0