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