mirror of
https://github.com/deepmodeling/Uni-Lab-OS
synced 2026-04-29 10:09:56 +00:00
fix: 物料系统标准化重构 + 多轮运行期 Bug 修复 (2026-03-12)
- MagazineHolder: klasses=None,解耦极片子节点初始化 - Magazine: 重写 serialize/deserialize,截断旧极片脏数据 - bottle_carriers: 移除 YIHUA_Electrolyte_12VialCarrier 初始化填瓶 - decks.py: BIOYOND_YB_Deck→BioyondElectrolyteDeck,移除 setup 参数 - YB_YH_materials.py: CoincellDeck→YihuaCoinCellDeck,新增 electrolyte_buffer 槽位 - resource_tracker.py: Container 状态键预填 + 重复 UUID 自动修复 + 树级名称去重 - itemized_carrier.py: XY 近似坐标匹配,修复 Z 偏移问题 - bioyond_cell_workstation.py: 跨站转运改用真实资源 + 类型映射双模式查找 - station.py: sync_to_external 属性访问路径修复 - coin_cell_assembly.py: 新增 10 个 Modbus 余量属性 - CSV/JSON/YAML 配置同步更新(类名重命名 + 移除 setup) - 新增 changelog_2026-03-12.md
This commit is contained in:
@@ -179,6 +179,35 @@ class ItemizedCarrier(ResourcePLR):
|
||||
idx = i
|
||||
break
|
||||
|
||||
if idx is None and location is not None:
|
||||
# 精确坐标匹配失败(常见原因:DB 存储的 z=0,而槽位定义 z=dz>0)。
|
||||
# 降级为仅按 XY 坐标进行近似匹配,找到后使用槽位自身的正确坐标写回,
|
||||
# 避免因 Z 偏移导致反序列化中断。
|
||||
_XY_TOLERANCE = 2.0 # mm,覆盖浮点误差和 z 偏移
|
||||
min_dist = float("inf")
|
||||
nearest_idx = None
|
||||
for _i, _loc in enumerate(self.child_locations.values()):
|
||||
_d = (((_loc.x - location.x) ** 2) + ((_loc.y - location.y) ** 2)) ** 0.5
|
||||
if _d < min_dist:
|
||||
min_dist = _d
|
||||
nearest_idx = _i
|
||||
if nearest_idx is not None and min_dist <= _XY_TOLERANCE:
|
||||
from unilabos.utils.log import logger as _logger
|
||||
_slot_label = list(self.child_locations.keys())[nearest_idx]
|
||||
_logger.warning(
|
||||
f"[ItemizedCarrier '{self.name}'] 资源 '{resource.name}' 坐标 {location} 与槽位 "
|
||||
f"'{_slot_label}' {list(self.child_locations.values())[nearest_idx]} 的 XY 吻合"
|
||||
f"(XY 偏差={min_dist:.2f}mm),按 XY 近似匹配成功,z 偏移已被修正。"
|
||||
)
|
||||
idx = nearest_idx
|
||||
|
||||
if idx is None:
|
||||
raise ValueError(
|
||||
f"[ItemizedCarrier '{self.name}'] 无法为资源 '{resource.name}' 找到匹配的槽位。\n"
|
||||
f" 已知槽位: {list(self.child_locations.keys())}\n"
|
||||
f" 传入坐标: {location}\n"
|
||||
f" 提示: XY 近似匹配也失败,请检查资源坐标或 Carrier 槽位定义是否正确。"
|
||||
)
|
||||
if not reassign and self.sites[idx] is not None:
|
||||
raise ValueError(f"a site with index {idx} already exists")
|
||||
location = list(self.child_locations.values())[idx]
|
||||
|
||||
Reference in New Issue
Block a user