Browse Source

fix:点击暂停时不再回原点

master
白凤吉 3 weeks ago
parent
commit
c866cac39e
  1. 3
      src/main/java/com/qyft/ms/app/device/spray/SprayTaskExecutor.java
  2. 38
      src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayPause.java

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

@ -91,6 +91,8 @@ public class SprayTaskExecutor {
Double[] slide = slideArr[sprayTaskParam.getIndex()];//获取玻片的坐标
List<SprayTaskStep> sprayTaskStepList = getSprayPath(sprayTimes);//计算本次喷涂的路线
if(sprayTask.getCurrentStep() == 0){
//先移动到玻片左上角位置
DeviceCommand motorXPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(slideArr[sprayTaskParam.getIndex()][0], 20.0);
DeviceCommand motorYPositionSetCommand = DeviceCommandGenerator.motorYPositionSet(slideArr[sprayTaskParam.getIndex()][1], 20.0);
@ -103,6 +105,7 @@ public class SprayTaskExecutor {
DeviceCommand motorZPositionSetAboveSlideCommand = DeviceCommandGenerator.motorZPositionSet(height, 15.0);
CommandFuture motorZPositionSetAboveSlideCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorZPositionSetAboveSlideCommand);
commandWait(motorXPositionSetCommandFuture, motorYPositionSetCommandFuture, motorZPositionSetAboveSlideCommandFuture);
}
DeviceCommand threeWayValveOpenSyringePipelineCommand = DeviceCommandGenerator.threeWayValveOpenNozzlePipeline();//打开三通阀注射器管路
CommandFuture threeWayValveOpenSyringePipelineCommandFuture = deviceCommandService.sendCommand(sprayTask.getCmdId(), sprayTask.getCmdCode(), threeWayValveOpenSyringePipelineCommand);

38
src/main/java/com/qyft/ms/app/front/cmd/business/MatrixSprayPause.java

@ -61,31 +61,31 @@ public class MatrixSprayPause extends BaseCommandHandler {
CommandFuture motorZStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZStopCommand);
commandWait(motorXStopCommandFuture, motorYStopCommandFuture, motorZStopCommandFuture);
if(sprayTask.getCurrentStep() > 0 && sprayTask.getCurrentPausedPoint() == null){//只有在喷涂过程中才需要记录并且记录点不可被覆盖
//记录当前位置
DeviceCommand motorXyzPositionGetCommand = DeviceCommandGenerator.motorXyzPositionGet(); // 生成获得电机XYZ相对原点坐标指令
CommandFuture motorXyzPositionGetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXyzPositionGetCommand);
commandWait(motorXyzPositionGetCommandFuture);
JSONObject motorXyzPositionGetCommandDeviceResult = motorXyzPositionGetCommandFuture.getResponseResult();
Double xAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("xAxisPosition");
Double yAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("yAxisPosition");
Double zAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("zAxisPosition");
Point3D point3D = new Point3D(xAxisPosition, yAxisPosition, zAxisPosition);
sprayTask.setCurrentPausedPoint(point3D);
}
// if(sprayTask.getCurrentStep() > 0 && sprayTask.getCurrentPausedPoint() == null){//只有在喷涂过程中才需要记录并且记录点不可被覆盖
// //记录当前位置
// DeviceCommand motorXyzPositionGetCommand = DeviceCommandGenerator.motorXyzPositionGet(); // 生成获得电机XYZ相对原点坐标指令
// CommandFuture motorXyzPositionGetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXyzPositionGetCommand);
// commandWait(motorXyzPositionGetCommandFuture);
// JSONObject motorXyzPositionGetCommandDeviceResult = motorXyzPositionGetCommandFuture.getResponseResult();
// Double xAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("xAxisPosition");
// Double yAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("yAxisPosition");
// Double zAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("zAxisPosition");
// Point3D point3D = new Point3D(xAxisPosition, yAxisPosition, zAxisPosition);
// sprayTask.setCurrentPausedPoint(point3D);
// }
OperationLog operationLog = operationLogService.getById(sprayTask.getOperationLogId());
operationLog.setStatus(2);
operationLogService.updateById(operationLog);
//XYZ回原点
DeviceCommand motorXOriginCommand = DeviceCommandGenerator.motorXOrigin();
DeviceCommand motorYOriginCommand = DeviceCommandGenerator.motorYOrigin();
DeviceCommand motorZOriginCommand = DeviceCommandGenerator.motorZOrigin();
CommandFuture motorXOriginCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorXOriginCommand);
CommandFuture motorYOriginCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorYOriginCommand);
CommandFuture motorZOriginCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorZOriginCommand);
commandWait(motorXOriginCommandFuture, motorYOriginCommandFuture, motorZOriginCommandFuture);
// DeviceCommand motorXOriginCommand = DeviceCommandGenerator.motorXOrigin();
// DeviceCommand motorYOriginCommand = DeviceCommandGenerator.motorYOrigin();
// DeviceCommand motorZOriginCommand = DeviceCommandGenerator.motorZOrigin();
// CommandFuture motorXOriginCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorXOriginCommand);
// CommandFuture motorYOriginCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorYOriginCommand);
// CommandFuture motorZOriginCommandFuture = deviceCommandService.sendCommandSprayTask(sprayTask.getCmdId(), sprayTask.getCmdCode(), motorZOriginCommand);
// commandWait(motorXOriginCommandFuture, motorYOriginCommandFuture, motorZOriginCommandFuture);
} catch (Exception e) {
throw new RuntimeException(e);
}finally {

Loading…
Cancel
Save