|
@ -5,12 +5,15 @@ import com.iflytop.gd.app.core.SelfMoveTestGenerator; |
|
|
import com.iflytop.gd.app.model.bo.Point3D; |
|
|
import com.iflytop.gd.app.model.bo.Point3D; |
|
|
import com.iflytop.gd.app.model.dto.CmdDTO; |
|
|
import com.iflytop.gd.app.model.dto.CmdDTO; |
|
|
import com.iflytop.gd.app.service.api.DevicePositionService; |
|
|
import com.iflytop.gd.app.service.api.DevicePositionService; |
|
|
|
|
|
import com.iflytop.gd.app.service.device.DeviceStateService; |
|
|
import com.iflytop.gd.app.service.device.module.CapModuleService; |
|
|
import com.iflytop.gd.app.service.device.module.CapModuleService; |
|
|
import com.iflytop.gd.app.service.device.module.GantryModuleService; |
|
|
import com.iflytop.gd.app.service.device.module.GantryModuleService; |
|
|
import com.iflytop.gd.app.service.device.module.SolutionModuleService; |
|
|
import com.iflytop.gd.app.service.device.module.SolutionModuleService; |
|
|
import com.iflytop.gd.app.ws.server.WebSocketSender; |
|
|
import com.iflytop.gd.app.ws.server.WebSocketSender; |
|
|
import com.iflytop.gd.common.annotation.CommandMapping; |
|
|
import com.iflytop.gd.common.annotation.CommandMapping; |
|
|
import com.iflytop.gd.common.enums.data.DevicePositionCode; |
|
|
import com.iflytop.gd.common.enums.data.DevicePositionCode; |
|
|
|
|
|
import com.iflytop.gd.common.exception.AppException; |
|
|
|
|
|
import com.iflytop.gd.common.result.ResultCode; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.RequiredArgsConstructor; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import org.springframework.stereotype.Component; |
|
|
import org.springframework.stereotype.Component; |
|
@ -29,42 +32,50 @@ public class MoveTestCommand extends BaseCommandHandler { |
|
|
private final SolutionModuleService solutionModuleService; |
|
|
private final SolutionModuleService solutionModuleService; |
|
|
private final DevicePositionService devicePositionService; |
|
|
private final DevicePositionService devicePositionService; |
|
|
private final CapModuleService capModuleService; |
|
|
private final CapModuleService capModuleService; |
|
|
|
|
|
|
|
|
|
|
|
private final DeviceStateService deviceStateService; |
|
|
private final WebSocketSender webSocketService; |
|
|
private final WebSocketSender webSocketService; |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { |
|
|
public CompletableFuture<Void> handle(CmdDTO cmdDTO) { |
|
|
|
|
|
if (deviceStateService.getCommandMutexState().get().isMoveTest()) { |
|
|
|
|
|
throw new AppException(ResultCode.COMMAND_ALREADY_EXECUTING); |
|
|
|
|
|
} |
|
|
Point3D liquidAreaTrayPoint3D = devicePositionService.getPosition(DevicePositionCode.liquidAreaTrayPoint).getPoint3D();//获取加液模块上方点位 |
|
|
Point3D liquidAreaTrayPoint3D = devicePositionService.getPosition(DevicePositionCode.liquidAreaTrayPoint).getPoint3D();//获取加液模块上方点位 |
|
|
Double solutionModuleTrayMoveHeight = devicePositionService.getPosition(DevicePositionCode.solutionModuleTrayMoveHeight).getDistance();//加液模块托盘z轴移动高度 |
|
|
Double solutionModuleTrayMoveHeight = devicePositionService.getPosition(DevicePositionCode.solutionModuleTrayMoveHeight).getDistance();//加液模块托盘z轴移动高度 |
|
|
|
|
|
|
|
|
|
|
|
deviceStateService.getCommandMutexState().get().setMoveTest(true); |
|
|
return runAsync(() -> { |
|
|
return runAsync(() -> { |
|
|
webSocketService.pushSelfMoveTest(SelfMoveTestGenerator.generateJson(cmdDTO.getCommandId(), cmdDTO.getCommand(), "1、各项传感器正常", 15)); |
|
|
|
|
|
//移动xy到加液模块 |
|
|
|
|
|
gantryModuleService.gantryMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint3D); |
|
|
|
|
|
//移动z |
|
|
|
|
|
gantryModuleService.gantryZMove(solutionModuleTrayMoveHeight);//下降z轴,使托盘落入加液模块 |
|
|
|
|
|
//xyz回0点 |
|
|
|
|
|
gantryModuleService.gantryZMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0);//抬升z轴 |
|
|
|
|
|
webSocketService.pushSelfMoveTest(SelfMoveTestGenerator.generateJson(cmdDTO.getCommandId(), cmdDTO.getCommand(), "2、z轴电机检测完毕", 30)); |
|
|
|
|
|
gantryModuleService.gantryMoveZero(); |
|
|
|
|
|
webSocketService.pushSelfMoveTest(SelfMoveTestGenerator.generateJson(cmdDTO.getCommandId(), cmdDTO.getCommand(), "3、xy轴电机检测完毕", 45)); |
|
|
|
|
|
//抬起托盘1-6 |
|
|
|
|
|
gantryModuleService.allTrayUp(cmdDTO.getCommandId(), cmdDTO.getCommand()); |
|
|
|
|
|
gantryModuleService.allTrayDown(cmdDTO.getCommandId(), cmdDTO.getCommand()); |
|
|
|
|
|
webSocketService.pushSelfMoveTest(SelfMoveTestGenerator.generateJson(cmdDTO.getCommandId(), cmdDTO.getCommand(), "4、加热模块升降电机检测完毕", 60)); |
|
|
|
|
|
//抬升拍子升降 |
|
|
|
|
|
capModuleService.capMotorMove(21); |
|
|
|
|
|
webSocketService.pushSelfMoveTest(SelfMoveTestGenerator.generateJson(cmdDTO.getCommandId(), cmdDTO.getCommand(), "5、拍子存放区升降电机检测完毕", 75)); |
|
|
|
|
|
//摇匀 |
|
|
|
|
|
solutionModuleService.shakeStart(cmdDTO.getCommandId(), cmdDTO.getCommand()); |
|
|
|
|
|
Thread.sleep(2000); |
|
|
|
|
|
solutionModuleService.shakeStop(cmdDTO.getCommandId(), cmdDTO.getCommand()); |
|
|
|
|
|
solutionModuleService.shakeOrigin(cmdDTO.getCommandId(), cmdDTO.getCommand()); |
|
|
|
|
|
webSocketService.pushSelfMoveTest(SelfMoveTestGenerator.generateJson(cmdDTO.getCommandId(), cmdDTO.getCommand(), "6、摇匀电机检测完毕", 90)); |
|
|
|
|
|
//加液机械臂 |
|
|
|
|
|
solutionModuleService.dualRobotMovePoint(16); |
|
|
|
|
|
solutionModuleService.dualRobotOrigin(); |
|
|
|
|
|
webSocketService.pushSelfMoveTest(SelfMoveTestGenerator.generateJson(cmdDTO.getCommandId(), cmdDTO.getCommand(), "7、加液机械臂检测完毕", 100)); |
|
|
|
|
|
|
|
|
try{ |
|
|
|
|
|
webSocketService.pushSelfMoveTest(SelfMoveTestGenerator.generateJson(cmdDTO.getCommandId(), cmdDTO.getCommand(), "1、各项传感器正常", 15)); |
|
|
|
|
|
//移动xy到加液模块 |
|
|
|
|
|
gantryModuleService.gantryMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), liquidAreaTrayPoint3D); |
|
|
|
|
|
//移动z |
|
|
|
|
|
gantryModuleService.gantryZMove(solutionModuleTrayMoveHeight);//下降z轴,使托盘落入加液模块 |
|
|
|
|
|
//xyz回0点 |
|
|
|
|
|
gantryModuleService.gantryZMove(cmdDTO.getCommandId(), cmdDTO.getCommand(), 0);//抬升z轴 |
|
|
|
|
|
webSocketService.pushSelfMoveTest(SelfMoveTestGenerator.generateJson(cmdDTO.getCommandId(), cmdDTO.getCommand(), "2、z轴电机检测完毕", 30)); |
|
|
|
|
|
gantryModuleService.gantryMoveZero(); |
|
|
|
|
|
webSocketService.pushSelfMoveTest(SelfMoveTestGenerator.generateJson(cmdDTO.getCommandId(), cmdDTO.getCommand(), "3、xy轴电机检测完毕", 45)); |
|
|
|
|
|
//抬起托盘1-6 |
|
|
|
|
|
gantryModuleService.allTrayUp(cmdDTO.getCommandId(), cmdDTO.getCommand()); |
|
|
|
|
|
gantryModuleService.allTrayDown(cmdDTO.getCommandId(), cmdDTO.getCommand()); |
|
|
|
|
|
webSocketService.pushSelfMoveTest(SelfMoveTestGenerator.generateJson(cmdDTO.getCommandId(), cmdDTO.getCommand(), "4、加热模块升降电机检测完毕", 60)); |
|
|
|
|
|
//抬升拍子升降 |
|
|
|
|
|
capModuleService.capMotorMove(21); |
|
|
|
|
|
webSocketService.pushSelfMoveTest(SelfMoveTestGenerator.generateJson(cmdDTO.getCommandId(), cmdDTO.getCommand(), "5、拍子存放区升降电机检测完毕", 75)); |
|
|
|
|
|
//摇匀 |
|
|
|
|
|
solutionModuleService.shakeStart(cmdDTO.getCommandId(), cmdDTO.getCommand()); |
|
|
|
|
|
Thread.sleep(2000); |
|
|
|
|
|
solutionModuleService.shakeStop(cmdDTO.getCommandId(), cmdDTO.getCommand()); |
|
|
|
|
|
solutionModuleService.shakeOrigin(cmdDTO.getCommandId(), cmdDTO.getCommand()); |
|
|
|
|
|
webSocketService.pushSelfMoveTest(SelfMoveTestGenerator.generateJson(cmdDTO.getCommandId(), cmdDTO.getCommand(), "6、摇匀电机检测完毕", 90)); |
|
|
|
|
|
//加液机械臂 |
|
|
|
|
|
solutionModuleService.dualRobotMovePoint(16); |
|
|
|
|
|
solutionModuleService.dualRobotOrigin(); |
|
|
|
|
|
webSocketService.pushSelfMoveTest(SelfMoveTestGenerator.generateJson(cmdDTO.getCommandId(), cmdDTO.getCommand(), "7、加液机械臂检测完毕", 100)); |
|
|
|
|
|
}finally { |
|
|
|
|
|
deviceStateService.getCommandMutexState().get().setMoveTest(false); |
|
|
|
|
|
} |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|