Merge branch 'master' of https://e.coding.net/ctcdevteam/ehs/ehs_server
This commit is contained in:
commit
a0423cbd3f
|
@ -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)
|
elec_consume_mm = res_dict.get("煤磨", {}).get("elec_consume", 0)
|
||||||
if item["total_production"] == 0:
|
if item["total_production"] == 0:
|
||||||
item["celec_consume_unit"] = 0
|
item["celec_consume_unit"] = 0
|
||||||
item["en_consume_unit"] = 0
|
item["cen_consume_unit"] = 0
|
||||||
else:
|
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["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["en_consume_unit"] = round(item["coal_consume_unit"] + 0.1229 * item["elec_consume_unit"], 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)
|
item["total_production"] = round(item["total_production"], 2)
|
||||||
return res
|
return res
|
||||||
|
|
||||||
|
def get_safe_value(value, default=1):
|
||||||
|
return value if value != 0 else default
|
Loading…
Reference in New Issue