fix: 光子get_alldata_with_batch优化2

This commit is contained in:
caoqianming 2025-06-24 11:23:45 +08:00
parent 53972fd22a
commit 9ff72b2da1
1 changed files with 4 additions and 2 deletions

View File

@ -101,7 +101,7 @@ def get_alldata_with_batch(batch: str):
data["棒料成型_切料人"] = list(set(data["棒料成型_切料人"]))
data["棒料成型_切料人"] = ";".join([item.name for item in data["棒料成型_切料人"]])
data["棒料成型_日期"] = list(set(data["棒料成型_日期"]))
data["棒料成型_日期"] = [item.strftime("%Y-%m-%d") for item in data["棒料成型_日期"]]
data["棒料成型_日期"] = ";".join([item.strftime("%Y-%m-%d") for item in data["棒料成型_日期"]])
try:
data["棒料成型_合格率"] = round((data["棒料成型_count_ok"] * 100/ data["棒料成型_count_real"]), 1)
except ZeroDivisionError:
@ -134,7 +134,7 @@ def get_alldata_with_batch(batch: str):
data["产品规格"] = ";".join([item.specification for item in data["产品规格"]])
data["管料成型_合格率"] = round((data["管料成型_count_ok"] * 100 / data["管料成型_count_real"]), 1)
data["管料成型_日期"] = list(set(data["管料成型_日期"]))
data["管料成型_日期"] = [item.strftime("%Y-%m-%d") for item in data["管料成型_日期"]]
data["管料成型_日期"] = ";".join([item.strftime("%Y-%m-%d") for item in data["管料成型_日期"]])
# 7车间生产入库数据/ 8车间中检数据
mioitem_count_fields = MIOItem.count_fields()
@ -483,6 +483,8 @@ def get_f_l_date(data):
for k, v in data.items():
if k.endswith("_日期"):
if v:
if isinstance(v, list):
myLogger.error(f"get_f_l_date {k} {v}")
v = v.split(";")
if first_date is None:
first_date = min(v)