From 9805b471d4859d27944d0cb631b73f75b5a4d60d Mon Sep 17 00:00:00 2001 From: caoqianming Date: Fri, 26 Apr 2024 15:24:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E6=96=99=E8=80=97?= =?UTF-8?q?=E7=B3=BB=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/enm/tasks.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/enm/tasks.py b/apps/enm/tasks.py index fcdae7c4..05f5a3da 100644 --- a/apps/enm/tasks.py +++ b/apps/enm/tasks.py @@ -14,6 +14,7 @@ from apps.fim.services import get_cost_unit, get_price_unit from apps.fim.models import Fee from apps.enm.services import translate_eval_formula import logging +from server.settings import get_sysconfig from django.db.models import F from apps.wpm.services import get_pcoal_heat from django.utils import timezone @@ -83,8 +84,11 @@ def cal_mpointstats_duration(start_time: str, end_time: str): """ 重跑某一段时间的任务 """ + mytz = tz.gettz(settings.TIME_ZONE) start_time = datetime.datetime.strptime(start_time, "%Y-%m-%d %H:%M:%S") + start_time.replace(tzinfo=mytz) end_time = datetime.datetime.strptime(end_time, "%Y-%m-%d %H:%M:%S") + start_time.replace(tzinfo=mytz) current_time = start_time while current_time <= end_time: year, month, day, hour = current_time.year, current_time.month, current_time.day, current_time.hour @@ -353,6 +357,9 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s, if amount_consume is None: amount_consume = 0 if ind == 0 and has_product: # 如果是产量 + # 料耗系数 + if mgroup.name == '回转窑': + amount_consume = amount_consume / get_sysconfig('enm.enm_lhxs') enstat.total_production = amount_consume else: if material.code in ["pcoal", "cair", "steam"]: @@ -443,7 +450,8 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s, pre_enstat = EnStat.objects.filter(type=enstat.type, year_s=enstat.year_s, month_s=enstat.month_s, day_s=enstat.day_s, hour=enstat.hour, mgroup__name="原料磨").first() if pre_enstat: try: - enstat.celec_consume_unit = enstat.elec_consume_unit + 1.45 * pre_enstat.elec_consume_unit + # 料耗系数 + enstat.celec_consume_unit = enstat.elec_consume_unit + get_sysconfig('enm.enm_lhxs') * pre_enstat.elec_consume_unit enstat.save() except Exception as e: pass