diff --git a/src/main/java/com/qyft/ms/app/device/spray/SprayTaskExecutor.java b/src/main/java/com/qyft/ms/app/device/spray/SprayTaskExecutor.java index 2afea43..009d327 100644 --- a/src/main/java/com/qyft/ms/app/device/spray/SprayTaskExecutor.java +++ b/src/main/java/com/qyft/ms/app/device/spray/SprayTaskExecutor.java @@ -81,6 +81,7 @@ public class SprayTaskExecutor { CommandFuture motorYPositionSetCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorYPositionSetCommand); CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorZPositionSetCommand); commandWait(motorXPositionSetCommandFuture, motorYPositionSetCommandFuture, motorZPositionSetCommandFuture); + SysSettings slideHeightSysSettings = sysSettingsService.getOne(new LambdaQueryWrapper().eq(SysSettings::getCode, "slide_height")); Double slideHeight = Double.parseDouble(slideHeightSysSettings.getValue()); Double height = slideHeight - sprayTask.getSprayParams().getMotorZHeight(); @@ -100,18 +101,19 @@ public class SprayTaskExecutor { sprayTask.setSprayPreStepsCompleted(true); } + DeviceCommand nozzleValveOpenCommand = DeviceCommandGenerator.nozzleValveOpen();//开启喷嘴阀 + CommandFuture nozzleValveOpenCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), nozzleValveOpenCommand); + commandWait(nozzleValveOpenCommandFuture); + int reCurrentStep = sprayTask.getCurrentStep(); int currentStep = 0; //当前喷涂步骤 int sprayNum = 1; for (SprayTaskStep sprayTaskStep : sprayTask.getSprayTaskStepList()) {//循环进行多次喷涂 - - DeviceCommand nozzleValveOpenCommand = DeviceCommandGenerator.nozzleValveOpen();//开启喷嘴阀 DeviceCommand syringePumpForwardCommand = DeviceCommandGenerator.syringePumpForward(sprayTask.getSprayParams().getVolume());//推动移动注射泵 - CommandFuture nozzleValveOpenCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), nozzleValveOpenCommand); CommandFuture syringePumpForwardCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), syringePumpForwardCommand); - commandWait(nozzleValveOpenCommandFuture, syringePumpForwardCommandFuture); + commandWait(syringePumpForwardCommandFuture); + Thread.sleep(100); - List sprayStepList = new ArrayList<>(); sprayTask.setSuspendable(true);//可以暂停,单次喷涂范围内可以进行暂停 deviceStatus.setSuspendable(true); for (int i = 0; i < sprayTaskStep.getSpraySteps().size(); i++) {//单次喷涂 @@ -126,7 +128,6 @@ public class SprayTaskExecutor { } CommandFuture[] commandFutureArray = commandFutureList.toArray(new CommandFuture[0]); -// sprayTaskPointCollector.startCollecting(sprayTaskStep.getIndex()); //开启点位推送 Point2D currentPoint; Point2D nextPoint = null; if (i != 0) { @@ -141,7 +142,6 @@ public class SprayTaskExecutor { webSocketService.pushMsg(WebSocketMessageType.SPRAY_POINT, sprayTaskPointCollectorPushBO); } commandWait(commandFutureArray); -// sprayTaskPointCollector.stopCollecting();//关闭点位推送 currentStep++; sprayTask.setCurrentStep(currentStep);//将当前的喷涂进度缓存 if (nextPoint != null) { @@ -156,16 +156,19 @@ public class SprayTaskExecutor { sprayTask.setSuspendable(false);//不可暂停 deviceStatus.setSuspendable(false); - DeviceCommand nozzleValveCloseCommand = DeviceCommandGenerator.nozzleValveClose();//关闭喷嘴阀 + DeviceCommand syringePumpStopCommand = DeviceCommandGenerator.syringePumpStop();//停止推动注射泵 - CommandFuture nozzleValveCloseCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), nozzleValveCloseCommand); CommandFuture syringePumpStopCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), syringePumpStopCommand); - commandWait(nozzleValveCloseCommandFuture, syringePumpStopCommandFuture); + commandWait(syringePumpStopCommandFuture); sprayNum++; } DeviceCommand highVoltageCloseCommand = DeviceCommandGenerator.highVoltageClose();//关闭高压 CommandFuture highVoltageCloseCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), highVoltageCloseCommand); commandWait(highVoltageCloseCommandFuture); + Thread.sleep(500); + DeviceCommand nozzleValveCloseCommand = DeviceCommandGenerator.nozzleValveClose();//关闭喷嘴阀 + CommandFuture nozzleValveCloseCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), nozzleValveCloseCommand); + commandWait(nozzleValveCloseCommandFuture); //XYZ回原点 DeviceCommand motorXPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(0.0); diff --git a/src/main/java/com/qyft/ms/app/front/cmd/business/DeviceSelfTest.java b/src/main/java/com/qyft/ms/app/front/cmd/business/DeviceSelfTest.java index 9f1c6f7..1817441 100644 --- a/src/main/java/com/qyft/ms/app/front/cmd/business/DeviceSelfTest.java +++ b/src/main/java/com/qyft/ms/app/front/cmd/business/DeviceSelfTest.java @@ -41,23 +41,17 @@ public class DeviceSelfTest extends BaseCommandHandler { commandWait(motorXOriginCommandFuture, motorYOriginCommandFuture, motorZOriginCommandFuture); try { if (motorXOriginCommandFuture.getResponseResult().getBool("status")) { - selfTestService.getSelfTestStatus().setXAxisAtOrigin(true); + selfTestService.getSelfTestStatus().setXAxisAtOrigin(false); } - } catch (Exception ignored) { - } - try { if (motorYOriginCommandFuture.getResponseResult().getBool("status")) { selfTestService.getSelfTestStatus().setYAxisAtOrigin(true); } - } catch (Exception ignored) { - } - try { if (motorZOriginCommandFuture.getResponseResult().getBool("status")) { selfTestService.getSelfTestStatus().setZAxisAtOrigin(true); } + deviceStatus.setSelfTestCompleted(true); } catch (Exception ignored) { } - deviceStatus.setSelfTestCompleted(true); }); } } 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 9478ed2..147bced 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 @@ -35,11 +35,18 @@ public class MatrixSprayContinue extends BaseCommandHandler { throw new RuntimeException("设备没有正在喷涂"); } return runAsync(() -> { - DeviceCommand syringePumpForwardCommand = DeviceCommandGenerator.syringePumpForward(sprayTask.getSprayParams().getVolume()); //推动注射泵 - CommandFuture syringePumpForwardCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpForwardCommand); + DeviceCommand threeWayValveOpenSyringePipelineCommand = DeviceCommandGenerator.threeWayValveOpenSyringePipeline();//打开三通阀喷嘴管路 + CommandFuture threeWayValveOpenSyringePipelineCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), threeWayValveOpenSyringePipelineCommand); + commandWait(threeWayValveOpenSyringePipelineCommandFuture); + DeviceCommand nozzleValveOpenCommand = DeviceCommandGenerator.nozzleValveOpen(); //打开喷嘴阀 CommandFuture nozzleValveOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleValveOpenCommand); - commandWait(syringePumpForwardCommandFuture, nozzleValveOpenCommandFuture); + commandWait(nozzleValveOpenCommandFuture); + + DeviceCommand syringePumpForwardCommand = DeviceCommandGenerator.syringePumpForward(sprayTask.getSprayParams().getVolume()); //推动注射泵 + CommandFuture syringePumpForwardCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpForwardCommand); + commandWait(syringePumpForwardCommandFuture); + if (sprayTask.getSprayParams().getHighVoltage()) { DeviceCommand highVoltageOpenCommand = DeviceCommandGenerator.highVoltageOpen(sprayTask.getSprayParams().getHighVoltageValue()); //打开高压 CommandFuture highVoltageOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), highVoltageOpenCommand); diff --git a/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFill.java b/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFill.java index 2fff4ef..aaca822 100644 --- a/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFill.java +++ b/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFill.java @@ -79,10 +79,8 @@ public class NozzlePipelinePreFill extends BaseCommandHandler { //5.打开三通阀注射器管路 DeviceCommand threeWayValveOpenNozzlePipelineCommand = DeviceCommandGenerator.threeWayValveOpenNozzlePipeline(); CommandFuture threeWayValveOpenNozzlePipelineCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveOpenNozzlePipelineCommand); - //6.打开喷嘴阀 - DeviceCommand nozzleValveOpenCommand = DeviceCommandGenerator.nozzleValveOpen(); // 生成开启喷嘴阀指令 - CommandFuture nozzleValveOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleValveOpenCommand); - commandWait(nozzleValveOpenCommandFuture, threeWayValveOpenNozzlePipelineCommandFuture); + commandWait(threeWayValveOpenNozzlePipelineCommandFuture); + Thread.sleep(500); //7.设置注射泵速度,推注射泵 DeviceCommand syringePumpStartCommand = DeviceCommandGenerator.syringePumpForward(speed); // 生成移动注射泵指令 CommandFuture syringePumpStartCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpStartCommand); diff --git a/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFillStop.java b/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFillStop.java index 7f77a60..eb7953c 100644 --- a/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFillStop.java +++ b/src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFillStop.java @@ -32,13 +32,11 @@ public class NozzlePipelinePreFillStop extends BaseCommandHandler { //1.停止推动注射泵 DeviceCommand syringePumpStopCommand = DeviceCommandGenerator.syringePumpStop();//停止推动注射泵 CommandFuture syringePumpStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpStopCommand); + Thread.sleep(500); //2.全部关闭三通阀 DeviceCommand threeWayValveCloseAllCommand = DeviceCommandGenerator.threeWayValveCloseAll(); // 生成全部关闭三通阀指令 CommandFuture threeWayValveCloseAllCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveCloseAllCommand); - //3.关闭喷嘴阀 - DeviceCommand nozzleValveCloseCommand = DeviceCommandGenerator.nozzleValveClose(); //关闭喷嘴阀 - CommandFuture nozzleValveCloseCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleValveCloseCommand); - commandWait(syringePumpStopCommandFuture, threeWayValveCloseAllCommandFuture, nozzleValveCloseCommandFuture); + commandWait(syringePumpStopCommandFuture, threeWayValveCloseAllCommandFuture); deviceStatus.setPrefilling(false); });