From 91bc99a135cb05f910ab21ecf3fcbd19a54a20f3 Mon Sep 17 00:00:00 2001 From: caoqianming Date: Tue, 3 Dec 2024 11:13:55 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E5=AE=8C=E5=96=84get=5Falldata=5Fwith?= =?UTF-8?q?=5Fbatch4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/wpm/services_2.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/apps/wpm/services_2.py b/apps/wpm/services_2.py index c0acbb8d..c4eb78ff 100644 --- a/apps/wpm/services_2.py +++ b/apps/wpm/services_2.py @@ -127,8 +127,9 @@ def get_alldata_with_batch(batch: str): data[f'十车间入库_{field}'] += int(getattr(item, field)) data["十车间入库_抽检人"] = list(set(data["十车间入库_抽检人"])) data["十车间入库_抽检人"] = ";".join([item.name for item in data["十车间入库_抽检人"]]) - data["十车间入库_抽检合格数"] = data["十车间入库_count_sampling"] - data["十车间入库_count_notok"] - data["十车间入库_抽检合格率"] = round(data["十车间入库_抽检合格数"] * 100/ data["十车间入库_count_sampling"], 1) + if data["十车间入库_count_sampling"] > 0: + data["十车间入库_抽检合格数"] = data["十车间入库_count_sampling"] - data["十车间入库_count_notok"] + data["十车间入库_抽检合格率"] = round(data["十车间入库_抽检合格数"] * 100/ data["十车间入库_count_sampling"], 1) data["十车间入库_仓库执行人"] = list(set(data["十车间入库_仓库执行人"])) data["十车间入库_仓库执行人"] = ";".join([item.name for item in data["十车间入库_仓库执行人"]]) data["十车间入库_日期"] = list(set(data["十车间入库_日期"])) @@ -145,7 +146,7 @@ def get_alldata_with_batch(batch: str): for item in mlogs_glth_qs: if item.handle_date: data["管料退火_日期"].append(item.handle_date) - if item.mlog_user: + if item.handle_user: data["管料退火_操作人"].append(item.mlog_user) for field in mlog_count_fields: if getattr(item, field) > 0 or field in ["count", "count_notok"]: