diff --git a/src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayContinue.java b/src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayContinue.java index e479ab0..85816b7 100644 --- a/src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayContinue.java +++ b/src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayContinue.java @@ -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); + } }); } diff --git a/src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayPause.java b/src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayPause.java index f7d4113..0190094 100644 --- a/src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayPause.java +++ b/src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayPause.java @@ -61,7 +61,7 @@ public class MatrixSprayPause extends BaseCommandHandler { CommandFuture motorZStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZStopCommand); commandWait(motorXStopCommandFuture, motorYStopCommandFuture, motorZStopCommandFuture); - if(sprayTask.getCurrentStep() > 0){ + if(sprayTask.getCurrentStep() > 0 && sprayTask.getCurrentPausedPoint() == null){//只有在喷涂过程中才需要记录,并且记录点不可被覆盖 //记录当前位置 DeviceCommand motorXyzPositionGetCommand = DeviceCommandGenerator.motorXyzPositionGet(); // 生成获得电机XYZ相对原点坐标指令 CommandFuture motorXyzPositionGetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXyzPositionGetCommand);