|
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354 |
- package svc
-
- import (
- "applet/app/admin/md"
- "applet/app/db"
- "applet/app/e"
- "applet/app/utils"
- "encoding/json"
- "github.com/gin-gonic/gin"
- )
-
- func CommMakingData(c *gin.Context, args map[string]string) {
- eg := db.Db
- data, _ := db.GetOrderGoodsMakeStockByBigData(eg, args)
- list := make([]map[string]string, 0)
- if data != nil {
- for _, v := range *data {
- var tmp = map[string]string{
- "num": "",
- "state_str": "",
- "goods_title": v.GoodsTitle,
- "state": "",
- }
- if args["state"] == "1" {
- tmp["num"] = utils.IntToStr(v.WaitMakeNum)
- tmp["state_str"] = "制作中"
- tmp["state"] = "1"
- }
- if args["state"] == "2" {
- tmp["num"] = utils.IntToStr(v.WaitBakingNum)
- tmp["state_str"] = "烘焙中"
- tmp["state"] = "2"
- }
- if args["state"] == "3" {
- tmp["num"] = utils.IntToStr(v.WaitSortingNum)
- tmp["state_str"] = "分拣中"
- tmp["state"] = "3"
- }
- skuData := make([]md.Sku, 0)
- json.Unmarshal([]byte(v.Sku), &skuData)
- skuStr := ""
- for _, v1 := range skuData {
- if skuStr != "" {
- skuStr += ";"
- }
- skuStr += v1.Value
- }
- tmp["sku_str"] = skuStr
- list = append(list, tmp)
- }
- }
- e.OutSuc(c, list, nil)
- return
- }
|