Browse Source

dashboard 刷新

master
娄文智 2 years ago
parent
commit
afd9c53586
1 changed files with 29 additions and 9 deletions
  1. +29
    -9
      services/pln/implments/CustOrder.Dashborad.impl.go

+ 29
- 9
services/pln/implments/CustOrder.Dashborad.impl.go View File

@ -1560,8 +1560,26 @@ func (impl *CustOrderServiceImplement) SelectPic3(user *global.User, DayModelHou
}
for i := 0; i < len(hours); i++ {
key := hours[i]
recordKey := utils.TimeFormat(time.Now(), "yyyy-MM-dd HH:00")
preTime, _ := time.ParseInLocation("2006-01-02 15:04", key, utils.TimezoneLocation)
headInfo, err := headDao.SelectOneByKey(utils.TimeFormat(preTime.Add(1*time.Hour), "yyyy-MM-dd HH:00"))
if err != nil {
fmt.Println(err)
return DashboardData3, err
}
hourData, exist := displayHourProductMap[key]
if !exist {
//判断是否是当前时间
if headInfo != nil && headInfo.CurrentTempo != 0 {
if key != recordKey {
DashboardData3.CompleteNumber += 3600 / headInfo.CurrentTempo
} else {
nowCurrentTime, _ := time.ParseInLocation("2006-01-02 15:04", key, utils.TimezoneLocation)
lenTime := time.Now().Sub(nowCurrentTime).Minutes()
perTime := float64(lenTime / 60)
DashboardData3.CompleteNumber += utils.ValueToInt(float64(3600/headInfo.CurrentTempo)*perTime, 0)
}
}
continue
}
var hourPercent float64
@ -1586,19 +1604,20 @@ func (impl *CustOrderServiceImplement) SelectPic3(user *global.User, DayModelHou
var percent float64
if productFamilyProductData.Qty != 0 && usedTime != 0 && hourAllUsedTime != 0 && meter != 0 {
percent = meter * (float64(usedTime) / float64(hourAllUsedTime))
//percent = meter / (float64(usedTime) / float64(productFamilyProductData.Qty)) * (float64(usedTime) / float64(hourAllUsedTime))
}
hourPercent += percent
}
preTime, _ := time.ParseInLocation("2006-01-02 15:04", key, utils.TimezoneLocation)
headInfo, err := headDao.SelectOneByKey(utils.TimeFormat(preTime.Add(1*time.Hour), "yyyy-MM-dd HH:00"))
if err != nil {
fmt.Println(err)
return DashboardData3, err
glog.InfoExtln("计算时间", "currentTime", currentTime)
glog.InfoExtln("计算时间", "nowTime", nowTime)
lenSeconds := nowTime.Sub(currentTime).Seconds()
glog.InfoExtln("计算时间", "lenSeconds", lenSeconds)
nowKey := utils.TimeFormat(currentTime, "yyyy-MM-dd HH:00")
if headInfo != nil && headInfo.CurrentTempo > 0 && key == recordKey{
if nowKey > recordKey {
hourPercent += lenSeconds / float64(headInfo.CurrentTempo)
}
}
recordKey := utils.TimeFormat(time.Now(), "yyyy-MM-dd HH:00")
var jphVal float64
if headInfo != nil && key != recordKey {
jPHPercent = headInfo.JPHPercent
@ -1610,6 +1629,7 @@ func (impl *CustOrderServiceImplement) SelectPic3(user *global.User, DayModelHou
if attendancePersonNum > 0 {
jphVal = utils.Decimal(float64((hourPercent*jPHPercent)/float64(attendancePersonNum))*(float64(hourAllUsedTime)/3600), 2)
}
jPHPercent = jPHPercent * (float64(hourAllUsedTime) / 3600)
}
glog.InfoExtln("目标达成率", "key", key)
glog.InfoExtln("目标达成率", "jphVal", jphVal)


Loading…
Cancel
Save