|
|
@ -43,14 +43,20 @@ public class LiquidAddCommand extends BaseCommandHandler { |
|
|
|
@Override |
|
|
|
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return runAsync(() -> { |
|
|
|
deviceStateService.getDeviceState().getSolutionModule().setIdle(true);//设置占用 |
|
|
|
deviceStateService.getDeviceState().getSolutionModule().setPumping(true);//设置正在加液 |
|
|
|
JSONArray jsonArray = cmdDTO.getJSONArrayParam("columns");//获取参数 |
|
|
|
Assert.notNull(jsonArray, () -> new AppException(ResultCode.INVALID_PARAMETER));//解析参数 |
|
|
|
TransferModuleState transferModuleState = deviceStateService.getDeviceState().getTransferModule();//获取机械臂状态 |
|
|
|
Assert.isTrue(transferModuleState.isTrayStatus(), () -> new AppException(ResultCode.OPERATION_NOT_ALLOWED));//判断机械臂是否有托盘 |
|
|
|
Point3D liquidAreaTrayPoint = devicePositionService.getPosition(DevicePositionCode.liquidAreaTrayPoint).getPoint3D(); //获取加液区上方点位 |
|
|
|
Double solutionModuleMotorDownInTubeAddPositon = devicePositionService.getPosition(DevicePositionCode.solutionModuleMotorDownInTubeAddPositon).getPositon(); //加液模块电机下降进入试管加液位置 |
|
|
|
Double trayTubeHorizontalSpacingDistance = devicePositionService.getPosition(DevicePositionCode.trayTubeHorizontalSpacingDistance).getDistance(); //加液模块电机下降进入试管加液位置 |
|
|
|
Double trayTubeHorizontalSpacingDistance = devicePositionService.getPosition(DevicePositionCode.trayTubeHorizontalSpacingDistance).getDistance(); //托盘试管水平间距 |
|
|
|
solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0);//加液机械臂上升 |
|
|
|
transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint);//移动至加液位置 |
|
|
|
for (int i = 0; i < jsonArray.size(); i++) { |
|
|
|
JSONObject jsonObject = (JSONObject) jsonArray.get(i); |
|
|
|
Integer solutionId = jsonObject.getInt("solutionId");//溶液Id |
|
|
@ -61,17 +67,20 @@ public class LiquidAddCommand extends BaseCommandHandler { |
|
|
|
double scale = Double.parseDouble(systemConfigService.getSystemConfigValueByCode(valveStateCode.getSystemConfigCode()));//根据溶液获取转换比 |
|
|
|
double position = volume * scale * 8;//加液泵的转数 |
|
|
|
solutionModuleService.liquidValveSwitch(cmdDTO.getCommandId(), cmdDTO.getCommand(), valveStateCode);//电磁阀对应通道打开 |
|
|
|
solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0);//加液机械臂上升 |
|
|
|
transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint);//移动至加液位置 |
|
|
|
double distance = (column - 1) * trayTubeHorizontalSpacingDistance;//机械臂左移距离 |
|
|
|
transferModuleService.transferXMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), -distance);//机械臂左移 |
|
|
|
solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), solutionModuleMotorDownInTubeAddPositon);//加液机械臂下降 |
|
|
|
solutionModuleService.liquidPumpMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), position);//加液 |
|
|
|
double distance = (column - 1) * trayTubeHorizontalSpacingDistance;//机械臂左移距离 |
|
|
|
transferModuleService.transferXMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), -distance);//机械臂左移试管间距 |
|
|
|
solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0);//加液机械臂上升 |
|
|
|
transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint);//移动至加液位置 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0);//加液机械臂上升 |
|
|
|
transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint);//移动至加液位置 |
|
|
|
deviceStateService.getDeviceState().getSolutionModule().setIdle(false);//设置占用解除 |
|
|
|
deviceStateService.getDeviceState().getSolutionModule().setPumping(false);//设置加液结束 |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|