refactor: Split tipbox storage into left and right warehouses

This commit is contained in:
ZiWei
2026-01-15 17:04:20 +08:00
parent 6f7adce998
commit b64de9b509
6 changed files with 379 additions and 127 deletions

View File

@@ -83,11 +83,11 @@ def bioyond_warehouse_reagent_storage(name: str) -> WareHouse:
category="warehouse",
)
def bioyond_warehouse_tipbox_storage(name: str) -> WareHouse:
"""创建BioYond站内Tip盒堆栈A01B03用于存放枪头盒"""
def bioyond_warehouse_tipbox_storage_left(name: str) -> WareHouse:
"""创建BioYond站内Tip盒堆栈左侧部分A02B032列2行"""
return warehouse_factory(
name=name,
num_items_x=3, # 3列01-03
num_items_x=2, # 2列
num_items_y=2, # 2行A-B
num_items_z=1, # 1层
dx=10.0,
@@ -97,7 +97,25 @@ def bioyond_warehouse_tipbox_storage(name: str) -> WareHouse:
item_dy=96.0,
item_dz=120.0,
category="warehouse",
col_offset=0,
col_offset=1, # 从02开始: A02, A03
layout="row-major",
)
def bioyond_warehouse_tipbox_storage_right(name: str) -> WareHouse:
"""创建BioYond站内Tip盒堆栈右侧部分A01B011列2行"""
return warehouse_factory(
name=name,
num_items_x=1, # 1列
num_items_y=2, # 2行A-B
num_items_z=1, # 1层
dx=10.0,
dy=10.0,
dz=10.0,
item_dx=137.0,
item_dy=96.0,
item_dz=120.0,
category="warehouse",
col_offset=0, # 从01开始: A01
layout="row-major",
)
@@ -167,7 +185,7 @@ def bioyond_warehouse_1x4x2(name: str) -> WareHouse:
def bioyond_warehouse_1x2x2(name: str) -> WareHouse:
"""创建BioYond 1x2x2仓库1列×2行×2层- 旧版本,已弃用
布局2层:
层1: A01
B01
@@ -191,7 +209,7 @@ def bioyond_warehouse_1x2x2(name: str) -> WareHouse:
def bioyond_warehouse_2x2x1(name: str) -> WareHouse:
"""创建BioYond 2x2x1仓库2行×2列×1层
布局:
A01 | A02
B01 | B02
@@ -246,14 +264,14 @@ def bioyond_warehouse_1x3x3(name: str) -> WareHouse:
def bioyond_warehouse_5x3x1(name: str, row_offset: int = 0) -> WareHouse:
"""创建BioYond 5x3x1仓库5行×3列×1层
标准布局row_offset=0:
A01 | A02 | A03
B01 | B02 | B03
C01 | C02 | C03
D01 | D02 | D03
E01 | E02 | E03
带偏移布局row_offset=5:
F01 | F02 | F03
G01 | G02 | G03
@@ -281,7 +299,7 @@ def bioyond_warehouse_5x3x1(name: str, row_offset: int = 0) -> WareHouse:
def bioyond_warehouse_3x3x1(name: str) -> WareHouse:
"""创建BioYond 3x3x1仓库3行×3列×1层
布局:
A01 | A02 | A03
B01 | B02 | B03

View File

@@ -18,7 +18,8 @@ from unilabos.resources.bioyond.YB_warehouses import (
bioyond_warehouse_1x8x4,
bioyond_warehouse_reagent_storage,
# bioyond_warehouse_liquid_preparation,
bioyond_warehouse_tipbox_storage, # 新增Tip盒堆栈
bioyond_warehouse_tipbox_storage_left, # 新增Tip盒堆栈(左)
bioyond_warehouse_tipbox_storage_right, # 新增Tip盒堆栈(右)
bioyond_warehouse_density_vial,
)
@@ -47,16 +48,17 @@ class BIOYOND_PolymerReactionStation_Deck(Deck):
"堆栈1右": bioyond_warehouse_1x4x4_right("堆栈1右"), # 右侧堆栈: A05D08
"站内试剂存放堆栈": bioyond_warehouse_reagent_storage("站内试剂存放堆栈"), # A01A02
# "移液站内10%分装液体准备仓库": bioyond_warehouse_liquid_preparation("移液站内10%分装液体准备仓库"), # A01B04
"站内Tip盒堆栈": bioyond_warehouse_tipbox_storage("站内Tip盒堆栈"), # A01B03, 存放枪头盒.
"站内Tip盒堆栈(左)": bioyond_warehouse_tipbox_storage_left("站内Tip盒堆栈(左)"), # A02B03
"站内Tip盒堆栈(右)": bioyond_warehouse_tipbox_storage_right("站内Tip盒堆栈(右)"), # A01B01
"测量小瓶仓库(测密度)": bioyond_warehouse_density_vial("测量小瓶仓库(测密度)"), # A01B03
}
self.warehouse_locations = {
"堆栈1左": Coordinate(-200.0, 450.0, 0.0), # 左侧位置
"堆栈1右": Coordinate(2350.0, 450.0, 0.0), # 右侧位置
"站内试剂存放堆栈": Coordinate(730.0, 390.0, 0.0),
# "移液站内10%分装液体准备仓库": Coordinate(1200.0, 600.0, 0.0),
"站内Tip盒堆栈": Coordinate(300.0, 150.0, 0.0),
"测量小瓶仓库(测密度)": Coordinate(940.0, 530.0, 0.0),
"堆栈1左": Coordinate(-200.0, 400.0, 0.0), # 左侧位置
"堆栈1右": Coordinate(2350.0, 400.0, 0.0), # 右侧位置
"站内试剂存放堆栈": Coordinate(640.0, 400.0, 0.0),
"站内Tip盒堆栈(左)": Coordinate(300.0, 100.0, 0.0),
"站内Tip盒堆栈(右)": Coordinate(2250.0, 100.0, 0.0), # 向右偏移 2 * item_dx (137.0)
"测量小瓶仓库(测密度)": Coordinate(1000.0, 530.0, 0.0),
}
for warehouse_name, warehouse in self.warehouses.items():
@@ -89,9 +91,9 @@ class BIOYOND_PolymerPreparationStation_Deck(Deck):
"溶液堆栈": bioyond_warehouse_1x4x4("溶液堆栈"), # 4行×4列 (A01-D04)
}
self.warehouse_locations = {
"粉末堆栈": Coordinate(0.0, 450.0, 0.0),
"试剂堆栈": Coordinate(1850.0, 200.0, 0.0),
"溶液堆栈": Coordinate(2500.0, 450.0, 0.0),
"粉末堆栈": Coordinate(-200.0, 400.0, 0.0),
"试剂堆栈": Coordinate(1750.0, 160.0, 0.0),
"溶液堆栈": Coordinate(2350.0, 400.0, 0.0),
}
for warehouse_name, warehouse in self.warehouses.items():

View File

@@ -97,11 +97,11 @@ def bioyond_warehouse_reagent_storage(name: str) -> WareHouse:
layout="vertical-col-major", # ⭐ 竖向warehouse专用布局
)
def bioyond_warehouse_tipbox_storage(name: str) -> WareHouse:
"""创建BioYond站内Tip盒堆栈A01B03用于存放枪头盒"""
def bioyond_warehouse_tipbox_storage_left(name: str) -> WareHouse:
"""创建BioYond站内Tip盒堆栈左侧部分A02B032列2行"""
return warehouse_factory(
name=name,
num_items_x=3, # 3列01-03
num_items_x=2, # 2列
num_items_y=2, # 2行A-B
num_items_z=1, # 1层
dx=10.0,
@@ -111,7 +111,25 @@ def bioyond_warehouse_tipbox_storage(name: str) -> WareHouse:
item_dy=96.0,
item_dz=120.0,
category="warehouse",
col_offset=0,
col_offset=1, # 从02开始: A02, A03
layout="row-major",
)
def bioyond_warehouse_tipbox_storage_right(name: str) -> WareHouse:
"""创建BioYond站内Tip盒堆栈右侧部分A01B011列2行"""
return warehouse_factory(
name=name,
num_items_x=1, # 1列
num_items_y=2, # 2行A-B
num_items_z=1, # 1层
dx=10.0,
dy=10.0,
dz=10.0,
item_dx=137.0,
item_dy=96.0,
item_dz=120.0,
category="warehouse",
col_offset=0, # 从01开始: A01
layout="row-major",
)

View File

@@ -811,6 +811,15 @@ def resource_bioyond_to_plr(bioyond_materials: list[dict], type_mapping: Dict[st
logger.warning(f"物料 {material['name']} 的列号 x={x_val} 超出范围无法映射到堆栈1左或堆栈1右")
continue
# 特殊处理: Bioyond的"站内Tip盒堆栈"也需要进行拆分映射
if wh_name == "站内Tip盒堆栈":
y_val = loc.get("y", 1)
if y_val == 1:
wh_name = "站内Tip盒堆栈(右)"
elif y_val in [2, 3]:
wh_name = "站内Tip盒堆栈(左)"
y = y - 1 # 调整列号,因为左侧仓库对应的 Bioyond y=2 实际上是它的第1列
if hasattr(deck, "warehouses") and wh_name in deck.warehouses:
warehouse = deck.warehouses[wh_name]
logger.debug(f"[Warehouse匹配] 找到warehouse: {wh_name} (容量: {warehouse.capacity}, 行×列: {warehouse.num_items_x}×{warehouse.num_items_y})")
@@ -837,7 +846,7 @@ def resource_bioyond_to_plr(bioyond_materials: list[dict], type_mapping: Dict[st
row_idx = y - 1 # Bioyond的y(01,02,03) → row索引(0,1,2)
layer_idx = z - 1
idx = layer_idx * (warehouse.num_items_x * warehouse.num_items_y) + row_idx * warehouse.num_items_x + col_idx
idx = layer_idx * (warehouse.num_items_x * warehouse.num_items_y) + row_idx * warehouse.num_items_y + col_idx
logger.debug(f"🔍 竖向warehouse {wh_name}: Bioyond(x={x},y={y},z={z}) → warehouse(col={col_idx},row={row_idx},layer={layer_idx}) → idx={idx}, capacity={warehouse.capacity}")
# 普通横向warehouse的处理