|
|
@ -14,7 +14,6 @@ import com.iflytop.sgs.app.service.device.DeviceStateService; |
|
|
|
import com.iflytop.sgs.app.service.device.module.SolutionModuleService; |
|
|
|
import com.iflytop.sgs.app.service.device.module.TransferModuleService; |
|
|
|
import com.iflytop.sgs.common.annotation.CommandMapping; |
|
|
|
import com.iflytop.sgs.common.enums.DeviceSensorCode; |
|
|
|
import com.iflytop.sgs.common.enums.ValveStateCode; |
|
|
|
import com.iflytop.sgs.common.enums.data.DevicePositionCode; |
|
|
|
import com.iflytop.sgs.common.exception.AppException; |
|
|
@ -43,24 +42,27 @@ public class LiquidAddCommand extends BaseCommandHandler { |
|
|
|
|
|
|
|
@Override |
|
|
|
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { |
|
|
|
|
|
|
|
|
|
|
|
Point3D liquidAreaTrayPoint = devicePositionService.getPosition(DevicePositionCode.liquidAreaTrayPoint).getPoint3D(); //获取加液区上方托盘点位 |
|
|
|
Double solutionModuleMotorDownInTubeAddPositon = devicePositionService.getPosition(DevicePositionCode.solutionModuleMotorDownInTubeAddPositon).getPositon(); //加液模块电机下降进入试管加液位置 |
|
|
|
Double trayTubeHorizontalSpacingDistance = devicePositionService.getPosition(DevicePositionCode.trayTubeHorizontalSpacingDistance).getDistance(); //托盘试管水平间距 |
|
|
|
Point3D feedAreaTrayPoint3D = devicePositionService.getPosition(DevicePositionCode.feedAreaTrayPoint).getPoint3D();//获取上料区托盘夹爪位置点 |
|
|
|
Double transferModuleXPickTrayMoveDistance = devicePositionService.getPosition(DevicePositionCode.transferModuleXPickTrayMoveDistance).getDistance();//获取转运模块X轴拿取托盘进出卡槽移动距离 |
|
|
|
JSONArray jsonArray = cmdDTO.getJSONArrayParam("columns");//获取参数 |
|
|
|
Integer solutionId = cmdDTO.getIntegerParam("solutionId");//溶液ID |
|
|
|
double volume = cmdDTO.getDoubleParam("volume");//量 |
|
|
|
Solutions solutions = solutionsService.getById(solutionId);//获取溶液 |
|
|
|
ValveStateCode valveStateCode = ValveStateCode.valueOf(solutions.getName());//根据溶液获取电磁阀code |
|
|
|
Assert.isTrue(!jsonArray.isEmpty(), () -> new AppException(ResultCode.INVALID_PARAMETER));//确定选中了列 |
|
|
|
return runAsync(() -> { |
|
|
|
deviceStateService.getDeviceState().getSolutionModule().setIdle(true);//设置占用 |
|
|
|
deviceStateService.getDeviceState().getSolutionModule().setIdle(false);//设置占用 |
|
|
|
deviceStateService.getDeviceState().getSolutionModule().setPumping(true);//设置正在加液 |
|
|
|
JSONArray jsonArray = cmdDTO.getJSONArrayParam("columns");//获取参数 |
|
|
|
Integer solutionId = cmdDTO.getIntegerParam("solutionId");//溶液ID |
|
|
|
double volume = cmdDTO.getDoubleParam("volume");//量 |
|
|
|
Solutions solutions = solutionsService.getById(solutionId);//获取溶液 |
|
|
|
ValveStateCode valveStateCode = ValveStateCode.valueOf(solutions.getName());//根据溶液获取电磁阀code |
|
|
|
Assert.isTrue(!jsonArray.isEmpty(), () -> new AppException(ResultCode.INVALID_PARAMETER));//确定选中了列 |
|
|
|
Point3D liquidAreaTrayPoint = devicePositionService.getPosition(DevicePositionCode.liquidAreaTrayPoint).getPoint3D(); //获取加液区上方托盘点位 |
|
|
|
Double solutionModuleMotorDownInTubeAddPositon = devicePositionService.getPosition(DevicePositionCode.solutionModuleMotorDownInTubeAddPositon).getPositon(); //加液模块电机下降进入试管加液位置 |
|
|
|
Double trayTubeHorizontalSpacingDistance = devicePositionService.getPosition(DevicePositionCode.trayTubeHorizontalSpacingDistance).getDistance(); //托盘试管水平间距 |
|
|
|
solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0);//加液机械臂上升 |
|
|
|
solutionModuleService.solutionMotorMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//加液机械臂上升至0 |
|
|
|
transferModuleService.transferXMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), feedAreaTrayPoint3D.getX() + transferModuleXPickTrayMoveDistance);//将X轴移动至上料区托盘夹取点 + 进出卡槽移动距离 |
|
|
|
transferModuleService.transferZMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), feedAreaTrayPoint3D.getZ());//Z轴下降至夹取点,使托盘落入石墨加热盘 |
|
|
|
transferModuleService.transferXMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), -transferModuleXPickTrayMoveDistance);//X轴进入卡槽 |
|
|
|
transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint);//移动至加液位置 |
|
|
|
boolean liquidTrayExist = deviceSensorService.getSensorStatus(DeviceSensorCode.LIQUID_TRAY_EXIST);//获取传感器状态 |
|
|
|
Assert.isTrue(liquidTrayExist, () -> new AppException(ResultCode.SOLUTION_MODULE_NO_TRAY));//判断机械臂是否有托盘 |
|
|
|
// boolean liquidTrayExist = deviceSensorService.getSensorStatus(DeviceSensorCode.LIQUID_TRAY_EXIST);//获取传感器状态 |
|
|
|
//Assert.isTrue(liquidTrayExist, () -> new AppException(ResultCode.SOLUTION_MODULE_NO_TRAY));//判断机械臂是否有托盘 todo 正式放开 |
|
|
|
Integer currentChannel = deviceSensorService.readLiquidValvePosition();//获取当前阀门的状态 |
|
|
|
ValveStateCode oldValveState = ValveStateCode.thick.getByChannel(currentChannel);//获取当前电磁阀的值 |
|
|
|
|
|
|
@ -111,7 +113,7 @@ public class LiquidAddCommand extends BaseCommandHandler { |
|
|
|
} |
|
|
|
solutionModuleService.solutionMotorMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//加液机械臂上升 |
|
|
|
transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint);//移动至加液位置 |
|
|
|
deviceStateService.getDeviceState().getSolutionModule().setIdle(false);//设置占用解除 |
|
|
|
deviceStateService.getDeviceState().getSolutionModule().setIdle(true);//设置占用解除 |
|
|
|
deviceStateService.getDeviceState().getSolutionModule().setPumping(false);//设置加液结束 |
|
|
|
}); |
|
|
|
} |
|
|
|