fix: get_alldata_with_batch中小数计算异常捕获
This commit is contained in:
parent
1ff822161a
commit
fda9ecae94
|
@ -8,6 +8,9 @@ from datetime import datetime
|
||||||
from server.conf import BASE_PROJECT_CODE
|
from server.conf import BASE_PROJECT_CODE
|
||||||
import json
|
import json
|
||||||
from apps.utils.tools import MyJSONEncoder
|
from apps.utils.tools import MyJSONEncoder
|
||||||
|
import decimal
|
||||||
|
import logging
|
||||||
|
myLogger = logging.getLogger('log')
|
||||||
|
|
||||||
def get_alldata_with_batch_and_store(batch: str):
|
def get_alldata_with_batch_and_store(batch: str):
|
||||||
"""
|
"""
|
||||||
|
@ -80,6 +83,9 @@ def get_alldata_with_batch(batch: str):
|
||||||
data["棒料成型_合格率"] = round((data["棒料成型_count_ok"] * 100/ data["棒料成型_count_real"]), 1)
|
data["棒料成型_合格率"] = round((data["棒料成型_count_ok"] * 100/ data["棒料成型_count_real"]), 1)
|
||||||
except ZeroDivisionError:
|
except ZeroDivisionError:
|
||||||
data["棒料成型_合格率"] = 0
|
data["棒料成型_合格率"] = 0
|
||||||
|
except decimal.InvalidOperation:
|
||||||
|
myLogger.error(f"棒料成型_合格率计算错误decimal.InvalidOperation-{data}")
|
||||||
|
data["棒料成型_合格率"] = 0
|
||||||
|
|
||||||
# 管料成型数据
|
# 管料成型数据
|
||||||
mgroup_glcx = Mgroup.objects.get(name="管料成型")
|
mgroup_glcx = Mgroup.objects.get(name="管料成型")
|
||||||
|
|
Loading…
Reference in New Issue