|
|
@ -78,7 +78,7 @@ public class DeviceService { |
|
|
|
* |
|
|
|
* @param speed 速度值 |
|
|
|
*/ |
|
|
|
public boolean setRailArmSpeed(int speed) { |
|
|
|
public synchronized boolean setRailArmSpeed(int speed) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("speed", speed); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setRailArmSpeed", params); |
|
|
@ -90,48 +90,12 @@ public class DeviceService { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 开门 |
|
|
|
* 轨道机械臂移动停止移动 |
|
|
|
*/ |
|
|
|
public boolean openDoor() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("openDoor"); |
|
|
|
public synchronized boolean stopRailArm() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setRailArmSpeed"); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP openDoor 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 关门 |
|
|
|
*/ |
|
|
|
public boolean closeDoor() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("closeDoor"); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP closeDoor 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 张开夹爪 |
|
|
|
*/ |
|
|
|
public boolean openClaw() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("openClaw"); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP openClaw 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 收合夹爪 |
|
|
|
*/ |
|
|
|
public boolean closeClaw() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("closeClaw"); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP closeClaw 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
log.error("TCP stopRailArm 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
@ -176,11 +140,11 @@ public class DeviceService { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 设置加液机械臂的速度 |
|
|
|
* 设置加液机械臂的移动速度 |
|
|
|
* |
|
|
|
* @param speed 速度值 |
|
|
|
*/ |
|
|
|
public boolean setLiquidArmSpeed(int speed) { |
|
|
|
public synchronized boolean setLiquidArmSpeed(int speed) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("speed", speed); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setLiquidArmSpeed", params); |
|
|
@ -192,6 +156,62 @@ public class DeviceService { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 加液机械臂移动停止 |
|
|
|
*/ |
|
|
|
public synchronized boolean stopLiquidArm() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("stopLiquidArm"); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP stopLiquidArm 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 张开夹爪 |
|
|
|
*/ |
|
|
|
public synchronized boolean openClaw() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("openClaw"); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP openClaw 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 收合夹爪 |
|
|
|
*/ |
|
|
|
public synchronized boolean closeClaw() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("closeClaw"); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP closeClaw 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 设置夹爪移动速度 |
|
|
|
* |
|
|
|
* @param mode 夹取模式 "FULL_CLOSED":完全闭合 "TUBE_RACK": 夹取试管架 "CAP": 夹取拍子 |
|
|
|
* @param speed 电机的速度值 |
|
|
|
* @param targetPos 电机目标位置 |
|
|
|
*/ |
|
|
|
public synchronized boolean setClawParams(String mode, int speed, int targetPos) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("mode", mode); |
|
|
|
params.put("speed", speed); |
|
|
|
params.put("targetPos", targetPos); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setClawParams", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP setClawParams 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 加液 |
|
|
|
* |
|
|
|
* @param pumpId 泵id |
|
|
@ -209,6 +229,66 @@ public class DeviceService { |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 设置加热位试管架拍子密封状态 |
|
|
|
* |
|
|
|
* @param heaterId 加热位id |
|
|
|
* @param on true 密封, false 解除密封 |
|
|
|
*/ |
|
|
|
public synchronized boolean setSealLid(int heaterId, boolean on) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("heaterId", heaterId); |
|
|
|
params.put("on", on); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setSealLid", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP setSealLid 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
* 开门 |
|
|
|
*/ |
|
|
|
public synchronized boolean openDoor() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("openDoor"); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP openDoor 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 关门 |
|
|
|
*/ |
|
|
|
public synchronized boolean closeDoor() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("closeDoor"); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP closeDoor 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 设置门参数 |
|
|
|
* |
|
|
|
* @param speed 电机的速度值 |
|
|
|
* @param targetPos 电机目标位置 |
|
|
|
*/ |
|
|
|
public synchronized boolean setDoorParams(int speed, int targetPos) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("speed", speed); |
|
|
|
params.put("targetPos", targetPos); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setDoorParams", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP setDoorParams 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 设置加液泵流量 |
|
|
@ -216,7 +296,7 @@ public class DeviceService { |
|
|
|
* @param pumpId 泵id |
|
|
|
* @param flowRate 流量值 |
|
|
|
*/ |
|
|
|
public boolean setFlowRate(int pumpId, int flowRate) { |
|
|
|
public synchronized boolean setFlowRate(int pumpId, int flowRate) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("pumpId", pumpId); |
|
|
|
params.put("flowRate", flowRate); |
|
|
@ -231,7 +311,7 @@ public class DeviceService { |
|
|
|
/** |
|
|
|
* 开始摇匀 |
|
|
|
*/ |
|
|
|
public boolean startShaking() { |
|
|
|
public synchronized boolean startShaking() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("startShaking"); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP startShaking 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
@ -243,7 +323,7 @@ public class DeviceService { |
|
|
|
/** |
|
|
|
* 停止摇匀 |
|
|
|
*/ |
|
|
|
public boolean stopShaking() { |
|
|
|
public synchronized boolean stopShaking() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("stopShaking"); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP stopShaking 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
@ -257,7 +337,7 @@ public class DeviceService { |
|
|
|
* |
|
|
|
* @param speed 速度值 |
|
|
|
*/ |
|
|
|
public boolean setShakingSpeed(int speed) { |
|
|
|
public synchronized boolean setShakingSpeed(int speed) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("speed", speed); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setShakingSpeed", params); |
|
|
@ -269,66 +349,120 @@ public class DeviceService { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 开始加热 |
|
|
|
* 抬起托盘 |
|
|
|
* |
|
|
|
* @param heaterId 加热器id |
|
|
|
* @param temperature 温度值 |
|
|
|
* @param heaterId 加热位ID |
|
|
|
*/ |
|
|
|
public boolean startHeating(String heaterId, double temperature) { |
|
|
|
public boolean raiseTray(String heaterId) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("heaterId", heaterId); |
|
|
|
params.put("temperature", temperature); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("startHeating", params); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("raiseTray", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP startHeating 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
log.error("TCP raiseTray 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 停止加热 |
|
|
|
* @param heaterId 加热器id |
|
|
|
* 放下托盘 |
|
|
|
* |
|
|
|
* @param heaterId 加热位ID |
|
|
|
*/ |
|
|
|
public boolean stopHeating(String heaterId) { |
|
|
|
public boolean lowerTray(String heaterId) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("heaterId", heaterId); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("stopHeating", params); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("lowerTray", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP stopHeating 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
log.error("TCP lowerTray 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 设置加热区托盘电机参数 |
|
|
|
* |
|
|
|
* @param heaterId 加热位ID |
|
|
|
* @param speed 电机的速度值 |
|
|
|
* @param targetPos 电机目标位置 |
|
|
|
*/ |
|
|
|
public synchronized boolean setTrayParams(int heaterId, int speed, int targetPos) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("heaterId", heaterId); |
|
|
|
params.put("speed", speed); |
|
|
|
params.put("targetPos", targetPos); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setTrayParams", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP setTrayParams 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 抬起托盘到指定高度 |
|
|
|
* 调整拍子存放区高度 |
|
|
|
* |
|
|
|
* @param distance 距离 |
|
|
|
* @param level 高度等级 0-6 |
|
|
|
*/ |
|
|
|
public boolean moveTrayToHeight(double distance) { |
|
|
|
public synchronized boolean setCapHeight(int level) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("distance", distance); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("moveTrayToHeight", params); |
|
|
|
params.put("level", level); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setCapHeight", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP moveTrayToHeight 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
log.error("TCP setCapHeight 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 设置托盘抬起速度 |
|
|
|
* 设定拍子存放区电机参数 |
|
|
|
* |
|
|
|
* @param speed 速度值 |
|
|
|
* @param speed 电机的速度值 |
|
|
|
* @param targetPos 电机每一个等级目标位置 |
|
|
|
*/ |
|
|
|
public boolean setTraySpeed(int speed) { |
|
|
|
public synchronized boolean setCapParams(int speed, int targetPos) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("speed", speed); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setTraySpeed", params); |
|
|
|
params.put("targetPos", targetPos); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("setCapParams", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP setCapParams 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 开始加热 |
|
|
|
* |
|
|
|
* @param heaterId 加热区id |
|
|
|
* @param temperature 温度值 |
|
|
|
*/ |
|
|
|
public boolean startHeating(String heaterId, double temperature) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("heaterId", heaterId); |
|
|
|
params.put("temperature", temperature); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("startHeating", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP startHeating 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 停止加热 |
|
|
|
* |
|
|
|
* @param heaterId 加热区id |
|
|
|
*/ |
|
|
|
public boolean stopHeating(String heaterId) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("heaterId", heaterId); |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("stopHeating", params); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP setTraySpeed 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
log.error("TCP stopHeating 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
|
return false; |
|
|
|
} |
|
|
|
return true; |
|
|
@ -337,7 +471,7 @@ public class DeviceService { |
|
|
|
/** |
|
|
|
* 拍照 |
|
|
|
*/ |
|
|
|
public boolean takePhoto() { |
|
|
|
public synchronized boolean takePhoto() { |
|
|
|
DeviceFeedback deviceFeedback = tcpClient.sendCommand("takePhoto"); |
|
|
|
if (deviceFeedback == null || deviceFeedback.getError() != null) { |
|
|
|
log.error("TCP takePhoto 指令执行错误 {}", JSONUtil.toJsonStr(deviceFeedback)); |
|
|
@ -347,9 +481,9 @@ public class DeviceService { |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* 触发报警 |
|
|
|
* 测试用,触发报警 |
|
|
|
*/ |
|
|
|
public boolean alarmTest(String code, String msg, String module) { |
|
|
|
public synchronized boolean alarmTest(String code, String msg, String module) { |
|
|
|
Map<String, Object> params = new HashMap<>(); |
|
|
|
params.put("code", code); |
|
|
|
params.put("msg", msg); |
|
|
|