|
|
@ -39,33 +39,38 @@ public class MatrixSprayContinue extends BaseCommandHandler { |
|
|
|
if (!sprayTask.isSpraying()) { |
|
|
|
throw new RuntimeException("设备没有正在喷涂"); |
|
|
|
} |
|
|
|
if(!sprayTask.isPaused()){ |
|
|
|
throw new RuntimeException("解除暂停中"); |
|
|
|
} |
|
|
|
sprayTask.setPaused(false);//解除暂停 |
|
|
|
deviceStatus.setPaused(false); |
|
|
|
SprayTimes sprayTimes = sprayTask.getSprayTimes(); |
|
|
|
return runAsync(() -> { |
|
|
|
OperationLog operationLog = operationLogService.getById(sprayTask.getOperationLogId()); |
|
|
|
operationLog.setStatus(0); |
|
|
|
operationLogService.updateById(operationLog); |
|
|
|
|
|
|
|
if (sprayTimes.getHighVoltage()) { |
|
|
|
DeviceCommand highVoltageOpenCommand = DeviceCommandGenerator.highVoltageOpen(sprayTimes.getHighVoltageValue()); //打开高压 |
|
|
|
CommandFuture highVoltageOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), highVoltageOpenCommand); |
|
|
|
commandWait(highVoltageOpenCommandFuture); |
|
|
|
} |
|
|
|
try{ |
|
|
|
OperationLog operationLog = operationLogService.getById(sprayTask.getOperationLogId()); |
|
|
|
operationLog.setStatus(0); |
|
|
|
operationLogService.updateById(operationLog); |
|
|
|
|
|
|
|
DeviceCommand threeWayValveOpenSyringePipelineCommand = DeviceCommandGenerator.threeWayValveOpenSyringePipeline();//打开三通阀喷嘴管路 |
|
|
|
CommandFuture threeWayValveOpenSyringePipelineCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), threeWayValveOpenSyringePipelineCommand); |
|
|
|
commandWait(threeWayValveOpenSyringePipelineCommandFuture); |
|
|
|
if (sprayTimes.getHighVoltage()) { |
|
|
|
DeviceCommand highVoltageOpenCommand = DeviceCommandGenerator.highVoltageOpen(sprayTimes.getHighVoltageValue()); //打开高压 |
|
|
|
CommandFuture highVoltageOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), highVoltageOpenCommand); |
|
|
|
commandWait(highVoltageOpenCommandFuture); |
|
|
|
} |
|
|
|
|
|
|
|
DeviceCommand nozzleValveOpenCommand = DeviceCommandGenerator.nozzleValveOpen(); //打开喷嘴阀 |
|
|
|
CommandFuture nozzleValveOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleValveOpenCommand); |
|
|
|
commandWait(nozzleValveOpenCommandFuture); |
|
|
|
DeviceCommand threeWayValveOpenSyringePipelineCommand = DeviceCommandGenerator.threeWayValveOpenSyringePipeline();//打开三通阀喷嘴管路 |
|
|
|
CommandFuture threeWayValveOpenSyringePipelineCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), threeWayValveOpenSyringePipelineCommand); |
|
|
|
commandWait(threeWayValveOpenSyringePipelineCommandFuture); |
|
|
|
|
|
|
|
DeviceCommand syringePumpForwardCommand = DeviceCommandGenerator.syringePumpForward(sprayTimes.getVolume()); //推动注射泵 |
|
|
|
CommandFuture syringePumpForwardCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpForwardCommand); |
|
|
|
commandWait(syringePumpForwardCommandFuture); |
|
|
|
DeviceCommand nozzleValveOpenCommand = DeviceCommandGenerator.nozzleValveOpen(); //打开喷嘴阀 |
|
|
|
CommandFuture nozzleValveOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleValveOpenCommand); |
|
|
|
commandWait(nozzleValveOpenCommandFuture); |
|
|
|
|
|
|
|
sprayTaskExecutor.startTask(); |
|
|
|
DeviceCommand syringePumpForwardCommand = DeviceCommandGenerator.syringePumpForward(sprayTimes.getVolume()); //推动注射泵 |
|
|
|
CommandFuture syringePumpForwardCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpForwardCommand); |
|
|
|
commandWait(syringePumpForwardCommandFuture); |
|
|
|
sprayTaskExecutor.startTask(); |
|
|
|
} finally { |
|
|
|
deviceStatus.setPaused(false); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
} |
|
|
|