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