|
@ -30,6 +30,7 @@ public class SprayTaskExecutor { |
|
|
private final DeviceCommandService deviceCommandService; |
|
|
private final DeviceCommandService deviceCommandService; |
|
|
private final SprayTaskPointCollector sprayTaskPointCollector; |
|
|
private final SprayTaskPointCollector sprayTaskPointCollector; |
|
|
private final SysSettingsService sysSettingsService; |
|
|
private final SysSettingsService sysSettingsService; |
|
|
|
|
|
private final DeviceStatus deviceStatus; |
|
|
|
|
|
|
|
|
private Thread taskThread; |
|
|
private Thread taskThread; |
|
|
|
|
|
|
|
@ -86,7 +87,7 @@ public class SprayTaskExecutor { |
|
|
|
|
|
|
|
|
List<Point2D> sprayStepList = new ArrayList<>(); |
|
|
List<Point2D> sprayStepList = new ArrayList<>(); |
|
|
sprayTask.setSuspendable(true);//可以暂停,单次喷涂范围内可以进行暂停 |
|
|
sprayTask.setSuspendable(true);//可以暂停,单次喷涂范围内可以进行暂停 |
|
|
DeviceStatus.getInstance().setSuspendable(true); |
|
|
|
|
|
|
|
|
deviceStatus.setSuspendable(true); |
|
|
for (List<DeviceCommand> deviceCommandAgg : deviceCommandList) {//单次喷涂 |
|
|
for (List<DeviceCommand> deviceCommandAgg : deviceCommandList) {//单次喷涂 |
|
|
if (reCurrentStep < currentStep) { |
|
|
if (reCurrentStep < currentStep) { |
|
|
break; |
|
|
break; |
|
@ -113,7 +114,7 @@ public class SprayTaskExecutor { |
|
|
} |
|
|
} |
|
|
currentSprayIndex++; |
|
|
currentSprayIndex++; |
|
|
sprayTask.setSuspendable(false);//不可暂停 |
|
|
sprayTask.setSuspendable(false);//不可暂停 |
|
|
DeviceStatus.getInstance().setSuspendable(false); |
|
|
|
|
|
|
|
|
deviceStatus.setSuspendable(false); |
|
|
sprayTask.getSprayedPoints().add(sprayStepList); |
|
|
sprayTask.getSprayedPoints().add(sprayStepList); |
|
|
|
|
|
|
|
|
DeviceCommand nozzleValveCloseCommand = DeviceCommandGenerator.nozzleValveClose();//关闭喷嘴阀 |
|
|
DeviceCommand nozzleValveCloseCommand = DeviceCommandGenerator.nozzleValveClose();//关闭喷嘴阀 |
|
@ -135,7 +136,7 @@ public class SprayTaskExecutor { |
|
|
CommandFuture motorYPositionSetCommandFuture = deviceCommandService.sendCommand(motorYPositionSetCommand); |
|
|
CommandFuture motorYPositionSetCommandFuture = deviceCommandService.sendCommand(motorYPositionSetCommand); |
|
|
CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(motorZPositionSetCommand); |
|
|
CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(motorZPositionSetCommand); |
|
|
commandWait(motorXPositionSetCommandFuture, motorYPositionSetCommandFuture, motorZPositionSetCommandFuture); |
|
|
commandWait(motorXPositionSetCommandFuture, motorYPositionSetCommandFuture, motorZPositionSetCommandFuture); |
|
|
|
|
|
|
|
|
|
|
|
webSocketService.pushMsg(WebSocketMessageType.SPRAY_TASK, "喷涂任务执行完毕"); |
|
|
} catch (InterruptedException e) { |
|
|
} catch (InterruptedException e) { |
|
|
webSocketService.pushMsg(WebSocketMessageType.SPRAY_TASK, "喷涂任务线程停止"); |
|
|
webSocketService.pushMsg(WebSocketMessageType.SPRAY_TASK, "喷涂任务线程停止"); |
|
|
Thread.currentThread().interrupt(); |
|
|
Thread.currentThread().interrupt(); |
|
@ -147,9 +148,9 @@ public class SprayTaskExecutor { |
|
|
synchronized (this) { |
|
|
synchronized (this) { |
|
|
taskThread = null; |
|
|
taskThread = null; |
|
|
SprayTask.getInstance().clear(); |
|
|
SprayTask.getInstance().clear(); |
|
|
DeviceStatus.getInstance().setSpraying(false); |
|
|
|
|
|
DeviceStatus.getInstance().setPaused(false); |
|
|
|
|
|
DeviceStatus.getInstance().setSuspendable(false); |
|
|
|
|
|
|
|
|
deviceStatus.setSpraying(false); |
|
|
|
|
|
deviceStatus.setPaused(false); |
|
|
|
|
|
deviceStatus.setSuspendable(false); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
}); |
|
|
}); |
|
|