Selaa lähdekoodia

更新

master
huangjiajun 5 kuukautta sitten
vanhempi
commit
3e23e15896
2 muutettua tiedostoa jossa 40 lisäystä ja 13 poistoa
  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 Näytä tiedosto

@@ -1598,6 +1598,7 @@ func OrderDeductNum(c *gin.Context) {
return
}
newNum := num
WaitMakeNum := 0
if all1.WaitMakeNum > 0 {
leave := all1.WaitMakeNum - num
deNum := num
@@ -1606,19 +1607,8 @@ func OrderDeductNum(c *gin.Context) {
}
all1.WaitMakeNum -= 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 {
leave := all1.WaitSortingNum - num
@@ -1629,6 +1619,7 @@ func OrderDeductNum(c *gin.Context) {
newNum -= deNum
all1.WaitSortingNum -= deNum
}
WaitBakingNum := 0
if newNum > 0 && all1.WaitBakingNum > 0 {
leave := all1.WaitBakingNum - num
deNum := num
@@ -1637,6 +1628,7 @@ func OrderDeductNum(c *gin.Context) {
}
newNum -= deNum
all1.WaitBakingNum -= deNum
WaitBakingNum = deNum
}
if newNum > 0 {
sess.Rollback()
@@ -1649,6 +1641,37 @@ func OrderDeductNum(c *gin.Context) {
e.OutErr(c, 400, e.NewErr(400, "修改失败"))
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))
//销量减少
sqlSecond := `UPDATE goods SET sale=sale-%d WHERE id=%d`


+ 4
- 0
app/bigData/svc/svc_making_data.go Näytä tiedosto

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


Ladataan…
Peruuta
Tallenna