From 43db2f4adc6574853e8f14ac1f8ae347c7a2427c Mon Sep 17 00:00:00 2001 From: fyf Date: Mon, 18 Dec 2023 14:41:04 +0800 Subject: [PATCH] 7 --- .../activity/BottomNavigationNewActivity.java | 22 ++++++++++---- .../modules/home/fragment/Home1Fragment.java | 30 +++++++++++++------ .../home/fragment/from/DishTestActivity.java | 2 +- .../home/fragment/mode/add_silos_message.java | 11 ++++++- app/src/main/res/layout/activity_cooking.xml | 4 ++- .../res/layout/activity_cookingsimulated.xml | 4 ++- app/src/main/res/layout/activity_dishtest.xml | 10 ++++--- 7 files changed, 60 insertions(+), 23 deletions(-) diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationNewActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationNewActivity.java index a016e7e8..3b4ef361 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationNewActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationNewActivity.java @@ -103,6 +103,9 @@ public class BottomNavigationNewActivity extends BaseActivity { @Override protected void onDestroy() { ConfigData.getInstance().ColsePLC(); + IsRunThread=false; + if(makeThread!=null){makeThread=null;} + if(makeThreadDC!=null){makeThreadDC=null;} super.onDestroy(); } @@ -292,15 +295,20 @@ public class BottomNavigationNewActivity extends BaseActivity { //商品 public BPA_GOODS goods = null; + + public Thread makeThread=null; + public Thread makeThreadDC=null; + public boolean IsRunThread=true; + /** * 商品制作线程 */ public void MakeThread() { ExecuteTheRecipe.context = this; - new Thread(new Runnable() { + makeThread=new Thread(new Runnable() { @Override public void run() { - while (true) { + while (IsRunThread) { try { if (ExecuteTheRecipe.IsStart && goods != null) { long startTime= System.currentTimeMillis(); //起始时间 @@ -366,12 +374,13 @@ public class BottomNavigationNewActivity extends BaseActivity { } } } - }).start(); + }); + makeThread.start(); - new Thread(new Runnable() { + makeThreadDC=new Thread(new Runnable() { @Override public void run() { - while (true) { + while (IsRunThread) { try { if (ExecuteTheRecipe.IsStart && goods != null && gongxuIndex != 10000 && goodsrecipesL != null && MakeCipe != null) { @@ -467,7 +476,8 @@ public class BottomNavigationNewActivity extends BaseActivity { } } } - }).start(); + }); + makeThreadDC.start(); } /** diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home1Fragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home1Fragment.java index 63a8b166..28f20ccf 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home1Fragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home1Fragment.java @@ -530,16 +530,21 @@ public class Home1Fragment extends BaseFragment { BPA_GOODSRECIPE MakeCipe = null; + public Thread makeThread=null; + public Thread makeThreadDC=null; + public Thread makeThreadUI=null; + public boolean IsRunThread=true; + /** * 商品制作线程 */ public void MakeThread() { ExecuteTheRecipe.context = context; - new Thread(new Runnable() { + makeThread=new Thread(new Runnable() { @Override public void run() { - while (true) { + while (IsRunThread) { try { if (Status && good != null) { @@ -603,12 +608,13 @@ public class Home1Fragment extends BaseFragment { } } } - }).start(); + }); + makeThread.start(); - new Thread(new Runnable() { + makeThreadDC=new Thread(new Runnable() { @Override public void run() { - while (true) { + while (IsRunThread) { try { if (Status && good != null && gongxuIndex != 10000 && goodsrecipesL != null && MakeCipe != null) { @@ -704,12 +710,13 @@ public class Home1Fragment extends BaseFragment { } } } - }).start(); + }); + makeThreadDC.start(); - new Thread(new Runnable() { + makeThreadUI=new Thread(new Runnable() { @Override public void run() { - while (true) { + while (IsRunThread) { try { SxUI(); Thread.sleep(1000); @@ -718,7 +725,8 @@ public class Home1Fragment extends BaseFragment { } } } - }).start(); + }); + makeThreadUI.start(); } /** @@ -1042,6 +1050,10 @@ public class Home1Fragment extends BaseFragment { public void onDestroy() { super.onDestroy(); Logger.d("第一页销毁"); + IsRunThread=false; + if(makeThread!=null){makeThread=null;} + if(makeThreadDC!=null){makeThreadDC=null;} + if(makeThreadUI!=null){makeThreadUI=null;} } /** diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DishTestActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DishTestActivity.java index 6330f157..5677b9cd 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DishTestActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DishTestActivity.java @@ -1078,7 +1078,7 @@ public class DishTestActivity extends BaseActivity { BPA_GOODSRECIPE data = Get出菜(time_c); DataBus.getInstance().bpa_goodsrecipes.add(data); BPA_GOODSRECIPE data2 = Get清洗(0); - DataBus.getInstance().bpa_goodsrecipes.add(data); + DataBus.getInstance().bpa_goodsrecipes.add(data2); new Thread(new Runnable() { @Override public void run() { diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_silos_message.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_silos_message.java index e2bb1acc..ea5bf2df 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_silos_message.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_silos_message.java @@ -256,7 +256,7 @@ public class add_silos_message extends LinearLayout { * @param num * @return */ - private String GetNum(int num) + public String GetNum(int num) { if(num==1) { @@ -267,6 +267,15 @@ public class add_silos_message extends LinearLayout { }else if(num==3) { return "③"; + }else if(num==4) + { + return "④(水阀)"; + }else if(num==5) + { + return "⑤"; + }else if(num==6) + { + return "⑥"; }else { return "①"; diff --git a/app/src/main/res/layout/activity_cooking.xml b/app/src/main/res/layout/activity_cooking.xml index 1b7eb8fb..74fa84b6 100644 --- a/app/src/main/res/layout/activity_cooking.xml +++ b/app/src/main/res/layout/activity_cooking.xml @@ -50,7 +50,9 @@ android:shadowRadius="6.0" android:text="爆炒鱼香肉丝" android:textColor="@color/black" - android:textSize="45dp" /> + android:textSize="45dp" + android:ellipsize="end" + android:maxLines="1"/> + android:textSize="45dp" + android:ellipsize="end" + android:maxLines="1"/> - + android:layout_weight="0.4" + android:orientation="horizontal"> @@ -81,7 +83,7 @@ app:imagesrc_ks="@mipmap/zhizuo_zt2" app:imagesrc_tz="@mipmap/zhizuo_jx2" /> - +