Browse Source

fix:调整指令

master
白凤吉 2 weeks ago
parent
commit
ea0e0d9273
  1. 4
      src/main/java/com/qyft/ms/app/front/cmd/business/NozzleHeatStart.java
  2. 4
      src/main/java/com/qyft/ms/app/front/cmd/business/NozzleHeatStop.java
  3. 11
      src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFill.java
  4. 1
      src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFillStop.java
  5. 192
      src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelineWash.java
  6. 5
      src/main/java/com/qyft/ms/app/front/cmd/business/SlidePlatHeatStart.java
  7. 6
      src/main/java/com/qyft/ms/app/front/cmd/business/SlidePlatHeatStop.java
  8. 72
      src/main/java/com/qyft/ms/app/front/cmd/business/SlideTrayIn.java
  9. 72
      src/main/java/com/qyft/ms/app/front/cmd/business/SlideTrayOut.java
  10. 11
      src/main/java/com/qyft/ms/app/front/cmd/business/SyringePipelineWash.java
  11. 1
      src/main/java/com/qyft/ms/app/front/cmd/business/SyringePipelineWashStop.java

4
src/main/java/com/qyft/ms/app/front/cmd/business/NozzleHeatStart.java

@ -3,6 +3,7 @@ package com.qyft.ms.app.front.cmd.business;
import com.qyft.ms.app.device.status.DeviceStatus; import com.qyft.ms.app.device.status.DeviceStatus;
import com.qyft.ms.system.common.annotation.CommandMapping; import com.qyft.ms.system.common.annotation.CommandMapping;
import com.qyft.ms.system.common.constant.CommandStatus; import com.qyft.ms.system.common.constant.CommandStatus;
import com.qyft.ms.system.common.device.command.CommandFuture;
import com.qyft.ms.system.common.device.command.DeviceCommandGenerator; import com.qyft.ms.system.common.device.command.DeviceCommandGenerator;
import com.qyft.ms.system.common.device.command.FrontResponseGenerator; import com.qyft.ms.system.common.device.command.FrontResponseGenerator;
import com.qyft.ms.system.core.handler.BaseCommandHandler; import com.qyft.ms.system.core.handler.BaseCommandHandler;
@ -39,7 +40,8 @@ public class NozzleHeatStart extends BaseCommandHandler {
} }
return runAsync(() -> { return runAsync(() -> {
DeviceCommand nozzleHeatStartCmd = DeviceCommandGenerator.nozzleHeatStart(temperature); // 生成喷头加热 DeviceCommand nozzleHeatStartCmd = DeviceCommandGenerator.nozzleHeatStart(temperature); // 生成喷头加热
deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleHeatStartCmd);//发送指令
CommandFuture nozzleHeatStartCmdFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleHeatStartCmd);//发送指令
commandWait(nozzleHeatStartCmdFuture);
deviceStatus.setNozzleHeating(true);//设置喷头加热状态 deviceStatus.setNozzleHeating(true);//设置喷头加热状态
}); });
} }

4
src/main/java/com/qyft/ms/app/front/cmd/business/NozzleHeatStop.java

@ -2,6 +2,7 @@ package com.qyft.ms.app.front.cmd.business;
import com.qyft.ms.app.device.status.DeviceStatus; import com.qyft.ms.app.device.status.DeviceStatus;
import com.qyft.ms.system.common.annotation.CommandMapping; import com.qyft.ms.system.common.annotation.CommandMapping;
import com.qyft.ms.system.common.device.command.CommandFuture;
import com.qyft.ms.system.common.device.command.DeviceCommandGenerator; import com.qyft.ms.system.common.device.command.DeviceCommandGenerator;
import com.qyft.ms.system.core.handler.BaseCommandHandler; import com.qyft.ms.system.core.handler.BaseCommandHandler;
import com.qyft.ms.system.model.bo.DeviceCommand; import com.qyft.ms.system.model.bo.DeviceCommand;
@ -29,7 +30,8 @@ public class NozzleHeatStop extends BaseCommandHandler {
public CompletableFuture<Void> handle(FrontCmdControlForm form) { public CompletableFuture<Void> handle(FrontCmdControlForm form) {
return runAsync(() -> { return runAsync(() -> {
DeviceCommand nozzleHeatStopCmd = DeviceCommandGenerator.nozzleHeatStop(); // 生成喷头加热关闭 DeviceCommand nozzleHeatStopCmd = DeviceCommandGenerator.nozzleHeatStop(); // 生成喷头加热关闭
deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleHeatStopCmd);//发送指令
CommandFuture nozzleHeatStopCmdFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleHeatStopCmd);//发送指令
commandWait(nozzleHeatStopCmdFuture);
deviceStatus.setNozzleHeating(false);//设置喷头加热状态 deviceStatus.setNozzleHeating(false);//设置喷头加热状态
}); });
} }

11
src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFill.java

@ -72,11 +72,13 @@ public class NozzlePipelinePreFill extends BaseCommandHandler {
commandWait(motorZPositionSetCommandFuture); commandWait(motorZPositionSetCommandFuture);
} }
Position wasteLiquor = positionService.getOne(new LambdaQueryWrapper<Position>().eq(Position::getPointCode, "waste_liquor")); Position wasteLiquor = positionService.getOne(new LambdaQueryWrapper<Position>().eq(Position::getPointCode, "waste_liquor"));
//3.x轴移动到废液位置
//xy轴移动到废液位置
DeviceCommand motorXPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(wasteLiquor.getX(), 20.0); DeviceCommand motorXPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(wasteLiquor.getX(), 20.0);
CommandFuture motorXPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXPositionSetCommand); CommandFuture motorXPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXPositionSetCommand);
commandWait(motorXPositionSetCommandFuture);
//4.下降z轴高度防止飞溅
DeviceCommand motorYPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(wasteLiquor.getY(), 20.0);
CommandFuture motorYPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorYPositionSetCommand);
commandWait(motorXPositionSetCommandFuture, motorYPositionSetCommandFuture);
//下降z轴高度防止飞溅
DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(wasteLiquor.getZ(), 20.0); DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(wasteLiquor.getZ(), 20.0);
CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZPositionSetCommand); CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZPositionSetCommand);
commandWait(motorZPositionSetCommandFuture); commandWait(motorZPositionSetCommandFuture);
@ -85,12 +87,13 @@ public class NozzlePipelinePreFill extends BaseCommandHandler {
DeviceCommand nozzleValveOpenCommand = DeviceCommandGenerator.nozzleValveOpen(); // 开启喷嘴阀 DeviceCommand nozzleValveOpenCommand = DeviceCommandGenerator.nozzleValveOpen(); // 开启喷嘴阀
CommandFuture nozzleValveOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleValveOpenCommand); CommandFuture nozzleValveOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleValveOpenCommand);
commandWait(nozzleValveOpenCommandFuture); commandWait(nozzleValveOpenCommandFuture);
Thread.sleep(500);//开启喷嘴阀后需要延迟500毫秒
//5.打开三通阀注射器管路 //5.打开三通阀注射器管路
// DeviceCommand threeWayValveOpenNozzlePipelineCommand = DeviceCommandGenerator.threeWayValveOpenNozzlePipeline(); // DeviceCommand threeWayValveOpenNozzlePipelineCommand = DeviceCommandGenerator.threeWayValveOpenNozzlePipeline();
// CommandFuture threeWayValveOpenNozzlePipelineCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveOpenNozzlePipelineCommand); // CommandFuture threeWayValveOpenNozzlePipelineCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveOpenNozzlePipelineCommand);
// commandWait(threeWayValveOpenNozzlePipelineCommandFuture); // commandWait(threeWayValveOpenNozzlePipelineCommandFuture);
Thread.sleep(500);
//6.设置注射泵速度推注射泵 //6.设置注射泵速度推注射泵
DeviceCommand syringePumpStartCommand = DeviceCommandGenerator.syringePumpForward(speed); // 生成移动注射泵指令 DeviceCommand syringePumpStartCommand = DeviceCommandGenerator.syringePumpForward(speed); // 生成移动注射泵指令
CommandFuture syringePumpStartCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpStartCommand); CommandFuture syringePumpStartCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpStartCommand);

1
src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFillStop.java

@ -41,6 +41,7 @@ public class NozzlePipelinePreFillStop extends BaseCommandHandler {
DeviceCommand syringePumpStopCommand = DeviceCommandGenerator.syringePumpStop();//停止推动注射泵 DeviceCommand syringePumpStopCommand = DeviceCommandGenerator.syringePumpStop();//停止推动注射泵
CommandFuture syringePumpStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpStopCommand); CommandFuture syringePumpStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpStopCommand);
Thread.sleep(500); Thread.sleep(500);
//2.全部关闭三通阀 //2.全部关闭三通阀
DeviceCommand threeWayValveCloseAllCommand = DeviceCommandGenerator.threeWayValveCloseAll(); // 生成全部关闭三通阀指令 DeviceCommand threeWayValveCloseAllCommand = DeviceCommandGenerator.threeWayValveCloseAll(); // 生成全部关闭三通阀指令
CommandFuture threeWayValveCloseAllCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveCloseAllCommand); CommandFuture threeWayValveCloseAllCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveCloseAllCommand);

192
src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelineWash.java

@ -1,96 +1,96 @@
package com.qyft.ms.app.front.cmd.business;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.qyft.ms.app.device.status.DeviceStatus;
import com.qyft.ms.app.model.entity.Position;
import com.qyft.ms.app.model.entity.SysSettings;
import com.qyft.ms.app.service.PositionService;
import com.qyft.ms.app.service.SysSettingsService;
import com.qyft.ms.system.common.annotation.CommandMapping;
import com.qyft.ms.system.common.constant.CommandStatus;
import com.qyft.ms.system.common.device.command.CommandFuture;
import com.qyft.ms.system.common.device.command.DeviceCommandGenerator;
import com.qyft.ms.system.common.device.command.FrontResponseGenerator;
import com.qyft.ms.system.core.handler.BaseCommandHandler;
import com.qyft.ms.system.model.bo.DeviceCommand;
import com.qyft.ms.system.model.form.FrontCmdControlForm;
import com.qyft.ms.system.service.WebSocketService;
import com.qyft.ms.system.service.device.DeviceCommandService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.concurrent.CompletableFuture;
/**
* 喷嘴管路_清洗喷嘴管路
* 废弃
*/
@Slf4j
@Component
@RequiredArgsConstructor
@CommandMapping("nozzle_pipeline_wash")//业务指令注解
public class NozzlePipelineWash extends BaseCommandHandler {
private final DeviceCommandService deviceCommandService;
private final SysSettingsService sysSettingsService;
private final PositionService positionService;
private final DeviceStatus deviceStatus;
private final WebSocketService webSocketService;
@Override
public CompletableFuture<Void> handle(FrontCmdControlForm form) {
if (deviceStatus.isCleaningSyringePipeline() || deviceStatus.isCleaningNozzlePipeline()) {
throw new RuntimeException("正在清洗喷嘴管路或注射器管路,无法开启清洗注射器管路");
}
try {
//1.判断z轴是否在安全距离如果不在安全距离可以不抬升z轴
DeviceCommand motorXyzPositionGetCommand = DeviceCommandGenerator.motorXyzPositionGet();
CommandFuture motorXyzPositionGetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXyzPositionGetCommand);
commandWait(motorXyzPositionGetCommandFuture);
JSONObject motorXyzPositionGetCommandDeviceResult = motorXyzPositionGetCommandFuture.getResponseResult();
Double zAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("zAxisPosition");
if (zAxisPosition == null) {
webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(form.getCmdId(), form.getCmdCode(), CommandStatus.DEVICE_ERROR, "获得电机XYZ相对原点坐标失败", motorXyzPositionGetCommandDeviceResult));
throw new RuntimeException("获得电机XYZ相对原点坐标失败");
}
zAxisPosition = Math.abs(zAxisPosition);
SysSettings safeZHeightSysSettings = sysSettingsService.getOne(new LambdaQueryWrapper<SysSettings>().eq(SysSettings::getCode, "safe_z_height"));
double safeZHeight = Double.parseDouble(safeZHeightSysSettings.getValue());
if (zAxisPosition > safeZHeight) { //z轴超出安全距离抬升z轴
DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(safeZHeight, 15.0);
CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZPositionSetCommand);
commandWait(motorZPositionSetCommandFuture);
}
Position wasteLiquor = positionService.getOne(new LambdaQueryWrapper<Position>().eq(Position::getPointCode, "waste_liquor"));
//2.轴移动到废液位置
DeviceCommand motorXPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(wasteLiquor.getX(), 20.0);
CommandFuture motorXPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXPositionSetCommand);
commandWait(motorXPositionSetCommandFuture);
//3.下降z轴高度防止飞溅
DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(wasteLiquor.getZ(), 15.0);
CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZPositionSetCommand);
commandWait(motorZPositionSetCommandFuture);
//4.开启三通阀到喷嘴管路
DeviceCommand threeWayValveOpenSyringePipelineCommand = DeviceCommandGenerator.threeWayValveOpenSyringePipeline(); // 打开三通阀喷嘴管路
CommandFuture threeWayValveOpenSyringePipelineCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveOpenSyringePipelineCommand);
commandWait(threeWayValveOpenSyringePipelineCommandFuture);
//6.打开清洗阀
DeviceCommand washValveOpenCommand = DeviceCommandGenerator.washValveOpen(); // 生成打开清洗阀指令
CommandFuture washValveOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), washValveOpenCommand);
commandWait(washValveOpenCommandFuture);
deviceStatus.setCleaningNozzlePipeline(true);
} catch (Exception e) {
deviceStatus.setCleaningNozzlePipeline(false);
throw new RuntimeException(e);
}
return runAsync(() -> {
});
}
}
//package com.qyft.ms.app.front.cmd.business;
//
//import cn.hutool.json.JSONObject;
//import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
//import com.qyft.ms.app.device.status.DeviceStatus;
//import com.qyft.ms.app.model.entity.Position;
//import com.qyft.ms.app.model.entity.SysSettings;
//import com.qyft.ms.app.service.PositionService;
//import com.qyft.ms.app.service.SysSettingsService;
//import com.qyft.ms.system.common.annotation.CommandMapping;
//import com.qyft.ms.system.common.constant.CommandStatus;
//import com.qyft.ms.system.common.device.command.CommandFuture;
//import com.qyft.ms.system.common.device.command.DeviceCommandGenerator;
//import com.qyft.ms.system.common.device.command.FrontResponseGenerator;
//import com.qyft.ms.system.core.handler.BaseCommandHandler;
//import com.qyft.ms.system.model.bo.DeviceCommand;
//import com.qyft.ms.system.model.form.FrontCmdControlForm;
//import com.qyft.ms.system.service.WebSocketService;
//import com.qyft.ms.system.service.device.DeviceCommandService;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Component;
//
//import java.util.concurrent.CompletableFuture;
//
///**
// * 喷嘴管路_清洗喷嘴管路
// * 废弃
// */
//@Slf4j
//@Component
//@RequiredArgsConstructor
//@CommandMapping("nozzle_pipeline_wash")//业务指令注解
//public class NozzlePipelineWash extends BaseCommandHandler {
//
// private final DeviceCommandService deviceCommandService;
// private final SysSettingsService sysSettingsService;
// private final PositionService positionService;
// private final DeviceStatus deviceStatus;
// private final WebSocketService webSocketService;
//
// @Override
// public CompletableFuture<Void> handle(FrontCmdControlForm form) {
// if (deviceStatus.isCleaningSyringePipeline() || deviceStatus.isCleaningNozzlePipeline()) {
// throw new RuntimeException("正在清洗喷嘴管路或注射器管路,无法开启清洗注射器管路");
// }
// try {
// //1.判断z轴是否在安全距离如果不在安全距离可以不抬升z轴
// DeviceCommand motorXyzPositionGetCommand = DeviceCommandGenerator.motorXyzPositionGet();
// CommandFuture motorXyzPositionGetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXyzPositionGetCommand);
// commandWait(motorXyzPositionGetCommandFuture);
// JSONObject motorXyzPositionGetCommandDeviceResult = motorXyzPositionGetCommandFuture.getResponseResult();
// Double zAxisPosition = motorXyzPositionGetCommandDeviceResult.getJSONObject("data").getDouble("zAxisPosition");
// if (zAxisPosition == null) {
// webSocketService.pushCMDResponseMsg(FrontResponseGenerator.generateJson(form.getCmdId(), form.getCmdCode(), CommandStatus.DEVICE_ERROR, "获得电机XYZ相对原点坐标失败", motorXyzPositionGetCommandDeviceResult));
// throw new RuntimeException("获得电机XYZ相对原点坐标失败");
// }
// zAxisPosition = Math.abs(zAxisPosition);
// SysSettings safeZHeightSysSettings = sysSettingsService.getOne(new LambdaQueryWrapper<SysSettings>().eq(SysSettings::getCode, "safe_z_height"));
// double safeZHeight = Double.parseDouble(safeZHeightSysSettings.getValue());
// if (zAxisPosition > safeZHeight) { //z轴超出安全距离抬升z轴
// DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(safeZHeight, 15.0);
// CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZPositionSetCommand);
// commandWait(motorZPositionSetCommandFuture);
// }
// Position wasteLiquor = positionService.getOne(new LambdaQueryWrapper<Position>().eq(Position::getPointCode, "waste_liquor"));
// //2.轴移动到废液位置
// DeviceCommand motorXPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(wasteLiquor.getX(), 20.0);
// CommandFuture motorXPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXPositionSetCommand);
// commandWait(motorXPositionSetCommandFuture);
// //3.下降z轴高度防止飞溅
// DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(wasteLiquor.getZ(), 15.0);
// CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZPositionSetCommand);
// commandWait(motorZPositionSetCommandFuture);
// //4.开启三通阀到喷嘴管路
// DeviceCommand threeWayValveOpenSyringePipelineCommand = DeviceCommandGenerator.threeWayValveOpenSyringePipeline(); // 打开三通阀喷嘴管路
// CommandFuture threeWayValveOpenSyringePipelineCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveOpenSyringePipelineCommand);
// commandWait(threeWayValveOpenSyringePipelineCommandFuture);
//
// //6.打开清洗阀
// DeviceCommand washValveOpenCommand = DeviceCommandGenerator.washValveOpen(); // 生成打开清洗阀指令
// CommandFuture washValveOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), washValveOpenCommand);
// commandWait(washValveOpenCommandFuture);
//
// deviceStatus.setCleaningNozzlePipeline(true);
// } catch (Exception e) {
// deviceStatus.setCleaningNozzlePipeline(false);
// throw new RuntimeException(e);
// }
// return runAsync(() -> {
//
//
// });
//
// }
//}

5
src/main/java/com/qyft/ms/app/front/cmd/business/SlidePlatHeatStart.java

@ -3,6 +3,7 @@ package com.qyft.ms.app.front.cmd.business;
import com.qyft.ms.app.device.status.DeviceStatus; import com.qyft.ms.app.device.status.DeviceStatus;
import com.qyft.ms.system.common.annotation.CommandMapping; import com.qyft.ms.system.common.annotation.CommandMapping;
import com.qyft.ms.system.common.constant.CommandStatus; import com.qyft.ms.system.common.constant.CommandStatus;
import com.qyft.ms.system.common.device.command.CommandFuture;
import com.qyft.ms.system.common.device.command.DeviceCommandGenerator; import com.qyft.ms.system.common.device.command.DeviceCommandGenerator;
import com.qyft.ms.system.common.device.command.FrontResponseGenerator; import com.qyft.ms.system.common.device.command.FrontResponseGenerator;
import com.qyft.ms.system.core.handler.BaseCommandHandler; import com.qyft.ms.system.core.handler.BaseCommandHandler;
@ -37,9 +38,9 @@ public class SlidePlatHeatStart extends BaseCommandHandler {
throw new RuntimeException("参数 temperature 必填"); throw new RuntimeException("参数 temperature 必填");
} }
return runAsync(() -> { return runAsync(() -> {
DeviceCommand nozzleHeatStartCmd = DeviceCommandGenerator.slidePlatHeatStart(temperature); // 生成载玻台加热指令 DeviceCommand nozzleHeatStartCmd = DeviceCommandGenerator.slidePlatHeatStart(temperature); // 生成载玻台加热指令
deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleHeatStartCmd);//发送指令
CommandFuture nozzleHeatStartCmdFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleHeatStartCmd);//发送指令
commandWait(nozzleHeatStartCmdFuture);
deviceStatus.setSlidePlatHeating(true);//设置载玻台加热状态 deviceStatus.setSlidePlatHeating(true);//设置载玻台加热状态
}); });
} }

6
src/main/java/com/qyft/ms/app/front/cmd/business/SlidePlatHeatStop.java

@ -2,6 +2,7 @@ package com.qyft.ms.app.front.cmd.business;
import com.qyft.ms.app.device.status.DeviceStatus; import com.qyft.ms.app.device.status.DeviceStatus;
import com.qyft.ms.system.common.annotation.CommandMapping; import com.qyft.ms.system.common.annotation.CommandMapping;
import com.qyft.ms.system.common.device.command.CommandFuture;
import com.qyft.ms.system.common.device.command.DeviceCommandGenerator; import com.qyft.ms.system.common.device.command.DeviceCommandGenerator;
import com.qyft.ms.system.core.handler.BaseCommandHandler; import com.qyft.ms.system.core.handler.BaseCommandHandler;
import com.qyft.ms.system.model.bo.DeviceCommand; import com.qyft.ms.system.model.bo.DeviceCommand;
@ -28,11 +29,10 @@ public class SlidePlatHeatStop extends BaseCommandHandler {
@Override @Override
public CompletableFuture<Void> handle(FrontCmdControlForm form) { public CompletableFuture<Void> handle(FrontCmdControlForm form) {
return runAsync(() -> { return runAsync(() -> {
DeviceCommand nozzleHeatStopCmd = DeviceCommandGenerator.slidePlatHeatStop(); // 生成载板加热关闭指令 DeviceCommand nozzleHeatStopCmd = DeviceCommandGenerator.slidePlatHeatStop(); // 生成载板加热关闭指令
deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleHeatStopCmd);//发送指令
CommandFuture nozzleHeatStopCmdFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleHeatStopCmd);//发送指令
commandWait(nozzleHeatStopCmdFuture);
deviceStatus.setSlidePlatHeating(false);//设置载玻台加热状态 deviceStatus.setSlidePlatHeating(false);//设置载玻台加热状态
}); });
} }
} }

72
src/main/java/com/qyft/ms/app/front/cmd/business/SlideTrayIn.java

@ -1,36 +1,36 @@
package com.qyft.ms.app.front.cmd.business;
import com.qyft.ms.system.common.annotation.CommandMapping;
import com.qyft.ms.system.common.device.command.CommandFuture;
import com.qyft.ms.system.common.device.command.DeviceCommandGenerator;
import com.qyft.ms.system.core.handler.BaseCommandHandler;
import com.qyft.ms.system.model.bo.DeviceCommand;
import com.qyft.ms.system.model.form.FrontCmdControlForm;
import com.qyft.ms.system.service.device.DeviceCommandService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.concurrent.CompletableFuture;
/**
* 玻片托盘_推入托盘
*/
@Slf4j
@Component
@RequiredArgsConstructor
@CommandMapping("slide_tray_in")//业务指令注解
public class SlideTrayIn extends BaseCommandHandler {
private final DeviceCommandService deviceCommandService;
@Override
public CompletableFuture<Void> handle(FrontCmdControlForm form) {
return runAsync(() -> {
DeviceCommand slideTrayInCommand = DeviceCommandGenerator.slideTrayIn(0.0, 20.0);//推入玻片托盘
CommandFuture slideTrayInCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), slideTrayInCommand);
commandWait(slideTrayInCommandFuture);
});
}
}
//package com.qyft.ms.app.front.cmd.business;
//
//import com.qyft.ms.system.common.annotation.CommandMapping;
//import com.qyft.ms.system.common.device.command.CommandFuture;
//import com.qyft.ms.system.common.device.command.DeviceCommandGenerator;
//import com.qyft.ms.system.core.handler.BaseCommandHandler;
//import com.qyft.ms.system.model.bo.DeviceCommand;
//import com.qyft.ms.system.model.form.FrontCmdControlForm;
//import com.qyft.ms.system.service.device.DeviceCommandService;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Component;
//
//import java.util.concurrent.CompletableFuture;
//
///**
// * 玻片托盘_推入托盘
// */
//@Slf4j
//@Component
//@RequiredArgsConstructor
//@CommandMapping("slide_tray_in")//业务指令注解
//public class SlideTrayIn extends BaseCommandHandler {
//
// private final DeviceCommandService deviceCommandService;
//
// @Override
// public CompletableFuture<Void> handle(FrontCmdControlForm form) {
// return runAsync(() -> {
// DeviceCommand slideTrayInCommand = DeviceCommandGenerator.slideTrayIn(0.0, 20.0);//推入玻片托盘
// CommandFuture slideTrayInCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), slideTrayInCommand);
// commandWait(slideTrayInCommandFuture);
// });
//
// }
//}

72
src/main/java/com/qyft/ms/app/front/cmd/business/SlideTrayOut.java

@ -1,36 +1,36 @@
package com.qyft.ms.app.front.cmd.business;
import com.qyft.ms.system.common.annotation.CommandMapping;
import com.qyft.ms.system.common.device.command.CommandFuture;
import com.qyft.ms.system.common.device.command.DeviceCommandGenerator;
import com.qyft.ms.system.core.handler.BaseCommandHandler;
import com.qyft.ms.system.model.bo.DeviceCommand;
import com.qyft.ms.system.model.form.FrontCmdControlForm;
import com.qyft.ms.system.service.device.DeviceCommandService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.concurrent.CompletableFuture;
/**
* 玻片托盘_推出托盘
*/
@Slf4j
@Component
@RequiredArgsConstructor
@CommandMapping("slide_tray_out")//业务指令注解
public class SlideTrayOut extends BaseCommandHandler {
private final DeviceCommandService deviceCommandService;
@Override
public CompletableFuture<Void> handle(FrontCmdControlForm form) {
return runAsync(() -> {
DeviceCommand slideTrayOutCommand = DeviceCommandGenerator.slideTrayOut(150.0, 20.0);//推出玻片托盘
CommandFuture slideTrayOutCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), slideTrayOutCommand);
commandWait(slideTrayOutCommandFuture);
});
}
}
//package com.qyft.ms.app.front.cmd.business;
//
//import com.qyft.ms.system.common.annotation.CommandMapping;
//import com.qyft.ms.system.common.device.command.CommandFuture;
//import com.qyft.ms.system.common.device.command.DeviceCommandGenerator;
//import com.qyft.ms.system.core.handler.BaseCommandHandler;
//import com.qyft.ms.system.model.bo.DeviceCommand;
//import com.qyft.ms.system.model.form.FrontCmdControlForm;
//import com.qyft.ms.system.service.device.DeviceCommandService;
//import lombok.RequiredArgsConstructor;
//import lombok.extern.slf4j.Slf4j;
//import org.springframework.stereotype.Component;
//
//import java.util.concurrent.CompletableFuture;
//
///**
// * 玻片托盘_推出托盘
// */
//@Slf4j
//@Component
//@RequiredArgsConstructor
//@CommandMapping("slide_tray_out")//业务指令注解
//public class SlideTrayOut extends BaseCommandHandler {
//
// private final DeviceCommandService deviceCommandService;
//
// @Override
// public CompletableFuture<Void> handle(FrontCmdControlForm form) {
// return runAsync(() -> {
// DeviceCommand slideTrayOutCommand = DeviceCommandGenerator.slideTrayOut(150.0, 20.0);//推出玻片托盘
// CommandFuture slideTrayOutCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), slideTrayOutCommand);
// commandWait(slideTrayOutCommandFuture);
// });
//
// }
//}

11
src/main/java/com/qyft/ms/app/front/cmd/business/SyringePipelineWash.java

@ -73,11 +73,13 @@ public class SyringePipelineWash extends BaseCommandHandler {
commandWait(motorZPositionSetCommandFuture); commandWait(motorZPositionSetCommandFuture);
} }
Position wasteLiquor = positionService.getOne(new LambdaQueryWrapper<Position>().eq(Position::getPointCode, "waste_liquor")); Position wasteLiquor = positionService.getOne(new LambdaQueryWrapper<Position>().eq(Position::getPointCode, "waste_liquor"));
//3.x轴移动到废液位置
//xy轴移动到废液位置
DeviceCommand motorXPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(wasteLiquor.getX(), 20.0); DeviceCommand motorXPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(wasteLiquor.getX(), 20.0);
CommandFuture motorXPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXPositionSetCommand); CommandFuture motorXPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorXPositionSetCommand);
commandWait(motorXPositionSetCommandFuture);
//4.下降z轴高度防止飞溅
DeviceCommand motorYPositionSetCommand = DeviceCommandGenerator.motorXPositionSet(wasteLiquor.getY(), 20.0);
CommandFuture motorYPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorYPositionSetCommand);
commandWait(motorXPositionSetCommandFuture, motorYPositionSetCommandFuture);
//下降z轴高度防止飞溅
DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(wasteLiquor.getZ(), 20.0); DeviceCommand motorZPositionSetCommand = DeviceCommandGenerator.motorZPositionSet(wasteLiquor.getZ(), 20.0);
CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZPositionSetCommand); CommandFuture motorZPositionSetCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), motorZPositionSetCommand);
commandWait(motorZPositionSetCommandFuture); commandWait(motorZPositionSetCommandFuture);
@ -86,7 +88,7 @@ public class SyringePipelineWash extends BaseCommandHandler {
DeviceCommand nozzleValveOpenCommand = DeviceCommandGenerator.nozzleValveOpen(); // 开启喷嘴阀 DeviceCommand nozzleValveOpenCommand = DeviceCommandGenerator.nozzleValveOpen(); // 开启喷嘴阀
CommandFuture nozzleValveOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleValveOpenCommand); CommandFuture nozzleValveOpenCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), nozzleValveOpenCommand);
commandWait(nozzleValveOpenCommandFuture); commandWait(nozzleValveOpenCommandFuture);
Thread.sleep(500);
Thread.sleep(500);//开启喷嘴阀后需要延迟500毫秒
//6.设置注射泵速度推注射泵 //6.设置注射泵速度推注射泵
DeviceCommand syringePumpStartCommand = DeviceCommandGenerator.syringePumpForward(speed); // 生成移动注射泵指令 DeviceCommand syringePumpStartCommand = DeviceCommandGenerator.syringePumpForward(speed); // 生成移动注射泵指令
@ -105,7 +107,6 @@ public class SyringePipelineWash extends BaseCommandHandler {
// commandWait(washValveOpenCommandFuture); // commandWait(washValveOpenCommandFuture);
deviceStatus.setCleaningSyringePipeline(true); deviceStatus.setCleaningSyringePipeline(true);
} catch (Exception e) { } catch (Exception e) {
deviceStatus.setCleaningSyringePipeline(false); deviceStatus.setCleaningSyringePipeline(false);

1
src/main/java/com/qyft/ms/app/front/cmd/business/SyringePipelineWashStop.java

@ -40,6 +40,7 @@ public class SyringePipelineWashStop extends BaseCommandHandler {
//1.停止推动注射泵 //1.停止推动注射泵
DeviceCommand syringePumpStopCommand = DeviceCommandGenerator.syringePumpStop(); //停止推动注射泵 DeviceCommand syringePumpStopCommand = DeviceCommandGenerator.syringePumpStop(); //停止推动注射泵
CommandFuture syringePumpStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpStopCommand); CommandFuture syringePumpStopCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), syringePumpStopCommand);
//2.全部关闭三通阀 //2.全部关闭三通阀
DeviceCommand threeWayValveCloseAllCommand = DeviceCommandGenerator.threeWayValveCloseAll(); // 生成全部关闭三通阀指令 DeviceCommand threeWayValveCloseAllCommand = DeviceCommandGenerator.threeWayValveCloseAll(); // 生成全部关闭三通阀指令
CommandFuture threeWayValveCloseAllCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveCloseAllCommand); CommandFuture threeWayValveCloseAllCommandFuture = deviceCommandService.sendCommand(form.getCmdId(), form.getCmdCode(), threeWayValveCloseAllCommand);

Loading…
Cancel
Save