|
@ -77,15 +77,15 @@ public class SprayTaskExecutor { |
|
|
int sprayNum = 1; |
|
|
int sprayNum = 1; |
|
|
for (SprayTaskStep sprayTaskStep : sprayTask.getSprayTaskStepList()) {//循环进行多次喷涂 |
|
|
for (SprayTaskStep sprayTaskStep : sprayTask.getSprayTaskStepList()) {//循环进行多次喷涂 |
|
|
//先移动到玻片位置 |
|
|
//先移动到玻片位置 |
|
|
DeviceCommand motorXPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(slideArr[sprayTaskStep.getIndex()][0],20.0); |
|
|
|
|
|
DeviceCommand motorYPositionSetCommand = DeviceCommandGenerator.motorYPositionSet(75.5 - slideArr[sprayTaskStep.getIndex()][1],20.0); |
|
|
|
|
|
|
|
|
DeviceCommand motorXPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(slideArr[sprayTaskStep.getIndex()][0], 20.0); |
|
|
|
|
|
DeviceCommand motorYPositionSetCommand = DeviceCommandGenerator.motorYPositionSet(75.5 - slideArr[sprayTaskStep.getIndex()][1], 20.0); |
|
|
CommandFuture motorXPositionSetCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorXPositionSetCommand); |
|
|
CommandFuture motorXPositionSetCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorXPositionSetCommand); |
|
|
CommandFuture motorYPositionSetCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorYPositionSetCommand); |
|
|
CommandFuture motorYPositionSetCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorYPositionSetCommand); |
|
|
|
|
|
|
|
|
SysSettings slideHeightSysSettings = sysSettingsService.getOne(new LambdaQueryWrapper<SysSettings>().eq(SysSettings::getCode, "slide_height")); |
|
|
SysSettings slideHeightSysSettings = sysSettingsService.getOne(new LambdaQueryWrapper<SysSettings>().eq(SysSettings::getCode, "slide_height")); |
|
|
Double slideHeight = Double.parseDouble(slideHeightSysSettings.getValue()); |
|
|
Double slideHeight = Double.parseDouble(slideHeightSysSettings.getValue()); |
|
|
Double height = slideHeight - sprayTask.getSprayParams().getMotorZHeight();//下降z轴高度 |
|
|
Double height = slideHeight - sprayTask.getSprayParams().getMotorZHeight();//下降z轴高度 |
|
|
DeviceCommand motorZPositionSetAboveSlideCommand = DeviceCommandGenerator.motorZPositionSet(height,15.0); |
|
|
|
|
|
|
|
|
DeviceCommand motorZPositionSetAboveSlideCommand = DeviceCommandGenerator.motorZPositionSet(height, 15.0); |
|
|
CommandFuture motorZPositionSetAboveSlideCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorZPositionSetAboveSlideCommand); |
|
|
CommandFuture motorZPositionSetAboveSlideCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorZPositionSetAboveSlideCommand); |
|
|
commandWait(motorXPositionSetCommandFuture, motorYPositionSetCommandFuture, motorZPositionSetAboveSlideCommandFuture); |
|
|
commandWait(motorXPositionSetCommandFuture, motorYPositionSetCommandFuture, motorZPositionSetAboveSlideCommandFuture); |
|
|
|
|
|
|
|
@ -104,17 +104,21 @@ public class SprayTaskExecutor { |
|
|
continue; |
|
|
continue; |
|
|
} |
|
|
} |
|
|
List<DeviceCommand> sprayStepCommands = sprayTaskStep.getSpraySteps().get(i); |
|
|
List<DeviceCommand> sprayStepCommands = sprayTaskStep.getSpraySteps().get(i); |
|
|
|
|
|
DeviceCommand xSprayStepCommands = sprayStepCommands.get(0); |
|
|
|
|
|
xSprayStepCommands.getParam().put("speed", sprayTask.getSprayParams().getMovingSpeed());//防止修改了移动速度这里重新设置移动速度 |
|
|
|
|
|
DeviceCommand ySprayStepCommands = sprayStepCommands.get(1); |
|
|
|
|
|
ySprayStepCommands.getParam().put("speed", sprayTask.getSprayParams().getMovingSpeed()); |
|
|
List<CommandFuture> commandFutureList = new ArrayList<>(); |
|
|
List<CommandFuture> commandFutureList = new ArrayList<>(); |
|
|
double aXPoint = (double) sprayStepCommands.get(0).getParam().get("position"); |
|
|
|
|
|
double aYPoint = (double) sprayStepCommands.get(1).getParam().get("position"); |
|
|
|
|
|
|
|
|
double aXPoint = (double) xSprayStepCommands.getParam().get("position"); |
|
|
|
|
|
double aYPoint = (double) ySprayStepCommands.getParam().get("position"); |
|
|
|
|
|
|
|
|
if(cacheXPoint != aXPoint){ |
|
|
|
|
|
CommandFuture commandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), sprayStepCommands.get(0)); |
|
|
|
|
|
|
|
|
if (cacheXPoint != aXPoint) { |
|
|
|
|
|
CommandFuture commandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), xSprayStepCommands); |
|
|
commandFutureList.add(commandFuture); |
|
|
commandFutureList.add(commandFuture); |
|
|
cacheXPoint = aXPoint; |
|
|
cacheXPoint = aXPoint; |
|
|
} |
|
|
} |
|
|
if(cacheYPoint != aYPoint){ |
|
|
|
|
|
CommandFuture commandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), sprayStepCommands.get(1)); |
|
|
|
|
|
|
|
|
if (cacheYPoint != aYPoint) { |
|
|
|
|
|
CommandFuture commandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), ySprayStepCommands); |
|
|
commandFutureList.add(commandFuture); |
|
|
commandFutureList.add(commandFuture); |
|
|
cacheYPoint = aYPoint; |
|
|
cacheYPoint = aYPoint; |
|
|
} |
|
|
} |
|
@ -126,8 +130,8 @@ public class SprayTaskExecutor { |
|
|
double currentXPoint = (Double) currentSprayStepCommands.get(0).getParam().get("position") - slideArr[sprayTaskStep.getIndex()][0]; |
|
|
double currentXPoint = (Double) currentSprayStepCommands.get(0).getParam().get("position") - slideArr[sprayTaskStep.getIndex()][0]; |
|
|
double currentYPoint = 75.5 - (Double) currentSprayStepCommands.get(1).getParam().get("position"); |
|
|
double currentYPoint = 75.5 - (Double) currentSprayStepCommands.get(1).getParam().get("position"); |
|
|
currentPoint = new Point2D(currentXPoint, currentYPoint); |
|
|
currentPoint = new Point2D(currentXPoint, currentYPoint); |
|
|
double nextXPoint = (Double) sprayStepCommands.get(0).getParam().get("position") - slideArr[sprayTaskStep.getIndex()][0]; |
|
|
|
|
|
double nextYPoint = 75.5 - (Double) sprayStepCommands.get(1).getParam().get("position"); |
|
|
|
|
|
|
|
|
double nextXPoint = (Double) xSprayStepCommands.getParam().get("position") - slideArr[sprayTaskStep.getIndex()][0]; |
|
|
|
|
|
double nextYPoint = 75.5 - (Double) ySprayStepCommands.getParam().get("position"); |
|
|
nextPoint = new Point2D(nextXPoint, nextYPoint); |
|
|
nextPoint = new Point2D(nextXPoint, nextYPoint); |
|
|
SprayTaskPointCollectorPushBO sprayTaskPointCollectorPushBO = new SprayTaskPointCollectorPushBO(sprayTask.getCmdId(), sprayTask.getCmdCode(), sprayTaskStep.getIndex(), sprayNum, currentPoint, nextPoint); |
|
|
SprayTaskPointCollectorPushBO sprayTaskPointCollectorPushBO = new SprayTaskPointCollectorPushBO(sprayTask.getCmdId(), sprayTask.getCmdCode(), sprayTaskStep.getIndex(), sprayNum, currentPoint, nextPoint); |
|
|
webSocketService.pushMsg(WebSocketMessageType.SPRAY_POINT, sprayTaskPointCollectorPushBO); |
|
|
webSocketService.pushMsg(WebSocketMessageType.SPRAY_POINT, sprayTaskPointCollectorPushBO); |
|
|