|
|
@ -280,7 +280,7 @@ func (impl *CustOrderServiceImplement) Dashboard(user *global.User, workLineId s |
|
|
|
wg.Add(7) |
|
|
|
//图例001
|
|
|
|
go func(wg *sync.WaitGroup) { |
|
|
|
DashboardData.DashboardDataPic1, err1 = impl.SelectPic1(user, dayModel, workLineId, startTime, endTime, useDayStartTime) |
|
|
|
DashboardData.DashboardDataPic1, err1 = impl.SelectPic1(user, dayModel, workLineId, startTime, endTime, useDayStartTime, jPHPercent) |
|
|
|
wg.Done() // 操作完成,减少一个计数
|
|
|
|
}(&wg) |
|
|
|
//图例002
|
|
|
@ -444,7 +444,7 @@ func (impl *CustOrderServiceImplement) RecordDashBoard(user *global.User, dashbo |
|
|
|
sessionSlave.Rollback() |
|
|
|
return err |
|
|
|
} |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
//更新
|
|
|
|
err = headDao.UpdateOne(&headData) |
|
|
|
if err != nil { |
|
|
@ -1159,7 +1159,7 @@ func (impl *CustOrderServiceImplement) SelectTeamTemPo(user *global.User, dayMod |
|
|
|
} |
|
|
|
|
|
|
|
//图例1
|
|
|
|
func (impl *CustOrderServiceImplement) SelectPic1(user *global.User, dayModel *baseModel.DayModel, workLineId string, startTime, endTime, dayStartTime time.Time) (result model.CutLine1, err error) { |
|
|
|
func (impl *CustOrderServiceImplement) SelectPic1(user *global.User, dayModel *baseModel.DayModel, workLineId string, startTime, endTime, dayStartTime time.Time, jphPercent float64) (result model.CutLine1, err error) { |
|
|
|
engine := db.Eloquent.Master() |
|
|
|
session := engine.NewSession() |
|
|
|
defer session.Close() |
|
|
@ -1319,9 +1319,10 @@ func (impl *CustOrderServiceImplement) SelectPic1(user *global.User, dayModel *b |
|
|
|
displayHourProductMap[hour] = producedLi |
|
|
|
} |
|
|
|
result = model.CutLine1{ |
|
|
|
Standard: 1.0, |
|
|
|
ProductFamilyMeter: currentMeter, |
|
|
|
ProduceData: make([]float64, 0, len(displayHourLi)), |
|
|
|
Standard: 1.0, |
|
|
|
ProductFamilyMeter: int(float64(currentMeter) / jphPercent), |
|
|
|
OriginProductFamilyMeter: currentMeter, |
|
|
|
ProduceData: make([]float64, 0, len(displayHourLi)), |
|
|
|
} |
|
|
|
for hour := 0; hour < 48; hour++ { |
|
|
|
hourData, exist := displayHourProductMap[hour] |
|
|
@ -1584,7 +1585,7 @@ func (impl *CustOrderServiceImplement) SelectPic3(user *global.User, DayModelHou |
|
|
|
meter := productFamilyMeterMap[productFamilyProductData.ProductFamilyId] |
|
|
|
var percent float64 |
|
|
|
if productFamilyProductData.Qty != 0 && usedTime != 0 && hourAllUsedTime != 0 && meter != 0 { |
|
|
|
percent = (meter * (float64(usedTime) / float64(hourAllUsedTime))) |
|
|
|
percent = meter * (float64(usedTime) / float64(hourAllUsedTime)) |
|
|
|
//percent = meter / (float64(usedTime) / float64(productFamilyProductData.Qty)) * (float64(usedTime) / float64(hourAllUsedTime))
|
|
|
|
} |
|
|
|
hourPercent += percent |
|
|
@ -1592,7 +1593,7 @@ func (impl *CustOrderServiceImplement) SelectPic3(user *global.User, DayModelHou |
|
|
|
|
|
|
|
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")) |
|
|
|
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 |
|
|
@ -1601,20 +1602,20 @@ func (impl *CustOrderServiceImplement) SelectPic3(user *global.User, DayModelHou |
|
|
|
var jphVal float64 |
|
|
|
if headInfo != nil && key != recordKey { |
|
|
|
jPHPercent = headInfo.JPHPercent |
|
|
|
if headInfo.PersonNum >0 { |
|
|
|
jphVal = utils.Decimal(float64((hourPercent * jPHPercent)/float64(headInfo.PersonNum))*(float64(hourAllUsedTime)/3600), 2) |
|
|
|
if headInfo.PersonNum > 0 { |
|
|
|
jphVal = utils.Decimal(float64((hourPercent*jPHPercent)/float64(headInfo.PersonNum))*(float64(hourAllUsedTime)/3600), 2) |
|
|
|
} |
|
|
|
|
|
|
|
}else{ |
|
|
|
if attendancePersonNum >0 { |
|
|
|
jphVal = utils.Decimal(float64((hourPercent * jPHPercent)/float64(attendancePersonNum))*(float64(hourAllUsedTime)/3600), 2) |
|
|
|
} else { |
|
|
|
if attendancePersonNum > 0 { |
|
|
|
jphVal = utils.Decimal(float64((hourPercent*jPHPercent)/float64(attendancePersonNum))*(float64(hourAllUsedTime)/3600), 2) |
|
|
|
} |
|
|
|
} |
|
|
|
glog.InfoExtln("目标达成率","key",key) |
|
|
|
glog.InfoExtln("目标达成率","jphVal",jphVal) |
|
|
|
glog.InfoExtln("目标达成率","jphVal",jphVal) |
|
|
|
glog.InfoExtln("目标达成率","hourPercent",hourPercent) |
|
|
|
glog.InfoExtln("目标达成率","jPHPercent",jPHPercent) |
|
|
|
glog.InfoExtln("目标达成率", "key", key) |
|
|
|
glog.InfoExtln("目标达成率", "jphVal", jphVal) |
|
|
|
glog.InfoExtln("目标达成率", "jphVal", jphVal) |
|
|
|
glog.InfoExtln("目标达成率", "hourPercent", hourPercent) |
|
|
|
glog.InfoExtln("目标达成率", "jPHPercent", jPHPercent) |
|
|
|
jphMap[key] = jphVal |
|
|
|
DashboardData3.CompleteNumber += utils.ValueToInt(utils.ValueToFloat(hourPercent, 0.0)*jPHPercent, 0) |
|
|
|
|
|
|
|