Browse Source

更新

master
huangjiajun 5 months ago
parent
commit
3e23e15896
2 changed files with 40 additions and 13 deletions
  1. +36
    -13
      app/admin/svc/order/svc_order_list.go
  2. +4
    -0
      app/bigData/svc/svc_making_data.go

+ 36
- 13
app/admin/svc/order/svc_order_list.go View File

@@ -1598,6 +1598,7 @@ func OrderDeductNum(c *gin.Context) {
return return
} }
newNum := num newNum := num
WaitMakeNum := 0
if all1.WaitMakeNum > 0 { if all1.WaitMakeNum > 0 {
leave := all1.WaitMakeNum - num leave := all1.WaitMakeNum - num
deNum := num deNum := num
@@ -1606,19 +1607,8 @@ func OrderDeductNum(c *gin.Context) {
} }
all1.WaitMakeNum -= deNum all1.WaitMakeNum -= deNum
newNum -= deNum newNum -= deNum
all := all1
all.Id = 0
all.WaitBakingNum = 0
all.WaitMakeNum = deNum
all.WaitSortingNum = 0
all.GoodsTitle = orderGoods1.GoodsTitle
all.GoodsType = 2
_, err = sess.InsertOne(all)
if err != nil {
sess.Rollback()
e.OutErr(c, 400, e.NewErr(400, "修改失败"))
return
}
WaitMakeNum = deNum

} }
if newNum > 0 && all1.WaitSortingNum > 0 { if newNum > 0 && all1.WaitSortingNum > 0 {
leave := all1.WaitSortingNum - num leave := all1.WaitSortingNum - num
@@ -1629,6 +1619,7 @@ func OrderDeductNum(c *gin.Context) {
newNum -= deNum newNum -= deNum
all1.WaitSortingNum -= deNum all1.WaitSortingNum -= deNum
} }
WaitBakingNum := 0
if newNum > 0 && all1.WaitBakingNum > 0 { if newNum > 0 && all1.WaitBakingNum > 0 {
leave := all1.WaitBakingNum - num leave := all1.WaitBakingNum - num
deNum := num deNum := num
@@ -1637,6 +1628,7 @@ func OrderDeductNum(c *gin.Context) {
} }
newNum -= deNum newNum -= deNum
all1.WaitBakingNum -= deNum all1.WaitBakingNum -= deNum
WaitBakingNum = deNum
} }
if newNum > 0 { if newNum > 0 {
sess.Rollback() sess.Rollback()
@@ -1649,6 +1641,37 @@ func OrderDeductNum(c *gin.Context) {
e.OutErr(c, 400, e.NewErr(400, "修改失败")) e.OutErr(c, 400, e.NewErr(400, "修改失败"))
return return
} }
if WaitMakeNum > 0 {
all := all1
all.Id = 0
all.WaitBakingNum = 0
all.WaitMakeNum = WaitMakeNum
all.WaitSortingNum = 0
all.GoodsTitle = orderGoods1.GoodsTitle
all.GoodsType = 2
_, err = sess.InsertOne(all)
if err != nil {
sess.Rollback()
e.OutErr(c, 400, e.NewErr(400, "修改失败"))
return
}
}
if WaitBakingNum > 0 {
all := all1
all.Id = 0
all.WaitBakingNum = WaitBakingNum
all.WaitMakeNum = 0
all.WaitSortingNum = 0
all.GoodsTitle = orderGoods1.GoodsTitle
all.GoodsType = 2
_, err = sess.InsertOne(all)
if err != nil {
sess.Rollback()
e.OutErr(c, 400, e.NewErr(400, "修改失败"))
return
}
}

order.Amount = utils.Float64ToStr(utils.StrToFloat64(order.Amount) - float64(num)*utils.StrToFloat64(orderGoods1.Price)) order.Amount = utils.Float64ToStr(utils.StrToFloat64(order.Amount) - float64(num)*utils.StrToFloat64(orderGoods1.Price))
//销量减少 //销量减少
sqlSecond := `UPDATE goods SET sale=sale-%d WHERE id=%d` sqlSecond := `UPDATE goods SET sale=sale-%d WHERE id=%d`


+ 4
- 0
app/bigData/svc/svc_making_data.go View File

@@ -52,6 +52,10 @@ func CommMakingData(c *gin.Context, args map[string]string) {
tmp["state"] = "4" tmp["state"] = "4"
tmp["state_str"] = "烘焙完成" tmp["state_str"] = "烘焙完成"
} }
if v.GoodsType == 2 {
tmp["state"] = "4"
tmp["state_str"] = "无需烘焙"
}
} }
if args["state"] == "3" { if args["state"] == "3" {
tmp["num"] = utils.IntToStr(v.WaitSortingNum) tmp["num"] = utils.IntToStr(v.WaitSortingNum)


Loading…
Cancel
Save