From c03abb341a8502cceaf5b97c4661ec158667e19f Mon Sep 17 00:00:00 2001 From: lixinyu1011 <674842481@qq.com> Date: Sun, 16 Nov 2025 16:24:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=A5=94=E8=80=80=E8=BE=93?= =?UTF-8?q?=E5=85=A5=E9=85=8D=E6=96=B9=E7=9A=84=EF=BC=8C=E7=94=B5=E8=A7=A3?= =?UTF-8?q?=E6=B6=B2=E4=BD=93=E7=A7=AF=E4=B8=BA=E5=B0=8F=E6=95=B0=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bioyond_cell/bioyond_cell_workstation.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/unilabos/devices/workstation/bioyond_studio/bioyond_cell/bioyond_cell_workstation.py b/unilabos/devices/workstation/bioyond_studio/bioyond_cell/bioyond_cell_workstation.py index f49eae94..18479dc1 100644 --- a/unilabos/devices/workstation/bioyond_studio/bioyond_cell/bioyond_cell_workstation.py +++ b/unilabos/devices/workstation/bioyond_studio/bioyond_cell/bioyond_cell_workstation.py @@ -11,6 +11,7 @@ from datetime import datetime, timedelta import re import threading import json +from copy import deepcopy from urllib3 import response from unilabos.devices.workstation.bioyond_studio.station import BioyondWorkstation, BioyondResourceSynchronizer from unilabos.devices.workstation.bioyond_studio.config import ( @@ -547,6 +548,14 @@ class BioyondCellWorkstation(BioyondWorkstation): except Exception: return default + def _as_float(val, default=0.0) -> float: + try: + if pd.isna(val): + return default + return float(val) + except Exception: + return default + def _as_str(val, default="") -> str: if val is None or (isinstance(val, float) and pd.isna(val)): return default @@ -580,9 +589,9 @@ class BioyondCellWorkstation(BioyondWorkstation): "createTime": _to_ymd_slash(row[col_create_time]) if col_create_time else _to_ymd_slash(None), "bottleType": _as_str(row[col_bottle_type], default="配液小瓶") if col_bottle_type else "配液小瓶", "mixTime": _as_int(row[col_mix_time]) if col_mix_time else 0, - "loadSheddingInfo": _as_int(row[col_load]) if col_load else 0, - "pouchCellInfo": _as_int(row[col_pouch]) if col_pouch else 0, - "conductivityInfo": _as_int(row[col_cond]) if col_cond else 0, + "loadSheddingInfo": _as_float(row[col_load]) if col_load else 0.0, + "pouchCellInfo": _as_float(row[col_pouch]) if col_pouch else 0, + "conductivityInfo": _as_float(row[col_cond]) if col_cond else 0, "conductivityBottleCount": _as_int(row[col_cond_cnt]) if col_cond_cnt else 0, "materialInfos": mats, "totalMass": round(total_mass, 4) # 自动汇总