查询物料点订单销量
This commit is contained in:
@@ -54,6 +54,10 @@ type OrderSkusAccept struct {
|
|||||||
Img string `json:"img"`
|
Img string `json:"img"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type OrderCount struct {
|
||||||
|
Count int `json:"count"`
|
||||||
|
}
|
||||||
|
|
||||||
func (c *OrderManager) GetStoreOrderCountInfo(ctx *jxcontext.Context, storeID, lastHours int, isIncludeFake bool) (countInfo []*model.GoodsOrderCountInfo, err error) {
|
func (c *OrderManager) GetStoreOrderCountInfo(ctx *jxcontext.Context, storeID, lastHours int, isIncludeFake bool) (countInfo []*model.GoodsOrderCountInfo, err error) {
|
||||||
globals.SugarLogger.Debugf("GetStoreOrderCountInfo storeID:%d", storeID)
|
globals.SugarLogger.Debugf("GetStoreOrderCountInfo storeID:%d", storeID)
|
||||||
if lastHours > maxLastHours {
|
if lastHours > maxLastHours {
|
||||||
@@ -1168,3 +1172,42 @@ func GetOrdersAccept(ctx *jxcontext.Context, storeID int) (result []*OrderSkusAc
|
|||||||
err = dao.GetRows(db, &result, sql, sqlParams)
|
err = dao.GetRows(db, &result, sql, sqlParams)
|
||||||
return result, err
|
return result, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetMatterStoreOrderCount(ctx *jxcontext.Context, storeID int) (count int, err error) {
|
||||||
|
var (
|
||||||
|
db = dao.GetDB()
|
||||||
|
goodsOrder *model.GoodsOrder
|
||||||
|
orderCount *OrderCount
|
||||||
|
orderTime time.Time
|
||||||
|
)
|
||||||
|
sql := `
|
||||||
|
SELECT *
|
||||||
|
FROM goods_order
|
||||||
|
WHERE IF(store_id = 0,jx_store_id,store_id) = 666666
|
||||||
|
AND from_store_id = ?
|
||||||
|
ORDER BY order_created_at DESC
|
||||||
|
LIMIT 1
|
||||||
|
`
|
||||||
|
sqlParams := []interface{}{storeID}
|
||||||
|
err = dao.GetRow(db, &goodsOrder, sql, sqlParams)
|
||||||
|
if goodsOrder != nil {
|
||||||
|
orderTime = goodsOrder.OrderFinishedAt
|
||||||
|
} else {
|
||||||
|
orderTime = time.Now().AddDate(0, -1, 0)
|
||||||
|
}
|
||||||
|
sql2 := `
|
||||||
|
SELECT COUNT(*) count
|
||||||
|
FROM goods_order
|
||||||
|
WHERE IF(store_id = 0,jx_store_id,store_id) = ?
|
||||||
|
AND order_created_at <= NOW() AND order_created_at >= ?
|
||||||
|
`
|
||||||
|
sqlParams2 := []interface{}{
|
||||||
|
storeID,
|
||||||
|
orderTime,
|
||||||
|
}
|
||||||
|
err = dao.GetRow(db, &orderCount, sql2, sqlParams2)
|
||||||
|
if err != nil {
|
||||||
|
return 0, err
|
||||||
|
}
|
||||||
|
return orderCount.Count, err
|
||||||
|
}
|
||||||
|
|||||||
@@ -117,6 +117,9 @@ func (p *PurchaseHandler) UpdateStore(db *dao.DaoDB, storeID int, userName strin
|
|||||||
if storeDetail.VendorStoreName != "" {
|
if storeDetail.VendorStoreName != "" {
|
||||||
name = storeDetail.VendorStoreName
|
name = storeDetail.VendorStoreName
|
||||||
}
|
}
|
||||||
|
// else {
|
||||||
|
// name = jxutils.ComposeStoreName(storeDetail.Store.Name, model.VendorIDMTWM)
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
// openLevel, isOnline := bizStatusJX2Mtwm(mergedStoreStatus)
|
// openLevel, isOnline := bizStatusJX2Mtwm(mergedStoreStatus)
|
||||||
params := map[string]interface{}{
|
params := map[string]interface{}{
|
||||||
|
|||||||
@@ -1002,3 +1002,17 @@ func (c *OrderController) GetOrdersAccept() {
|
|||||||
return retVal, "", err
|
return retVal, "", err
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Title 获取某个门店上次申请物料到现在的销量
|
||||||
|
// @Description 获取某个门店上次申请物料到现在的销量
|
||||||
|
// @Param token header string true "认证token"
|
||||||
|
// @Param storeID query int true "门店ID"
|
||||||
|
// @Success 200 {object} controllers.CallResult
|
||||||
|
// @Failure 200 {object} controllers.CallResult
|
||||||
|
// @router /GetMatterStoreOrderCount [get]
|
||||||
|
func (c *OrderController) GetMatterStoreOrderCount() {
|
||||||
|
c.callGetMatterStoreOrderCount(func(params *tOrderGetMatterStoreOrderCountParams) (retVal interface{}, errCode string, err error) {
|
||||||
|
retVal, err = orderman.GetMatterStoreOrderCount(params.Ctx, params.StoreID)
|
||||||
|
return retVal, "", err
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|||||||
@@ -972,6 +972,15 @@ func init() {
|
|||||||
Filters: nil,
|
Filters: nil,
|
||||||
Params: nil})
|
Params: nil})
|
||||||
|
|
||||||
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
|
||||||
|
beego.ControllerComments{
|
||||||
|
Method: "GetMatterStoreOrderCount",
|
||||||
|
Router: `/GetMatterStoreOrderCount`,
|
||||||
|
AllowHTTPMethods: []string{"get"},
|
||||||
|
MethodParams: param.Make(),
|
||||||
|
Filters: nil,
|
||||||
|
Params: nil})
|
||||||
|
|
||||||
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
|
beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"] = append(beego.GlobalControllerRouter["git.rosy.net.cn/jx-callback/controllers:OrderController"],
|
||||||
beego.ControllerComments{
|
beego.ControllerComments{
|
||||||
Method: "GetOrderInfo",
|
Method: "GetOrderInfo",
|
||||||
|
|||||||
Reference in New Issue
Block a user