fix: 标煤耗计算修改
This commit is contained in:
parent
0e273a35c6
commit
5b4742f181
|
@ -214,7 +214,7 @@ def cal_mpointstats(is_now=1, year=None, month=None, day=None, hour=None, m_code
|
||||||
mpoints_related = Mpoint.objects.none()
|
mpoints_related = Mpoint.objects.none()
|
||||||
for code in m_code_list:
|
for code in m_code_list:
|
||||||
mpoints_related = mpoints_related | Mpoint.objects.filter(type=Mpoint.MT_COMPUTE, enabled=True, material__isnull=False, formula__contains='{' + code + '}')
|
mpoints_related = mpoints_related | Mpoint.objects.filter(type=Mpoint.MT_COMPUTE, enabled=True, material__isnull=False, formula__contains='{' + code + '}')
|
||||||
mpoints_related = mpoints_related.order_by('report_sortstr', 'create_time')
|
mpoints_related = mpoints_related.distinct().order_by('report_sortstr', 'create_time')
|
||||||
for item in mpoints_related:
|
for item in mpoints_related:
|
||||||
cal_mpointstat_hour(item.id, year, month, day, hour)
|
cal_mpointstat_hour(item.id, year, month, day, hour)
|
||||||
else:
|
else:
|
||||||
|
@ -478,7 +478,7 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s,
|
||||||
if "pcoal" in this_cal_attrs:
|
if "pcoal" in this_cal_attrs:
|
||||||
if type in ["hour_s", "sflog", "day_s"]:
|
if type in ["hour_s", "sflog", "day_s"]:
|
||||||
enstat.pcoal_heat = get_pcoal_heat(enstat.year_s, enstat.month_s, enstat.day_s)
|
enstat.pcoal_heat = get_pcoal_heat(enstat.year_s, enstat.month_s, enstat.day_s)
|
||||||
enstat.pcoal_coal_consume = enstat.pcoal_consume * enstat.pcoal_heat / 29307
|
enstat.pcoal_coal_consume = enstat.pcoal_consume * enstat.pcoal_heat / 7000
|
||||||
elif type == "month_st":
|
elif type == "month_st":
|
||||||
enstat.pcoal_coal_consume = EnStat.objects.filter(type="sflog", mgroup=enstat.mgroup, year_s=year_s, month_s=month_s, sflog__team=enstat.team).aggregate(
|
enstat.pcoal_coal_consume = EnStat.objects.filter(type="sflog", mgroup=enstat.mgroup, year_s=year_s, month_s=month_s, sflog__team=enstat.team).aggregate(
|
||||||
sum=Sum("pcoal_coal_consume")
|
sum=Sum("pcoal_coal_consume")
|
||||||
|
@ -493,7 +493,7 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s,
|
||||||
|
|
||||||
# 算单位产品标煤耗
|
# 算单位产品标煤耗
|
||||||
try:
|
try:
|
||||||
enstat.coal_consume_unit = enstat.pcoal_coal_consume / enstat.total_production
|
enstat.coal_consume_unit = enstat.pcoal_coal_consume * 100 / enstat.total_production
|
||||||
except ZeroDivisionError:
|
except ZeroDivisionError:
|
||||||
enstat.coal_consume_unit = 0
|
enstat.coal_consume_unit = 0
|
||||||
|
|
||||||
|
@ -671,7 +671,7 @@ def cal_enstat_pcoal_change(enstat: EnStat, new_pcoal_heat):
|
||||||
type = enstat.type
|
type = enstat.type
|
||||||
if type in ["hour_s", "sflog", "day_s"]:
|
if type in ["hour_s", "sflog", "day_s"]:
|
||||||
enstat.pcoal_heat = new_pcoal_heat
|
enstat.pcoal_heat = new_pcoal_heat
|
||||||
enstat.pcoal_coal_consume = enstat.pcoal_consume * enstat.pcoal_heat / 29307
|
enstat.pcoal_coal_consume = enstat.pcoal_consume * enstat.pcoal_heat / 7000
|
||||||
elif type == "month_st":
|
elif type == "month_st":
|
||||||
enstat.pcoal_coal_consume = EnStat.objects.filter(type="sflog", mgroup=enstat.mgroup, year_s=enstat.year_s, month_s=enstat.month_s, sflog__team=enstat.team).aggregate(
|
enstat.pcoal_coal_consume = EnStat.objects.filter(type="sflog", mgroup=enstat.mgroup, year_s=enstat.year_s, month_s=enstat.month_s, sflog__team=enstat.team).aggregate(
|
||||||
sum=Sum("pcoal_coal_consume")
|
sum=Sum("pcoal_coal_consume")
|
||||||
|
|
Loading…
Reference in New Issue