|
@ -3,7 +3,6 @@ package com.qyft.ms.app.front.cmd.business; |
|
|
import cn.hutool.json.JSONObject; |
|
|
import cn.hutool.json.JSONObject; |
|
|
import com.qyft.ms.system.common.annotation.CommandMapping; |
|
|
import com.qyft.ms.system.common.annotation.CommandMapping; |
|
|
import com.qyft.ms.system.common.constant.CommandStatus; |
|
|
import com.qyft.ms.system.common.constant.CommandStatus; |
|
|
import com.qyft.ms.system.common.constant.DeviceEventConstants; |
|
|
|
|
|
import com.qyft.ms.system.common.device.command.CommandFuture; |
|
|
import com.qyft.ms.system.common.device.command.CommandFuture; |
|
|
import com.qyft.ms.system.common.device.command.DeviceCommandGenerator; |
|
|
import com.qyft.ms.system.common.device.command.DeviceCommandGenerator; |
|
|
import com.qyft.ms.system.common.device.command.FrontCommand; |
|
|
import com.qyft.ms.system.common.device.command.FrontCommand; |
|
@ -43,7 +42,7 @@ public class NozzlePipelinePreFill extends BaseCommandHandler { |
|
|
// 判断z轴是否在安全距离,如果不在安全距离则抬升z轴 |
|
|
// 判断z轴是否在安全距离,如果不在安全距离则抬升z轴 |
|
|
DeviceCommand motorXyzPositionGetCommand = DeviceCommandGenerator.motorXyzPositionGet(); // 生成获取xyz当前位置指令 |
|
|
DeviceCommand motorXyzPositionGetCommand = DeviceCommandGenerator.motorXyzPositionGet(); // 生成获取xyz当前位置指令 |
|
|
CommandFuture motorXyzPositionGetCommandFuture = deviceCommandService.sendCommand(motorXyzPositionGetCommand, form, emitter); |
|
|
CommandFuture motorXyzPositionGetCommandFuture = deviceCommandService.sendCommand(motorXyzPositionGetCommand, form, emitter); |
|
|
waitAll(motorXyzPositionGetCommandFuture.getAckFuture()); |
|
|
|
|
|
|
|
|
commandWait(motorXyzPositionGetCommandFuture); |
|
|
|
|
|
|
|
|
JSONObject motorXyzPositionGetCommandFutureResult = motorXyzPositionGetCommandFuture.getAckFuture().get(); |
|
|
JSONObject motorXyzPositionGetCommandFutureResult = motorXyzPositionGetCommandFuture.getAckFuture().get(); |
|
|
JSONObject resultObj = motorXyzPositionGetCommandFutureResult.getJSONObject("result"); |
|
|
JSONObject resultObj = motorXyzPositionGetCommandFutureResult.getJSONObject("result"); |
|
@ -58,9 +57,7 @@ public class NozzlePipelinePreFill extends BaseCommandHandler { |
|
|
emitter.send(FrontCommand.backstage(form.getCmdId(), form.getCmdCode(), CommandStatus.SEND, "z轴超出安全距离,抬升z轴至安全距离"), MediaType.APPLICATION_JSON); |
|
|
emitter.send(FrontCommand.backstage(form.getCmdId(), form.getCmdCode(), CommandStatus.SEND, "z轴超出安全距离,抬升z轴至安全距离"), MediaType.APPLICATION_JSON); |
|
|
DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(80.0); |
|
|
DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(80.0); |
|
|
CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(motorZPositionSetCommand, form, emitter); |
|
|
CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(motorZPositionSetCommand, form, emitter); |
|
|
deviceCommandService.waitForEvent(DeviceEventConstants.MOTOR_Z_MOVE_FINISHED,motorZPositionSetCommandFuture); |
|
|
|
|
|
waitAll(motorZPositionSetCommandFuture.getAckFuture()); |
|
|
|
|
|
waitAllEvent(motorZPositionSetCommandFuture.getEventFuture()); |
|
|
|
|
|
|
|
|
commandWait(motorZPositionSetCommandFuture); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// x轴移动到废液位置,下降z轴高度防止飞溅 |
|
|
// x轴移动到废液位置,下降z轴高度防止飞溅 |
|
@ -72,26 +69,21 @@ public class NozzlePipelinePreFill extends BaseCommandHandler { |
|
|
DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(70.0); |
|
|
DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(70.0); |
|
|
CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(motorZPositionSetCommand, form, emitter); |
|
|
CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(motorZPositionSetCommand, form, emitter); |
|
|
|
|
|
|
|
|
deviceCommandService.waitForEvent(DeviceEventConstants.MOTOR_X_MOVE_FINISHED,motorXPositionSetCommandFuture); |
|
|
|
|
|
deviceCommandService.waitForEvent(DeviceEventConstants.MOTOR_Z_MOVE_FINISHED,motorZPositionSetCommandFuture); |
|
|
|
|
|
|
|
|
|
|
|
waitAll(motorXPositionSetCommandFuture.getAckFuture(),motorZPositionSetCommandFuture.getAckFuture()); |
|
|
|
|
|
waitAllEvent(motorXPositionSetCommandFuture.getEventFuture(),motorZPositionSetCommandFuture.getEventFuture()); |
|
|
|
|
|
|
|
|
commandWait(motorXPositionSetCommandFuture, motorZPositionSetCommandFuture); |
|
|
|
|
|
|
|
|
// 打开三通阀注射器管路 |
|
|
// 打开三通阀注射器管路 |
|
|
DeviceCommand threeWayValveOpenNozzlePipelineCommand = DeviceCommandGenerator.threeWayValveOpenNozzlePipeline(); |
|
|
DeviceCommand threeWayValveOpenNozzlePipelineCommand = DeviceCommandGenerator.threeWayValveOpenNozzlePipeline(); |
|
|
CommandFuture threeWayValveOpenNozzlePipelineCommandFuture = deviceCommandService.sendCommand(threeWayValveOpenNozzlePipelineCommand, form, emitter); |
|
|
CommandFuture threeWayValveOpenNozzlePipelineCommandFuture = deviceCommandService.sendCommand(threeWayValveOpenNozzlePipelineCommand, form, emitter); |
|
|
waitAll(threeWayValveOpenNozzlePipelineCommandFuture.getAckFuture()); |
|
|
|
|
|
|
|
|
|
|
|
// 打开喷嘴阀 |
|
|
// 打开喷嘴阀 |
|
|
DeviceCommand nozzleValveOpenCommand = DeviceCommandGenerator.nozzleValveOpen(); |
|
|
DeviceCommand nozzleValveOpenCommand = DeviceCommandGenerator.nozzleValveOpen(); |
|
|
CommandFuture nozzleValveOpenCommandFuture = deviceCommandService.sendCommand(nozzleValveOpenCommand, form, emitter); |
|
|
CommandFuture nozzleValveOpenCommandFuture = deviceCommandService.sendCommand(nozzleValveOpenCommand, form, emitter); |
|
|
waitAll(nozzleValveOpenCommandFuture.getAckFuture()); |
|
|
|
|
|
|
|
|
|
|
|
// 设置注射泵速度,推注射泵 |
|
|
// 设置注射泵速度,推注射泵 |
|
|
DeviceCommand syringePumpForwardCommand = DeviceCommandGenerator.syringePumpForward(speed); |
|
|
DeviceCommand syringePumpForwardCommand = DeviceCommandGenerator.syringePumpForward(speed); |
|
|
CommandFuture syringePumpForwardCommandFuture = deviceCommandService.sendCommand(syringePumpForwardCommand, form, emitter); |
|
|
CommandFuture syringePumpForwardCommandFuture = deviceCommandService.sendCommand(syringePumpForwardCommand, form, emitter); |
|
|
waitAll(syringePumpForwardCommandFuture.getAckFuture()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
commandWait(threeWayValveOpenNozzlePipelineCommandFuture, nozzleValveOpenCommandFuture, syringePumpForwardCommandFuture); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |