From 03423e479161976426b7c0b1c8f0a99bd6be8f83 Mon Sep 17 00:00:00 2001 From: ZiWei <131428629+ZiWei09@users.noreply.github.com> Date: Tue, 13 Jan 2026 11:24:10 +0800 Subject: [PATCH] =?UTF-8?q?feat=EF=BC=9A=E5=A2=9E=E5=BC=BA=E6=9D=90?= =?UTF-8?q?=E6=96=99=E7=BC=93=E5=AD=98=E6=9B=B4=E6=96=B0=E9=80=BB=E8=BE=91?= =?UTF-8?q?=EF=BC=8C=E6=94=AF=E6=8C=81=E5=A4=84=E7=90=86=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E4=B8=AD=E7=9A=84=E8=AF=A6=E7=BB=86=E4=BF=A1?= =?UTF-8?q?=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../workstation/bioyond_studio/bioyond_rpc.py | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/unilabos/devices/workstation/bioyond_studio/bioyond_rpc.py b/unilabos/devices/workstation/bioyond_studio/bioyond_rpc.py index 6ea5e75..7d95365 100644 --- a/unilabos/devices/workstation/bioyond_studio/bioyond_rpc.py +++ b/unilabos/devices/workstation/bioyond_studio/bioyond_rpc.py @@ -193,6 +193,22 @@ class BioyondV1RPC(BaseRequest): self.material_cache[name] = mat_id print(f"已自动更新缓存: {name} -> {mat_id}") + # 处理返回数据中的 details (如果有) + # 有些 API 返回结构可能直接包含 details,或者在 data 字段中 + details = data.get("details", []) if isinstance(data, dict) else [] + if not details and isinstance(data, dict): + details = data.get("detail", []) + + if details: + for detail in details: + d_name = detail.get("name") + # 尝试从不同字段获取 ID + d_id = detail.get("id") or detail.get("detailMaterialId") + + if d_name and d_id: + self.material_cache[d_name] = d_id + print(f"已自动更新 detail 缓存: {d_name} -> {d_id}") + return data def query_matial_type_id(self, data) -> list: @@ -1128,6 +1144,10 @@ class BioyondV1RPC(BaseRequest): for detail_material in detail_materials: detail_name = detail_material.get("name") detail_id = detail_material.get("detailMaterialId") + if not detail_id: + # 尝试其他可能的字段 + detail_id = detail_material.get("id") + if detail_name and detail_id: self.material_cache[detail_name] = detail_id print(f"加载detail材料: {detail_name} -> ID: {detail_id}")