feat: 料耗系数可用于测点
This commit is contained in:
parent
6ae849150f
commit
d73cc1af5b
|
@ -98,7 +98,6 @@ class EnStatFilter(filters.FilterSet):
|
|||
"year_s": ["exact"],
|
||||
"year": ["exact"],
|
||||
"month": ["exact"],
|
||||
"day_s": ["exact"],
|
||||
"day": ["exact"],
|
||||
"hour": ["exact"],
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ from .serializers import MpointSerializer
|
|||
from apps.enp.models import EnvData
|
||||
from apps.em.models import Equipment
|
||||
from apps.em.services import set_eq_rs
|
||||
from server.settings import get_sysconfig
|
||||
|
||||
myLogger = logging.getLogger("log")
|
||||
|
||||
|
@ -22,9 +23,12 @@ def translate_eval_formula(exp_str: str, year: int, month: int, day: int, hour:
|
|||
pattern = r"\{(.*?)}"
|
||||
matches = re.findall(pattern, exp_str)
|
||||
for match in matches:
|
||||
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:
|
||||
exp_str = exp_str.replace(f"{{{match}}}", str(mpst.val))
|
||||
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()
|
||||
if mpst:
|
||||
exp_str = exp_str.replace(f"{{{match}}}", str(mpst.val))
|
||||
rval = eval(exp_str)
|
||||
return rval
|
||||
|
||||
|
|
|
@ -365,9 +365,6 @@ 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"]:
|
||||
|
@ -737,7 +734,7 @@ def king_insert_mplogx():
|
|||
|
||||
|
||||
@shared_task(base=CustomTask)
|
||||
def check_mpoint_offline(seconds=300):
|
||||
def check_mpoint_offline(seconds=100):
|
||||
"""监测测点采集掉线"""
|
||||
now = localtime()
|
||||
for mpoint in Mpoint.objects.filter(enabled=True, type=Mpoint.MT_AUTO):
|
||||
|
|
Loading…
Reference in New Issue