mirror of
https://github.com/dptech-corp/Uni-Lab-OS.git
synced 2026-02-05 05:45:10 +00:00
feat: 添加三阶段工作流函数和别名映射
- 在 BioyondCellWorkstation 添加 run_feeding_stage, run_liquid_preparation_stage, run_transfer_stage 三个阶段函数 - 在 host_node.py 添加 JSON_COMMAND_ALIASES 映射表,支持 run_feeding_stage -> auto_feeding4to3 别名 - 修复 create_orders 中 transfer_resource_to_another 参数名错误 - 简化 run_transfer_stage,注释掉物料转换逻辑,只保留核心转运功能
This commit is contained in:
@@ -654,12 +654,13 @@ class BioyondCellWorkstation(BioyondWorkstation):
|
|||||||
"[create_orders] 未收到订单报送物料信息,回退到实时查询"
|
"[create_orders] 未收到订单报送物料信息,回退到实时查询"
|
||||||
)
|
)
|
||||||
print("materials_from_report:", materials_from_report)
|
print("materials_from_report:", materials_from_report)
|
||||||
self.transfer_resource_to_another(
|
# TODO: 需要将 materials 字典转换为 ResourceSlot 对象后才能转运
|
||||||
plr_resources=[materials],
|
# self.transfer_resource_to_another(
|
||||||
target_device_id="BatteryStation",
|
# resource=[materials],
|
||||||
target_resources=["YB_YH_Deck"],
|
# mount_resource=["YB_YH_Deck"],
|
||||||
sites=[None]
|
# sites=[None],
|
||||||
)
|
# mount_device_id="BatteryStation"
|
||||||
|
# )
|
||||||
return {
|
return {
|
||||||
"api_response": response,
|
"api_response": response,
|
||||||
"order_finish": result,
|
"order_finish": result,
|
||||||
@@ -1377,39 +1378,38 @@ class BioyondCellWorkstation(BioyondWorkstation):
|
|||||||
def run_transfer_stage(
|
def run_transfer_stage(
|
||||||
self,
|
self,
|
||||||
liquid_materials: Optional[List[Dict[str, Any]]] = None,
|
liquid_materials: Optional[List[Dict[str, Any]]] = None,
|
||||||
) -> Dict[str, List[Dict[str, Any]]]:
|
source_wh_id: Optional[str] = '3a19debc-84b4-0359-e2d4-b3beea49348b',
|
||||||
transfer_summary: Dict[str, Any] = {}
|
source_x: int = 1,
|
||||||
try:
|
source_y: int = 1,
|
||||||
source_materials = liquid_materials or self._fetch_bioyond_materials()
|
source_z: int = 1
|
||||||
transfer_plr = self._convert_materials_to_plr(source_materials)
|
) -> Dict[str, Any]:
|
||||||
transfer_summary["plr_count"] = len(transfer_plr)
|
"""转运阶段:调用transfer_3_to_2_to_1执行3到2到1转运"""
|
||||||
|
logger.info("开始执行转运阶段 (run_transfer_stage)")
|
||||||
|
|
||||||
if transfer_plr:
|
# 暂时注释掉物料转换和跨工站转运逻辑
|
||||||
self._register_plr_resources(transfer_plr)
|
# transfer_summary: Dict[str, Any] = {}
|
||||||
target_parent = self._get_target_resource(self.transfer_target_parent)
|
# try:
|
||||||
sites = self._allocate_sites(target_parent, len(transfer_plr))
|
# source_materials = liquid_materials or self._fetch_bioyond_materials()
|
||||||
future = ROS2DeviceNode.run_async_func(
|
# transfer_plr = self._convert_materials_to_plr(source_materials)
|
||||||
self._ros_node.transfer_resource_to_another, # type: ignore[arg-type]
|
# transfer_summary["plr_count"] = len(transfer_plr)
|
||||||
True,
|
# ...
|
||||||
plr_resources=transfer_plr,
|
# except Exception as exc:
|
||||||
target_device_id=self.transfer_target_device_id,
|
# transfer_summary["error"] = str(exc)
|
||||||
target_resources=[target_parent] * len(transfer_plr),
|
# logger.error(f"跨工站转运失败: {exc}", exc_info=True)
|
||||||
sites=sites,
|
|
||||||
)
|
|
||||||
self._wait_for_future(future, "transfer_resource_to_another")
|
|
||||||
transfer_summary["sites"] = sites
|
|
||||||
|
|
||||||
coin_cell_result = self._invoke_coin_cell_workflow(source_materials)
|
# 只执行核心的3到2到1转运
|
||||||
transfer_summary["coin_cell_result"] = coin_cell_result
|
transfer_result = self.transfer_3_to_2_to_1(
|
||||||
except Exception as exc:
|
source_wh_id=source_wh_id,
|
||||||
transfer_summary["error"] = str(exc)
|
source_x=source_x,
|
||||||
logger.error(f"跨工站转运失败: {exc}", exc_info=True)
|
source_y=source_y,
|
||||||
|
source_z=source_z
|
||||||
|
)
|
||||||
|
|
||||||
transfer_materials = self._fetch_bioyond_materials()
|
logger.info("转运阶段执行完成")
|
||||||
return {
|
return {
|
||||||
"liquid_materials": liquid_materials or [],
|
"success": True,
|
||||||
"transfer_materials": transfer_materials,
|
"stage": "transfer",
|
||||||
"transfer_summary": transfer_summary,
|
"transfer_result": transfer_result
|
||||||
}
|
}
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
deck = BIOYOND_YB_Deck(setup=True)
|
deck = BIOYOND_YB_Deck(setup=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user