|
|
@ -141,7 +141,10 @@ public class MatrixSprayStart extends BaseCommandHandler { |
|
|
|
webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(form.getCmdId(), form.getCmdCode(), CommandStatus.ERROR, "电压不能大于6000V")); |
|
|
|
throw new RuntimeException("电压不能大于6000V"); |
|
|
|
} |
|
|
|
return runAsync(() -> { |
|
|
|
if (positionList.isEmpty()) { |
|
|
|
webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(form.getCmdId(), form.getCmdCode(), CommandStatus.ERROR, "喷涂区域不能为空")); |
|
|
|
throw new RuntimeException("喷涂区域不能为空"); |
|
|
|
} |
|
|
|
// 3. 设定喷涂参数 |
|
|
|
sprayTask.setSprayParam(matrixPathType, motorZHeight, gasPressure, volume, highVoltage, highVoltageValue, spacing, movingSpeed, times, positionList); |
|
|
|
sprayTask.setCacheParams(form.getParams()); |
|
|
@ -196,9 +199,9 @@ public class MatrixSprayStart extends BaseCommandHandler { |
|
|
|
PathGenerator.Points p = pathList.get(j); |
|
|
|
List<DeviceCommand> deviceCommands = new ArrayList<>(); |
|
|
|
if (j == pathList.size() - 1) { |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorXPositionSet(p.getX(), 20.0));//移动x轴 |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorYPositionSet(75.5 - p.getY(), 20.0));//移动y轴 |
|
|
|
}else{ |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorXPositionSet(p.getX(), movingSpeed));//移动x轴 |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorYPositionSet(75.5 - p.getY(), movingSpeed));//移动y轴 |
|
|
|
} else { |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorXPositionSet(p.getX(), movingSpeed));//移动x轴 |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorYPositionSet(75.5 - p.getY(), movingSpeed));//移动y轴 |
|
|
|
} |
|
|
@ -233,9 +236,9 @@ public class MatrixSprayStart extends BaseCommandHandler { |
|
|
|
PathGenerator.Points p = pathList.get(j); |
|
|
|
List<DeviceCommand> deviceCommands = new ArrayList<>(); |
|
|
|
if (j == pathList.size() - 1) { |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorXPositionSet(p.getX(), 20.0));//移动x轴 |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorYPositionSet(75.5 - p.getY(), 20.0));//移动y轴 |
|
|
|
}else{ |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorXPositionSet(p.getX(), movingSpeed));//移动x轴 |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorYPositionSet(75.5 - p.getY(), movingSpeed));//移动y轴 |
|
|
|
} else { |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorXPositionSet(p.getX(), movingSpeed));//移动x轴 |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorYPositionSet(75.5 - p.getY(), movingSpeed));//移动y轴 |
|
|
|
} |
|
|
@ -269,9 +272,9 @@ public class MatrixSprayStart extends BaseCommandHandler { |
|
|
|
PathGenerator.Points p = pathList.get(j); |
|
|
|
List<DeviceCommand> deviceCommands = new ArrayList<>(); |
|
|
|
if (j == pathList.size() - 1) { |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorXPositionSet(p.getX(), 20.0));//移动x轴 |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorYPositionSet(75.5 - p.getY(), 20.0));//移动y轴 |
|
|
|
}else{ |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorXPositionSet(p.getX(), movingSpeed));//移动x轴 |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorYPositionSet(75.5 - p.getY(), movingSpeed));//移动y轴 |
|
|
|
} else { |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorXPositionSet(p.getX(), movingSpeed));//移动x轴 |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorYPositionSet(75.5 - p.getY(), movingSpeed));//移动y轴 |
|
|
|
} |
|
|
@ -292,9 +295,9 @@ public class MatrixSprayStart extends BaseCommandHandler { |
|
|
|
PathGenerator.Points p = pathList.get(j); |
|
|
|
List<DeviceCommand> deviceCommands = new ArrayList<>(); |
|
|
|
if (j == pathList.size() - 1) { |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorXPositionSet(p.getX(), 20.0));//移动x轴 |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorYPositionSet(75.5 - p.getY(), 20.0));//移动y轴 |
|
|
|
}else{ |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorXPositionSet(p.getX(), movingSpeed));//移动x轴 |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorYPositionSet(75.5 - p.getY(), movingSpeed));//移动y轴 |
|
|
|
} else { |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorXPositionSet(p.getX(), movingSpeed));//移动x轴 |
|
|
|
deviceCommands.add(DeviceCommandGenerator.motorYPositionSet(75.5 - p.getY(), movingSpeed));//移动y轴 |
|
|
|
} |
|
|
@ -306,9 +309,32 @@ public class MatrixSprayStart extends BaseCommandHandler { |
|
|
|
sprayTask.getSprayTaskStepList().add(sprayTaskStep2); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return runAsync(() -> { |
|
|
|
//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); |
|
|
|
|
|
|
|
DeviceCommand threeWayValveOpenSyringePipelineCommand = DeviceCommandGenerator.threeWayValveOpenSyringePipeline();//打开三通阀喷嘴管路 |
|
|
|
CommandFuture threeWayValveOpenSyringePipelineCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveOpenSyringePipelineCommand); |
|
|
|
commandWait(threeWayValveOpenSyringePipelineCommandFuture); |
|
|
|
|
|
|
|
if (sprayTask.getSprayParams().getHighVoltage()) {//加电 |
|
|
|
DeviceCommand highVoltageOpenCommand = DeviceCommandGenerator.highVoltageOpen(highVoltageValue);//开启高压 |
|
|
|
CommandFuture highVoltageOpenCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), highVoltageOpenCommand); |
|
|
|
commandWait(highVoltageOpenCommandFuture); |
|
|
|
} |
|
|
|
// log.info(JSONUtil.toJsonStr(sprayTask.getSprayTaskStepList())); |
|
|
|
|
|
|
|
DeviceCommand nozzleValveOpenCommand = DeviceCommandGenerator.nozzleValveOpen();//开启喷嘴阀 |
|
|
|
CommandFuture nozzleValveOpenCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), nozzleValveOpenCommand); |
|
|
|
commandWait(nozzleValveOpenCommandFuture); |
|
|
|
|
|
|
|
|
|
|
|
// 10. 启动喷涂线程,开始喷涂 |
|
|
|
sprayTaskExecutor.startTask(); |
|
|
|
webSocketService.pushDebugMsg(FrontResponseGenerator.generateJson(form.getCmdId(), form.getCmdCode(), CommandStatus.SEND, "已开启喷涂线程")); |
|
|
|