Browse Source

重连修改

炒锅机器人_一拖多
liup 2 months ago
parent
commit
57c04177af
4 changed files with 13 additions and 5 deletions
  1. +2
    -0
      app/src/main/java/com/bonait/bnframework/modbus/RackModbusTcpServer.java
  2. +7
    -1
      app/src/main/java/com/bonait/bnframework/modbus/RobotModbusTcpServer.java
  3. +3
    -3
      app/src/main/java/com/bonait/bnframework/modbus/Wok2ModbusTcpServer.java
  4. +1
    -1
      app/src/main/java/com/bonait/bnframework/modbus/WokModbusTcpServer.java

+ 2
- 0
app/src/main/java/com/bonait/bnframework/modbus/RackModbusTcpServer.java View File

@@ -228,6 +228,7 @@ public class RackModbusTcpServer {
RackModbusTcpServer.get().plcIsConnect = true;
Log.e("设备PLC", "设备PLC: 连接成功");
RecordManager.getInstance().addLogRecord("设备异常日志","货架plc-连接成功");
ThreadManager.get().Stop("烤箱设备重连");
}

@Override
@@ -246,6 +247,7 @@ public class RackModbusTcpServer {
});
Thread.sleep(3000);
}
ThreadManager.get().Stop("烤箱设备重连");
});

}


+ 7
- 1
app/src/main/java/com/bonait/bnframework/modbus/RobotModbusTcpServer.java View File

@@ -122,6 +122,12 @@ public class RobotModbusTcpServer {
*/
public static void ConnectPLC()
{
ThreadManager.get().execute(new Runnable() {
@Override
public void run() {

}
});
ThreadManager.get().StartLong("机器人PLC重连", false, new IThread() {
@Override
public void Run() throws InterruptedException {
@@ -139,7 +145,7 @@ public class RobotModbusTcpServer {
MessageLog.ShowInfo("机器人设备 " + ModbusCenter.robotAddress + " 连接成功");
RobotModbusTcpServer.get().plcIsConnect = true;
Log.e("机器人PLC", "机器人PLC: 连接成功");
ThreadManager.get().Stop("机器人设备重连");
ThreadManager.get().Stop("机器人PLC重连");
ModbusCenter.Listening();
RecordManager.getInstance().addLogRecord("设备异常日志","机器人PLC-连接成功");
}


+ 3
- 3
app/src/main/java/com/bonait/bnframework/modbus/Wok2ModbusTcpServer.java View File

@@ -98,7 +98,7 @@ public class Wok2ModbusTcpServer {
*/
public static void ConnectPLC()
{
ThreadManager.get().StartLong("炒锅PLC重连", false, new IThread() {
ThreadManager.get().StartLong("炒锅2PLC重连", false, new IThread() {
@Override
public void Run() throws InterruptedException {
while (!Wok2ModbusTcpServer.get().plcIsConnect){
@@ -115,7 +115,7 @@ public class Wok2ModbusTcpServer {
MessageLog.ShowInfo("炒锅设备 " + ModbusCenter.wokAddress + " 连接成功");
Wok2ModbusTcpServer.get().plcIsConnect = true;
Log.e("炒锅设备PLC", "炒锅设备PLC: 连接成功");
ThreadManager.get().Stop("炒锅设备重连");
ThreadManager.get().Stop("炒锅2PLC重连");
ModbusCenter.Listening();
init();
RecordManager.getInstance().addLogRecord("设备异常日志",2+"号炒锅-连接成功");
@@ -140,7 +140,7 @@ public class Wok2ModbusTcpServer {
throw new RuntimeException(e);
}
}
ThreadManager.get().Stop("炒锅PLC重连");
ThreadManager.get().Stop("炒锅2PLC重连");
}});
}



+ 1
- 1
app/src/main/java/com/bonait/bnframework/modbus/WokModbusTcpServer.java View File

@@ -119,7 +119,7 @@ public class WokModbusTcpServer {
MessageLog.ShowInfo("炒锅设备 " + ModbusCenter.wokAddress + " 连接成功");
WokModbusTcpServer.get().plcIsConnect = true;
Log.e("炒锅设备PLC", "炒锅设备PLC: 连接成功");
ThreadManager.get().Stop("炒锅设备重连");
ThreadManager.get().Stop("炒锅PLC重连");
ModbusCenter.Listening();
RecordManager.getInstance().addLogRecord("设备异常日志",1+"号炒锅-连接成功");
init();


Loading…
Cancel
Save