From 5f20247818bf74f901f8a772dfc455b87c891f75 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 30 Apr 2024 14:21:09 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E6=B7=BB=E5=8A=A0=E4=B8=80=E4=B8=AAlog?= =?UTF-8?q?=E6=8E=92=E6=9F=A5=E9=80=BB=E8=BE=91=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/enm/tasks.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/apps/enm/tasks.py b/apps/enm/tasks.py index b897e4c4..7b5ec294 100644 --- a/apps/enm/tasks.py +++ b/apps/enm/tasks.py @@ -270,7 +270,7 @@ def cal_mpointstat_manual(mpointId: str, sflogId: str, mgroupId: str, year: int, ms_year_s.val = sum_dict_year_s["sum"] ms_year_s.save() - if next_cal: # 二次计算 + if next_cal: # 计算工段级数据,手动录入时调用 if hour: cal_enstat("hour_s", sflogId, mgroupId, year, month, day, hour, year_s, month_s, day_s) else: @@ -307,6 +307,7 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s, if sflog: year_s, month_s, day_s = sflog.get_ymd team = sflog.team + # 如果没有班组,那么month_st无需计算 if team is None and type == "month_st": return year_s, month_s, day_s if type == "hour_s": @@ -360,6 +361,7 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s, mps = MpointStat.objects.filter(type="year_s", mgroup=mgroup, year_s=year_s, mpoint__material=material) if mps.filter(mpoint__is_rep_mgroup=True).exists(): mps = mps.filter(mpoint__is_rep_mgroup=True) + myLogger.info(f'{mgroup.name}-{material.name}-{year_s}-{month_s}-{day_s}-{hour}') amount_consume = mps.aggregate(sum=Sum("val"))["sum"] if amount_consume is None: amount_consume = 0