fix : enm 修改 单位产品综合能耗

This commit is contained in:
zty 2024-11-18 13:51:04 +08:00
parent c2cae12c4f
commit 3fff294189
1 changed files with 7 additions and 4 deletions

View File

@ -474,9 +474,12 @@ def get_analyse_data_mgroups_duration(start_date: datetime, end_date: datetime)
elec_consume_mm = res_dict.get("煤磨", {}).get("elec_consume", 0)
if item["total_production"] == 0:
item["celec_consume_unit"] = 0
item["en_consume_unit"] = 0
item["cen_consume_unit"] = 0
else:
item["celec_consume_unit"] = round((elec_consume_mm + item["elec_consume"]) / item["total_production"] + get_sysconfig("enm.enm_lhxs") * elec_consume_ylm / total_production_ylm, 2)
item["en_consume_unit"] = round(item["coal_consume_unit"] + 0.1229 * item["elec_consume_unit"], 2)
item["celec_consume_unit"] = round((elec_consume_mm + item["elec_consume"]) / get_safe_value(item["total_production"]) + get_sysconfig("enm.enm_lhxs") * elec_consume_ylm / get_safe_value(total_production_ylm), 2)
item["cen_consume_unit"] = round(item["coal_consume_unit"] + 0.1229 * item["elec_consume_unit"], 2)
item["total_production"] = round(item["total_production"], 2)
return res
def get_safe_value(value, default=1):
return value if value != 0 else default