diff --git a/apps/enm/services.py b/apps/enm/services.py index 77399bc7..827e01d5 100644 --- a/apps/enm/services.py +++ b/apps/enm/services.py @@ -35,7 +35,11 @@ def translate_eval_formula(exp_str: str, year: int, month: int, day: int, hour: for match in matches: mpst = MpointStat.objects.filter(mpoint__code=match, type="hour", year=year, month=month, day=day, hour=hour).first() if mpst is None: - mpoint = Mpoint.objects.get(code=match) + try: + mpoint = Mpoint.objects.get(code=match) + except Exception as e: + myLogger.error(f"找不到该测点: exp_str: {exp_str} code: {match} {e}") + raise mpst, _ = MpointStat.objects.get_or_create(mpoint=mpoint, type="hour", year=year, month=month, day=day, hour=hour, defaults={"val": 0}) myLogger.error(f"找不到该测点的时间线数据: {match}, {year}, {month}, {day}, {hour}, 赋予0值") if mpst: