From 32bd2341760ea32e55b5e4adc0a183f0c9cc32a4 Mon Sep 17 00:00:00 2001 From: ZiWei <131428629+ZiWei09@users.noreply.github.com> Date: Sun, 23 Nov 2025 17:16:51 +0800 Subject: [PATCH] =?UTF-8?q?feat(bioyond):=20=E6=B7=BB=E5=8A=A0=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE=E5=8F=8D=E5=BA=94=E5=99=A8=E6=B8=A9=E5=BA=A6=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=EF=BC=8C=E6=94=AF=E6=8C=81=E6=B8=A9=E5=BA=A6=E8=8C=83?= =?UTF-8?q?=E5=9B=B4=E5=92=8C=E5=BC=82=E5=B8=B8=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bioyond_studio/reaction_station.py | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/unilabos/devices/workstation/bioyond_studio/reaction_station.py b/unilabos/devices/workstation/bioyond_studio/reaction_station.py index 43deda3..2884172 100644 --- a/unilabos/devices/workstation/bioyond_studio/reaction_station.py +++ b/unilabos/devices/workstation/bioyond_studio/reaction_station.py @@ -1336,3 +1336,35 @@ class BioyondReactionStation(BioyondWorkstation): except Exception as e: print(f"❌ 跳过滴定异常: {str(e)}") return {"code": 0, "message": str(e), "timestamp": int(time.time())} + + def set_reactor_temperature(self, reactor_id: int, temperature: float) -> str: + """ + 设置反应器温度 + + Args: + reactor_id: 反应器编号 (1-5) + temperature: 目标温度 (°C) + + Returns: + str: JSON 字符串,格式为 {"suc": True/False, "msg": "描述信息"} + """ + if reactor_id not in range(1, 6): + return json.dumps({"suc": False, "msg": "反应器编号必须在 1-5 之间"}) + + try: + payload = { + "deviceTypeName": f"反应模块{chr(64 + reactor_id)}", # 1->A, 2->B... + "temperature": float(temperature) + } + resp = requests.post( + f"{self.hardware_interface.host}/api/lims/device/set-reactor-temperatue", + json=payload, + headers={"Content-Type": "application/json"}, + timeout=10 + ) + if resp.status_code == 200: + return json.dumps({"suc": True, "msg": "温度设置成功"}) + else: + return json.dumps({"suc": False, "msg": f"温度设置失败,HTTP {resp.status_code}"}) + except Exception as e: + return json.dumps({"suc": False, "msg": f"温度设置异常: {str(e)}"})