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 bd61429..4d42d98 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 @@ -51,7 +51,7 @@ public class LiquidAddCommand extends BaseCommandHandler { Integer solutionId = cmdDTO.getIntegerParam("solutionId");//溶液ID double volume = cmdDTO.getDoubleParam("volume");//量 Solutions solutions = solutionsService.getById(solutionId);//获取溶液 - ValveStateCode valveStateCode = ValveStateCode.valueOf(solutions.getName());//根据溶液获取电磁阀code + ValveStateCode valveStateCode = ValveStateCode.valueOf(solutions.getCode());//根据溶液获取电磁阀code Assert.isTrue(!jsonArray.isEmpty(), () -> new AppException(ResultCode.INVALID_PARAMETER));//确定选中了列 return runAsync(() -> { deviceStateService.getDeviceState().getSolutionModule().setIdle(false);//设置占用 @@ -106,12 +106,11 @@ public class LiquidAddCommand extends BaseCommandHandler { if (column > 0 && column < 6) { double distance = (column - 1) * trayTubeHorizontalSpacingDistance;//机械臂右移距离 transferModuleService.transferXMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint.getX()+distance);//机械臂移动到试管位置 - solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), solutionModuleMotorDownInTubeAddPositon);//加液机械臂下降 - solutionModuleService.liquidPumpMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), position);//加液 + solutionModuleService.solutionMotorMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 10);//加液机械臂下降 solutionModuleMotorDownInTubeAddPositon + solutionModuleService.liquidPumpMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0.5);//加液 position设置固定值 todo 正式要改这个 solutionModuleService.solutionMotorMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//加液机械臂上升 } } - solutionModuleService.solutionMotorMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//加液机械臂上升 transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint);//移动至加液位置 deviceStateService.getDeviceState().getSolutionModule().setIdle(true);//设置占用解除 deviceStateService.getDeviceState().getSolutionModule().setPumping(false);//设置加液结束 diff --git a/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToAnnealAreaCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToAnnealAreaCommand.java index 1ce7bef..3cb4ad4 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToAnnealAreaCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToAnnealAreaCommand.java @@ -45,7 +45,7 @@ public class MoveToAnnealAreaCommand extends BaseCommandHandler { HeatModuleCode targetHeatModuleCode = HeatModuleCode.heat_module_04; if (heatModuleCodeStr != null) {//目标加热模块非必填,如果没有传递目标加热模块则尝试获取上料区是否有托盘 heatModuleCode = HeatModuleCode.valueOf(heatModuleCodeStr);//目标加热模块 - Assert.isTrue(heatModuleCode.equals(targetHeatModuleCode), () -> new AppException(ResultCode.HAVE_IN_ANNEAL_MODULE)); + Assert.isTrue(!heatModuleCode.equals(targetHeatModuleCode), () -> new AppException(ResultCode.HAVE_IN_ANNEAL_MODULE)); } else { heatModuleCode = null; } @@ -54,13 +54,14 @@ public class MoveToAnnealAreaCommand extends BaseCommandHandler { Double transferModuleXPickTrayMoveDistance = devicePositionService.getPosition(DevicePositionCode.transferModuleXPickTrayMoveDistance).getDistance();//获取转运模块X轴拿取托盘进出卡槽移动距离 Point3D liquidAreaTrayPoint = devicePositionService.getPosition(DevicePositionCode.liquidAreaTrayPoint).getPoint3D(); //获取加液区上方点位 return runAsync(() -> { - boolean annealTrayExist = deviceSensorService.getSensorStatus(DeviceSensorCode.HEATER_TRAY_4_EXIST);//获取传感器状态 - Assert.isTrue(annealTrayExist, () -> new AppException(ResultCode.ANNEAL_MODULE_EXIST_TRAY));//加热位是否有托盘 - if (heatModuleCode != null) { + //boolean annealTrayExist = deviceSensorService.getSensorStatus(DeviceSensorCode.HEATER_TRAY_4_EXIST);//获取传感器状态 + //Assert.isTrue(!annealTrayExist, () -> new AppException(ResultCode.ANNEAL_MODULE_EXIST_TRAY));//加热位是否有托盘 + if (heatModuleCode == null) { solutionModuleService.solutionMotorMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//加液机械臂上升 transferModuleService.transferMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint);//移动至加液位置 boolean liquidTrayExist = deviceSensorService.getSensorStatus(DeviceSensorCode.LIQUID_TRAY_EXIST);//获取传感器状态 Assert.isTrue(liquidTrayExist, () -> new AppException(ResultCode.OPERATION_NOT_ALLOWED));//判断机械臂是否有托盘 + }else{ transferModuleService.transferXMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleTrayClawPoint3D.getX() + transferModuleXPickTrayMoveDistance);//将X轴移动至加热区托盘夹取点 + 进出卡槽移动距离 transferModuleService.transferZMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), heatModuleTrayClawPoint3D.getZ());//Z轴下降至夹取点,使托盘落入石墨加热盘 transferModuleService.transferXMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), -transferModuleXPickTrayMoveDistance);//X轴进入卡槽 @@ -69,7 +70,7 @@ public class MoveToAnnealAreaCommand extends BaseCommandHandler { transferModuleService.transferXMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), targetHeatModuleTrayClawPoint3D.getX());//将X轴移动至目标加热模块托盘夹取点 transferModuleService.transferZMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), targetHeatModuleTrayClawPoint3D.getZ());//Z轴下降至夹取点,使托盘落入石墨加热盘 transferModuleService.transferXMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), transferModuleXPickTrayMoveDistance);//X轴移出卡槽 - transferModuleService.transferZMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//Z轴抬升至最高 + transferModuleService.transferZMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//Z轴抬升至最高 todo 不执行 deviceStateService.getDeviceState().getHeatModuleByCode(targetHeatModuleCode).setTrayStatus(true);//设置目标加热区有托盘 }); } diff --git a/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToFeedAreaCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToFeedAreaCommand.java index e8b82da..2fecf51 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToFeedAreaCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToFeedAreaCommand.java @@ -69,8 +69,8 @@ public class MoveToFeedAreaCommand extends BaseCommandHandler { transferModuleService.transferXMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), targetHeatModuleTrayClawPoint3D.getX() + transferModuleXPickTrayMoveDistance);//将X轴移动至目标加热模块托盘夹取点 + 进出卡槽移动距离 transferModuleService.transferZMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), targetHeatModuleTrayClawPoint3D.getZ());//Z轴下降至夹取点,使托盘落入石墨加热盘 transferModuleService.transferXMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), -transferModuleXPickTrayMoveDistance);//X轴进入卡槽 - deviceStateService.getDeviceState().getHeatModuleByCode(targetHeatModuleCode).setTrayStatus(false);//设定目标加热模块托盘状态 - deviceStateService.getDeviceState().getTrayByHeatModuleCode(targetHeatModuleCode).setInHeatModule(false);//设定托盘不在加热模块中 + //deviceStateService.getDeviceState().getHeatModuleByCode(targetHeatModuleCode).setTrayStatus(false);//设定目标加热模块托盘状态 todo 报错 + //deviceStateService.getDeviceState().getTrayByHeatModuleCode(targetHeatModuleCode).setInHeatModule(false);//设定托盘不在加热模块中 todo 报错 deviceStateService.getDeviceState().getTransferModule().setTrayStatus(true);//设定托盘在机械臂上 transferModuleService.transferZMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//Z轴抬升至最高 transferModuleService.transferXMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), feedAreaTrayPoint3D.getX());//将X轴移动至上料区位置点 diff --git a/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToLiquidAreaCommand.java b/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToLiquidAreaCommand.java index 37f4231..8be9539 100644 --- a/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToLiquidAreaCommand.java +++ b/src/main/java/com/iflytop/sgs/app/cmd/control/MoveToLiquidAreaCommand.java @@ -69,10 +69,10 @@ public class MoveToLiquidAreaCommand extends BaseCommandHandler { transferModuleService.transferXMoveBy(cmdDTO.getCommandId(), cmdDTO.getCommand(), -transferModuleXPickTrayMoveDistance);//X轴进入卡槽 transferModuleService.transferZMoveZero(cmdDTO.getCommandId(), cmdDTO.getCommand());//Z轴抬升至最高 deviceStateService.getDeviceState().getHeatModuleByCode(targetHeatModuleCode).setTrayStatus(false);//设定目标加热模块托盘状态 - deviceStateService.getDeviceState().getTrayByHeatModuleCode(targetHeatModuleCode).setInHeatModule(false);//设定托盘不在加热模块中 + //deviceStateService.getDeviceState().getTrayByHeatModuleCode(targetHeatModuleCode).setInHeatModule(false);//设定托盘不在加热模块中 todo 报错 } transferModuleService.transferXMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint3D.getX());//将X轴移动至加液时托盘位置点 - deviceStateService.getDeviceState().getTrayByHeatModuleCode(targetHeatModuleCode).setInSolutionPositon(true);//设定托盘在加液位中 + //deviceStateService.getDeviceState().getTrayByHeatModuleCode(targetHeatModuleCode).setInSolutionPositon(true);//设定托盘在加液位中 todo 报错 }); } diff --git a/src/main/java/com/iflytop/sgs/app/service/device/module/TransferModuleService.java b/src/main/java/com/iflytop/sgs/app/service/device/module/TransferModuleService.java index 322b28f..31df55b 100644 --- a/src/main/java/com/iflytop/sgs/app/service/device/module/TransferModuleService.java +++ b/src/main/java/com/iflytop/sgs/app/service/device/module/TransferModuleService.java @@ -40,9 +40,10 @@ public class TransferModuleService { public void transferMove(String cmdId, String cmdCode, Point3D point) throws Exception { DeviceCommandBundle transferZMoveDeviceCommand = DeviceCommandGenerator.transferZMove(point.getZ()); CommandFuture transferZMoveDeviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, transferZMoveDeviceCommand); + CommandUtil.wait(transferZMoveDeviceCommandFuture); DeviceCommandBundle transferXMoveDeviceCommand = DeviceCommandGenerator.transferXMove(point.getX()); CommandFuture transferXMoveDeviceCommandFuture = deviceCommandService.sendCommand(cmdId, cmdCode, transferXMoveDeviceCommand); - CommandUtil.wait(transferXMoveDeviceCommandFuture, transferZMoveDeviceCommandFuture); + CommandUtil.wait(transferXMoveDeviceCommandFuture); }