|
@ -321,7 +321,7 @@ func (impl *CustOrderServiceImplement) Dashboard(user *global.User, workLineId s |
|
|
}(&wg) |
|
|
}(&wg) |
|
|
//图例004
|
|
|
//图例004
|
|
|
go func(wg *sync.WaitGroup) { |
|
|
go func(wg *sync.WaitGroup) { |
|
|
DashboardData.DashboardDataPic4, err4 = impl.CountTarget(user, workLineId) |
|
|
|
|
|
|
|
|
DashboardData.DashboardDataPic4, err4 = impl.CountTarget(user, dayModel, WorkShift, workLineId) |
|
|
wg.Done() // 操作完成,减少一个计数
|
|
|
wg.Done() // 操作完成,减少一个计数
|
|
|
}(&wg) |
|
|
}(&wg) |
|
|
//计算当前节拍,及其平均
|
|
|
//计算当前节拍,及其平均
|
|
@ -761,7 +761,7 @@ func (impl *CustOrderServiceImplement) SelectDefectNumber(user *global.User, day |
|
|
return result, nil |
|
|
return result, nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
func (impl *CustOrderServiceImplement) CountTarget(user *global.User, workLineId string) (model.TargetItem, error) { |
|
|
|
|
|
|
|
|
func (impl *CustOrderServiceImplement) CountTarget(user *global.User, dayModel *baseModel.DayModel, WorkShift int, workLineId string) (model.TargetItem, error) { |
|
|
engine := db.Eloquent.Master() |
|
|
engine := db.Eloquent.Master() |
|
|
session := engine.NewSession() |
|
|
session := engine.NewSession() |
|
|
defer session.Close() |
|
|
defer session.Close() |
|
@ -797,12 +797,52 @@ func (impl *CustOrderServiceImplement) CountTarget(user *global.User, workLineId |
|
|
result.Target += custOrderData.OrderQty.PlanQty - custOrderData.OrderQty.CancelQty |
|
|
result.Target += custOrderData.OrderQty.PlanQty - custOrderData.OrderQty.CancelQty |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
//计算打包数量
|
|
|
|
|
|
packList, err := packDao.SelectUserClosePackOrder(start, end, workLineIds) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return result, err |
|
|
|
|
|
|
|
|
todayStart := now.Format(grmi.DateOutFormat) + " 00:00:00" |
|
|
|
|
|
todayStartTime, _ := time.ParseInLocation(grmi.DateTimeOutFormat, todayStart, utils.TimezoneLocation) |
|
|
|
|
|
//计算当班平均节拍
|
|
|
|
|
|
switch WorkShift { |
|
|
|
|
|
case 1: |
|
|
|
|
|
//查询当班开始和结束时间
|
|
|
|
|
|
WorkShift1StartTime := todayStartTime.Add(time.Duration(dayModel.S1Beg) * time.Second) |
|
|
|
|
|
WorkShift1EndTime := todayStartTime.Add(time.Duration(dayModel.S1End) * time.Second) |
|
|
|
|
|
|
|
|
|
|
|
startTime := utils.TimeFormat(WorkShift1StartTime, "yyyy-MM-dd HH:mm:ss") |
|
|
|
|
|
endTime := utils.TimeFormat(WorkShift1EndTime, "yyyy-MM-dd HH:mm:ss") |
|
|
|
|
|
|
|
|
|
|
|
packList, err := packDao.SelectUserClosePackOrder(startTime, endTime, workLineIds) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return result, err |
|
|
|
|
|
} |
|
|
|
|
|
result.Current = len(packList) |
|
|
|
|
|
case 2: |
|
|
|
|
|
//查询当班开始和结束时间
|
|
|
|
|
|
|
|
|
|
|
|
WorkShift2StartTime := todayStartTime.Add(time.Duration(dayModel.S2Beg) * time.Second) |
|
|
|
|
|
WorkShift2EndTime := todayStartTime.Add(time.Duration(dayModel.S2End) * time.Second) |
|
|
|
|
|
|
|
|
|
|
|
startTime := utils.TimeFormat(WorkShift2StartTime, "yyyy-MM-dd HH:mm:ss") |
|
|
|
|
|
endTime := utils.TimeFormat(WorkShift2EndTime, "yyyy-MM-dd HH:mm:ss") |
|
|
|
|
|
|
|
|
|
|
|
packList, err := packDao.SelectUserClosePackOrder(startTime, endTime, workLineIds) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return result, err |
|
|
|
|
|
} |
|
|
|
|
|
result.Current = len(packList) |
|
|
|
|
|
case 3: |
|
|
|
|
|
//查询当班开始和结束时间
|
|
|
|
|
|
|
|
|
|
|
|
WorkShift3StartTime := todayStartTime.Add(time.Duration(dayModel.S3Beg) * time.Second) |
|
|
|
|
|
WorkShift3EndTime := todayStartTime.Add(time.Duration(dayModel.S3End) * time.Second) |
|
|
|
|
|
|
|
|
|
|
|
startTime := utils.TimeFormat(WorkShift3StartTime, "yyyy-MM-dd HH:mm:ss") |
|
|
|
|
|
endTime := utils.TimeFormat(WorkShift3EndTime, "yyyy-MM-dd HH:mm:ss") |
|
|
|
|
|
|
|
|
|
|
|
packList, err := packDao.SelectUserClosePackOrder(startTime, endTime, workLineIds) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return result, err |
|
|
|
|
|
} |
|
|
|
|
|
result.Current = len(packList) |
|
|
} |
|
|
} |
|
|
result.Current = len(packList) |
|
|
|
|
|
return result, nil |
|
|
return result, nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -848,8 +888,8 @@ func (impl *CustOrderServiceImplement) SelectTeamTemPo(user *global.User, dayMod |
|
|
packTimes := impl.GetUsefulTime(WorkShift1StartTime, time.Now(), timeModelList) |
|
|
packTimes := impl.GetUsefulTime(WorkShift1StartTime, time.Now(), timeModelList) |
|
|
if countPack > 0 { |
|
|
if countPack > 0 { |
|
|
TeamTemPoNumber = utils.Decimal(float64(packTimes)/float64(countPack), 2) |
|
|
TeamTemPoNumber = utils.Decimal(float64(packTimes)/float64(countPack), 2) |
|
|
if packTimes > 0 { |
|
|
|
|
|
packHours := packTimes / 3600 |
|
|
|
|
|
|
|
|
packHours := float64(packTimes) / float64(3600) |
|
|
|
|
|
if packHours > 0 { |
|
|
PerTeamTemPoNumber = utils.Decimal(float64(countPack)/float64(num)/float64(packHours), 4) |
|
|
PerTeamTemPoNumber = utils.Decimal(float64(countPack)/float64(num)/float64(packHours), 4) |
|
|
} else { |
|
|
} else { |
|
|
PerTeamTemPoNumber = 0 |
|
|
PerTeamTemPoNumber = 0 |
|
@ -878,8 +918,8 @@ func (impl *CustOrderServiceImplement) SelectTeamTemPo(user *global.User, dayMod |
|
|
packTimes := impl.GetUsefulTime(WorkShift2StartTime, time.Now(), timeModelList) |
|
|
packTimes := impl.GetUsefulTime(WorkShift2StartTime, time.Now(), timeModelList) |
|
|
if countPack > 0 { |
|
|
if countPack > 0 { |
|
|
TeamTemPoNumber = utils.Decimal(float64(packTimes)/float64(countPack), 2) |
|
|
TeamTemPoNumber = utils.Decimal(float64(packTimes)/float64(countPack), 2) |
|
|
if packTimes > 0 { |
|
|
|
|
|
packHours := packTimes / 3600 |
|
|
|
|
|
|
|
|
packHours := float64(packTimes) / float64(3600) |
|
|
|
|
|
if packHours > 0 { |
|
|
PerTeamTemPoNumber = utils.Decimal(float64(countPack)/float64(num)/float64(packHours), 4) |
|
|
PerTeamTemPoNumber = utils.Decimal(float64(countPack)/float64(num)/float64(packHours), 4) |
|
|
} else { |
|
|
} else { |
|
|
PerTeamTemPoNumber = 0 |
|
|
PerTeamTemPoNumber = 0 |
|
@ -906,8 +946,8 @@ func (impl *CustOrderServiceImplement) SelectTeamTemPo(user *global.User, dayMod |
|
|
packTimes := impl.GetUsefulTime(WorkShift3StartTime, time.Now(), timeModelList) |
|
|
packTimes := impl.GetUsefulTime(WorkShift3StartTime, time.Now(), timeModelList) |
|
|
if countPack > 0 { |
|
|
if countPack > 0 { |
|
|
TeamTemPoNumber = utils.Decimal(float64(packTimes)/float64(countPack), 2) |
|
|
TeamTemPoNumber = utils.Decimal(float64(packTimes)/float64(countPack), 2) |
|
|
if packTimes > 0 { |
|
|
|
|
|
packHours := packTimes / 3600 |
|
|
|
|
|
|
|
|
packHours := float64(packTimes) / float64(3600) |
|
|
|
|
|
if packHours > 0 { |
|
|
PerTeamTemPoNumber = utils.Decimal(float64(countPack)/float64(num)/float64(packHours), 4) |
|
|
PerTeamTemPoNumber = utils.Decimal(float64(countPack)/float64(num)/float64(packHours), 4) |
|
|
} else { |
|
|
} else { |
|
|
PerTeamTemPoNumber = 0 |
|
|
PerTeamTemPoNumber = 0 |
|
|