Browse Source

fix:急停放到设备状态中

tags/1.0
白凤吉 5 months ago
parent
commit
4a92b736a9
  1. 6
      src/main/java/com/qyft/ms/app/device/status/DeviceStatus.java
  2. 8
      src/main/java/com/qyft/ms/system/service/device/DeviceCommandService.java

6
src/main/java/com/qyft/ms/app/device/status/DeviceStatus.java

@ -51,6 +51,11 @@ public class DeviceStatus {
*/
private volatile boolean selfTestCompleted = false;
/**
* 是否按下急停
*/
private volatile boolean stopPressed = false;
public JSONObject toJSON() {
JSONObject json = new JSONObject();
json.putOnce("spraying", spraying);
@ -61,6 +66,7 @@ public class DeviceStatus {
json.putOnce("prefilling", prefilling);
json.putOnce("dehumidifierRunning", dehumidifierRunning);
json.putOnce("selfTestCompleted", selfTestCompleted);
json.putOnce("stopPressed", stopPressed);
return json;
}

8
src/main/java/com/qyft/ms/system/service/device/DeviceCommandService.java

@ -2,6 +2,7 @@ package com.qyft.ms.system.service.device;
import cn.hutool.json.JSONObject;
import com.qyft.ms.app.common.constant.WebSocketMessageType;
import com.qyft.ms.app.device.status.DeviceStatus;
import com.qyft.ms.system.common.constant.CommandStatus;
import com.qyft.ms.system.common.device.command.CommandFuture;
import com.qyft.ms.system.core.client.DeviceTcpClient;
@ -27,7 +28,7 @@ public class DeviceCommandService {
private final DeviceTcpClient deviceTcpClient;
private final FrontCommandService frontCommandService;
private final WebSocketService webSocketService;
private final DeviceStatus deviceStatus;
public CommandFuture executeCommand(DeviceCommand cmdToDevice) {
@ -92,10 +93,9 @@ public class DeviceCommandService {
} else if ("event".equals(tag)) {
String eventType = deviceResult.getStr("event_type");
if("system_e_stop_pressed".equals(eventType)) {//系统急停按钮被按下
webSocketService.pushMsg(WebSocketMessageType.SYSTEM_E_STOP_PRESSED, "系统急停按钮被按下");
deviceStatus.setStopPressed(true);
}else if("system_e_stop_released".equals(eventType)) {//系统急停按钮被释放
webSocketService.pushMsg(WebSocketMessageType.SYSTEM_E_STOP_RELEASED, "系统急停按钮被释放");
}
} deviceStatus.setStopPressed(false);
} else if ("status".equals(tag)) {
}

Loading…
Cancel
Save