Browse Source

fix:统一加热区id、加热器设备id字段定义

master
白凤吉 5 months ago
parent
commit
f840cf64d5
  1. 2
      src/main/java/com/qyft/gd/controller/CMDController.java
  2. 8
      src/main/java/com/qyft/gd/device/model/bo/DeviceStatus.java
  3. 36
      src/main/java/com/qyft/gd/device/service/DeviceService.java
  4. 36
      src/main/java/com/qyft/gd/device/service/DeviceStepService.java
  5. 2
      src/main/java/com/qyft/gd/model/bo/CraftsStepMethod.java
  6. 26
      src/main/java/com/qyft/gd/service/CMDService.java
  7. 6
      src/main/java/com/qyft/gd/service/CraftsStepService.java

2
src/main/java/com/qyft/gd/controller/CMDController.java

@ -55,7 +55,7 @@ public class CMDController {
cmdForm.setCommand("startHeat");
cmdForm.setCommandId(UUID.randomUUID().toString());
Map<String, Object> params = new HashMap<>();
params.put("areaId", i);
params.put("heatId", i);
cmdForm.setParams(params);
cmdService.executeCommand(cmdForm);
}

8
src/main/java/com/qyft/gd/device/model/bo/DeviceStatus.java

@ -25,7 +25,7 @@ public class DeviceStatus {
private LiquidArea liquidArea;
@Schema(description = "加热操作区属性")
private List<HeatingArea> heater;
private List<HeatArea> heatArea;
@Schema(description = "碱容器状态")
private LiquidBucket alkaliBucket;
@ -83,9 +83,9 @@ public class DeviceStatus {
* 加热操作区属性
*/
@Data
public static class HeatingArea {
@Schema(description = "加热id")
private String heaterId;
public static class HeatArea {
@Schema(description = "加热器设备id")
private String hardwareId;
@Schema(description = "托盘状态,0为无托盘,1为有托盘,2为托盘抬起")
private Integer trayStatus;
@Schema(description = "是否正在加热,true为正在加热,false为未加热")

36
src/main/java/com/qyft/gd/device/service/DeviceService.java

@ -252,12 +252,12 @@ public class DeviceService {
/**
* 设置加热位试管架拍子密封状态
*
* @param heaterId 加热位id
* @param hardwareId 加热器id
* @param on true 密封 false 解除密封
*/
public synchronized boolean setSealLid(int heaterId, boolean on) {
public synchronized boolean setSealLid(int hardwareId, boolean on) {
Map<String, Object> params = new HashMap<>();
params.put("heaterId", heaterId);
params.put("hardwareId", hardwareId);
params.put("on", on);
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.SET_SEAL_LID, params);
if (deviceFeedback == null || deviceFeedback.getError() != null) {
@ -361,11 +361,11 @@ public class DeviceService {
/**
* 抬起托盘
*
* @param heaterId 加热位ID
* @param hardwareId 加热器ID
*/
public boolean raiseTray(String heaterId) {
public boolean raiseTray(String hardwareId) {
Map<String, Object> params = new HashMap<>();
params.put("heaterId", heaterId);
params.put("hardwareId", hardwareId);
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.RAISE_TRAY, params);
if (deviceFeedback == null || deviceFeedback.getError() != null) {
log.error("TCP raiseTray 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback));
@ -377,11 +377,11 @@ public class DeviceService {
/**
* 放下托盘
*
* @param heaterId 加热位ID
* @param hardwareId 加热器ID
*/
public boolean lowerTray(String heaterId) {
public boolean lowerTray(String hardwareId) {
Map<String, Object> params = new HashMap<>();
params.put("heaterId", heaterId);
params.put("hardwareId", hardwareId);
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.LOWER_TRAY, params);
if (deviceFeedback == null || deviceFeedback.getError() != null) {
log.error("TCP lowerTray 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback));
@ -393,13 +393,13 @@ public class DeviceService {
/**
* 设置加热区托盘电机参数
*
* @param heaterId 加热位ID
* @param hardwareId 加热器ID
* @param speed 电机的速度值
* @param targetPos 电机目标位置
*/
public synchronized boolean setTrayParams(String heaterId, int speed, int targetPos) {
public synchronized boolean setTrayParams(String hardwareId, int speed, int targetPos) {
Map<String, Object> params = new HashMap<>();
params.put("heaterId", heaterId);
params.put("hardwareId", hardwareId);
params.put("speed", speed);
params.put("targetPos", targetPos);
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.SET_TRAY_PARAMS, params);
@ -447,12 +447,12 @@ public class DeviceService {
/**
* 开始加热
*
* @param heaterId 加热区id
* @param hardwareId 加热器id
* @param temperature 温度值
*/
public boolean startHeating(String heaterId, double temperature) {
public boolean startHeating(String hardwareId, double temperature) {
Map<String, Object> params = new HashMap<>();
params.put("heaterId", heaterId);
params.put("hardwareId", hardwareId);
params.put("temperature", temperature);
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.START_HEATING, params);
if (deviceFeedback == null || deviceFeedback.getError() != null) {
@ -465,11 +465,11 @@ public class DeviceService {
/**
* 停止加热
*
* @param heaterId 加热区id
* @param hardwareId 加热器id
*/
public boolean stopHeating(String heaterId) {
public boolean stopHeating(String hardwareId) {
Map<String, Object> params = new HashMap<>();
params.put("heaterId", heaterId);
params.put("hardwareId", hardwareId);
DeviceFeedback deviceFeedback = tcpClient.sendCommand(DeviceCommands.STOP_HEATING, params);
if (deviceFeedback == null || deviceFeedback.getError() != null) {
log.error("TCP stopHeating 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback));

36
src/main/java/com/qyft/gd/device/service/DeviceStepService.java

@ -23,10 +23,10 @@ public class DeviceStepService {
/**
* 抬起托盘
*
* @param heaterId 加热区id
* @param heatId 加热区id
*/
public boolean upTray(String heaterId) {
Map<String, Object> params = Map.of("areaId", heaterId);
public boolean upTray(String heatId) {
Map<String, Object> params = Map.of("heatId", heatId);
List<Supplier<Boolean>> cmdList = cmdService.upTray(params);
return cmdList.stream().allMatch(Supplier::get);
}
@ -34,10 +34,10 @@ public class DeviceStepService {
/**
* 降下托盘
*
* @param heaterId 加热区id
* @param heatId 加热区id
*/
public boolean downTray(String heaterId) {
Map<String, Object> params = Map.of("areaId", heaterId);
public boolean downTray(String heatId) {
Map<String, Object> params = Map.of("heatId", heatId);
List<Supplier<Boolean>> cmdList = cmdService.downTray(params);
return cmdList.stream().allMatch(Supplier::get);
}
@ -64,10 +64,10 @@ public class DeviceStepService {
/**
* 将指定加热区的托盘移至加液区
*
* @param heaterId 加热区id
* @param heatId 加热区id
*/
public boolean moveToSol(String heaterId) {
Map<String, Object> params = Map.of("areaId", heaterId);
public boolean moveToSol(String heatId) {
Map<String, Object> params = Map.of("heatId", heatId);
List<Supplier<Boolean>> cmdList = cmdService.moveToActionArea(params);
return cmdList.stream().allMatch(Supplier::get);
}
@ -75,10 +75,10 @@ public class DeviceStepService {
/**
* 移至加热
*
* @param heaterId 加热区id
* @param heatId 加热区id
*/
public boolean moveToHeater(String heaterId) {
Map<String, Object> params = Map.of("areaId", heaterId);
public boolean moveToHeat(String heatId) {
Map<String, Object> params = Map.of("heatId", heatId);
List<Supplier<Boolean>> cmdList = cmdService.moveToHeatArea(params);
return cmdList.stream().allMatch(Supplier::get);
}
@ -104,11 +104,11 @@ public class DeviceStepService {
/**
* 开始加热
*
* @param heaterId 加热区id
* @param heatId 加热区id
* @param temperature 目标温度
*/
public boolean startHeating(String heaterId, double temperature) {
Map<String, Object> params = Map.of("areaId", heaterId, "temperature", temperature);
public boolean startHeating(String heatId, double temperature) {
Map<String, Object> params = Map.of("heatId", heatId, "temperature", temperature);
List<Supplier<Boolean>> cmdList = cmdService.startHeat(params);
return cmdList.stream().allMatch(Supplier::get);
}
@ -116,10 +116,10 @@ public class DeviceStepService {
/**
* 停止加热
*
* @param heaterId 加热区id
* @param heatId 加热区id
*/
public boolean stopHeating(String heaterId) {
Map<String, Object> params = Map.of("areaId", heaterId);
public boolean stopHeating(String heatId) {
Map<String, Object> params = Map.of("heatId", heatId);
List<Supplier<Boolean>> cmdList = cmdService.stopHeat(params);
return cmdList.stream().allMatch(Supplier::get);
}

2
src/main/java/com/qyft/gd/model/bo/CraftsStepMethod.java

@ -26,7 +26,7 @@ public class CraftsStepMethod {
/**
* 移动到加热器位置
*/
public static final String MOVE_TO_HEATER = "moveToHeater";
public static final String MOVE_TO_HEAT = "moveToHeat";
/**
* 摇晃
*/

26
src/main/java/com/qyft/gd/service/CMDService.java

@ -107,7 +107,7 @@ public class CMDService {
public List<Supplier<Boolean>> moveToHeatArea(Map<String, Object> params) {
List<Supplier<Boolean>> cmdList = new ArrayList<>();
Map<String ,Object> map = baseDataService.getOffsetMap();
String heatAreaPosition = baseDataService.getHeatAreaPositionById((Integer) params.get("areaId"));
String heatAreaPosition = baseDataService.getHeatAreaPositionById((Integer) params.get("heatId"));
String [] heatAreaPositionArr =heatAreaPosition.split(",");
int x1 = Integer.parseInt(heatAreaPositionArr[0]);
int y1 = Integer.parseInt(heatAreaPositionArr[1]);
@ -163,14 +163,14 @@ public class CMDService {
public List<Supplier<Boolean>> putBackCap(Map<String, Object> params) {
List<Supplier<Boolean>> cmdList = new ArrayList<>();
// 加热位机器代码
String heaterId = baseDataService.getHeatAreaHardwareIdById((Integer) params.get("areaId"));
String heatId = baseDataService.getHeatAreaHardwareIdById((Integer) params.get("heatId"));
String lidPosition = baseDataService.getLidPosition();
String [] lidPositionArr = lidPosition.split(",");
int x1 = Integer.parseInt(lidPositionArr[0]);
int y1 = Integer.parseInt(lidPositionArr[1]);
int z1 = Integer.parseInt(lidPositionArr[2]);
String position = baseDataService.getHeatAreaLidPositionById((Integer) params.get("areaId"));
String position = baseDataService.getHeatAreaLidPositionById((Integer) params.get("heatId"));
Map<String ,Object> map = baseDataService.getOffsetMap();
String [] positionArr =position.split(",");
int x2 = Integer.parseInt(positionArr[0]);
@ -196,7 +196,7 @@ public class CMDService {
cmdList.add(() -> deviceService.closeClaw());
// 密封
// 解除密封
cmdList.add(() -> deviceService.setSealLid(Integer.parseInt(heaterId), true));
cmdList.add(() -> deviceService.setSealLid(Integer.parseInt(heatId), true));
// 机械臂复位
return cmdList;
}
@ -204,9 +204,9 @@ public class CMDService {
public List<Supplier<Boolean>> takeOffCap(Map<String, Object> params) {
List<Supplier<Boolean>> cmdList = new ArrayList<>();
// 拍子坐标
String position = baseDataService.getHeatAreaLidPositionById((Integer) params.get("areaId"));
String position = baseDataService.getHeatAreaLidPositionById((Integer) params.get("heatId"));
// 加热位机器代码
String heaterId = baseDataService.getHeatAreaHardwareIdById((Integer) params.get("areaId"));
String hardwareId = baseDataService.getHeatAreaHardwareIdById((Integer) params.get("heatId"));
Map<String ,Object> map = baseDataService.getOffsetMap();
String [] positionArr =position.split(",");
@ -223,7 +223,7 @@ public class CMDService {
//机械臂移动到拍子坐标
cmdList.add(() -> deviceService.moveRailArmToPoint(x1,y1,z1));
// 解除密封
cmdList.add(() -> deviceService.setSealLid(Integer.parseInt(heaterId), false));
cmdList.add(() -> deviceService.setSealLid(Integer.parseInt(hardwareId), false));
// 打开钩子
cmdList.add(() -> deviceService.openClaw());
// 机械臂下移位置
@ -252,17 +252,17 @@ public class CMDService {
// 停止加热
public List<Supplier<Boolean>> stopHeat(Map<String, Object> params) {
List<Supplier<Boolean>> cmdList = new ArrayList<>();
String hardwareId = baseDataService.getHeatAreaHardwareIdById((Integer) params.get("areaId"));
String hardwareId = baseDataService.getHeatAreaHardwareIdById((Integer) params.get("heatId"));
cmdList.add(() -> deviceService.stopHeating(hardwareId));
return cmdList;
}
// 开始加热
public List<Supplier<Boolean>> startHeat(Map<String, Object> params) {
List<Supplier<Boolean>> cmdList = new ArrayList<>();
String hardwareId = baseDataService.getHeatAreaHardwareIdById((Integer) params.get("areaId"));
String hardwareId = baseDataService.getHeatAreaHardwareIdById((Integer) params.get("heatId"));
Double temperature;
if (params.get("temperature") == null) {
temperature = Double.valueOf(baseDataService.getHeatAreaTemperatureById((Integer) params.get("areaId")));
temperature = Double.valueOf(baseDataService.getHeatAreaTemperatureById((Integer) params.get("heatId")));
}else{
temperature = (Double) params.get("temperature");
}
@ -289,7 +289,7 @@ public class CMDService {
public List<Supplier<Boolean>> moveToActionArea(Map<String, Object> params) {
List<Supplier<Boolean>> cmdList = new ArrayList<>();
Map<String ,Object> map = baseDataService.getOffsetMap();
String heatAreaPosition = baseDataService.getHeatAreaPositionById((Integer) params.get("areaId"));
String heatAreaPosition = baseDataService.getHeatAreaPositionById((Integer) params.get("heatId"));
String [] heatAreaPositionArr =heatAreaPosition.split(",");
int x1 = Integer.parseInt(heatAreaPositionArr[0]);
int y1 = Integer.parseInt(heatAreaPositionArr[1]);
@ -345,7 +345,7 @@ public class CMDService {
// 放下托盘
public List<Supplier<Boolean>> downTray(Map<String, Object> params) {
List<Supplier<Boolean>> cmdList = new ArrayList<>();
String hardwareId = baseDataService.getHeatAreaHardwareIdById((Integer) params.get("areaId"));
String hardwareId = baseDataService.getHeatAreaHardwareIdById((Integer) params.get("heatId"));
if(params.get("height") != null && params.get("speed") != null) {
cmdList.add(() -> deviceService.setTrayParams(hardwareId, (Integer) params.get("speed"), (Integer) params.get("height")));
}
@ -356,7 +356,7 @@ public class CMDService {
// 抬起托盘
public List<Supplier<Boolean>> upTray(Map<String, Object> params) {
List<Supplier<Boolean>> cmdList = new ArrayList<>();
String hardwareId = baseDataService.getHeatAreaHardwareIdById((Integer) params.get("areaId"));
String hardwareId = baseDataService.getHeatAreaHardwareIdById((Integer) params.get("heatId"));
if(params.get("height") != null && params.get("speed") != null) {
cmdList.add(() -> deviceService.setTrayParams(hardwareId, (Integer) params.get("speed"), (Integer) params.get("height")));
}

6
src/main/java/com/qyft/gd/service/CraftsStepService.java

@ -122,7 +122,7 @@ public class CraftsStepService {
case CraftsStepMethod.DOWN_TRAY -> this.downTray();
case CraftsStepMethod.ADD_LIQUID -> this.addLiquid(params);
case CraftsStepMethod.MOVE_TO_SOL -> this.moveToSol();
case CraftsStepMethod.MOVE_TO_HEATER -> this.moveToHeater();
case CraftsStepMethod.MOVE_TO_HEAT -> this.moveToHeat();
case CraftsStepMethod.SHAKING -> this.shaking(params);
case CraftsStepMethod.START_HEATING -> this.startHeating(params);
case CraftsStepMethod.STOP_HEATING -> this.stopHeating();
@ -230,8 +230,8 @@ public class CraftsStepService {
/**
* 移至加热
*/
private boolean moveToHeater() {
currentMethod = CraftsStepMethod.MOVE_TO_HEATER;
private boolean moveToHeat() {
currentMethod = CraftsStepMethod.MOVE_TO_HEAT;
pushMsg(heatId, CraftsStepStatus.IN_PROGRESS, currentMethod);
try {

Loading…
Cancel
Save