diff --git a/test/resources/test_resourcetreeset.py b/test/resources/test_resourcetreeset.py index 99c6a984..3d3bd4e7 100644 --- a/test/resources/test_resourcetreeset.py +++ b/test/resources/test_resourcetreeset.py @@ -15,9 +15,9 @@ lab_registry.setup() type_mapping = { - "加样头(大)": ("YB_jia_yang_tou_da_1X1_carrier", "3a190ca0-b2f6-9aeb-8067-547e72c11469"), + "加样头(大)": ("YB_jia_yang_tou_da", "3a190ca0-b2f6-9aeb-8067-547e72c11469"), "液": ("YB_1BottleCarrier", "3a190ca1-2add-2b23-f8e1-bbd348b7f790"), - "配液瓶(小)板": ("YB_6x_SmallSolutionBottleCarrier", "3a190c8b-3284-af78-d29f-9a69463ad047"), + "配液瓶(小)板": ("YB_peiyepingxiaoban", "3a190c8b-3284-af78-d29f-9a69463ad047"), "配液瓶(小)": ("YB_pei_ye_xiao_Bottler", "3a190c8c-fe8f-bf48-0dc3-97afc7f508eb"), } diff --git a/unilabos/app/ws_client.py b/unilabos/app/ws_client.py index c91ca8ec..d9f1a585 100644 --- a/unilabos/app/ws_client.py +++ b/unilabos/app/ws_client.py @@ -421,7 +421,7 @@ class MessageProcessor: ssl_context = ssl_module.create_default_context() ws_logger = logging.getLogger("websockets.client") - ws_logger.setLevel(logging.INFO) + # 日志级别已在 unilabos.utils.log 中统一配置为 WARNING async with websockets.connect( self.websocket_url, @@ -1197,7 +1197,7 @@ class WebSocketClient(BaseCommunicationClient): }, } self.message_processor.send_message(message) - logger.debug(f"[WebSocketClient] Device status published: {device_id}.{property_name}") + logger.trace(f"[WebSocketClient] Device status published: {device_id}.{property_name}") def publish_job_status( self, feedback_data: dict, item: QueueItem, status: str, return_info: Optional[dict] = None diff --git a/unilabos/devices/workstation/bioyond_studio/bioyond_cell/2025092701.xlsx b/unilabos/devices/workstation/bioyond_studio/bioyond_cell/2025092701.xlsx index 4147095e..9d069619 100644 Binary files a/unilabos/devices/workstation/bioyond_studio/bioyond_cell/2025092701.xlsx and b/unilabos/devices/workstation/bioyond_studio/bioyond_cell/2025092701.xlsx differ 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 a6722306..5ca2bb0f 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 @@ -3,6 +3,7 @@ from cgi import print_arguments from doctest import debug from typing import Dict, Any, List, Optional import requests +from pylabrobot.resources.resource import Resource as ResourcePLR from pathlib import Path import pandas as pd import time @@ -255,7 +256,7 @@ class BioyondCellWorkstation(BioyondWorkstation): def auto_feeding4to3( self, # ★ 修改点:默认模板路径 - xlsx_path: Optional[str] = "C:/ML/GitHub/Uni-Lab-OS/unilabos/devices/workstation/bioyond_studio/bioyond_cell/material_template.xlsx", + xlsx_path: Optional[str] = "/Users/sml/work/Unilab/Uni-Lab-OS/unilabos/devices/workstation/bioyond_studio/bioyond_cell/material_template.xlsx", # ---------------- WH4 - 加样头面 (Z=1, 12个点位) ---------------- WH4_x1_y1_z1_1_materialName: str = "", WH4_x1_y1_z1_1_quantity: float = 0.0, WH4_x2_y1_z1_2_materialName: str = "", WH4_x2_y1_z1_2_quantity: float = 0.0, @@ -307,7 +308,7 @@ class BioyondCellWorkstation(BioyondWorkstation): # ---------- 模式 1: Excel 导入 ---------- if xlsx_path: - path = Path(xlsx_path) + path = Path(__file__).parent / Path(xlsx_path) if path.exists(): # ★ 修改点:路径存在才加载 try: df = pd.read_excel(path, sheet_name=0, header=None, engine="openpyxl") @@ -472,14 +473,23 @@ class BioyondCellWorkstation(BioyondWorkstation): - totalMass 自动计算为所有物料质量之和 - createTime 缺失或为空时自动填充为当前日期(YYYY/M/D) """ - path = Path(xlsx_path) + default_path = Path("/Users/sml/work/Unilab/Uni-Lab-OS/unilabos/devices/workstation/bioyond_studio/bioyond_cell/2025092701.xlsx") + path = Path(xlsx_path) if xlsx_path else default_path + print(f"[create_orders] 使用 Excel 路径: {path}") + if path != default_path: + print("[create_orders] 来源: 调用方传入自定义路径") + else: + print("[create_orders] 来源: 使用默认模板路径") + if not path.exists(): + print(f"[create_orders] ⚠️ Excel 文件不存在: {path}") raise FileNotFoundError(f"未找到 Excel 文件:{path}") try: df = pd.read_excel(path, sheet_name=0, engine="openpyxl") except Exception as e: raise RuntimeError(f"读取 Excel 失败:{e}") + print(f"[create_orders] Excel 读取成功,行数: {len(df)}, 列: {list(df.columns)}") # 列名容错:返回可选列名,找不到则返回 None def _pick(col_names: List[str]) -> Optional[str]: @@ -496,9 +506,20 @@ class BioyondCellWorkstation(BioyondWorkstation): col_pouch = _pick(["软包组装分液体积", "pouchCellInfo"]) col_cond = _pick(["电导测试分液体积", "conductivityInfo"]) col_cond_cnt = _pick(["电导测试分液瓶数", "conductivityBottleCount"]) + print("[create_orders] 列匹配结果:", { + "order_name": col_order_name, + "create_time": col_create_time, + "bottle_type": col_bottle_type, + "mix_time": col_mix_time, + "load": col_load, + "pouch": col_pouch, + "conductivity": col_cond, + "conductivity_bottle_count": col_cond_cnt, + }) # 物料列:所有以 (g) 结尾 material_cols = [c for c in df.columns if isinstance(c, str) and c.endswith("(g)")] + print(f"[create_orders] 识别到的物料列: {material_cols}") if not material_cols: raise KeyError("未发现任何以“(g)”结尾的物料列,请检查表头。") @@ -546,6 +567,9 @@ class BioyondCellWorkstation(BioyondWorkstation): if mass > 0: mats.append({"name": mcol.replace("(g)", ""), "mass": mass}) total_mass += mass + else: + if mass < 0: + print(f"[create_orders] 第 {idx+1} 行物料 {mcol} 数值为负数: {mass}") order_data = { "batchId": batch_id, @@ -560,11 +584,22 @@ class BioyondCellWorkstation(BioyondWorkstation): "materialInfos": mats, "totalMass": round(total_mass, 4) # 自动汇总 } + print(f"[create_orders] 第 {idx+1} 行解析结果: orderName={order_data['orderName']}, " + f"loadShedding={order_data['loadSheddingInfo']}, pouchCell={order_data['pouchCellInfo']}, " + f"conductivity={order_data['conductivityInfo']}, totalMass={order_data['totalMass']}, " + f"material_count={len(mats)}") + + if order_data["totalMass"] <= 0: + print(f"[create_orders] ⚠️ 第 {idx+1} 行总质量 <= 0,可能导致 LIMS 校验失败") + if not mats: + print(f"[create_orders] ⚠️ 第 {idx+1} 行未找到有效物料") + orders.append(order_data) + print(f"[create_orders] 即将提交订单数量: {len(orders)}") response = self._post_lims("/api/lims/order/orders", orders) - print(response) + print(f"[create_orders] 接口返回: {response}") # 等待任务报送成功 data_list = response.get("data", []) if data_list: @@ -1015,24 +1050,71 @@ class BioyondCellWorkstation(BioyondWorkstation): "create_result": create_result, "inbound_result": inbound_result, } + def resource_tree_transfer(self, old_parent: ResourcePLR, plr_resource: ResourcePLR, parent_resource: ResourcePLR): + # ROS2DeviceNode.run_async_func(self._ros_node.resource_tree_transfer, True, **{ + # "old_parent": old_parent, + # "plr_resource": plr_resource, + # "parent_resource": parent_resource, + # }) + print("resource_tree_transfer", plr_resource, parent_resource) + if hasattr(plr_resource, "unilabos_extra") and plr_resource.unilabos_extra: + if "update_resource_site" in plr_resource.unilabos_extra: + site = plr_resource.unilabos_extra["update_resource_site"] + plr_model = plr_resource.model + board_type = None + for key, (moudle_name,moudle_uuid) in MATERIAL_TYPE_MAPPINGS.items(): + if plr_model == moudle_name: + board_type = key + break + if board_type is None: + pass + bottle1 = plr_resource.children[0] + bottle_moudle = bottle1.model + bottle_type = None + for key, (moudle_name, moudle_uuid) in MATERIAL_TYPE_MAPPINGS.items(): + if bottle_moudle == moudle_name: + bottle_type = key + break + + # 从 parent_resource 获取仓库名称 + warehouse_name = parent_resource.name if parent_resource else "手动堆栈" + logger.info(f"拖拽上料: {plr_resource.name} -> {warehouse_name} / {site}") + + self.create_sample(plr_resource.name, board_type, bottle_type, site, warehouse_name) + return + self.lab_logger().warning(f"无库位的上料,不处理,{plr_resource} 挂载到 {parent_resource}") def create_sample( self, name: str, board_type: str, bottle_type: str, - location_code: str + location_code: str, + warehouse_name: str = "手动堆栈" ) -> Dict[str, Any]: """创建配液板物料并自动入库。 Args: - material_name: 物料名称,支持 "5ml分液瓶板"/"5ml分液瓶"、"配液瓶(小)板"/"配液瓶(小)"。 - quantity: 主物料与明细的数量,默认 1。 - location_code: 库位编号,例如 "A01",将自动映射为 "手动堆栈" 下的 UUID。 + name: 物料名称 + board_type: 板类型,如 "5ml分液瓶板"、"配液瓶(小)板" + bottle_type: 瓶类型,如 "5ml分液瓶"、"配液瓶(小)" + location_code: 库位编号,例如 "A01" + warehouse_name: 仓库名称,默认为 "手动堆栈",支持 "自动堆栈-左"、"自动堆栈-右" 等 """ carrier_type_id = MATERIAL_TYPE_MAPPINGS[board_type][1] bottle_type_id = MATERIAL_TYPE_MAPPINGS[bottle_type][1] - location_id = WAREHOUSE_MAPPING["手动堆栈"]["site_uuids"][location_code] + + # 从指定仓库获取库位UUID + if warehouse_name not in WAREHOUSE_MAPPING: + logger.error(f"未找到仓库: {warehouse_name},回退到手动堆栈") + warehouse_name = "手动堆栈" + + if location_code not in WAREHOUSE_MAPPING[warehouse_name]["site_uuids"]: + logger.error(f"仓库 {warehouse_name} 中未找到库位 {location_code}") + raise ValueError(f"库位 {location_code} 在仓库 {warehouse_name} 中不存在") + + location_id = WAREHOUSE_MAPPING[warehouse_name]["site_uuids"][location_code] + logger.info(f"创建样品入库: {name} -> {warehouse_name}/{location_code} (UUID: {location_id})") # 新建小瓶 details = [] diff --git a/unilabos/devices/workstation/bioyond_studio/config.py b/unilabos/devices/workstation/bioyond_studio/config.py index b594125b..9606c788 100644 --- a/unilabos/devices/workstation/bioyond_studio/config.py +++ b/unilabos/devices/workstation/bioyond_studio/config.py @@ -8,8 +8,8 @@ import os # BioyondCellWorkstation 默认配置(包含所有必需参数) API_CONFIG = { # API 连接配置 - # "api_host": os.getenv("BIOYOND_API_HOST", "http://172.21.32.65:44389"),#实机 - "api_host": os.getenv("BIOYOND_API_HOST", "http://172.16.10.169:44388"),# 仿真机 + "api_host": os.getenv("BIOYOND_API_HOST", "http://172.16.1.143:44389"),#实机 + # "api_host": os.getenv("BIOYOND_API_HOST", "http://172.16.7.149:44388"),# 仿真机 "api_key": os.getenv("BIOYOND_API_KEY", "8A819E5C"), "timeout": int(os.getenv("BIOYOND_TIMEOUT", "30")), @@ -17,7 +17,7 @@ API_CONFIG = { "report_token": os.getenv("BIOYOND_REPORT_TOKEN", "CHANGE_ME_TOKEN"), # HTTP 服务配置 - "HTTP_host": os.getenv("BIOYOND_HTTP_HOST", "172.21.32.115"), # HTTP服务监听地址,监听计算机飞连ip地址 + "HTTP_host": os.getenv("BIOYOND_HTTP_HOST", "172.16.2.140"), # HTTP服务监听地址,监听计算机飞连ip地址 "HTTP_port": int(os.getenv("BIOYOND_HTTP_PORT", "8080")), "debug_mode": False,# 调试模式 } @@ -234,22 +234,22 @@ WAREHOUSE_MAPPING = { # 物料类型配置 MATERIAL_TYPE_MAPPINGS = { - "100ml液体": ("YB_1Bottle100mlCarrier", "d37166b3-ecaa-481e-bd84-3032b795ba07"), - "液": ("YB_1BottleCarrier", "3a190ca1-2add-2b23-f8e1-bbd348b7f790"), - "高粘液": ("YB_1GaoNianYeBottleCarrier", "abe8df30-563d-43d2-85e0-cabec59ddc16"), - "加样头(大)": ("YB_jia_yang_tou_da_1X1_carrier", "3a190ca0-b2f6-9aeb-8067-547e72c11469"), - # "加样头(大)板": ("YB_jia_yang_tou_da_1X1_carrier", "a8e714ae-2a4e-4eb9-9614-e4c140ec3f16"), - "5ml分液瓶板": ("YB_6x5ml_DispensingVialCarrier", "3a192fa4-007d-ec7b-456e-2a8be7a13f23"), - "5ml分液瓶": ("YB_fen_ye_5ml_Bottle", "3a192c2a-ebb7-58a1-480d-8b3863bf74f4"), - "20ml分液瓶板": ("YB_6x20ml_DispensingVialCarrier", "3a192fa4-47db-3449-162a-eaf8aba57e27"), - "20ml分液瓶": ("YB_fen_ye_20ml_Bottle", "3a192c2b-19e8-f0a3-035e-041ca8ca1035"), - "配液瓶(小)板": ("YB_6x_SmallSolutionBottleCarrier", "3a190c8b-3284-af78-d29f-9a69463ad047"), + "100ml液体": ("YB_100ml_yeti", "d37166b3-ecaa-481e-bd84-3032b795ba07"), + "液": ("YB_ye", "3a190ca1-2add-2b23-f8e1-bbd348b7f790"), + "高粘液": ("YB_gaonianye", "abe8df30-563d-43d2-85e0-cabec59ddc16"), + "加样头(大)": ("YB_jia_yang_tou_da", "3a190ca0-b2f6-9aeb-8067-547e72c11469"), + # "加样头(大)板": ("YB_jia_yang_tou_da", "a8e714ae-2a4e-4eb9-9614-e4c140ec3f16"), + "5ml分液瓶板": ("YB_5ml_fenyepingban", "3a192fa4-007d-ec7b-456e-2a8be7a13f23"), + "5ml分液瓶": ("YB_5ml_fenyeping", "3a192c2a-ebb7-58a1-480d-8b3863bf74f4"), + "20ml分液瓶板": ("YB_20ml_fenyepingban", "3a192fa4-47db-3449-162a-eaf8aba57e27"), + "20ml分液瓶": ("YB_20ml_fenyeping", "3a192c2b-19e8-f0a3-035e-041ca8ca1035"), + "配液瓶(小)板": ("YB_peiyepingxiaoban", "3a190c8b-3284-af78-d29f-9a69463ad047"), "配液瓶(小)": ("YB_pei_ye_xiao_Bottle", "3a190c8c-fe8f-bf48-0dc3-97afc7f508eb"), - "配液瓶(大)板": ("YB_4x_LargeSolutionBottleCarrier", "53e50377-32dc-4781-b3c0-5ce45bc7dc27"), + "配液瓶(大)板": ("YB_peiyepingdaban", "53e50377-32dc-4781-b3c0-5ce45bc7dc27"), "配液瓶(大)": ("YB_pei_ye_da_Bottle", "19c52ad1-51c5-494f-8854-576f4ca9c6ca"), - "适配器块": ("YB_AdapterBlock", "efc3bb32-d504-4890-91c0-b64ed3ac80cf"), - "枪头盒": ("YB_TipBox", "3a192c2e-20f3-a44a-0334-c8301839d0b3"), - "枪头": ("YB_Pipette_Tip", "b6196971-1050-46da-9927-333e8dea062d"), + "适配器块": ("YB_shi_pei_qi_kuai", "efc3bb32-d504-4890-91c0-b64ed3ac80cf"), + "枪头盒": ("YB_qiang_tou_he", "3a192c2e-20f3-a44a-0334-c8301839d0b3"), + "枪头": ("YB_qiang_tou", "b6196971-1050-46da-9927-333e8dea062d"), } SOLID_LIQUID_MAPPINGS = { diff --git a/unilabos/devices/workstation/bioyond_studio/station.py b/unilabos/devices/workstation/bioyond_studio/station.py index d6fe4870..44f9cf19 100644 --- a/unilabos/devices/workstation/bioyond_studio/station.py +++ b/unilabos/devices/workstation/bioyond_studio/station.py @@ -177,7 +177,18 @@ class BioyondWorkstation(WorkstationBase): ROS2DeviceNode.run_async_func(self._ros_node.update_resource, True, **{ "resources": [self.deck] }) - + def resource_tree_transfer(self, old_parent: ResourcePLR, plr_resource: ResourcePLR, parent_resource: ResourcePLR): + # ROS2DeviceNode.run_async_func(self._ros_node.resource_tree_transfer, True, **{ + # "old_parent": old_parent, + # "plr_resource": plr_resource, + # "parent_resource": parent_resource, + # }) + print("resource_tree_transfer", plr_resource, parent_resource) + if hasattr(plr_resource, "unilabos_data") and plr_resource.unilabos_data: + if "update_resource_site" in plr_resource.unilabos_data: + site = plr_resource.unilabos_data["update_resource_site"] + return + self.lab_logger().warning(f"无库位的上料,不处理,{plr_resource} 挂载到 {parent_resource}") def transfer_resource_to_another(self, resource: List[ResourceSlot], mount_resource: List[ResourceSlot], sites: List[str], mount_device_id: DeviceSlot): ROS2DeviceNode.run_async_func(self._ros_node.transfer_resource_to_another, True, **{ "plr_resources": resource, diff --git a/unilabos/devices/workstation/coin_cell_assembly.zip b/unilabos/devices/workstation/coin_cell_assembly.zip deleted file mode 100644 index b95b7f4a..00000000 Binary files a/unilabos/devices/workstation/coin_cell_assembly.zip and /dev/null differ diff --git a/unilabos/devices/workstation/coin_cell_assembly/YB_YH_materials.py b/unilabos/devices/workstation/coin_cell_assembly/YB_YH_materials.py index d5f447c1..1e929c80 100644 --- a/unilabos/devices/workstation/coin_cell_assembly/YB_YH_materials.py +++ b/unilabos/devices/workstation/coin_cell_assembly/YB_YH_materials.py @@ -636,5 +636,5 @@ class CoincellDeck(Deck): if __name__ == "__main__": - deck = CoincellDeck(setup=True) + deck = create_coin_cell_deck() print(deck) \ No newline at end of file diff --git a/unilabos/devices/workstation/coin_cell_assembly/coin_cell_assembly.py b/unilabos/devices/workstation/coin_cell_assembly/coin_cell_assembly.py index f7f8e33b..8c2cf5f1 100644 --- a/unilabos/devices/workstation/coin_cell_assembly/coin_cell_assembly.py +++ b/unilabos/devices/workstation/coin_cell_assembly/coin_cell_assembly.py @@ -879,7 +879,7 @@ class CoinCellAssemblyWorkstation(WorkstationBase): return self.success - def func_allpack_cmd(self, elec_num, elec_use_num, elec_vol:int=50, assembly_type:int=7, assembly_pressure:int=4200, file_path: str="C:\\Users\\67484\\Desktop") -> bool: + def func_allpack_cmd(self, elec_num, elec_use_num, elec_vol:int=50, assembly_type:int=7, assembly_pressure:int=4200, file_path: str="/Users/sml/work") -> bool: elec_num, elec_use_num, elec_vol, assembly_type, assembly_pressure = int(elec_num), int(elec_use_num), int(elec_vol), int(assembly_type), int(assembly_pressure) summary_csv_file = os.path.join(file_path, "duandian.csv") # 如果断点文件存在,先读取之前的进度 diff --git a/unilabos/devices/workstation/coin_cell_assembly/coin_cell_assembly_1105.csv b/unilabos/devices/workstation/coin_cell_assembly/coin_cell_assembly_1105.csv new file mode 100644 index 00000000..3f7b357f --- /dev/null +++ b/unilabos/devices/workstation/coin_cell_assembly/coin_cell_assembly_1105.csv @@ -0,0 +1,64 @@ +Name,DataType,InitValue,Comment,Attribute,DeviceType,Address, +COIL_SYS_START_CMD,BOOL,,,,coil,9010, +COIL_SYS_STOP_CMD,BOOL,,,,coil,9020, +COIL_SYS_RESET_CMD,BOOL,,,,coil,9030, +COIL_SYS_HAND_CMD,BOOL,,,,coil,9040, +COIL_SYS_AUTO_CMD,BOOL,,,,coil,9050, +COIL_SYS_INIT_CMD,BOOL,,,,coil,9060, +COIL_UNILAB_SEND_MSG_SUCC_CMD,BOOL,,,,coil,9700, +COIL_UNILAB_REC_MSG_SUCC_CMD,BOOL,,,,coil,9710,unilab_rec_msg_succ_cmd +COIL_SYS_START_STATUS,BOOL,,,,coil,9210, +COIL_SYS_STOP_STATUS,BOOL,,,,coil,9220, +COIL_SYS_RESET_STATUS,BOOL,,,,coil,9230, +COIL_SYS_HAND_STATUS,BOOL,,,,coil,9240, +COIL_SYS_AUTO_STATUS,BOOL,,,,coil,9250, +COIL_SYS_INIT_STATUS,BOOL,,,,coil,9260, +COIL_REQUEST_REC_MSG_STATUS,BOOL,,,,coil,9500, +COIL_REQUEST_SEND_MSG_STATUS,BOOL,,,,coil,9510,request_send_msg_status +REG_MSG_ELECTROLYTE_USE_NUM,INT16,,,,hold_register,17000, +REG_MSG_ELECTROLYTE_NUM,INT16,,,,hold_register,17002,unilab_send_msg_electrolyte_num +REG_MSG_ELECTROLYTE_VOLUME,INT16,,,,hold_register,17004,unilab_send_msg_electrolyte_vol +REG_MSG_ASSEMBLY_TYPE,INT16,,,,hold_register,17006,unilab_send_msg_assembly_type +REG_MSG_ASSEMBLY_PRESSURE,INT16,,,,hold_register,17008,unilab_send_msg_assembly_pressure +REG_DATA_ASSEMBLY_COIN_CELL_NUM,INT16,,,,hold_register,16000,data_assembly_coin_cell_num +REG_DATA_OPEN_CIRCUIT_VOLTAGE,FLOAT32,,,,hold_register,16002,data_open_circuit_voltage +REG_DATA_AXIS_X_POS,FLOAT32,,,,hold_register,16004, +REG_DATA_AXIS_Y_POS,FLOAT32,,,,hold_register,16006, +REG_DATA_AXIS_Z_POS,FLOAT32,,,,hold_register,16008, +REG_DATA_POLE_WEIGHT,FLOAT32,,,,hold_register,16010,data_pole_weight +REG_DATA_ASSEMBLY_PER_TIME,FLOAT32,,,,hold_register,16012,data_assembly_time +REG_DATA_ASSEMBLY_PRESSURE,INT16,,,,hold_register,16014,data_assembly_pressure +REG_DATA_ELECTROLYTE_VOLUME,INT16,,,,hold_register,16016,data_electrolyte_volume +REG_DATA_COIN_NUM,INT16,,,,hold_register,16018,data_coin_num +REG_DATA_ELECTROLYTE_CODE,STRING,,,,hold_register,16020,data_electrolyte_code() +REG_DATA_COIN_CELL_CODE,STRING,,,,hold_register,16030,data_coin_cell_code() +REG_DATA_STACK_VISON_CODE,STRING,,,,hold_register,18004,data_stack_vision_code() +REG_DATA_GLOVE_BOX_PRESSURE,FLOAT32,,,,hold_register,16050,data_glove_box_pressure +REG_DATA_GLOVE_BOX_WATER_CONTENT,FLOAT32,,,,hold_register,16052,data_glove_box_water_content +REG_DATA_GLOVE_BOX_O2_CONTENT,FLOAT32,,,,hold_register,16054,data_glove_box_o2_content +UNILAB_SEND_ELECTROLYTE_BOTTLE_NUM,BOOL,,,,coil,9720, +UNILAB_RECE_ELECTROLYTE_BOTTLE_NUM,BOOL,,,,coil,9520, +REG_MSG_ELECTROLYTE_NUM_USED,INT16,,,,hold_register,17496, +REG_DATA_ELECTROLYTE_USE_NUM,INT16,,,,hold_register,16000, +UNILAB_SEND_FINISHED_CMD,BOOL,,,,coil,9730, +UNILAB_RECE_FINISHED_CMD,BOOL,,,,coil,9530, +REG_DATA_ASSEMBLY_TYPE,INT16,,,,hold_register,16018,ASSEMBLY_TYPE7or8 +COIL_ALUMINUM_FOIL,BOOL,,使用铝箔垫,,coil,9340, +REG_MSG_NE_PLATE_MATRIX,INT16,,负极片矩阵点位,,hold_register,17440, +REG_MSG_SEPARATOR_PLATE_MATRIX,INT16,,隔膜矩阵点位,,hold_register,17450, +REG_MSG_TIP_BOX_MATRIX,INT16,,移液枪头矩阵点位,,hold_register,17480, +REG_MSG_NE_PLATE_NUM,INT16,,负极片盘数,,hold_register,17443, +REG_MSG_SEPARATOR_PLATE_NUM,INT16,,隔膜盘数,,hold_register,17453, +REG_MSG_PRESS_MODE,BOOL,,压制模式(false:压力检测模式,True:距离模式),,coil,9360,电池压制模式 +,,,,,,, +,BOOL,,视觉对位(false:使用,true:忽略),,coil,9300,视觉对位 +,BOOL,,复检(false:使用,true:忽略),,coil,9310,视觉复检 +,BOOL,,手套箱_左仓(false:使用,true:忽略),,coil,9320,手套箱左仓 +,BOOL,,手套箱_右仓(false:使用,true:忽略),,coil,9420,手套箱右仓 +,BOOL,,真空检知(false:使用,true:忽略),,coil,9350,真空检知 +,BOOL,,电解液添加模式(false:单次滴液,true:二次滴液),,coil,9370,滴液模式 +,BOOL,,正极片称重(false:使用,true:忽略),,coil,9380,正极片称重 +,BOOL,,正负极片组装方式(false:正装,true:倒装),,coil,9390,正负极反装 +,BOOL,,压制清洁(false:使用,true:忽略),,coil,9400,压制清洁 +,BOOL,,物料盘摆盘方式(false:水平摆盘,true:堆叠摆盘),,coil,9410,负极片摆盘方式 +REG_MSG_BATTERY_CLEAN_IGNORE,BOOL,,忽略电池清洁(false:使用,true:忽略),,coil,9460, diff --git a/unilabos/registry/devices/coin_cell_workstation.yaml b/unilabos/registry/devices/coin_cell_workstation.yaml index 06caa0f9..be2bcaaa 100644 --- a/unilabos/registry/devices/coin_cell_workstation.yaml +++ b/unilabos/registry/devices/coin_cell_workstation.yaml @@ -502,7 +502,7 @@ coincellassemblyworkstation_device: config_info: [] description: '' handles: [] - icon: '' + icon: coin_cell_assembly_picture.webp init_param_schema: config: properties: diff --git a/unilabos/registry/resources/bioyond/YB_bottle.yaml b/unilabos/registry/resources/bioyond/YB_bottle.yaml index 6d8a380d..7cafab48 100644 --- a/unilabos/registry/resources/bioyond/YB_bottle.yaml +++ b/unilabos/registry/resources/bioyond/YB_bottle.yaml @@ -1,37 +1,37 @@ -YB_Pipette_Tip: +YB_qiang_tou: category: - yb3 - YB_bottle class: - module: unilabos.resources.bioyond.YB_bottles:YB_Pipette_Tip + module: unilabos.resources.bioyond.YB_bottles:YB_qiang_tou type: pylabrobot - description: YB_Pipette_Tip + description: YB_qiang_tou handles: [] icon: '' init_param_schema: {} registry_type: resource version: 1.0.0 -YB_fen_ye_20ml_Bottle: +YB_20ml_fenyeping: category: - yb3 - YB_bottle class: - module: unilabos.resources.bioyond.YB_bottles:YB_fen_ye_20ml_Bottle + module: unilabos.resources.bioyond.YB_bottles:YB_20ml_fenyeping type: pylabrobot - description: YB_fen_ye_20ml_Bottle + description: YB_20ml_fenyeping handles: [] icon: '' init_param_schema: {} registry_type: resource version: 1.0.0 -YB_fen_ye_5ml_Bottle: +YB_5ml_fenyeping: category: - yb3 - YB_bottle class: - module: unilabos.resources.bioyond.YB_bottles:YB_fen_ye_5ml_Bottle + module: unilabos.resources.bioyond.YB_bottles:YB_5ml_fenyeping type: pylabrobot - description: YB_fen_ye_5ml_Bottle + description: YB_5ml_fenyeping handles: [] icon: '' init_param_schema: {} diff --git a/unilabos/registry/resources/bioyond/YB_bottle_carriers.yaml b/unilabos/registry/resources/bioyond/YB_bottle_carriers.yaml index eb2ff6fc..a387ca64 100644 --- a/unilabos/registry/resources/bioyond/YB_bottle_carriers.yaml +++ b/unilabos/registry/resources/bioyond/YB_bottle_carriers.yaml @@ -1,11 +1,11 @@ -YB_1Bottle100mlCarrier: +YB_100ml_yeti: category: - yb3 - YB_bottle_carriers class: - module: unilabos.resources.bioyond.YB_bottle_carriers:YB_1Bottle100mlCarrier + module: unilabos.resources.bioyond.YB_bottle_carriers:YB_100ml_yeti type: pylabrobot - description: YB_1Bottle100mlCarrier + description: YB_100ml_yeti handles: [] icon: '' init_param_schema: {} @@ -24,27 +24,27 @@ YB_1BottleCarrier: init_param_schema: {} registry_type: resource version: 1.0.0 -YB_1GaoNianYeBottleCarrier: +YB_gaonianye: category: - yb3 - YB_bottle_carriers class: - module: unilabos.resources.bioyond.YB_bottle_carriers:YB_1GaoNianYeBottleCarrier + module: unilabos.resources.bioyond.YB_bottle_carriers:YB_gaonianye type: pylabrobot - description: YB_1GaoNianYeBottleCarrier + description: YB_gaonianye handles: [] icon: '' init_param_schema: {} registry_type: resource version: 1.0.0 -YB_4x_LargeSolutionBottleCarrier: +YB_peiyepingdaban: category: - yb3 - YB_bottle_carriers class: - module: unilabos.resources.bioyond.YB_bottle_carriers:YB_4x_LargeSolutionBottleCarrier + module: unilabos.resources.bioyond.YB_bottle_carriers:YB_peiyepingdaban type: pylabrobot - description: YB_4x_LargeSolutionBottleCarrier + description: YB_peiyepingdaban handles: [] icon: '' init_param_schema: {} @@ -76,66 +76,66 @@ YB_6VialCarrier: init_param_schema: {} registry_type: resource version: 1.0.0 -YB_6x20ml_DispensingVialCarrier: +YB_20ml_fenyepingban: category: - yb3 - YB_bottle_carriers class: - module: unilabos.resources.bioyond.YB_bottle_carriers:YB_6x20ml_DispensingVialCarrier + module: unilabos.resources.bioyond.YB_bottle_carriers:YB_20ml_fenyepingban type: pylabrobot - description: YB_6x20ml_DispensingVialCarrier + description: YB_20ml_fenyepingban handles: [] icon: '' init_param_schema: {} registry_type: resource version: 1.0.0 -YB_6x5ml_DispensingVialCarrier: +YB_5ml_fenyepingban: category: - yb3 - YB_bottle_carriers class: - module: unilabos.resources.bioyond.YB_bottle_carriers:YB_6x5ml_DispensingVialCarrier + module: unilabos.resources.bioyond.YB_bottle_carriers:YB_5ml_fenyepingban type: pylabrobot - description: YB_6x5ml_DispensingVialCarrier + description: YB_5ml_fenyepingban handles: [] icon: '' init_param_schema: {} registry_type: resource version: 1.0.0 -YB_6x_SmallSolutionBottleCarrier: +YB_peiyepingxiaoban: category: - yb3 - YB_bottle_carriers class: - module: unilabos.resources.bioyond.YB_bottle_carriers:YB_6x_SmallSolutionBottleCarrier + module: unilabos.resources.bioyond.YB_bottle_carriers:YB_peiyepingxiaoban type: pylabrobot - description: YB_6x_SmallSolutionBottleCarrier + description: YB_peiyepingxiaoban handles: [] icon: '' init_param_schema: {} registry_type: resource version: 1.0.0 -YB_AdapterBlock: +YB_shi_pei_qi_kuai: category: - yb3 - YB_bottle_carriers class: - module: unilabos.resources.bioyond.YB_bottle_carriers:YB_AdapterBlock + module: unilabos.resources.bioyond.YB_bottle_carriers:YB_shi_pei_qi_kuai type: pylabrobot - description: YB_AdapterBlock + description: YB_shi_pei_qi_kuai handles: [] icon: '' init_param_schema: {} registry_type: resource version: 1.0.0 -YB_TipBox: +YB_qiang_tou_he: category: - yb3 - YB_bottle_carriers class: - module: unilabos.resources.bioyond.YB_bottle_carriers:YB_TipBox + module: unilabos.resources.bioyond.YB_bottle_carriers:YB_qiang_tou_he type: pylabrobot - description: YB_TipBox + description: YB_qiang_tou_he handles: [] icon: '' init_param_schema: {} @@ -167,14 +167,14 @@ YB_jia_yang_tou_da: init_param_schema: {} registry_type: resource version: 1.0.0 -YB_jia_yang_tou_da_1X1_carrier: +YB_jia_yang_tou_da_Carrier: category: - yb3 - YB_bottle_carriers class: - module: unilabos.resources.bioyond.YB_bottle_carriers:YB_jia_yang_tou_da_1X1_carrier + module: unilabos.resources.bioyond.YB_bottle_carriers:YB_jia_yang_tou_da_Carrier type: pylabrobot - description: YB_jia_yang_tou_da_1X1_carrier + description: YB_jia_yang_tou_da_Carrier handles: [] icon: '' init_param_schema: {} diff --git a/unilabos/resources/bioyond/YB_bottle_carriers.py b/unilabos/resources/bioyond/YB_bottle_carriers.py index 01d64c52..28c8fcc1 100644 --- a/unilabos/resources/bioyond/YB_bottle_carriers.py +++ b/unilabos/resources/bioyond/YB_bottle_carriers.py @@ -6,11 +6,11 @@ from unilabos.resources.bioyond.YB_bottles import ( YB_ye_Bottle, YB_ye_100ml_Bottle, YB_gao_nian_ye_Bottle, - YB_fen_ye_5ml_Bottle, - YB_fen_ye_20ml_Bottle, + YB_5ml_fenyeping, + YB_20ml_fenyeping, YB_pei_ye_xiao_Bottle, YB_pei_ye_da_Bottle, - YB_Pipette_Tip, + YB_qiang_tou, ) # 命名约定:试剂瓶-Bottle,烧杯-Beaker,烧瓶-Flask,小瓶-Vial @@ -233,7 +233,7 @@ def YB_1BottleCarrier(name: str) -> BottleCarrier: resource_size_y=beaker_diameter, name_prefix=name, ), - model="1BottleCarrier", + model="YB_1BottleCarrier", ) carrier.num_items_x = 1 carrier.num_items_y = 1 @@ -243,7 +243,7 @@ def YB_1BottleCarrier(name: str) -> BottleCarrier: # 高粘液瓶载架 - 单个中央位置 -def YB_1GaoNianYeBottleCarrier(name: str) -> BottleCarrier: +def YB_gaonianye(name: str) -> BottleCarrier: # 载架尺寸 (mm) carrier_size_x = 127.8 @@ -270,7 +270,7 @@ def YB_1GaoNianYeBottleCarrier(name: str) -> BottleCarrier: resource_size_y=beaker_diameter, name_prefix=name, ), - model="1GaoNianYeBottleCarrier", + model="YB_gaonianye", ) carrier.num_items_x = 1 carrier.num_items_y = 1 @@ -280,7 +280,7 @@ def YB_1GaoNianYeBottleCarrier(name: str) -> BottleCarrier: # 100ml液体瓶载架 - 单个中央位置 -def YB_1Bottle100mlCarrier(name: str) -> BottleCarrier: +def YB_100ml_yeti(name: str) -> BottleCarrier: # 载架尺寸 (mm) carrier_size_x = 127.8 @@ -307,7 +307,7 @@ def YB_1Bottle100mlCarrier(name: str) -> BottleCarrier: resource_size_y=beaker_diameter, name_prefix=name, ), - model="1Bottle100mlCarrier", + model="YB_100ml_yeti", ) carrier.num_items_x = 1 carrier.num_items_y = 1 @@ -316,7 +316,7 @@ def YB_1Bottle100mlCarrier(name: str) -> BottleCarrier: return carrier # 5ml分液瓶板 - 4x2布局,8个位置 -def YB_6x5ml_DispensingVialCarrier(name: str) -> BottleCarrier: +def YB_5ml_fenyepingban(name: str) -> BottleCarrier: # 载架尺寸 (mm) @@ -355,18 +355,18 @@ def YB_6x5ml_DispensingVialCarrier(name: str) -> BottleCarrier: size_y=carrier_size_y, size_z=carrier_size_z, sites=sites, - model="6x5ml_DispensingVialCarrier", + model="YB_5ml_fenyepingban", ) carrier.num_items_x = 4 carrier.num_items_y = 2 carrier.num_items_z = 1 ordering = ["A1", "A2", "A3", "A4", "B1", "B2", "B3", "B4"] for i in range(8): - carrier[i] = YB_fen_ye_5ml_Bottle(f"{name}_vial_{ordering[i]}") + carrier[i] = YB_5ml_fenyeping(f"{name}_vial_{ordering[i]}") return carrier # 20ml分液瓶板 - 4x2布局,8个位置 -def YB_6x20ml_DispensingVialCarrier(name: str) -> BottleCarrier: +def YB_20ml_fenyepingban(name: str) -> BottleCarrier: # 载架尺寸 (mm) @@ -405,18 +405,18 @@ def YB_6x20ml_DispensingVialCarrier(name: str) -> BottleCarrier: size_y=carrier_size_y, size_z=carrier_size_z, sites=sites, - model="6x20ml_DispensingVialCarrier", + model="YB_20ml_fenyepingban", ) carrier.num_items_x = 4 carrier.num_items_y = 2 carrier.num_items_z = 1 ordering = ["A1", "A2", "A3", "A4", "B1", "B2", "B3", "B4"] for i in range(8): - carrier[i] = YB_fen_ye_20ml_Bottle(f"{name}_vial_{ordering[i]}") + carrier[i] = YB_20ml_fenyeping(f"{name}_vial_{ordering[i]}") return carrier # 配液瓶(小)板 - 4x2布局,8个位置 -def YB_6x_SmallSolutionBottleCarrier(name: str) -> BottleCarrier: +def YB_peiyepingxiaoban(name: str) -> BottleCarrier: # 载架尺寸 (mm) @@ -455,7 +455,7 @@ def YB_6x_SmallSolutionBottleCarrier(name: str) -> BottleCarrier: size_y=carrier_size_y, size_z=carrier_size_z, sites=sites, - model="6x_SmallSolutionBottleCarrier", + model="YB_peiyepingxiaoban", ) carrier.num_items_x = 4 carrier.num_items_y = 2 @@ -467,7 +467,7 @@ def YB_6x_SmallSolutionBottleCarrier(name: str) -> BottleCarrier: # 配液瓶(大)板 - 2x2布局,4个位置 -def YB_4x_LargeSolutionBottleCarrier(name: str) -> BottleCarrier: +def YB_peiyepingdaban(name: str) -> BottleCarrier: # 载架尺寸 (mm) carrier_size_x = 127.8 @@ -505,7 +505,7 @@ def YB_4x_LargeSolutionBottleCarrier(name: str) -> BottleCarrier: size_y=carrier_size_y, size_z=carrier_size_z, sites=sites, - model="4x_LargeSolutionBottleCarrier", + model="YB_peiyepingdaban", ) carrier.num_items_x = 2 carrier.num_items_y = 2 @@ -516,7 +516,7 @@ def YB_4x_LargeSolutionBottleCarrier(name: str) -> BottleCarrier: return carrier # 加样头(大)板 - 1x1布局,1个位置 -def YB_jia_yang_tou_da_1X1_carrier(name: str) -> BottleCarrier: +def YB_jia_yang_tou_da_Carrier(name: str) -> BottleCarrier: # 载架尺寸 (mm) carrier_size_x = 127.8 @@ -554,7 +554,7 @@ def YB_jia_yang_tou_da_1X1_carrier(name: str) -> BottleCarrier: size_y=carrier_size_y, size_z=carrier_size_z, sites=sites, - model="6x_LargeDispenseHeadCarrier", + model="YB_jia_yang_tou_da_Carrier", ) carrier.num_items_x = 1 carrier.num_items_y = 1 @@ -563,7 +563,7 @@ def YB_jia_yang_tou_da_1X1_carrier(name: str) -> BottleCarrier: return carrier -def YB_AdapterBlock(name: str) -> BottleCarrier: +def YB_shi_pei_qi_kuai(name: str) -> BottleCarrier: """适配器块 - 单个中央位置""" # 载架尺寸 (mm) @@ -591,7 +591,7 @@ def YB_AdapterBlock(name: str) -> BottleCarrier: resource_size_y=adapter_diameter, name_prefix=name, ), - model="AdapterBlock", + model="YB_shi_pei_qi_kuai", ) carrier.num_items_x = 1 carrier.num_items_y = 1 @@ -600,7 +600,7 @@ def YB_AdapterBlock(name: str) -> BottleCarrier: return carrier -def YB_TipBox(name: str) -> BottleCarrier: +def YB_qiang_tou_he(name: str) -> BottleCarrier: """枪头盒 - 8x12布局,96个位置""" # 载架尺寸 (mm) @@ -639,7 +639,7 @@ def YB_TipBox(name: str) -> BottleCarrier: size_y=carrier_size_y, size_z=carrier_size_z, sites=sites, - model="TipBox", + model="YB_qiang_tou_he", ) carrier.num_items_x = 12 carrier.num_items_y = 8 @@ -648,6 +648,6 @@ def YB_TipBox(name: str) -> BottleCarrier: for i in range(96): row = chr(65 + i // 12) # A-H col = (i % 12) + 1 # 1-12 - carrier[i] = YB_Pipette_Tip(f"{name}_tip_{row}{col}") + carrier[i] = YB_qiang_tou(f"{name}_tip_{row}{col}") return carrier diff --git a/unilabos/resources/bioyond/YB_bottles.py b/unilabos/resources/bioyond/YB_bottles.py index 8ebdb415..c8f1c950 100644 --- a/unilabos/resources/bioyond/YB_bottles.py +++ b/unilabos/resources/bioyond/YB_bottles.py @@ -15,7 +15,7 @@ def YB_jia_yang_tou_da( height=height, max_volume=max_volume, barcode=barcode, - model="Solid_Stock", + model="YB_jia_yang_tou_da", ) """液1x1""" @@ -51,7 +51,7 @@ def YB_ye_100ml_Bottle( height=height, max_volume=max_volume, barcode=barcode, - model="Liquid_Bottle_100ml", + model="YB_100ml_yeti", ) """高粘液""" @@ -73,7 +73,7 @@ def YB_gao_nian_ye_Bottle( ) """5ml分液瓶""" -def YB_fen_ye_5ml_Bottle( +def YB_5ml_fenyeping( name: str, diameter: float = 20.0, height: float = 50.0, @@ -87,11 +87,11 @@ def YB_fen_ye_5ml_Bottle( height=height, max_volume=max_volume, barcode=barcode, - model="Separation_Bottle_5ml", + model="YB_5ml_fenyeping", ) """20ml分液瓶""" -def YB_fen_ye_20ml_Bottle( +def YB_20ml_fenyeping( name: str, diameter: float = 30.0, height: float = 65.0, @@ -105,7 +105,7 @@ def YB_fen_ye_20ml_Bottle( height=height, max_volume=max_volume, barcode=barcode, - model="Separation_Bottle_20ml", + model="YB_20ml_fenyeping", ) """配液瓶(小)""" @@ -123,7 +123,7 @@ def YB_pei_ye_xiao_Bottle( height=height, max_volume=max_volume, barcode=barcode, - model="Mixing_Bottle_Small", + model="YB_pei_ye_xiao_Bottle", ) """配液瓶(大)""" @@ -141,11 +141,11 @@ def YB_pei_ye_da_Bottle( height=height, max_volume=max_volume, barcode=barcode, - model="Mixing_Bottle_Large", + model="YB_pei_ye_da_Bottle", ) """枪头""" -def YB_Pipette_Tip( +def YB_qiang_tou( name: str, diameter: float = 10.0, height: float = 50.0, @@ -159,5 +159,5 @@ def YB_Pipette_Tip( height=height, max_volume=max_volume, barcode=barcode, - model="Pipette_Tip", + model="YB_qiang_tou", ) diff --git a/unilabos/ros/nodes/presets/host_node.py b/unilabos/ros/nodes/presets/host_node.py index 7a8806d4..53b44c24 100644 --- a/unilabos/ros/nodes/presets/host_node.py +++ b/unilabos/ros/nodes/presets/host_node.py @@ -652,7 +652,7 @@ class HostNode(BaseROS2DeviceNode): if bCreate: self.lab_logger().trace(f"Status created: {device_id}.{property_name} = {msg.data}") else: - self.lab_logger().debug(f"Status updated: {device_id}.{property_name} = {msg.data}") + self.lab_logger().trace(f"Status updated: {device_id}.{property_name} = {msg.data}") def send_goal( self, diff --git a/unilabos/utils/log.py b/unilabos/utils/log.py index 3894233b..9bf5cebf 100644 --- a/unilabos/utils/log.py +++ b/unilabos/utils/log.py @@ -191,8 +191,19 @@ def configure_logger(loglevel=None): # 添加处理器到根日志记录器 root_logger.addHandler(console_handler) - logging.getLogger("asyncio").setLevel(logging.INFO) - logging.getLogger("urllib3").setLevel(logging.INFO) + + # 降低第三方库的日志级别,避免过多输出 + # pymodbus 库的日志太详细,设置为 WARNING + logging.getLogger('pymodbus').setLevel(logging.WARNING) + logging.getLogger('pymodbus.logging').setLevel(logging.WARNING) + logging.getLogger('pymodbus.logging.base').setLevel(logging.WARNING) + logging.getLogger('pymodbus.logging.decoders').setLevel(logging.WARNING) + + # websockets 库的日志输出较多,设置为 WARNING + logging.getLogger('websockets').setLevel(logging.WARNING) + logging.getLogger('websockets.client').setLevel(logging.WARNING) + logging.getLogger('websockets.server').setLevel(logging.WARNING) + # 配置日志系统 configure_logger()