feat: 料耗系数可用于测点
This commit is contained in:
parent
6ae849150f
commit
d73cc1af5b
|
@ -98,7 +98,6 @@ class EnStatFilter(filters.FilterSet):
|
||||||
"year_s": ["exact"],
|
"year_s": ["exact"],
|
||||||
"year": ["exact"],
|
"year": ["exact"],
|
||||||
"month": ["exact"],
|
"month": ["exact"],
|
||||||
"day_s": ["exact"],
|
|
||||||
"day": ["exact"],
|
"day": ["exact"],
|
||||||
"hour": ["exact"],
|
"hour": ["exact"],
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ from .serializers import MpointSerializer
|
||||||
from apps.enp.models import EnvData
|
from apps.enp.models import EnvData
|
||||||
from apps.em.models import Equipment
|
from apps.em.models import Equipment
|
||||||
from apps.em.services import set_eq_rs
|
from apps.em.services import set_eq_rs
|
||||||
|
from server.settings import get_sysconfig
|
||||||
|
|
||||||
myLogger = logging.getLogger("log")
|
myLogger = logging.getLogger("log")
|
||||||
|
|
||||||
|
@ -22,6 +23,9 @@ def translate_eval_formula(exp_str: str, year: int, month: int, day: int, hour:
|
||||||
pattern = r"\{(.*?)}"
|
pattern = r"\{(.*?)}"
|
||||||
matches = re.findall(pattern, exp_str)
|
matches = re.findall(pattern, exp_str)
|
||||||
for match in matches:
|
for match in matches:
|
||||||
|
if match in ['enm_lhxs']:
|
||||||
|
exp_str = exp_str.replace(f"{{{match}}}", get_sysconfig(f'enm.{match}'))
|
||||||
|
else:
|
||||||
mpst = MpointStat.objects.filter(Q(mpoint__id=match) | Q(mpoint__name=match) | Q(mpoint__code=match), type="hour", year=year, month=month, day=day, hour=hour).first()
|
mpst = MpointStat.objects.filter(Q(mpoint__id=match) | Q(mpoint__name=match) | Q(mpoint__code=match), type="hour", year=year, month=month, day=day, hour=hour).first()
|
||||||
if mpst:
|
if mpst:
|
||||||
exp_str = exp_str.replace(f"{{{match}}}", str(mpst.val))
|
exp_str = exp_str.replace(f"{{{match}}}", str(mpst.val))
|
||||||
|
|
|
@ -365,9 +365,6 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s,
|
||||||
if amount_consume is None:
|
if amount_consume is None:
|
||||||
amount_consume = 0
|
amount_consume = 0
|
||||||
if ind == 0 and has_product: # 如果是产量
|
if ind == 0 and has_product: # 如果是产量
|
||||||
# 料耗系数
|
|
||||||
if mgroup.name == '回转窑':
|
|
||||||
amount_consume = amount_consume / get_sysconfig('enm.enm_lhxs')
|
|
||||||
enstat.total_production = amount_consume
|
enstat.total_production = amount_consume
|
||||||
else:
|
else:
|
||||||
if material.code in ["pcoal", "cair", "steam"]:
|
if material.code in ["pcoal", "cair", "steam"]:
|
||||||
|
@ -737,7 +734,7 @@ def king_insert_mplogx():
|
||||||
|
|
||||||
|
|
||||||
@shared_task(base=CustomTask)
|
@shared_task(base=CustomTask)
|
||||||
def check_mpoint_offline(seconds=300):
|
def check_mpoint_offline(seconds=100):
|
||||||
"""监测测点采集掉线"""
|
"""监测测点采集掉线"""
|
||||||
now = localtime()
|
now = localtime()
|
||||||
for mpoint in Mpoint.objects.filter(enabled=True, type=Mpoint.MT_AUTO):
|
for mpoint in Mpoint.objects.filter(enabled=True, type=Mpoint.MT_AUTO):
|
||||||
|
|
Loading…
Reference in New Issue