|
@@ -223,6 +223,11 @@ func NewOrderSortingEnd(c *gin.Context) { |
|
|
return |
|
|
return |
|
|
} |
|
|
} |
|
|
makeRecord := db.GetOrderGoodsMakeStock(sess, utils.StrToInt64(args.Gid), utils.StrToInt64(args.SkuId)) |
|
|
makeRecord := db.GetOrderGoodsMakeStock(sess, utils.StrToInt64(args.Gid), utils.StrToInt64(args.SkuId)) |
|
|
|
|
|
if utils.StrToInt(v["num"]) > makeRecord.WaitSortingNum { |
|
|
|
|
|
sess.Rollback() |
|
|
|
|
|
e.OutErr(c, 400, e.NewErr(400, record.GoodsTitle+",数量只能提交"+utils.IntToStr(makeRecord.WaitSortingNum)+"个")) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
makeRecord.WaitSortingNum -= utils.StrToInt(v["num"]) |
|
|
makeRecord.WaitSortingNum -= utils.StrToInt(v["num"]) |
|
|
makeRecord.SuccessNum += utils.StrToInt(v["num"]) |
|
|
makeRecord.SuccessNum += utils.StrToInt(v["num"]) |
|
|
_, err = sess.Where("id=?", makeRecord.Id).Cols("success_num,wait_sorting_num").Update(makeRecord) |
|
|
_, err = sess.Where("id=?", makeRecord.Id).Cols("success_num,wait_sorting_num").Update(makeRecord) |
|
@@ -273,6 +278,11 @@ func commNewMake(c *gin.Context, args map[string]string) { |
|
|
|
|
|
|
|
|
WaitMakeNum := orderGoods.WaitMakeNum |
|
|
WaitMakeNum := orderGoods.WaitMakeNum |
|
|
if state == 2 { //制作完成 |
|
|
if state == 2 { //制作完成 |
|
|
|
|
|
if utils.StrToInt(args["num"]) > orderGoods.WaitMakeNum { |
|
|
|
|
|
sess.Rollback() |
|
|
|
|
|
e.OutErr(c, 400, e.NewErr(400, "数量只能提交"+utils.IntToStr(orderGoods.WaitMakeNum)+"个")) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
orderGoods.WaitMakeNum -= utils.StrToInt(args["num"]) |
|
|
orderGoods.WaitMakeNum -= utils.StrToInt(args["num"]) |
|
|
orderGoods.WaitBakingNum += utils.StrToInt(args["num"]) |
|
|
orderGoods.WaitBakingNum += utils.StrToInt(args["num"]) |
|
|
if orderGoods.WaitMakeNum < 0 { |
|
|
if orderGoods.WaitMakeNum < 0 { |
|
@@ -280,6 +290,11 @@ func commNewMake(c *gin.Context, args map[string]string) { |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
if state == 3 { //烘焙完成 |
|
|
if state == 3 { //烘焙完成 |
|
|
|
|
|
if utils.StrToInt(args["num"]) > orderGoods.WaitBakingNum { |
|
|
|
|
|
sess.Rollback() |
|
|
|
|
|
e.OutErr(c, 400, e.NewErr(400, "数量只能提交"+utils.IntToStr(orderGoods.WaitBakingNum)+"个")) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
WaitMakeNum = orderGoods.WaitBakingNum |
|
|
WaitMakeNum = orderGoods.WaitBakingNum |
|
|
orderGoods.WaitBakingNum -= utils.StrToInt(args["num"]) |
|
|
orderGoods.WaitBakingNum -= utils.StrToInt(args["num"]) |
|
|
orderGoods.WaitSortingNum += utils.StrToInt(args["num"]) |
|
|
orderGoods.WaitSortingNum += utils.StrToInt(args["num"]) |
|
|