From 5b4742f181ef4241b780552324cb401820ac329b Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 10 May 2024 15:41:09 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=A0=87=E7=85=A4=E8=80=97=E8=AE=A1?= =?UTF-8?q?=E7=AE=97=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/enm/tasks.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/apps/enm/tasks.py b/apps/enm/tasks.py index cf0da6d3..ace70f0d 100644 --- a/apps/enm/tasks.py +++ b/apps/enm/tasks.py @@ -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() 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.order_by('report_sortstr', 'create_time') + mpoints_related = mpoints_related.distinct().order_by('report_sortstr', 'create_time') for item in mpoints_related: cal_mpointstat_hour(item.id, year, month, day, hour) 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 type in ["hour_s", "sflog", "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": 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") @@ -493,7 +493,7 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s, # 算单位产品标煤耗 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: enstat.coal_consume_unit = 0 @@ -671,7 +671,7 @@ def cal_enstat_pcoal_change(enstat: EnStat, new_pcoal_heat): type = enstat.type if type in ["hour_s", "sflog", "day_s"]: 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": 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")