diff --git a/apps/wpm/services_2.py b/apps/wpm/services_2.py index 7fea0f5c..914a7490 100644 --- a/apps/wpm/services_2.py +++ b/apps/wpm/services_2.py @@ -74,7 +74,10 @@ def get_alldata_with_batch(batch: str): data["棒料成型_出料人"] = ";".join([item.name for item in data["棒料成型_出料人"]]) data["棒料成型_切料人"] = list(set(data["棒料成型_切料人"])) data["棒料成型_切料人"] = ";".join([item.name for item in data["棒料成型_切料人"]]) - data["棒料成型_合格率"] = round((data["棒料成型_count_ok"] * 100/ data["棒料成型_count_real"]), 1) + try: + data["棒料成型_合格率"] = round((data["棒料成型_count_ok"] * 100/ data["棒料成型_count_real"]), 1) + except ZeroDivisionError: + data["棒料成型_合格率"] = 0 # 管料成型数据 mgroup_glcx = Mgroup.objects.get(name="管料成型")