|
|
@ -49,41 +49,43 @@ public class MatrixSprayStop extends BaseCommandHandler { |
|
|
|
webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(sprayTask.getCmdId(), sprayTask.getCmdCode(), CommandStatus.SPRAY_TASK_FINISH, "喷涂任务结束")); |
|
|
|
|
|
|
|
return runAsync(() -> { |
|
|
|
sprayTask.setClose(true); |
|
|
|
sprayTaskExecutor.stopTask();//终止喷涂任务线程 |
|
|
|
try{ |
|
|
|
sprayTask.setClose(true); |
|
|
|
sprayTaskExecutor.stopTask();//终止喷涂任务线程 |
|
|
|
|
|
|
|
DeviceCommand syringePumpStopCommand = DeviceCommandGenerator.syringePumpStop(); //停止推动注射泵 |
|
|
|
CommandFuture syringePumpStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpStopCommand); |
|
|
|
DeviceCommand nozzleValveCloseCommand = DeviceCommandGenerator.nozzleValveClose(); //关闭喷嘴阀 |
|
|
|
CommandFuture nozzleValveCloseCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleValveCloseCommand); |
|
|
|
DeviceCommand highVoltageCloseCommand = DeviceCommandGenerator.highVoltageClose(); //关闭高压 |
|
|
|
CommandFuture highVoltageCloseCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), highVoltageCloseCommand); |
|
|
|
commandWait(syringePumpStopCommandFuture, nozzleValveCloseCommandFuture, highVoltageCloseCommandFuture); |
|
|
|
DeviceCommand syringePumpStopCommand = DeviceCommandGenerator.syringePumpStop(); //停止推动注射泵 |
|
|
|
CommandFuture syringePumpStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpStopCommand); |
|
|
|
DeviceCommand nozzleValveCloseCommand = DeviceCommandGenerator.nozzleValveClose(); //关闭喷嘴阀 |
|
|
|
CommandFuture nozzleValveCloseCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleValveCloseCommand); |
|
|
|
DeviceCommand highVoltageCloseCommand = DeviceCommandGenerator.highVoltageClose(); //关闭高压 |
|
|
|
CommandFuture highVoltageCloseCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), highVoltageCloseCommand); |
|
|
|
commandWait(syringePumpStopCommandFuture, nozzleValveCloseCommandFuture, highVoltageCloseCommandFuture); |
|
|
|
|
|
|
|
DeviceCommand motorXStopCommand = DeviceCommandGenerator.motorXStop(); //x轴停止移动 |
|
|
|
DeviceCommand motorYStopCommand = DeviceCommandGenerator.motorYStop(); //y轴停止移动 |
|
|
|
DeviceCommand motorZStopCommand = DeviceCommandGenerator.motorZStop(); //z轴停止移动 |
|
|
|
CommandFuture motorXStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXStopCommand); |
|
|
|
CommandFuture motorYStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorYStopCommand); |
|
|
|
CommandFuture motorZStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZStopCommand); |
|
|
|
commandWait(motorXStopCommandFuture, motorYStopCommandFuture, motorZStopCommandFuture); |
|
|
|
DeviceCommand motorXStopCommand = DeviceCommandGenerator.motorXStop(); //x轴停止移动 |
|
|
|
DeviceCommand motorYStopCommand = DeviceCommandGenerator.motorYStop(); //y轴停止移动 |
|
|
|
DeviceCommand motorZStopCommand = DeviceCommandGenerator.motorZStop(); //z轴停止移动 |
|
|
|
CommandFuture motorXStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXStopCommand); |
|
|
|
CommandFuture motorYStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorYStopCommand); |
|
|
|
CommandFuture motorZStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZStopCommand); |
|
|
|
commandWait(motorXStopCommandFuture, motorYStopCommandFuture, motorZStopCommandFuture); |
|
|
|
|
|
|
|
OperationLog operationLog = operationLogService.getById(sprayTask.getOperationLogId()); |
|
|
|
operationLog.setStatus(3); |
|
|
|
operationLogService.updateById(operationLog); |
|
|
|
OperationLog operationLog = operationLogService.getById(sprayTask.getOperationLogId()); |
|
|
|
operationLog.setStatus(3); |
|
|
|
operationLogService.updateById(operationLog); |
|
|
|
|
|
|
|
//XYZ回原点 |
|
|
|
DeviceCommand motorXOriginCommand = DeviceCommandGenerator.motorXOrigin(); |
|
|
|
DeviceCommand motorYOriginCommand = DeviceCommandGenerator.motorYOrigin(); |
|
|
|
DeviceCommand motorZOriginCommand = DeviceCommandGenerator.motorZOrigin(); |
|
|
|
CommandFuture motorXOriginCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXOriginCommand); |
|
|
|
CommandFuture motorYOriginCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorYOriginCommand); |
|
|
|
CommandFuture motorZOriginCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZOriginCommand); |
|
|
|
commandWait(motorXOriginCommandFuture, motorYOriginCommandFuture, motorZOriginCommandFuture); |
|
|
|
|
|
|
|
SprayTask.getInstance().clear(); |
|
|
|
deviceStatus.setSpraying(false); |
|
|
|
deviceStatus.setPaused(false); |
|
|
|
//XYZ回原点 |
|
|
|
DeviceCommand motorXOriginCommand = DeviceCommandGenerator.motorXOrigin(); |
|
|
|
DeviceCommand motorYOriginCommand = DeviceCommandGenerator.motorYOrigin(); |
|
|
|
DeviceCommand motorZOriginCommand = DeviceCommandGenerator.motorZOrigin(); |
|
|
|
CommandFuture motorXOriginCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXOriginCommand); |
|
|
|
CommandFuture motorYOriginCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorYOriginCommand); |
|
|
|
CommandFuture motorZOriginCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZOriginCommand); |
|
|
|
commandWait(motorXOriginCommandFuture, motorYOriginCommandFuture, motorZOriginCommandFuture); |
|
|
|
}finally { |
|
|
|
sprayTask.clear(); |
|
|
|
deviceStatus.setSpraying(false); |
|
|
|
deviceStatus.setPaused(false); |
|
|
|
} |
|
|
|
}); |
|
|
|
} |
|
|
|
} |