fix: water_consume

This commit is contained in:
caoqianming 2024-04-30 16:23:57 +08:00
parent 5f20247818
commit cb766247b0
1 changed files with 1 additions and 3 deletions

View File

@ -361,7 +361,6 @@ 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
@ -389,7 +388,7 @@ def cal_enstat(type, sflogId, mgroupId, year, month, day, hour, year_s, month_s,
except Exception:
pass
elif material.code == "water":
enstat.water = amount_consume
enstat.water_consume = amount_consume
elif material.code == "pcoal":
enstat.pcoal_consume = amount_consume
elif material.code == "cair":
@ -750,5 +749,4 @@ def check_mpoint_offline(seconds=300):
if is_offline:
mpoint_data['gather_state'] = -2 # 掉线了
cache.set(cache_key, mpoint_data, timeout=None)