Browse Source

更新

master
huangjiajun 6 months ago
parent
commit
61d9d21531
17 changed files with 132 additions and 45 deletions
  1. +1
    -0
      app/admin/md/goods_pay.go
  2. +13
    -6
      app/admin/svc/order/svc_order_list.go
  3. +3
    -1
      app/admin/svc/order/svc_order_pay.go
  4. +16
    -24
      app/bigData/svc/svc_data.go
  5. +36
    -0
      app/bigData/svc/svc_making_data.go
  6. +1
    -1
      app/db/db_order_goods_list.go
  7. +43
    -5
      app/db/db_order_goods_make_stock.go
  8. +5
    -1
      app/db/db_order_list.go
  9. +1
    -0
      app/db/model/order.go
  10. +1
    -0
      app/db/model/order_goods.go
  11. +1
    -0
      app/db/model/order_goods_make_stock.go
  12. +2
    -0
      app/ipad/hdl/hdl_order_goods.go
  13. +1
    -0
      app/ipad/md/md_order.go
  14. +2
    -1
      app/ipad/svc/svc_order.go
  15. +2
    -6
      app/ipad/svc/svc_order_make.go
  16. +4
    -0
      app/utils/time.go
  17. BIN
     

+ 1
- 0
app/admin/md/goods_pay.go View File

@@ -5,6 +5,7 @@ type GoodsPayParam struct {
EnterpriseId string `json:"enterprise_id"`
BuyInfo BuyInfo `json:"buy_info"`
Oid string `json:"oid"`
MakeDate string `json:"make_date"`
}
type BuyInfo struct {
Name string `json:"name"`


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

@@ -64,6 +64,7 @@ func OrderList(c *gin.Context) {
"inside_name": insideEnterpriseName,
"enterprise_id": v.EnterpriseId,
"company_id": companyId,
"make_date": utils.TimeParseDateStd1(v.MakeDate),
}
data = append(data, tmp)
}
@@ -129,6 +130,7 @@ func OrderExport(c *gin.Context) {
tmp["date"] = v.CreateAt.Format("2006-01-02")
tmp["send_date"] = gjson.Get(v.BuyInfo, "date").String()
tmp["goods_name"] = vv.GoodsTitle
tmp["make_date"] = utils.TimeParseDateStd1(vv.MakeDate)
tmp["ord_no"] = vv.OrdNo
tmp["goods_type"] = utils.IntToStr(vv.GoodsType)
skuData := make([]md.Sku, 0)
@@ -178,6 +180,7 @@ func OrderExport(c *gin.Context) {
v3["goods_name"],
v3["sku_str"],
v3["num"],
v3["make_date"],
})
xlsx.SetRowHeight("Sheet1", j, 18)
if utils.StrToInt(v3["goods_type"]) == 0 {
@@ -332,7 +335,7 @@ func OrderCancel(c *gin.Context) {
continue
}
//判断有没有的扣
all := db.GetOrderGoodsMakeStockAll(sess, v.GoodsId, v.SkuId, 0)
all := db.GetOrderGoodsMakeStockAllByDate(sess, v.GoodsId, v.SkuId, 0, v.MakeDate)
if all == nil {
sess.Rollback()
e.OutErr(c, 400, e.NewErr(400, "订单取消失败"))
@@ -491,6 +494,7 @@ func OrderDetail(c *gin.Context) {
"address": gjson.Get(order.BuyInfo, "address").String(),
"time": gjson.Get(order.BuyInfo, "time").String(),
"create_at": order.CreateAt.Format("2006-01-02 15:04:05"),
"make_date": utils.TimeParseDateStd1(order.MakeDate),
"enterprise_name": enterpriseName,
"enterprise_id": order.EnterpriseId,
"company_id": "",
@@ -552,6 +556,7 @@ func OrderOutput(c *gin.Context) {
tmp["date"] = v.CreateAt.Format("2006-01-02")
tmp["send_date"] = gjson.Get(v.BuyInfo, "date").String()
tmp["goods_name"] = vv.GoodsTitle
tmp["make_date"] = utils.TimeParseDateStd1(vv.MakeDate)
tmp["ord_no"] = vv.OrdNo
tmp["goods_type"] = utils.IntToStr(vv.GoodsType)
skuData := make([]md.Sku, 0)
@@ -601,6 +606,7 @@ func OrderOutput(c *gin.Context) {
v3["goods_name"],
v3["sku_str"],
v3["num"],
v3["make_date"],
})
xlsx.SetRowHeight("Sheet1", j, 18)
if utils.StrToInt(v3["goods_type"]) == 0 {
@@ -725,7 +731,7 @@ func OrderEditNum(c *gin.Context) {
isHasSku := 0
if orderGoods.SkuId != utils.StrToInt64(args["sku_id"]) {
//判断有没有的扣
all := db.GetOrderGoodsMakeStockAll(sess, orderGoods.GoodsId, orderGoods.SkuId, 0)
all := db.GetOrderGoodsMakeStockAllByDate(sess, orderGoods.GoodsId, orderGoods.SkuId, 0, orderGoods.MakeDate)
if all == nil {
sess.Rollback()
e.OutErr(c, 400, e.NewErr(400, "修改失败"))
@@ -798,7 +804,7 @@ func OrderEditNum(c *gin.Context) {
}
if isHasSku == 0 {
//判断有没有的扣
all := db.GetOrderGoodsMakeStockAll(sess, orderGoods.GoodsId, orderGoods.SkuId, 0)
all := db.GetOrderGoodsMakeStockAllByDate(sess, orderGoods.GoodsId, orderGoods.SkuId, 0, orderGoods.MakeDate)
if all == nil {
sess.Rollback()
e.OutErr(c, 400, e.NewErr(400, "修改失败"))
@@ -932,6 +938,7 @@ func OrderAddSku(c *gin.Context) {
State: 1,
IsNew: 1,
OrdNo: order.OrdNo,
MakeDate: order.MakeDate,
}
err := Total(sess, tmp)
if err != nil {
@@ -978,7 +985,7 @@ func commAdd(sess *xorm.Session, num string, orderGoods *model.OrderGoods) (floa
orderGoods1.Num = utils.StrToInt(num)
sess.InsertOne(orderGoods1)
//判断有没有的扣
all1 := db.GetOrderGoodsMakeStockAll(sess, orderGoods1.GoodsId, orderGoods1.SkuId, 0)
all1 := db.GetOrderGoodsMakeStockAllByDate(sess, orderGoods1.GoodsId, orderGoods1.SkuId, 0, orderGoods1.MakeDate)
if all1 == nil {
return 0, e.NewErr(400, "修改失败")
}
@@ -1045,7 +1052,7 @@ func OrderAddNum(c *gin.Context) {
orderGoods1.Num = num
sess.InsertOne(orderGoods1)
//判断有没有的扣
all1 := db.GetOrderGoodsMakeStockAll(sess, orderGoods1.GoodsId, orderGoods1.SkuId, 0)
all1 := db.GetOrderGoodsMakeStockAllByDate(sess, orderGoods1.GoodsId, orderGoods1.SkuId, 0, orderGoods1.MakeDate)
if all1 == nil {
sess.Rollback()
e.OutErr(c, 400, e.NewErr(400, "修改失败"))
@@ -1125,7 +1132,7 @@ func OrderDeductNum(c *gin.Context) {
orderGoods1.Num = num
sess.InsertOne(orderGoods1)
//判断有没有的扣
all1 := db.GetOrderGoodsMakeStockAll(sess, orderGoods1.GoodsId, orderGoods1.SkuId, 0)
all1 := db.GetOrderGoodsMakeStockAllByDate(sess, orderGoods1.GoodsId, orderGoods1.SkuId, 0, orderGoods1.MakeDate)
if all1 == nil {
sess.Rollback()
e.OutErr(c, 400, e.NewErr(400, "修改失败"))


+ 3
- 1
app/admin/svc/order/svc_order_pay.go View File

@@ -59,6 +59,7 @@ func GoodsPayCreate(c *gin.Context) {
State: 1,
Date: utils.StrToInt(strings.ReplaceAll(req.BuyInfo.Date, "-", "")),
OrdNo: "AP" + time.Now().Format("20060102") + i,
MakeDate: utils.StrToInt(strings.ReplaceAll(req.MakeDate, "-", "")),
}
one, err := sess.InsertOne(&order)
if one == 0 || err != nil {
@@ -92,6 +93,7 @@ func GoodsPayCreate(c *gin.Context) {
State: 1,
IsNew: 1,
OrdNo: "AP" + time.Now().Format("20060102") + i,
MakeDate: utils.StrToInt(strings.ReplaceAll(req.MakeDate, "-", "")),
}
goodsTotal[tmp.GoodsId] += tmp.Num
orderGoods = append(orderGoods, tmp)
@@ -155,7 +157,7 @@ func commCalc(c *gin.Context, req md.GoodsPayParam) (float64, map[string]string)

// 统计数量
func Total(sess *xorm.Session, tmp model.OrderGoods) error {
stock := db.GetOrderGoodsMakeStock(sess, tmp.GoodsId, tmp.SkuId)
stock := db.GetOrderGoodsMakeStockByDate(sess, tmp.GoodsId, tmp.SkuId, tmp.MakeDate)
if stock == nil {
return errors.New("下单失败")
}


+ 16
- 24
app/bigData/svc/svc_data.go View File

@@ -217,12 +217,12 @@ func LeftDataForSorting() (resp []md.LeftDataForMakeResp, err error) {
}

//1、查找不等于4 5
today := utils.GetTimeRange("today")
if time.Now().Hour() < 2 {
today = utils.GetTimeRange("yesterday")
}
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
now := CommDate()
var orders []model.Order
err = engine.Where(" state != 4 and state != 5 and create_at>=?", time.Unix(today["start"], 0).Format("2006-01-02 15:04:05")).Find(&orders)
err = engine.Where(" state != 4 and state != 5 and make_date=?", now).Find(&orders)
if err != nil {
return
}
@@ -423,12 +423,9 @@ func NewSortingCate() []map[string]string {
}

//1、查找不等于4 5
today := utils.GetTimeRange("today")
if time.Now().Hour() < 2 {
today = utils.GetTimeRange("yesterday")
}
now := CommDate()
var orders []model.Order
err = engine.Where(" state != 4 and state != 5 and create_at>=?", time.Unix(today["start"], 0).Format("2006-01-02 15:04:05")).Find(&orders)
err = engine.Where(" state != 4 and state != 5 and make_date=?", now).Find(&orders)
if err != nil {
return res
}
@@ -518,12 +515,9 @@ func NewSortingGoodsCate() []map[string]string {

engine := db.Db
//1、查找不等于4 5
today := utils.GetTimeRange("today")
if time.Now().Hour() < 2 {
today = utils.GetTimeRange("yesterday")
}
now := CommDate()
var orders []model.Order
err := engine.Where(" state != 4 and state != 5 and create_at>=? ", time.Unix(today["start"], 0).Format("2006-01-02 15:04:05")).Find(&orders)
err := engine.Where(" state != 4 and state != 5 and make_date=? ", now).Find(&orders)
if err != nil {
return res
}
@@ -535,8 +529,8 @@ func NewSortingGoodsCate() []map[string]string {
}
oIds = append(oIds, utils.Int64ToStr(v.Oid))
}
sql := `SELECT SUM(num) as num,SUM(success_num) as success_num,goods_title,sku,goods_id,sku_id FROM order_goods WHERE oid in (%s) and goods_type=0 GROUP BY goods_id,sku_id`
sql = fmt.Sprintf(sql, strings.Join(oIds, ","))
sql := `SELECT SUM(num) as num,SUM(success_num) as success_num,goods_title,sku,goods_id,sku_id FROM order_goods WHERE oid in (%s) and goods_type=0 and make_date=%s GROUP BY goods_id,sku_id`
sql = fmt.Sprintf(sql, strings.Join(oIds, ","), now)
nativeString, err := db.QueryNativeString(engine, sql)
for _, v := range nativeString {
skuData := make([]md2.Sku, 0)
@@ -580,12 +574,10 @@ func NewSortingGoodsData(arg map[string]string) []map[string]string {
enterpriseMap[v.Id] = v
}
//1、查找不等于4 5
today := utils.GetTimeRange("today")
if time.Now().Hour() < 2 {
today = utils.GetTimeRange("yesterday")
}
now := CommDate()

var orders []model.Order
err = engine.Where(" state != 4 and state != 5 and create_at>=? ", time.Unix(today["start"], 0).Format("2006-01-02 15:04:05")).Find(&orders)
err = engine.Where(" state != 4 and state != 5 and make_date=? ", now).Find(&orders)
if err != nil {
return res
}
@@ -597,8 +589,8 @@ func NewSortingGoodsData(arg map[string]string) []map[string]string {
}
oIds = append(oIds, utils.Int64ToStr(v.Oid))
}
sql := `SELECT SUM(num) as num,SUM(success_num) as success_num,goods_title,sku,goods_id,sku_id,enterprise_id FROM order_goods WHERE oid in (%s) and goods_id=%s and goods_type=0 and sku_id=%s GROUP BY enterprise_id`
sql = fmt.Sprintf(sql, strings.Join(oIds, ","), arg["goods_id"], arg["sku_id"])
sql := `SELECT SUM(num) as num,SUM(success_num) as success_num,goods_title,sku,goods_id,sku_id,enterprise_id FROM order_goods WHERE oid in (%s) and goods_id=%s and goods_type=0 and sku_id=%s and make_date=%s GROUP BY enterprise_id`
sql = fmt.Sprintf(sql, strings.Join(oIds, ","), arg["goods_id"], arg["sku_id"], now)
nativeString, err := db.QueryNativeString(engine, sql)
for _, v := range nativeString {
skuData := make([]md2.Sku, 0)


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

@@ -3,14 +3,17 @@ package svc
import (
"applet/app/admin/md"
"applet/app/db"
"applet/app/db/model"
"applet/app/e"
"applet/app/utils"
"encoding/json"
"github.com/gin-gonic/gin"
"time"
)

func CommMakingData(c *gin.Context, args map[string]string) {
eg := db.Db
args["now"] = CommDate()
data, _ := db.GetOrderGoodsMakeStockByBigData(eg, args)
list := make([]map[string]string, 0)
if data != nil {
@@ -25,16 +28,39 @@ func CommMakingData(c *gin.Context, args map[string]string) {
tmp["num"] = utils.IntToStr(v.WaitMakeNum)
tmp["state_str"] = "制作中"
tmp["state"] = "1"
if v.WaitMakeNum == 0 {
tmp["state"] = "4"
tmp["state_str"] = "制作完成"
}
if v.GoodsType == 2 {
tmp["state"] = "4"
tmp["state_str"] = "无需制作"
}
if v.GoodsType == 1 { //判断主单做完了就显示完成
count, _ := eg.Where("gid=? and sku_id=? and goods_type=0 and make_date=?", v.Gid, v.SkuId, v.MakeDate).Count(&model.OrderGoodsMakeStock{})
if count == 0 {
tmp["state"] = "4"
tmp["state_str"] = "制作完成"
}
}
}
if args["state"] == "2" {
tmp["num"] = utils.IntToStr(v.WaitBakingNum)
tmp["state_str"] = "烘焙中"
tmp["state"] = "2"
if v.WaitBakingNum == 0 {
tmp["state"] = "4"
tmp["state_str"] = "烘焙完成"
}
}
if args["state"] == "3" {
tmp["num"] = utils.IntToStr(v.WaitSortingNum)
tmp["state_str"] = "分拣中"
tmp["state"] = "3"
if v.WaitSortingNum == 0 {
tmp["state"] = "4"
tmp["state_str"] = "分拣完成"
}
}
skuData := make([]md.Sku, 0)
json.Unmarshal([]byte(v.Sku), &skuData)
@@ -52,3 +78,13 @@ func CommMakingData(c *gin.Context, args map[string]string) {
e.OutSuc(c, list, nil)
return
}
func CommDate() string {
sysCfgDb := db.SysCfgDb{}
sysCfgDb.Set()
beforeHourShowOrder, _ := sysCfgDb.SysCfgGetOne("before_hour_show_order")
today := utils.GetTimeRange("today")
if utils.StrToInt(beforeHourShowOrder.Val) > time.Now().Hour() {
today = utils.GetTimeRange("yesterday")
}
return time.Unix(today["start"], 0).Format("20060102")
}

+ 1
- 1
app/db/db_order_goods_list.go View File

@@ -29,7 +29,7 @@ func GetOrderGoodsListByIpad(eg *xorm.Engine, param map[string]string) (*[]model
}
size := utils.StrToInt(param["limit"])
start := (utils.StrToInt(param["page"]) - 1) * size
count, err := sess.Limit(size, start).OrderBy("id asc").FindAndCount(&order)
count, err := sess.Limit(size, start).OrderBy("make_date asc,id asc").FindAndCount(&order)
if err != nil {
return nil, count
}


+ 43
- 5
app/db/db_order_goods_make_stock.go View File

@@ -24,7 +24,7 @@ func GetOrderGoodsMakeStockByIpad(eg *xorm.Engine, param map[string]string) (*[]
}
size := utils.StrToInt(param["limit"])
start := (utils.StrToInt(param["page"]) - 1) * size
count, err := sess.Limit(size, start).OrderBy("id asc").FindAndCount(&order)
count, err := sess.Limit(size, start).OrderBy("make_date asc,id asc").FindAndCount(&order)
if err != nil {
return nil, count
}
@@ -33,17 +33,19 @@ func GetOrderGoodsMakeStockByIpad(eg *xorm.Engine, param map[string]string) (*[]
func GetOrderGoodsMakeStockByBigData(eg *xorm.Engine, param map[string]string) (*[]model.OrderGoodsMakeStock, int64) {
var order []model.OrderGoodsMakeStock
sess := eg.Where("1=1")

if param["now"] != "" {
sess.And("make_date=?", param["now"])
}
if param["state"] == "1" {
sess.And("wait_make_num >0")
sess.And("wait_make_num >=0")
} else {
sess.And("goods_type =0")
}
if param["state"] == "2" {
sess.And("wait_baking_num >0")
sess.And("wait_make_num =0 and wait_baking_num >=0")
}
if param["state"] == "3" {
sess.And("wait_sorting_num >0")
sess.And("wait_baking_num =0 and wait_sorting_num >=0")
}
if param["keyword"] != "" {
sess.And("goods_title like ?", "%"+param["keyword"]+"%")
@@ -73,6 +75,14 @@ func GetOrderGoodsMakeStock(sess *xorm.Session, gid, skuId int64) *model.OrderGo
}
return &data
}
func GetOrderGoodsMakeStockById(sess *xorm.Session, id int64) *model.OrderGoodsMakeStock {
var data model.OrderGoodsMakeStock
get, err := sess.Where("id=? ", id).Get(&data)
if err != nil || get == false {
return nil
}
return &data
}
func GetOrderGoodsMakeStockAll(sess *xorm.Session, gid, skuId int64, goodsType int) *model.OrderGoodsMakeStock {
var data model.OrderGoodsMakeStock
get, err := sess.Where("gid=? and sku_id=? and goods_type=?", gid, skuId, goodsType).Get(&data)
@@ -82,3 +92,31 @@ func GetOrderGoodsMakeStockAll(sess *xorm.Session, gid, skuId int64, goodsType i

return &data
}
func GetOrderGoodsMakeStockAllByDate(sess *xorm.Session, gid, skuId int64, goodsType int, date int) *model.OrderGoodsMakeStock {
var data model.OrderGoodsMakeStock
get, err := sess.Where("gid=? and sku_id=? and goods_type=? and make_date=?", gid, skuId, goodsType, date).Get(&data)
if err != nil || get == false {
return nil
}

return &data
}
func GetOrderGoodsMakeStockByDate(sess *xorm.Session, gid, skuId int64, date int) *model.OrderGoodsMakeStock {
var data model.OrderGoodsMakeStock
get, err := sess.Where("gid=? and sku_id=? and make_date=?", gid, skuId, date).Get(&data)
if err != nil {
return nil
}
if get == false {
data = model.OrderGoodsMakeStock{
Gid: gid,
SkuId: skuId,
MakeDate: date,
}
insert, err := sess.Insert(&data)
if insert == 0 || err != nil {
return nil
}
}
return &data
}

+ 5
- 1
app/db/db_order_list.go View File

@@ -67,6 +67,10 @@ func GetOrderList(eg *xorm.Engine, param map[string]string) (*[]model.Order, int
param["date"] = strings.ReplaceAll(param["date"], "-", "")
sess.And("date = ?", param["date"])
}
if param["make_date"] != "" {
param["date"] = strings.ReplaceAll(param["date"], "-", "")
sess.And("make_date = ?", param["date"])
}
if param["enterprise_name"] != "" {
var enterprise []model.Enterprise
eg.Where("name like ?", "%"+param["enterprise_name"]+"%").Find(&enterprise)
@@ -198,7 +202,7 @@ func GetOrderListByIpad(eg *xorm.Engine, param map[string]string) (*[]model.Orde
}
size := utils.StrToInt(param["limit"])
start := (utils.StrToInt(param["page"]) - 1) * size
count, err := sess.Limit(size, start).OrderBy("create_at desc,id desc").FindAndCount(&order)
count, err := sess.Limit(size, start).OrderBy("make_date asc,id asc").FindAndCount(&order)
if err != nil {
return nil, count
}


+ 1
- 0
app/db/model/order.go View File

@@ -17,4 +17,5 @@ type Order struct {
BuyPhone string `json:"buy_phone" xorm:"comment('购买人手机') VARCHAR(20)"`
EnterpriseName string `json:"enterprise_name" xorm:"comment('校企名称') VARCHAR(20)"`
OrdNo string `json:"ord_no" xorm:"comment('') VARCHAR(255)"`
MakeDate int `json:"make_date" xorm:"comment('') default 0 INT(11)"`
}

+ 1
- 0
app/db/model/order_goods.go View File

@@ -24,4 +24,5 @@ type OrderGoods struct {
AdminId int `json:"admin_id" xorm:"default 0 comment('admin 的id') INT(11)"`
EnterpriseId int `json:"enterprise_id" xorm:"default 0 comment('校企 的id') INT(11)"`
GoodsType int `json:"goods_type" xorm:"default 0 comment('') INT(11)"`
MakeDate int `json:"make_date" xorm:"comment('') default 0 INT(11)"`
}

+ 1
- 0
app/db/model/order_goods_make_stock.go View File

@@ -12,4 +12,5 @@ type OrderGoodsMakeStock struct {
WaitSortingNum int `json:"wait_sorting_num" xorm:"default 0 comment('待分拣') INT(11)"`
SuccessNum int `json:"success_num" xorm:"default 0 comment('已分拣') INT(11)"`
GoodsType int `json:"goods_type" xorm:"default 0 comment('') INT(11)"`
MakeDate int `json:"make_date" xorm:"comment('') default 0 INT(11)"`
}

+ 2
- 0
app/ipad/hdl/hdl_order_goods.go View File

@@ -45,6 +45,7 @@ func OrderGoods(c *gin.Context) {
"oid": utils.Int64ToStr(v.Oid),
"id": utils.IntToStr(v.Id),
"num": utils.IntToStr(v.Num),
"make_date": utils.TimeParseDateStd1(v.MakeDate),
"success_num": utils.IntToStr(v.SuccessNum),
"state_str": stateArr[v.State],
"btn_str": btnArr[v.State],
@@ -113,6 +114,7 @@ func SortingOrderGoods(c *gin.Context) {
"success_num": utils.IntToStr(v.SuccessNum),
"need_num": utils.IntToStr(v.Num - v.SuccessNum),
"enterprise_name": enterpriseName,
"make_date": utils.TimeParseDateStd1(v.MakeDate),
}
list = append(list, tmp)
}


+ 1
- 0
app/ipad/md/md_order.go View File

@@ -7,6 +7,7 @@ type OrderSorting struct {
}
type NewOrderSorting struct {
Gid string `json:"gid"`
Id string `json:"id"`
SkuId string `json:"sku_id"`
AdminId string `json:"admin_id"`
OrderInfo []map[string]string `json:"goods_info"`


+ 2
- 1
app/ipad/svc/svc_order.go View File

@@ -35,6 +35,7 @@ func Order(c *gin.Context) {
}
var tmp = map[string]string{
"oid": utils.Int64ToStr(v.Oid),
"make_date": utils.TimeParseDateStd1(v.MakeDate),
"id": utils.IntToStr(v.Id),
"state_str": stateArr[v.State],
"btn_str": btnArr[v.State],
@@ -42,7 +43,6 @@ func Order(c *gin.Context) {
"enterprise_name": enterpriseName,
"time": v.CreateAt.Format("2006-01-02 15:04:05"),
}

list = append(list, tmp)
}
}
@@ -72,6 +72,7 @@ func StateOrder(c *gin.Context) {
"id": utils.IntToStr(v.Id),
"gid": utils.Int64ToStr(v.Gid),
"sku_id": utils.Int64ToStr(v.SkuId),
"make_date": utils.TimeParseDateStd1(v.MakeDate),
"num": "",
"state_str": "",
"btn_str": "",


+ 2
- 6
app/ipad/svc/svc_order_make.go View File

@@ -55,7 +55,7 @@ func NewOrderSortingEnd(c *gin.Context) {
e.OutErr(c, 400, e.NewErr(400, "提交失败,请重试"))
return
}
makeRecord := db.GetOrderGoodsMakeStock(sess, utils.StrToInt64(args.Gid), utils.StrToInt64(args.SkuId))
makeRecord := db.GetOrderGoodsMakeStockByDate(sess, utils.StrToInt64(args.Gid), utils.StrToInt64(args.SkuId), record.MakeDate)
if utils.StrToInt(v["num"]) > makeRecord.WaitSortingNum {
sess.Rollback()
e.OutErr(c, 400, e.NewErr(400, record.GoodsTitle+",数量只能提交"+utils.IntToStr(makeRecord.WaitSortingNum)+"个"))
@@ -105,15 +105,12 @@ func commNewMake(c *gin.Context, args map[string]string) {
defer sess.Close()
sess.Begin()
state := utils.StrToInt(args["state"])

orderGoods := db.GetOrderGoodsMakeStock(sess, utils.StrToInt64(args["gid"]), utils.StrToInt64(args["sku_id"]))

orderGoods := db.GetOrderGoodsMakeStockById(sess, utils.StrToInt64(args["id"]))
if orderGoods == nil {
sess.Rollback()
e.OutErr(c, 400, e.NewErr(400, "订单查找失败,请重试"))
return
}

WaitMakeNum := orderGoods.WaitMakeNum
if state == 2 { //制作完成
if utils.StrToInt(args["num"]) > orderGoods.WaitMakeNum {
@@ -147,7 +144,6 @@ func commNewMake(c *gin.Context, args map[string]string) {
return
}
//写入流程记录

var recordFlow = &model.OrderGoodsDoingFlow{
Num: WaitMakeNum,
State: state,


+ 4
- 0
app/utils/time.go View File

@@ -74,6 +74,10 @@ func TimeParseDateStd(src string) time.Time {
t, _ := TimeParse("2006-01-02", src)
return t
}
func TimeParseDateStd1(src int) string {
t, _ := TimeParse("20060102", IntToStr(src))
return t.Format("2006-01-02")
}
func TimeStdParseUnix(src string) int64 {
t, err := TimeParse("2006-01-02 15:04:05", src)
if err != nil {


BIN
View File


Loading…
Cancel
Save