11 changed files with 195 additions and 184 deletions
-
4src/main/java/com/qyft/ms/app/front/cmd/business/NozzleHeatStart.java
-
4src/main/java/com/qyft/ms/app/front/cmd/business/NozzleHeatStop.java
-
11src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFill.java
-
1src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelinePreFillStop.java
-
192src/main/java/com/qyft/ms/app/front/cmd/business/NozzlePipelineWash.java
-
5src/main/java/com/qyft/ms/app/front/cmd/business/SlidePlatHeatStart.java
-
6src/main/java/com/qyft/ms/app/front/cmd/business/SlidePlatHeatStop.java
-
72src/main/java/com/qyft/ms/app/front/cmd/business/SlideTrayIn.java
-
72src/main/java/com/qyft/ms/app/front/cmd/business/SlideTrayOut.java
-
11src/main/java/com/qyft/ms/app/front/cmd/business/SyringePipelineWash.java
-
1src/main/java/com/qyft/ms/app/front/cmd/business/SyringePipelineWashStop.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(() -> { |
||||
|
// |
||||
|
// |
||||
|
// }); |
||||
|
// |
||||
|
// } |
||||
|
//} |
@ -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); |
||||
|
// }); |
||||
|
// |
||||
|
// } |
||||
|
//} |
@ -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); |
||||
|
// }); |
||||
|
// |
||||
|
// } |
||||
|
//} |
Write
Preview
Loading…
Cancel
Save
Reference in new issue