fix: 班月质检数据统计错误

This commit is contained in:
caoqianming 2023-07-25 13:58:31 +08:00
parent e64ae3aebe
commit 841815bbb6
2 changed files with 5 additions and 5 deletions

View File

@ -218,7 +218,7 @@ def compute_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, mont
defaults={'type': 'day_s', 'mgroup': mgroup, 'year_s': year_s, 'month_s': month_s, 'day_s': day_s, 'total_production': 0, 'elec_consume': 0})
elif type == 'month_st':
enstat, _ = EnStat.objects.get_or_create(type="month_st", mgroup=mgroup, team=team, year_s=year_s, month_s=month_s,
defaults={'type': 'month_sf', 'mgroup': mgroup, 'year_s': year_s, 'month_s': month_s, 'team': team, 'total_production': 0, 'elec_consume': 0})
defaults={'type': 'month_st', 'mgroup': mgroup, 'year_s': year_s, 'month_s': month_s, 'team': team, 'total_production': 0, 'elec_consume': 0})
elif type == 'month_s':
enstat, _ = EnStat.objects.get_or_create(type="month_s", mgroup=mgroup, year_s=year_s, month_s=month_s,
defaults={'type': 'month_s', 'mgroup': mgroup, 'year_s': year_s, 'month_s': month_s, 'total_production': 0, 'elec_consume': 0})

View File

@ -142,12 +142,12 @@ ORDER BY mgroup.sort, mtma.sort, qmt.sort
and qmq.val_avg is not NULL
and qmq.num_test is not NULL
and qmq.num_ok is not NULL
GROUP BY mgroup."id", mtma."id", qmt."id", mgroup.sort, mtma.sort, qmt.sort
ORDER BY mgroup.sort, mtma.sort, qmt.sort
GROUP BY mtma."id", qmt."id", mtma.sort, qmt.sort
ORDER BY mtma.sort, qmt.sort
"""
res3 = query_all_dict(sql_q3)
enstat, _ = EnStat.objects.get_or_create(type="month_sf", mgroup=mgroup, team=team, year_s=year_s, month_s=month_s,
defaults={'type': 'month_sf', 'mgroup': mgroup, 'year_s': year_s, 'month_s': month_s, 'team': team, 'total_production': 0, 'elec_consume': 0})
enstat, _ = EnStat.objects.get_or_create(type="month_st", mgroup=mgroup, team=team, year_s=year_s, month_s=month_s,
defaults={'type': 'month_st', 'mgroup': mgroup, 'year_s': year_s, 'month_s': month_s, 'team': team, 'total_production': 0, 'elec_consume': 0})
enstat.qua_data = res3
enstat.save()