From 44f43400bb2b926cc9d7ed249d08d463dbf7521d Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 16 Apr 2024 14:09:21 +0800 Subject: [PATCH] =?UTF-8?q?1ipad=E7=AB=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/ipad/svc/svc_order_make.go | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/app/ipad/svc/svc_order_make.go b/app/ipad/svc/svc_order_make.go index e0173e0..5836584 100644 --- a/app/ipad/svc/svc_order_make.go +++ b/app/ipad/svc/svc_order_make.go @@ -223,6 +223,11 @@ func NewOrderSortingEnd(c *gin.Context) { return } 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.SuccessNum += utils.StrToInt(v["num"]) _, 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 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.WaitBakingNum += utils.StrToInt(args["num"]) if orderGoods.WaitMakeNum < 0 { @@ -280,6 +290,11 @@ func commNewMake(c *gin.Context, args map[string]string) { } } 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 orderGoods.WaitBakingNum -= utils.StrToInt(args["num"]) orderGoods.WaitSortingNum += utils.StrToInt(args["num"])