fix: 去除所有exception只保留zerodi
This commit is contained in:
parent
89d9ac84d8
commit
a2ff2c0a2c
|
@ -394,7 +394,7 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s,
|
|||
cost = amount_consume * price_unit
|
||||
try:
|
||||
cost_unit = cost / enstat.total_production
|
||||
except Exception:
|
||||
except ZeroDivisionError:
|
||||
cost_unit = 0
|
||||
imaterial_cost_unit = imaterial_cost_unit + cost_unit
|
||||
if material.code == "elec":
|
||||
|
@ -402,8 +402,8 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s,
|
|||
enstat.elec_coal_consume = enstat.elec_consume * 0.1229 / 1000
|
||||
try:
|
||||
enstat.elec_consume_unit = enstat.elec_consume / enstat.total_production
|
||||
except Exception:
|
||||
pass
|
||||
except ZeroDivisionError:
|
||||
enstat.elec_consume_unit = 0
|
||||
elif material.code == "water":
|
||||
enstat.water_consume = amount_consume
|
||||
elif material.code == "pcoal":
|
||||
|
@ -452,8 +452,8 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s,
|
|||
if enstat.mgroup.name != "回转窑":
|
||||
try:
|
||||
enstat.en_consume_unit = enstat.elec_coal_consume / enstat.total_production
|
||||
except Exception:
|
||||
pass
|
||||
except ZeroDivisionError:
|
||||
enstat.en_consume_unit = 0
|
||||
enstat.save()
|
||||
# 计算一些其他数据
|
||||
if type == "month_st" and "material" in this_cal_attrs: # 如果计算的是班月,把主要设备电耗数据拉过来, 方便查询
|
||||
|
@ -475,12 +475,8 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s,
|
|||
if enstat.type in ["hour_s", "day_s", "year_s", "month_s"]:
|
||||
pre_enstat = 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="原料磨").first()
|
||||
if pre_enstat:
|
||||
try:
|
||||
# 料耗系数
|
||||
enstat.celec_consume_unit = enstat.elec_consume_unit + get_sysconfig('enm.enm_lhxs') * pre_enstat.elec_consume_unit
|
||||
enstat.save()
|
||||
except Exception:
|
||||
pass
|
||||
enstat.celec_consume_unit = enstat.elec_consume_unit + get_sysconfig('enm.enm_lhxs') * pre_enstat.elec_consume_unit
|
||||
enstat.save()
|
||||
|
||||
# 算总煤耗
|
||||
if "pcoal" in this_cal_attrs:
|
||||
|
|
Loading…
Reference in New Issue