diff --git a/apps/enm/tasks.py b/apps/enm/tasks.py index 912dcc7a..f978b398 100644 --- a/apps/enm/tasks.py +++ b/apps/enm/tasks.py @@ -494,8 +494,12 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s, ).exclude(mpoint__ep_monitored=None).update(total_production=total_production, elec_consume_unit=elec_consume_unit) # 更新余热发电的production_elec_unit if mgroup.name == "回转窑": + if enstat.total_production == 0: + production_elec_unit_yr = 0 + else: + production_elec_unit_yr = F("total_production") / enstat.total_production EnStat.objects.filter(type=enstat.type, year_s=enstat.year_s, month_s=enstat.month_s, day_s=enstat.day_s, hour=enstat.hour, mgroup__name="余热发电").update( - production_elec_unit=F("total_production") / enstat.total_production + production_elec_unit=production_elec_unit_yr ) # 其他一些触发计算