Browse Source

fix:优化暂停功能

master
白凤吉 3 weeks ago
parent
commit
b795bb07c4
  1. 45
      src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayContinue.java
  2. 2
      src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayPause.java

45
src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayContinue.java

@ -39,33 +39,38 @@ public class MatrixSprayContinue extends BaseCommandHandler {
if (!sprayTask.isSpraying()) { if (!sprayTask.isSpraying()) {
throw new RuntimeException("设备没有正在喷涂"); throw new RuntimeException("设备没有正在喷涂");
} }
if(!sprayTask.isPaused()){
throw new RuntimeException("解除暂停中");
}
sprayTask.setPaused(false);//解除暂停 sprayTask.setPaused(false);//解除暂停
deviceStatus.setPaused(false);
SprayTimes sprayTimes = sprayTask.getSprayTimes(); SprayTimes sprayTimes = sprayTask.getSprayTimes();
return runAsync(() -> { 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);
}
}); });
} }

2
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); CommandFuture motorZStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZStopCommand);
commandWait(motorXStopCommandFuture, motorYStopCommandFuture, motorZStopCommandFuture); commandWait(motorXStopCommandFuture, motorYStopCommandFuture, motorZStopCommandFuture);
if(sprayTask.getCurrentStep() > 0){
if(sprayTask.getCurrentStep() > 0 && sprayTask.getCurrentPausedPoint() == null){//只有在喷涂过程中才需要记录并且记录点不可被覆盖
//记录当前位置 //记录当前位置
DeviceCommand motorXyzPositionGetCommand = DeviceCommandGenerator.motorXyzPositionGet(); // 生成获得电机XYZ相对原点坐标指令 DeviceCommand motorXyzPositionGetCommand = DeviceCommandGenerator.motorXyzPositionGet(); // 生成获得电机XYZ相对原点坐标指令
CommandFuture motorXyzPositionGetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXyzPositionGetCommand); CommandFuture motorXyzPositionGetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXyzPositionGetCommand);

Loading…
Cancel
Save