From 3dc647272a850fc3c56e05bdba6679e1f2484ec2 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Wed, 2 Aug 2023 10:22:51 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20cal=5Fenstat=5Fwhen=5Fpcoal=5Fval=5Fcha?= =?UTF-8?q?nge=20=E6=9C=AA=E5=AE=8C=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/tasks.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/wpm/tasks.py b/apps/wpm/tasks.py index 83229a53..c19fc430 100644 --- a/apps/wpm/tasks.py +++ b/apps/wpm/tasks.py @@ -12,7 +12,7 @@ from django.db.models import Sum from apps.wpm.services import make_sflogs from apps.wpm.models import SfLog, StLog, StSfLog from django.utils.timezone import localtime - +from django.db.models import F @shared_task(base=CustomTask) def make_sflogs_simple(days=2): @@ -91,4 +91,13 @@ def cal_shut_hour(stlogId: str): @shared_task(base=CustomTask) -def cal_enstat_when_pcoal_val_change(): +def cal_enstat_when_pcoal_val_change(sflogId): + from apps.enm.models import EnStat + sflog = SfLog.objects.get(id=sflogId) + mgroup = sflog.mgroup + pcoal_val = sflog.pcoal_val + year_s, month_s, day_s = sflog.get_ymd + enstats = EnStat.objects.filter(mgroup__name='回转窑') + for enstat in enstats: + if type in ['hour_s', 'sflog', 'day_s']: + pass