|
@@ -1061,10 +1061,14 @@ func (e *Waybill) GetBasicsStats(c *dto.WaybillStatsReq, p *actions.DataPermissi
|
|
|
|
|
|
// 今日总运单数
|
|
// 今日总运单数
|
|
e.Orm.Model(&data).Scopes(actions.Permission(data.TableName(), p)).Where("order_time between ? and ?", todayStartTime, todayEndTime).Count(&res.TodayNum)
|
|
e.Orm.Model(&data).Scopes(actions.Permission(data.TableName(), p)).Where("order_time between ? and ?", todayStartTime, todayEndTime).Count(&res.TodayNum)
|
|
|
|
+ // 待派单
|
|
|
|
+ e.Orm.Model(&data).Scopes(actions.Permission(data.TableName(), p)).Where("status = ?", model.WaybillStatusWaitDelivery).Count(&res.WaitDeliveryNum)
|
|
// 未装车
|
|
// 未装车
|
|
e.Orm.Model(&data).Scopes(actions.Permission(data.TableName(), p)).Where("status = ?", model.WaybillStatusWaitTruck).Count(&res.WaitTruckNum)
|
|
e.Orm.Model(&data).Scopes(actions.Permission(data.TableName(), p)).Where("status = ?", model.WaybillStatusWaitTruck).Count(&res.WaitTruckNum)
|
|
// 未入库
|
|
// 未入库
|
|
e.Orm.Model(&data).Scopes(actions.Permission(data.TableName(), p)).Where("status = ?", model.WaybillStatusWaitStorage).Count(&res.WaitStorageNum)
|
|
e.Orm.Model(&data).Scopes(actions.Permission(data.TableName(), p)).Where("status = ?", model.WaybillStatusWaitStorage).Count(&res.WaitStorageNum)
|
|
|
|
+ // 配送中
|
|
|
|
+ e.Orm.Model(&data).Scopes(actions.Permission(data.TableName(), p)).Where("status in (?)", []int{model.WaybillStatusTruck, model.WaybillStatusStorage, model.WaybillStatusTruckOut, model.WaybillStatusStorageOut}).Count(&res.InDeliveryNum)
|
|
// 获取本月,上月数据
|
|
// 获取本月,上月数据
|
|
e.Orm.Model(&data).Select("date_format(order_time,'%Y%m') date,count(1) as count ").Scopes(actions.Permission(data.TableName(), p)).
|
|
e.Orm.Model(&data).Select("date_format(order_time,'%Y%m') date,count(1) as count ").Scopes(actions.Permission(data.TableName(), p)).
|
|
Where("order_time between ? and ?", monthStartTime, now).Group("date").Find(&monthCount)
|
|
Where("order_time between ? and ?", monthStartTime, now).Group("date").Find(&monthCount)
|