rev ndc下发信号

This commit is contained in:
2023-05-06 13:57:25 +08:00
parent 7d0791027f
commit e9acc99e44
2 changed files with 21 additions and 4 deletions

View File

@@ -216,6 +216,7 @@ public class TwoNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
e.printStackTrace(); e.printStackTrace();
} }
if (standardAutodoorDeviceDriver.getOpen() == 1) { if (standardAutodoorDeviceDriver.getOpen() == 1) {
log.info("下发开门信号值为:{},下发关门信号值为:{}", standardAutodoorDeviceDriver.getToOpen(), standardAutodoorDeviceDriver.getToClose());
data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0); data = ndcAgvService.sendAgvTwoModeInst(phase, index, 0);
} }
} }

View File

@@ -31,7 +31,13 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
int last_open = 0; int last_open = 0;
int last_close = 0; int last_close = 0;
int toOpen = 0;
int last_toOpen = 0;
int toClose = 0;
int last_toClose = 0;
String device_code = null; String device_code = null;
@Override @Override
public Device getDevice() { public Device getDevice() {
return this.device; return this.device;
@@ -45,6 +51,8 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
device_code = this.getDevice().getDevice_code(); device_code = this.getDevice().getDevice_code();
open = this.itemProtocol.getOpen(); open = this.itemProtocol.getOpen();
close = this.itemProtocol.getClose(); close = this.itemProtocol.getClose();
toOpen = this.itemProtocol.getToOpen();
toClose = this.itemProtocol.getToClose();
if (open != last_open) { if (open != last_open) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号open" + last_open + "->" + open); logServer.deviceExecuteLog(this.device_code, "", "", "信号open" + last_open + "->" + open);
} }
@@ -52,9 +60,17 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
logServer.deviceExecuteLog(this.device_code, "", "", "信号close" + last_close + "->" + close); logServer.deviceExecuteLog(this.device_code, "", "", "信号close" + last_close + "->" + close);
} }
if (toClose != last_toClose) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号toClose" + last_toClose + "->" + toClose);
}
if (toOpen != last_toOpen) {
logServer.deviceExecuteLog(this.device_code, "", "", "信号toOpen" + last_toOpen + "->" + toOpen);
}
last_open = open; last_open = open;
last_close = close; last_close = close;
last_toClose = toClose;
last_toOpen = toOpen;
} }
@@ -74,14 +90,14 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
JSONObject jo = new JSONObject(); JSONObject jo = new JSONObject();
String open = ""; String open = "";
String close = ""; String close = "";
if(this.getOpen() == 0){ if (this.getOpen() == 0) {
open = "未知"; open = "未知";
} else if(this.getOpen() == 1){ } else if (this.getOpen() == 1) {
open = "开到位"; open = "开到位";
} }
if(this.getClose() == 0){ if (this.getClose() == 0) {
open = "未知"; open = "未知";
} else if(this.getClose() == 1){ } else if (this.getClose() == 1) {
open = "关到位"; open = "关到位";
} }
jo.put("device_name", this.getDevice().getDevice_name()); jo.put("device_name", this.getDevice().getDevice_name());