fix: 更新煤粉热值触发计算的bug
This commit is contained in:
parent
5093eb7b29
commit
9a1074caf8
|
@ -117,11 +117,11 @@ class SfLogSerializer(CustomModelSerializer):
|
|||
mgroup: Mgroup = instance.mgroup
|
||||
|
||||
# 更新煤粉热值触发计算
|
||||
if instance.mgroup == '回转窑' and instance.shift.name in ['早班', '白班']:
|
||||
year_s, month_s, day_s = instance.get_ymd
|
||||
if new_pcoal_heat: # 更新一下缓存
|
||||
year_s, month_s, day_s = instance.get_ymd
|
||||
cache.set(f'pgoal_val_{year_s}_{month_s}_{day_s}', new_pcoal_heat)
|
||||
if new_pcoal_heat != old_pcoal_heat and mgroup.need_enm:
|
||||
year_s, month_s, day_s = instance.get_ymd
|
||||
cache.set(f'pcoal_heat_{year_s}_{month_s}_{day_s}', new_pcoal_heat)
|
||||
if new_pcoal_heat != old_pcoal_heat:
|
||||
cal_enstat_when_pcoal_heat_change.delay(year_s, month_s, day_s)
|
||||
|
||||
# 更新班组触发计算
|
||||
|
|
|
@ -62,7 +62,7 @@ def get_pcoal_heat(year_s: int, month_s: int, day_s: int):
|
|||
获取煤粉热值
|
||||
只有回转窑需要录入煤粉热值
|
||||
"""
|
||||
key = f'pgoal_val_{year_s}_{month_s}_{day_s}'
|
||||
key = f'pcoal_heat_{year_s}_{month_s}_{day_s}'
|
||||
pcoal_heat = cache.get(key)
|
||||
if pcoal_heat:
|
||||
return pcoal_heat
|
||||
|
@ -73,7 +73,7 @@ def get_pcoal_heat(year_s: int, month_s: int, day_s: int):
|
|||
if qs.pcoal_heat is None:
|
||||
qs.pcoal_heat = 6000
|
||||
qs.save(update_fields=['pcoal_heat'])
|
||||
cache.set(f'pgoal_val_{year_s}_{month_s}_{day_s}', qs.pcoal_heat)
|
||||
cache.set(f'pcoal_heat_{year_s}_{month_s}_{day_s}', qs.pcoal_heat)
|
||||
return qs.pcoal_heat
|
||||
except Exception:
|
||||
return 6000
|
||||
|
|
Loading…
Reference in New Issue