|
@@ -64,6 +64,9 @@ func Calculate(varietyId int, sysUserId int, sysUserName string) (err error) {
|
|
|
maintenanceDataMap := make(map[time.Time][]float64)
|
|
|
|
|
|
for _, plantInfo := range plantList {
|
|
|
+ if plantInfo.IsStop == 1 {
|
|
|
+ plantInfo.ResumptionDate = lastDate
|
|
|
+ }
|
|
|
|
|
|
if plantInfo.MaintenanceDate.IsZero() || plantInfo.ResumptionDate.IsZero() {
|
|
|
continue
|
|
@@ -79,9 +82,6 @@ func Calculate(varietyId int, sysUserId int, sysUserName string) (err error) {
|
|
|
|
|
|
|
|
|
resumptionDate := plantInfo.ResumptionDate
|
|
|
- if plantInfo.IsStop == 1 {
|
|
|
- resumptionDate = lastDate
|
|
|
- }
|
|
|
|
|
|
for tmpDate := plantInfo.MaintenanceDate; !tmpDate.After(resumptionDate); tmpDate = tmpDate.AddDate(0, 0, 1) {
|
|
|
dataList, ok := maintenanceDataMap[tmpDate]
|
|
@@ -124,10 +124,13 @@ func Calculate(varietyId int, sysUserId int, sysUserName string) (err error) {
|
|
|
}
|
|
|
}()
|
|
|
|
|
|
- for _, varietyEdbInfo := range varietyEdbInfoList {
|
|
|
- err = calculateEdb(to, varietyEdbInfo, dataMap, startDate, lastDate)
|
|
|
- if err != nil {
|
|
|
- return
|
|
|
+
|
|
|
+ if len(dataMap) > 0 {
|
|
|
+ for _, varietyEdbInfo := range varietyEdbInfoList {
|
|
|
+ err = calculateEdb(to, varietyEdbInfo, dataMap, startDate, lastDate)
|
|
|
+ if err != nil {
|
|
|
+ return
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
|