diff --git a/apps/enm/services.py b/apps/enm/services.py index 9958351f..0631d684 100644 --- a/apps/enm/services.py +++ b/apps/enm/services.py @@ -15,6 +15,7 @@ from server.settings import get_sysconfig from apps.enm.models import EnStat from django.db.models import Sum from typing import Dict, Any +from decimal import Decimal myLogger = logging.getLogger("log") @@ -176,7 +177,10 @@ class MpointCache: current_cache_val = self.data cache_key = self.cache_key last_data = current_cache_val["last_data"] - last_data["last_val"] = last_val*current_cache_val.get('coefficient', 1) + if last_val: + last_data["last_val"] = last_val*current_cache_val.get('coefficient', 1.0) + else: + last_data["last_val"] = last_val last_data["last_timex"] = last_timex last_mrs = None # 设备状态信号 mpoint_is_rep_ep_running_state = current_cache_val["is_rep_ep_running_state"]