Browse Source

我也不知道改了什么

tags/1.0
白凤吉 5 months ago
parent
commit
3ef1c33f56
  1. 16
      src/main/java/com/qyft/ms/app/device/spray/SprayTaskExecutor.java
  2. 28
      src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayStart.java

16
src/main/java/com/qyft/ms/app/device/spray/SprayTaskExecutor.java

@ -146,15 +146,27 @@ public class SprayTaskExecutor {
sprayTask.setSuspendable(true);//可以暂停单次喷涂范围内可以进行暂停
deviceStatus.setSuspendable(true);
double cacheXPoint = -1;
double cacheYPoint = -1;
for (int i = 0; i < sprayTaskStep.getSpraySteps().size(); i++) {//单次喷涂
if (currentStep < reCurrentStep) {
continue;
}
List<DeviceCommand> sprayStepCommands = sprayTaskStep.getSpraySteps().get(i);
List<CommandFuture> commandFutureList = new ArrayList<>();
double aXPoint = (double) sprayStepCommands.get(0).getParam().get("position");
double aYPoint = (double) sprayStepCommands.get(1).getParam().get("position");
for (DeviceCommand sprayStep : sprayStepCommands) {
CommandFuture commandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), sprayStep);
commandFutureList.add(commandFuture);
if(cacheXPoint != aXPoint){
CommandFuture commandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), sprayStep);
commandFutureList.add(commandFuture);
cacheXPoint = aXPoint;
}
if(cacheYPoint != aYPoint){
CommandFuture commandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), sprayStep);
commandFutureList.add(commandFuture);
cacheYPoint = aYPoint;
}
}
CommandFuture[] commandFutureArray = commandFutureList.toArray(new CommandFuture[0]);

28
src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayStart.java

@ -208,13 +208,12 @@ public class MatrixSprayStart extends BaseCommandHandler {
for (int j = 0; j < pathList.size(); j++) {
PathGenerator.Points p = pathList.get(j);
List<DeviceCommand> deviceCommands = new ArrayList<>();
if (j == 0) {
deviceCommands.add(DeviceCommandGenerator.motorXPositionSet(p.getX(), movingSpeed));//移动x轴
deviceCommands.add(DeviceCommandGenerator.motorYPositionSet(75.5 - p.getY(), movingSpeed));//移动y轴
}
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轴
}
deviceCommandList.add(deviceCommands);
}
@ -246,13 +245,12 @@ public class MatrixSprayStart extends BaseCommandHandler {
for (int j = 0; j < pathList.size(); j++) {
PathGenerator.Points p = pathList.get(j);
List<DeviceCommand> deviceCommands = new ArrayList<>();
if (j == 0) {
deviceCommands.add(DeviceCommandGenerator.motorXPositionSet(p.getX(), movingSpeed));//移动x轴
deviceCommands.add(DeviceCommandGenerator.motorYPositionSet(75.5 - p.getY(), movingSpeed));//移动y轴
}
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轴
}
deviceCommandList.add(deviceCommands);
}
@ -283,13 +281,12 @@ public class MatrixSprayStart extends BaseCommandHandler {
for (int j = 0; j < pathList.size(); j++) {
PathGenerator.Points p = pathList.get(j);
List<DeviceCommand> deviceCommands = new ArrayList<>();
if (j == 0) {
deviceCommands.add(DeviceCommandGenerator.motorXPositionSet(p.getX(), movingSpeed));//移动x轴
deviceCommands.add(DeviceCommandGenerator.motorYPositionSet(75.5 - p.getY(), movingSpeed));//移动y轴
}
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轴
}
deviceCommandList.add(deviceCommands);
}
@ -307,13 +304,12 @@ public class MatrixSprayStart extends BaseCommandHandler {
for (int j = 0; j < pathList.size(); j++) {
PathGenerator.Points p = pathList.get(j);
List<DeviceCommand> deviceCommands = new ArrayList<>();
if (j == 0) {
deviceCommands.add(DeviceCommandGenerator.motorXPositionSet(p.getX(), movingSpeed));//移动x轴
deviceCommands.add(DeviceCommandGenerator.motorYPositionSet(75.5 - p.getY(), movingSpeed));//移动y轴
}
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轴
}
deviceCommandList.add(deviceCommands);
}

Loading…
Cancel
Save