fix 自动门、ndc链接
This commit is contained in:
@@ -23,6 +23,7 @@ import org.springframework.stereotype.Component;
|
||||
import java.io.DataInputStream;
|
||||
import java.io.DataOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Socket;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@@ -78,11 +79,17 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
DeviceExecuteLogService logServer = SpringContextHolder.getBean(DeviceExecuteLogService.class);
|
||||
ip = paramService.findByCode(AcsConfig.AGVURL).getValue();
|
||||
port = Integer.parseInt(paramService.findByCode(AcsConfig.AGVPORT).getValue());
|
||||
byte[] data = null;
|
||||
|
||||
|
||||
try {
|
||||
InetSocketAddress socketAddress = new InetSocketAddress(ip, port);
|
||||
|
||||
byte[] b = new byte[1024];
|
||||
s = new Socket(ip, port);
|
||||
s = new Socket();
|
||||
s.connect(socketAddress,2*1000);
|
||||
s.setKeepAlive(true);//长链接
|
||||
// s.setSoTimeout(1000* 60 * 10);//读取超时时间
|
||||
dos = new DataOutputStream(s.getOutputStream());
|
||||
dis = new DataInputStream(s.getInputStream());
|
||||
System.out.println("1楼NDCAgv链接成功");
|
||||
@@ -113,7 +120,6 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
//System.out.println("收到请求参数:" + bs);
|
||||
boolean flag = false;
|
||||
if (arr[8] * 256 + arr[9] == 0x73) {
|
||||
byte[] data = null;
|
||||
System.out.println("接收agv上报信息:" + bs);
|
||||
//执行阶段
|
||||
int phase = arr[16] * 256 + arr[17];
|
||||
@@ -221,15 +227,17 @@ public class OneNDCSocketConnectionAutoRun extends AbstractAutoRunnable {
|
||||
}
|
||||
|
||||
}
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
write(data);
|
||||
}
|
||||
|
||||
} else {
|
||||
System.out.println("agv上报不是0073类型动作,不处理");
|
||||
}
|
||||
}
|
||||
|
||||
if (!ObjectUtil.isEmpty(data)) {
|
||||
write(data);
|
||||
data = null;
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("OneAgv链接异常");
|
||||
log.info("OneAgv链接异常");
|
||||
|
||||
@@ -58,7 +58,9 @@ public class StandardAutodoorDeviceDriver extends AbstractOpcDeviceDriver implem
|
||||
}
|
||||
if (close != last_close) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号close:" + last_close + "->" + close);
|
||||
|
||||
if(close ==1 ){
|
||||
this.writing("to_close","0");
|
||||
}
|
||||
}
|
||||
if (toClose != last_toClose) {
|
||||
logServer.deviceExecuteLog(this.device_code, "", "", "信号toClose:" + last_toClose + "->" + toClose);
|
||||
|
||||
Reference in New Issue
Block a user