From 71d35d31afbf08b993dd7f539c7bc31dbd1f02f0 Mon Sep 17 00:00:00 2001 From: ALITTLELZ Date: Wed, 25 Mar 2026 18:32:01 +0800 Subject: [PATCH] Register PRCXI9300ModuleSite/FunctionalModule for PLR deserialization Added PRCXI9300ModuleSite and PRCXI9300FunctionalModule to the PLR class registration in plr_additional_res_reg.py so find_subclass can locate them during deserialization of cached cloud data. Also added "module" and "carrier" to replace_plr_type and TYPE_MAP in resource_tracker.py to suppress unknown type warnings. Co-Authored-By: Claude Opus 4.6 --- unilabos/resources/plr_additional_res_reg.py | 3 +++ unilabos/resources/resource_tracker.py | 15 +++++++++++++++ 2 files changed, 18 insertions(+) diff --git a/unilabos/resources/plr_additional_res_reg.py b/unilabos/resources/plr_additional_res_reg.py index 1c019ded..a4be086e 100644 --- a/unilabos/resources/plr_additional_res_reg.py +++ b/unilabos/resources/plr_additional_res_reg.py @@ -9,6 +9,9 @@ def register(): from unilabos.devices.liquid_handling.prcxi.prcxi import PRCXI9300TipRack from unilabos.devices.liquid_handling.prcxi.prcxi import PRCXI9300Trash from unilabos.devices.liquid_handling.prcxi.prcxi import PRCXI9300TubeRack + from unilabos.devices.liquid_handling.prcxi.prcxi import PRCXI9300ModuleSite + # noinspection PyUnresolvedReferences + from unilabos.devices.liquid_handling.prcxi.prcxi_modules import PRCXI9300FunctionalModule # noinspection PyUnresolvedReferences from unilabos.devices.workstation.workstation_base import WorkStationContainer diff --git a/unilabos/resources/resource_tracker.py b/unilabos/resources/resource_tracker.py index 288ddc12..6a0755b5 100644 --- a/unilabos/resources/resource_tracker.py +++ b/unilabos/resources/resource_tracker.py @@ -459,6 +459,8 @@ class ResourceTreeSet(object): "reagent_bottle": "reagent_bottle", "flask": "flask", "beaker": "beaker", + "module": "module", + "carrier": "carrier", } if source in replace_info: return replace_info[source] @@ -596,6 +598,8 @@ class ResourceTreeSet(object): "deck": "Deck", "container": "RegularContainer", "tip_spot": "TipSpot", + "module": "PRCXI9300ModuleSite", + "carrier": "ItemizedCarrier", } def collect_node_data(node: ResourceDictInstance, name_to_uuid: dict, all_states: dict, name_to_extra: dict): @@ -958,6 +962,17 @@ class ResourceTreeSet(object): f"从远端同步了 {added_count} 个物料子树" ) else: + # 二级是物料 + if remote_child_name not in local_children_map: + # 本地不存在该物料,直接引入 + remote_child.res_content.parent = local_device.res_content + local_device.children.append(remote_child) + local_children_map[remote_child_name] = remote_child + logger.info( + f"物料 '{remote_root_id}/{remote_child_name}': " + f"从远端同步了整个子树" + ) + continue # 二级物料已存在,比较三级子节点是否缺失 local_material = local_children_map[remote_child_name] local_material_children_map = {child.res_content.name: child for child in