feat: 添加一个log排查逻辑错误
This commit is contained in:
parent
dddab37c63
commit
5f20247818
|
@ -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.val = sum_dict_year_s["sum"]
|
||||||
ms_year_s.save()
|
ms_year_s.save()
|
||||||
|
|
||||||
if next_cal: # 二次计算
|
if next_cal: # 计算工段级数据,手动录入时调用
|
||||||
if hour:
|
if hour:
|
||||||
cal_enstat("hour_s", sflogId, mgroupId, year, month, day, hour, year_s, month_s, day_s)
|
cal_enstat("hour_s", sflogId, mgroupId, year, month, day, hour, year_s, month_s, day_s)
|
||||||
else:
|
else:
|
||||||
|
@ -307,6 +307,7 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s,
|
||||||
if sflog:
|
if sflog:
|
||||||
year_s, month_s, day_s = sflog.get_ymd
|
year_s, month_s, day_s = sflog.get_ymd
|
||||||
team = sflog.team
|
team = sflog.team
|
||||||
|
# 如果没有班组,那么month_st无需计算
|
||||||
if team is None and type == "month_st":
|
if team is None and type == "month_st":
|
||||||
return year_s, month_s, day_s
|
return year_s, month_s, day_s
|
||||||
if type == "hour_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)
|
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():
|
if mps.filter(mpoint__is_rep_mgroup=True).exists():
|
||||||
mps = mps.filter(mpoint__is_rep_mgroup=True)
|
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"]
|
amount_consume = mps.aggregate(sum=Sum("val"))["sum"]
|
||||||
if amount_consume is None:
|
if amount_consume is None:
|
||||||
amount_consume = 0
|
amount_consume = 0
|
||||||
|
|
Loading…
Reference in New Issue