Browse Source

1.更新工序增加变化

master
fyf 11 months ago
parent
commit
124689defb
6 changed files with 78 additions and 66 deletions
  1. +4
    -0
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  2. +35
    -30
      app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigation2Activity.java
  3. +33
    -30
      app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationNewActivity.java
  4. +2
    -2
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyActivity.java
  5. +2
    -2
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdate1Activity.java
  6. +2
    -2
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdateActivity.java

+ 4
- 0
app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java View File

@@ -184,6 +184,10 @@ public class ConfigName {
//endregion

//region PlC连接参数
/**
* Plc是否连接
*/
public boolean IsShow = false;
/**
* Plc是否连接
*/


+ 35
- 30
app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigation2Activity.java View File

@@ -66,6 +66,7 @@ public class BottomNavigation2Activity extends BaseActivity {
@Override
protected void onDestroy() {
ConfigData.getInstance().ColsePLC();
ConfigName.getInstance().IsShow=false;
//AliyunIOTManager.getInstance().CloseDev();
super.onDestroy();
}
@@ -182,51 +183,55 @@ public class BottomNavigation2Activity extends BaseActivity {
*/
public void ReconnectModbus() {
try {
ConfigName.getInstance().IsShow=true;
ThreadManager.Get().StartLong("PLC断线重连线程", true, new IThread() {
@Override
public void Run() throws InterruptedException {
try {
if (ConfigName.getInstance().PlcIsConnect) {
//ping 不通
boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1);
if (!status) //ping 不通 连接
{
MessageLog.ShowInfo("PLC状态断开,尝试连接...");
ConfigName.getInstance().PlcIsConnect = false;
}
} else {
boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1);
if (status) {
MessageLog.ShowInfo("设备 " + ConfigName.getInstance().Address + " PLC通讯正常,准备连接!");
ModbusTcpServer.ConnectPLC();
} else {
MessageLog.ShowInfo("PLC状态断开,尝试连接...");
ConfigName.getInstance().PlcIsConnect = false;
}
}

if(ConfigName.getInstance().versionSelectionEnum.contains("一拖"))
if(ConfigName.getInstance().IsShow)
{
if (ConfigName.getInstance().PlcMainIsConnect) {
if (ConfigName.getInstance().PlcIsConnect) {
//ping 不通
boolean status = ModbusTcpMainServer.ping2(ConfigName.getInstance().MainAddress, 1, 1);
boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1);
if (!status) //ping 不通 连接
{
MessageLog.ShowInfo("主控PLC状态断开,尝试连接...");
ConfigName.getInstance().PlcMainIsConnect = false;
MessageLog.ShowInfo("PLC状态断开,尝试连接...");
ConfigName.getInstance().PlcIsConnect = false;
}
} else {
boolean status = ModbusTcpMainServer.ping2(ConfigName.getInstance().MainAddress, 1, 1);
boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1);
if (status) {
MessageLog.ShowInfo("设备 " + ConfigName.getInstance().MainAddress + " 主控PLC通讯正常,准备连接!");
ModbusTcpMainServer.ConnectPLC();
MessageLog.ShowInfo("设备 " + ConfigName.getInstance().Address + " PLC通讯正常,准备连接!");
ModbusTcpServer.ConnectPLC();
} else {
MessageLog.ShowInfo("主控PLC状态断开,尝试连接...");
ConfigName.getInstance().PlcMainIsConnect = false;
MessageLog.ShowInfo("PLC状态断开,尝试连接...");
ConfigName.getInstance().PlcIsConnect = false;
}
}

if(ConfigName.getInstance().versionSelectionEnum.contains("一拖"))
{
if (ConfigName.getInstance().PlcMainIsConnect) {
//ping 不通
boolean status = ModbusTcpMainServer.ping2(ConfigName.getInstance().MainAddress, 1, 1);
if (!status) //ping 不通 连接
{
MessageLog.ShowInfo("主控PLC状态断开,尝试连接...");
ConfigName.getInstance().PlcMainIsConnect = false;
}
} else {
boolean status = ModbusTcpMainServer.ping2(ConfigName.getInstance().MainAddress, 1, 1);
if (status) {
MessageLog.ShowInfo("设备 " + ConfigName.getInstance().MainAddress + " 主控PLC通讯正常,准备连接!");
ModbusTcpMainServer.ConnectPLC();
} else {
MessageLog.ShowInfo("主控PLC状态断开,尝试连接...");
ConfigName.getInstance().PlcMainIsConnect = false;
}
}
}
}

Thread.sleep(3000);
} catch (Exception e) {
Log.i("PLC", "PLC重连接失败!" + e.getMessage());


+ 33
- 30
app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationNewActivity.java View File

@@ -282,46 +282,49 @@ public class BottomNavigationNewActivity extends BaseActivity {
*/
public void ReconnectModbus() {
try {
ThreadManager.Get().StartLong("PLC断线重连线程", true, new IThread() {
ThreadManager.Get().StartLong("PLC断线重连线程-2", true, new IThread() {
@Override
public void Run() throws InterruptedException {
try {
if (ConfigName.getInstance().PlcIsConnect) {
//ping 不通
boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1);
if (!status) //ping 不通 连接
{
MessageLog.ShowInfo("PLC状态断开,尝试连接...");
ConfigName.getInstance().PlcIsConnect = false;
}
} else {
boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1);
if (status) {
MessageLog.ShowInfo("设备 " + ConfigName.getInstance().Address + " PLC通讯正常,准备连接!");
ModbusTcpServer.ConnectPLC();
} else {
MessageLog.ShowInfo("PLC状态断开,尝试连接...");
ConfigName.getInstance().PlcIsConnect = false;
}
}

if (ConfigName.getInstance().versionSelectionEnum.contains("一拖")) {
if (ConfigName.getInstance().PlcMainIsConnect) {
if(IsRunThread)
{
if (ConfigName.getInstance().PlcIsConnect) {
//ping 不通
boolean status = ModbusTcpMainServer.ping2(ConfigName.getInstance().MainAddress, 1, 1);
boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1);
if (!status) //ping 不通 连接
{
MessageLog.ShowInfo("主控PLC状态断开,尝试连接...");
ConfigName.getInstance().PlcMainIsConnect = false;
MessageLog.ShowInfo("PLC状态断开,尝试连接...");
ConfigName.getInstance().PlcIsConnect = false;
}
} else {
boolean status = ModbusTcpMainServer.ping2(ConfigName.getInstance().MainAddress, 1, 1);
boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1);
if (status) {
MessageLog.ShowInfo("设备 " + ConfigName.getInstance().MainAddress + " 主控PLC通讯正常,准备连接!");
ModbusTcpMainServer.ConnectPLC();
MessageLog.ShowInfo("设备 " + ConfigName.getInstance().Address + " PLC通讯正常,准备连接!");
ModbusTcpServer.ConnectPLC();
} else {
MessageLog.ShowInfo("主控PLC状态断开,尝试连接...");
ConfigName.getInstance().PlcMainIsConnect = false;
MessageLog.ShowInfo("PLC状态断开,尝试连接...");
ConfigName.getInstance().PlcIsConnect = false;
}
}

if (ConfigName.getInstance().versionSelectionEnum.contains("一拖")) {
if (ConfigName.getInstance().PlcMainIsConnect) {
//ping 不通
boolean status = ModbusTcpMainServer.ping2(ConfigName.getInstance().MainAddress, 1, 1);
if (!status) //ping 不通 连接
{
MessageLog.ShowInfo("主控PLC状态断开,尝试连接...");
ConfigName.getInstance().PlcMainIsConnect = false;
}
} else {
boolean status = ModbusTcpMainServer.ping2(ConfigName.getInstance().MainAddress, 1, 1);
if (status) {
MessageLog.ShowInfo("设备 " + ConfigName.getInstance().MainAddress + " 主控PLC通讯正常,准备连接!");
ModbusTcpMainServer.ConnectPLC();
} else {
MessageLog.ShowInfo("主控PLC状态断开,尝试连接...");
ConfigName.getInstance().PlcMainIsConnect = false;
}
}
}
}


+ 2
- 2
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyActivity.java View File

@@ -550,7 +550,7 @@ public class DiyActivity extends BaseActivity {
*/
public boolean IsHotJ()
{
int index=0;
int index=1;
int k=0;int j=0;
for(BPA_GOODSRECIPE item:bpa_goodsrecipes)
{
@@ -566,7 +566,7 @@ public class DiyActivity extends BaseActivity {
index++;
}

if(j<=k)
if(j<k)
{
return false;
}else


+ 2
- 2
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdate1Activity.java View File

@@ -583,7 +583,7 @@ public class DiyUpdate1Activity extends BaseActivity {
*/
public boolean IsHotJ()
{
int index=0;
int index=1;
int k=0;int j=0;
for(BPA_GOODSRECIPE item:bpa_goodsrecipes)
{
@@ -599,7 +599,7 @@ public class DiyUpdate1Activity extends BaseActivity {
index++;
}

if(j<=k)
if(j<k)
{
return false;
}else


+ 2
- 2
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdateActivity.java View File

@@ -661,7 +661,7 @@ public class DiyUpdateActivity extends BaseActivity {
*/
public boolean IsHotJ()
{
int index=0;
int index=1;
int k=0;int j=0;
for(BPA_GOODSRECIPE item:bpa_goodsrecipes)
{
@@ -677,7 +677,7 @@ public class DiyUpdateActivity extends BaseActivity {
index++;
}

if(j<=k)
if(j<k)
{
return false;
}else


Loading…
Cancel
Save