jiangshuai
2023-10-20 96844c22ef3fba86a55e0af1b51bc1009d6fa950
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"
@@ -48,11 +50,22 @@
   //   util.ResponseFormat(c, code.RequestParamError, "请选择产品类别")
   //   return
   //}
   if err := models.NewLocationProductSearch().Create(&params); err != nil {
      logx.Errorf("Operation create err: %v", err)
      util.ResponseFormat(c, code.SaveFail, "添加失败:"+err.Error())
      return
   }
   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
   }
   util.ResponseFormat(c, code.Success, "添加成功")
}