Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions test/experiments/reaction_station_bioyond.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"type": "device",
"class": "reaction_station.bioyond",
"config": {
"bioyond_config": {
"config": {
"api_key": "DE9BDDA0",
"api_host": "http://192.168.1.200:44402",
"workflow_mappings": {
Expand All @@ -19,8 +19,8 @@
"Solid_feeding_vials": "3a160877-87e7-7699-7bc6-ec72b05eb5e6",
"Liquid_feeding_vials(non-titration)": "3a167d99-6158-c6f0-15b5-eb030f7d8e47",
"Liquid_feeding_solvents": "3a160824-0665-01ed-285a-51ef817a9046",
"Liquid_feeding(titration)": "3a160824-0665-01ed-285a-51ef817a9046",
"Liquid_feeding_beaker": "3a16087e-124f-8ddb-8ec1-c2dff09ca784",
"Liquid_feeding(titration)": "3a16082a-96ac-0449-446a-4ed39f3365b6",
"liquid_feeding_beaker": "3a16087e-124f-8ddb-8ec1-c2dff09ca784",
"Drip_back": "3a162cf9-6aac-565a-ddd7-682ba1796a4a"
},
"material_type_mappings": {
Expand Down
47 changes: 31 additions & 16 deletions unilabos/devices/workstation/bioyond_studio/bioyond_rpc.py
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,8 @@ def validate_workflow_parameters(self, workflows: List[Dict[str, Any]]) -> Dict[
for j, param in enumerate(params):
if not isinstance(param, dict):
workflow_errors.append(f"步骤 {step_id} 模块 {module_name} 参数 {j} 必须是字典类型")
elif "key" not in param or "value" not in param:
workflow_errors.append(f"步骤 {step_id} 模块 {module_name} 参数 {j} 必须包含 keyvalue")
elif "Key" not in param or "DisplayValue" not in param:
workflow_errors.append(f"步骤 {step_id} 模块 {module_name} 参数 {j} 必须包含 KeyDisplayValue")

if workflow_errors:
validation_errors.append({
Expand Down Expand Up @@ -703,20 +703,35 @@ def _load_material_cache(self):
"""预加载材料列表到缓存中"""
try:
print("正在加载材料列表缓存...")
stock_query = '{"typeMode": 2, "includeDetail": true}'
stock_result = self.stock_material(stock_query)

Comment on lines -706 to -708
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: Material cache loading now iterates over multiple typeModes; ensure this matches expected API behavior.

Please verify that loading multiple typeModes does not result in duplicate cache entries or inconsistencies due to differences in API responses.

if isinstance(stock_result, str):
stock_data = json.loads(stock_result)
else:
stock_data = stock_result

materials = stock_data
for material in materials:
material_name = material.get("name")
material_id = material.get("id")
if material_name and material_id:
self.material_cache[material_name] = material_id

# 加载所有类型的材料:耗材(0)、样品(1)、试剂(2)
material_types = [1, 2]

for type_mode in material_types:
print(f"正在加载类型 {type_mode} 的材料...")
stock_query = f'{{"typeMode": {type_mode}, "includeDetail": true}}'
stock_result = self.stock_material(stock_query)

if isinstance(stock_result, str):
stock_data = json.loads(stock_result)
else:
stock_data = stock_result

materials = stock_data
for material in materials:
material_name = material.get("name")
material_id = material.get("id")
if material_name and material_id:
self.material_cache[material_name] = material_id

# 处理样品板等容器中的detail材料
detail_materials = material.get("detail", [])
for detail_material in detail_materials:
detail_name = detail_material.get("name")
detail_id = detail_material.get("detailMaterialId")
if detail_name and detail_id:
self.material_cache[detail_name] = detail_id
print(f"加载detail材料: {detail_name} -> ID: {detail_id}")

print(f"材料列表缓存加载完成,共加载 {len(self.material_cache)} 个材料")

Expand Down
Loading
Loading