Browse Source

輕質

master
fyf 11 months ago
parent
commit
0c789fae20
4 changed files with 25 additions and 8 deletions
  1. +20
    -6
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  2. +1
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigation2Activity.java
  3. +3
    -1
      app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationNewActivity.java
  4. +1
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home1Fragment.java

+ 20
- 6
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

@@ -149,6 +149,14 @@ public class ExecuteTheRecipe {
ExecuteTheRecipe.showlog("客官,小菠萝正在强制结束当前炒制菜品,请耐心等候!!!"); ExecuteTheRecipe.showlog("客官,小菠萝正在强制结束当前炒制菜品,请耐心等候!!!");
return false; return false;
} }

if(!ConfigName.getInstance().PlcIsConnect)
{
ExecuteTheRecipe.showlog("客官,检测到硬件已经断开连接,主动停止炒制!!!");
IsForcedEnd=true;
return false;
}

ExecuteTheRecipe.showlog("开始执行:" + recipe.sort + "、" + recipe.processms); ExecuteTheRecipe.showlog("开始执行:" + recipe.sort + "、" + recipe.processms);


if (recipe.materialType == 0)//正常物料 if (recipe.materialType == 0)//正常物料
@@ -1955,7 +1963,7 @@ public class ExecuteTheRecipe {
ExecuteTheRecipe.showlog("工序线程等待-------时长:" + delay + "秒,请耐心等待,开始计时!"); ExecuteTheRecipe.showlog("工序线程等待-------时长:" + delay + "秒,请耐心等待,开始计时!");


long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
while ((System.currentTimeMillis() - startTime) <= (delay * 1000) && !IsForcedEnd) //
while ((System.currentTimeMillis() - startTime) <= (delay * 1000) && !IsForcedEnd && ConfigName.getInstance().PlcIsConnect)
{ {
try { try {
Thread.sleep(100); Thread.sleep(100);
@@ -1978,15 +1986,18 @@ public class ExecuteTheRecipe {
final boolean[] IsComplete = {false}; final boolean[] IsComplete = {false};
long a = System.currentTimeMillis(); long a = System.currentTimeMillis();
ExecuteTheRecipe.showlog(name + ",等待中"); ExecuteTheRecipe.showlog(name + ",等待中");
while (!IsComplete[0] && !IsForcedEnd) {
while (!IsComplete[0] && !IsForcedEnd && ConfigName.getInstance().PlcIsConnect) {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) { if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
ExecuteTheRecipe.showlog(name + ",异常超时退出!"); ExecuteTheRecipe.showlog(name + ",异常超时退出!");
break; break;
} else { } else {
Object sb = ReadPLC(name);//ListeningValue.get(name);
Object sb = ReadPLC(name);
if (sb != null) { if (sb != null) {
IsComplete[0] = (boolean) (sb); IsComplete[0] = (boolean) (sb);
ExecuteTheRecipe.showlog(name + ",接收到信号!");
if(IsComplete[0])
{
ExecuteTheRecipe.showlog(name + ",接收到信号!");
}
} }
} }
try { try {
@@ -2009,7 +2020,7 @@ public class ExecuteTheRecipe {
final boolean[] IsComplete = {false}; final boolean[] IsComplete = {false};
long a = System.currentTimeMillis(); long a = System.currentTimeMillis();
ExecuteTheRecipe.showlog(name + ",等待中"); ExecuteTheRecipe.showlog(name + ",等待中");
while (!IsComplete[0] && !IsForcedEnd) {
while (!IsComplete[0] && !IsForcedEnd && ConfigName.getInstance().PlcIsConnect) {
if ((System.currentTimeMillis() - a) > 1000 * whileTime * k) { if ((System.currentTimeMillis() - a) > 1000 * whileTime * k) {
ExecuteTheRecipe.showlog(name + ",异常超时退出!"); ExecuteTheRecipe.showlog(name + ",异常超时退出!");
break; break;
@@ -2017,7 +2028,10 @@ public class ExecuteTheRecipe {
Object sb = ReadPLC(name);//ListeningValue.get(name); Object sb = ReadPLC(name);//ListeningValue.get(name);
if (sb != null) { if (sb != null) {
IsComplete[0] = (boolean) (sb); IsComplete[0] = (boolean) (sb);
ExecuteTheRecipe.showlog(name + ",接收到信号!");
if(IsComplete[0])
{
ExecuteTheRecipe.showlog(name + ",接收到信号!");
}
} }
} }
try { try {


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

@@ -227,7 +227,7 @@ public class BottomNavigation2Activity extends BaseActivity {
} }
} }
} }
Thread.sleep(10000);
Thread.sleep(3000);
} catch (Exception e) { } catch (Exception e) {
Log.i("PLC", "PLC重连接失败!" + e.getMessage()); Log.i("PLC", "PLC重连接失败!" + e.getMessage());
} }


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

@@ -324,7 +324,7 @@ public class BottomNavigationNewActivity extends BaseActivity {
} }
} }
} }
Thread.sleep(10000);
Thread.sleep(3000);
} catch (Exception e) { } catch (Exception e) {
Log.i("PLC", "PLC重连接失败!" + e.getMessage()); Log.i("PLC", "PLC重连接失败!" + e.getMessage());
} }
@@ -396,6 +396,8 @@ public class BottomNavigationNewActivity extends BaseActivity {
} finally { } finally {
ExecuteTheRecipe.WritePLC("搅拌", false, null); ExecuteTheRecipe.WritePLC("搅拌", false, null);
ExecuteTheRecipe.WritePLC("加热", false, null); ExecuteTheRecipe.WritePLC("加热", false, null);
ExecuteTheRecipe.WritePLC("暂停开关", false, null);

ConfigName.getInstance().IsOpenHuoLi = false; ConfigName.getInstance().IsOpenHuoLi = false;
ExecuteTheRecipe.BottomClick("平移-去1号位"); ExecuteTheRecipe.BottomClick("平移-去1号位");
gongxuIndex = 10000; gongxuIndex = 10000;


+ 1
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home1Fragment.java View File

@@ -595,6 +595,7 @@ public class Home1Fragment extends BaseFragment {
} finally { } finally {
ExecuteTheRecipe.WritePLC("搅拌", false, null); ExecuteTheRecipe.WritePLC("搅拌", false, null);
ExecuteTheRecipe.WritePLC("加热", false, null); ExecuteTheRecipe.WritePLC("加热", false, null);
ExecuteTheRecipe.WritePLC("暂停开关", false, null);
ConfigName.getInstance().IsOpenHuoLi = false; ConfigName.getInstance().IsOpenHuoLi = false;
ExecuteTheRecipe.BottomClick("平移-去1号位"); ExecuteTheRecipe.BottomClick("平移-去1号位");
gongxuIndex = 10000; gongxuIndex = 10000;


Loading…
Cancel
Save