|
@@ -59,19 +59,23 @@ func Calculate(varietyId int, sysUserId int, sysUserName string) (err error) {
|
|
|
}
|
|
|
|
|
|
// 维修数据的开始日期和结束日期
|
|
|
- var startDate, endDate time.Time
|
|
|
+ var startDate time.Time
|
|
|
//所有设备在该日期的减产数
|
|
|
maintenanceDataMap := make(map[time.Time][]float64)
|
|
|
|
|
|
for _, plantInfo := range plantList {
|
|
|
+ // 数据不全
|
|
|
+ if plantInfo.MaintenanceDate.IsZero() || plantInfo.ResumptionDate.IsZero() {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ // 日均产量减量为0,说明数据不全,不参与计算
|
|
|
+ if plantInfo.AverageDailyCapacityReduction == 0 {
|
|
|
+ continue
|
|
|
+ }
|
|
|
// 开始检修日期
|
|
|
if startDate.IsZero() || plantInfo.MaintenanceDate.Before(startDate) {
|
|
|
startDate = plantInfo.MaintenanceDate
|
|
|
}
|
|
|
- // 结束检修日期
|
|
|
- if endDate.IsZero() || plantInfo.ResumptionDate.After(endDate) {
|
|
|
- endDate = plantInfo.ResumptionDate
|
|
|
- }
|
|
|
|
|
|
// 结束检修日期
|
|
|
resumptionDate := plantInfo.ResumptionDate
|