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")