From 61d9d21531d73e9a87a7a54ed59dc4b40da65c5d Mon Sep 17 00:00:00 2001 From: huangjiajun <582604932@qq.com> Date: Tue, 28 May 2024 16:15:24 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/admin/md/goods_pay.go | 1 + app/admin/svc/order/svc_order_list.go | 19 +++++--- app/admin/svc/order/svc_order_pay.go | 4 +- app/bigData/svc/svc_data.go | 40 +++++++---------- app/bigData/svc/svc_making_data.go | 36 ++++++++++++++++ app/db/db_order_goods_list.go | 2 +- app/db/db_order_goods_make_stock.go | 48 ++++++++++++++++++--- app/db/db_order_list.go | 6 ++- app/db/model/order.go | 1 + app/db/model/order_goods.go | 1 + app/db/model/order_goods_make_stock.go | 1 + app/ipad/hdl/hdl_order_goods.go | 2 + app/ipad/md/md_order.go | 1 + app/ipad/svc/svc_order.go | 3 +- app/ipad/svc/svc_order_make.go | 8 +--- app/utils/time.go | 4 ++ static/template/商品销售明细表.xlsx | Bin 9270 -> 9326 bytes 17 files changed, 132 insertions(+), 45 deletions(-) diff --git a/app/admin/md/goods_pay.go b/app/admin/md/goods_pay.go index c0559ec..4da6673 100644 --- a/app/admin/md/goods_pay.go +++ b/app/admin/md/goods_pay.go @@ -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"` diff --git a/app/admin/svc/order/svc_order_list.go b/app/admin/svc/order/svc_order_list.go index b753efa..51725e9 100644 --- a/app/admin/svc/order/svc_order_list.go +++ b/app/admin/svc/order/svc_order_list.go @@ -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, "修改失败")) diff --git a/app/admin/svc/order/svc_order_pay.go b/app/admin/svc/order/svc_order_pay.go index 8b0719a..5355284 100644 --- a/app/admin/svc/order/svc_order_pay.go +++ b/app/admin/svc/order/svc_order_pay.go @@ -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("下单失败") } diff --git a/app/bigData/svc/svc_data.go b/app/bigData/svc/svc_data.go index fbb8e09..93f829d 100644 --- a/app/bigData/svc/svc_data.go +++ b/app/bigData/svc/svc_data.go @@ -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) diff --git a/app/bigData/svc/svc_making_data.go b/app/bigData/svc/svc_making_data.go index d5130d6..67c276e 100644 --- a/app/bigData/svc/svc_making_data.go +++ b/app/bigData/svc/svc_making_data.go @@ -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") +} diff --git a/app/db/db_order_goods_list.go b/app/db/db_order_goods_list.go index db9e7be..64470fd 100644 --- a/app/db/db_order_goods_list.go +++ b/app/db/db_order_goods_list.go @@ -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 } diff --git a/app/db/db_order_goods_make_stock.go b/app/db/db_order_goods_make_stock.go index 7c5e910..915f2a7 100644 --- a/app/db/db_order_goods_make_stock.go +++ b/app/db/db_order_goods_make_stock.go @@ -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 +} diff --git a/app/db/db_order_list.go b/app/db/db_order_list.go index e4a19a4..99b691c 100644 --- a/app/db/db_order_list.go +++ b/app/db/db_order_list.go @@ -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 } diff --git a/app/db/model/order.go b/app/db/model/order.go index 493f42b..27085fc 100644 --- a/app/db/model/order.go +++ b/app/db/model/order.go @@ -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)"` } diff --git a/app/db/model/order_goods.go b/app/db/model/order_goods.go index d9b3bee..28159a9 100644 --- a/app/db/model/order_goods.go +++ b/app/db/model/order_goods.go @@ -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)"` } diff --git a/app/db/model/order_goods_make_stock.go b/app/db/model/order_goods_make_stock.go index 49bc5fd..2cbfa65 100644 --- a/app/db/model/order_goods_make_stock.go +++ b/app/db/model/order_goods_make_stock.go @@ -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)"` } diff --git a/app/ipad/hdl/hdl_order_goods.go b/app/ipad/hdl/hdl_order_goods.go index eff58dd..b969b8c 100644 --- a/app/ipad/hdl/hdl_order_goods.go +++ b/app/ipad/hdl/hdl_order_goods.go @@ -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) } diff --git a/app/ipad/md/md_order.go b/app/ipad/md/md_order.go index f602d1f..2ad4614 100644 --- a/app/ipad/md/md_order.go +++ b/app/ipad/md/md_order.go @@ -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"` diff --git a/app/ipad/svc/svc_order.go b/app/ipad/svc/svc_order.go index 16ebd47..ad2d8a9 100644 --- a/app/ipad/svc/svc_order.go +++ b/app/ipad/svc/svc_order.go @@ -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": "", diff --git a/app/ipad/svc/svc_order_make.go b/app/ipad/svc/svc_order_make.go index 6fb546c..a52c52c 100644 --- a/app/ipad/svc/svc_order_make.go +++ b/app/ipad/svc/svc_order_make.go @@ -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, diff --git a/app/utils/time.go b/app/utils/time.go index dcb5910..807f892 100644 --- a/app/utils/time.go +++ b/app/utils/time.go @@ -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 { diff --git a/static/template/商品销售明细表.xlsx b/static/template/商品销售明细表.xlsx index 9c9ceed0700486c748eb1aef3df07e11e6891949..be2299f20a01774c9c1f9626829f855afa5a2c6f 100644 GIT binary patch delta 4477 zcmZ8lXH=6-w@n~a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