fix: pcoal_coal_consume可能为None
This commit is contained in:
parent
cb60fe2728
commit
7fd10f3e51
|
@ -386,6 +386,9 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s,
|
|||
elif type == 'year_s':
|
||||
enstat.pcoal_coal_consume = EnStat.objects.filter(type='sflog', mgroup=enstat.mgroup, year_s=year_s).aggregate(sum=Sum('pcoal_coal_consume'))['sum']
|
||||
|
||||
if enstat.pcoal_coal_consume is None:
|
||||
enstat.pcoal_coal_consume = 0
|
||||
|
||||
# 算单位产品标煤耗
|
||||
try:
|
||||
enstat.coal_consume_unit = enstat.pcoal_coal_consume /enstat.total_production
|
||||
|
@ -522,6 +525,8 @@ def cal_enstat_pcoal_change(enstat, new_pcoal_heat):
|
|||
elif type == 'year_s':
|
||||
enstat.pcoal_coal_consume = EnStat.objects.filter(type='sflog', mgroup=enstat.mgroup, year_s=enstat.year_s).aggregate(sum=Sum('pcoal_coal_consume'))['sum']
|
||||
|
||||
if enstat.pcoal_coal_consume is None:
|
||||
enstat.pcoal_coal_consume = 0
|
||||
# 算单位产品标煤耗
|
||||
try:
|
||||
enstat.coal_consume_unit = enstat.pcoal_coal_consume /enstat.total_production
|
||||
|
|
Loading…
Reference in New Issue