mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2025-12-17 04:51:10 +00:00
add BIOYOND deck assignment and pass all tests
This commit is contained in:
@@ -6,19 +6,21 @@ from unilabos.resources.bioyond.warehouses import bioyond_warehouse_1x4x4, bioyo
|
||||
class BIOYOND_PolymerReactionStation_Deck(Deck):
|
||||
def __init__(self, name: str = "PolymerReactionStation_Deck") -> None:
|
||||
super().__init__(name=name, size_x=2700.0, size_y=1080.0, size_z=1500.0)
|
||||
self.setup()
|
||||
|
||||
def setup(self) -> None:
|
||||
# 添加仓库
|
||||
self.warehouses = {
|
||||
"io_warehouse_left": bioyond_warehouse_1x4x4("io_warehouse_left"),
|
||||
"io_warehouse_right": bioyond_warehouse_1x4x4("io_warehouse_right"),
|
||||
"liquid_and_lid_handling": bioyond_warehouse_liquid_and_lid_handling("liquid_and_lid_handling"),
|
||||
"堆栈1": bioyond_warehouse_1x4x4("堆栈1"),
|
||||
"堆栈2": bioyond_warehouse_1x4x4("堆栈2"),
|
||||
"站内试剂存放堆栈": bioyond_warehouse_liquid_and_lid_handling("站内试剂存放堆栈"),
|
||||
}
|
||||
self.warehouse_locations = {
|
||||
"io_warehouse_left": Coordinate(0.0, 650.0, 0.0),
|
||||
"io_warehouse_right": Coordinate(2550.0, 650.0, 0.0),
|
||||
"liquid_and_lid_handling": Coordinate(800.0, 475.0, 0.0),
|
||||
"堆栈1": Coordinate(0.0, 650.0, 0.0),
|
||||
"堆栈2": Coordinate(2550.0, 650.0, 0.0),
|
||||
"站内试剂存放堆栈": Coordinate(800.0, 475.0, 0.0),
|
||||
}
|
||||
self.warehouses["站内试剂存放堆栈"].rotation = 90.0
|
||||
|
||||
for warehouse_name, warehouse in self.warehouses.items():
|
||||
self.assign_child_resource(warehouse, location=self.warehouse_locations[warehouse_name])
|
||||
|
||||
@@ -8,12 +8,12 @@ def bioyond_warehouse_1x4x4(name: str) -> WareHouse:
|
||||
num_items_x=1,
|
||||
num_items_y=4,
|
||||
num_items_z=4,
|
||||
dx=137.0,
|
||||
dy=96.0,
|
||||
dz=120.0,
|
||||
item_dx=10.0,
|
||||
item_dy=10.0,
|
||||
item_dz=10.0,
|
||||
dx=10.0,
|
||||
dy=10.0,
|
||||
dz=10.0,
|
||||
item_dx=137.0,
|
||||
item_dy=96.0,
|
||||
item_dz=120.0,
|
||||
category="warehouse",
|
||||
)
|
||||
|
||||
@@ -25,12 +25,12 @@ def bioyond_warehouse_1x4x2(name: str) -> WareHouse:
|
||||
num_items_x=1,
|
||||
num_items_y=4,
|
||||
num_items_z=2,
|
||||
dx=137.0,
|
||||
dy=96.0,
|
||||
dz=120.0,
|
||||
item_dx=10.0,
|
||||
item_dy=10.0,
|
||||
item_dz=10.0,
|
||||
dx=10.0,
|
||||
dy=10.0,
|
||||
dz=10.0,
|
||||
item_dx=137.0,
|
||||
item_dy=96.0,
|
||||
item_dz=120.0,
|
||||
category="warehouse",
|
||||
removed_positions=None
|
||||
)
|
||||
@@ -43,12 +43,12 @@ def bioyond_warehouse_liquid_and_lid_handling(name: str) -> WareHouse:
|
||||
num_items_x=2,
|
||||
num_items_y=5,
|
||||
num_items_z=1,
|
||||
dx=137.0,
|
||||
dy=96.0,
|
||||
dz=120.0,
|
||||
item_dx=10.0,
|
||||
item_dy=10.0,
|
||||
item_dz=10.0,
|
||||
dx=10.0,
|
||||
dy=10.0,
|
||||
dz=10.0,
|
||||
item_dx=137.0,
|
||||
item_dy=96.0,
|
||||
item_dz=120.0,
|
||||
category="warehouse",
|
||||
removed_positions=None
|
||||
)
|
||||
@@ -480,7 +480,7 @@ def resource_plr_to_ulab(resource_plr: "ResourcePLR", parent_name: str = None, w
|
||||
return r
|
||||
|
||||
|
||||
def resource_bioyond_to_plr(bioyond_materials: list[dict], type_mapping: dict = {}, location_id_mapping: dict = None) -> list[dict]:
|
||||
def resource_bioyond_to_plr(bioyond_materials: list[dict], type_mapping: dict = {}, deck: Any = None) -> list[dict]:
|
||||
"""
|
||||
将 bioyond 物料格式转换为 ulab 物料格式
|
||||
|
||||
@@ -513,6 +513,17 @@ def resource_bioyond_to_plr(bioyond_materials: list[dict], type_mapping: dict =
|
||||
|
||||
plr_materials.append(plr_material)
|
||||
|
||||
if deck and hasattr(deck, "warehouses"):
|
||||
for loc in material.get("locations", []):
|
||||
if hasattr(deck, "warehouses") and loc.get("whName") in deck.warehouses:
|
||||
warehouse = deck.warehouses[loc["whName"]]
|
||||
idx = (loc.get("y", 0) - 1) * warehouse.num_items_x * warehouse.num_items_y + \
|
||||
(loc.get("x", 0) - 1) * warehouse.num_items_x + \
|
||||
(loc.get("z", 0) - 1)
|
||||
if 0 <= idx < warehouse.num_items_x * warehouse.num_items_y * warehouse.num_items_z:
|
||||
if warehouse[idx].resource is None:
|
||||
warehouse[idx] = plr_material
|
||||
|
||||
return plr_materials
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user