From 9a1074caf8e0e07609ed89f953afb037a9ca9538 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Thu, 16 May 2024 16:48:42 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E7=85=A4=E7=B2=89?= =?UTF-8?q?=E7=83=AD=E5=80=BC=E8=A7=A6=E5=8F=91=E8=AE=A1=E7=AE=97=E7=9A=84?= =?UTF-8?q?bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/serializers.py | 10 +++++----- apps/wpm/services.py | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/apps/wpm/serializers.py b/apps/wpm/serializers.py index 1320f40a..8ec3d981 100644 --- a/apps/wpm/serializers.py +++ b/apps/wpm/serializers.py @@ -117,12 +117,12 @@ class SfLogSerializer(CustomModelSerializer): mgroup: Mgroup = instance.mgroup # 更新煤粉热值触发计算 - if new_pcoal_heat: # 更新一下缓存 + if instance.mgroup == '回转窑' and instance.shift.name in ['早班', '白班']: 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 - cal_enstat_when_pcoal_heat_change.delay(year_s, month_s, day_s) + if new_pcoal_heat: # 更新一下缓存 + 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) # 更新班组触发计算 if new_team != old_team: diff --git a/apps/wpm/services.py b/apps/wpm/services.py index d795ee03..dff05f1d 100644 --- a/apps/wpm/services.py +++ b/apps/wpm/services.py @@ -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