From 3ac383e681ce8699390f85adbaa538272e3832b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E6=A2=A6=E8=BF=9C?= <1063331231@qq.com> Date: Thu, 29 May 2025 14:19:06 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E5=8A=A0=E6=B6=B2=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sgs/app/cmd/control/LiquidAddCommand.java | 36 ++++++++++++---------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidAddCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidAddCommand.java index e1896df..bd61429 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidAddCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/control/LiquidAddCommand.java @@ -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 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);//设置加液结束 }); }