From 49aaf4a3e4ac1fc5737279f7a1597a795f1052c8 Mon Sep 17 00:00:00 2001 From: fyf <11621@LAPTOP-04QQU0AO> Date: Tue, 5 Dec 2023 15:21:58 +0800 Subject: [PATCH] 777 --- .../business/ExecuteTheRecipe.java | 4 +- .../activity/BottomNavigationNewActivity.java | 3 + .../modules/home/fragment/Home1Fragment.java | 2 + .../home/fragment/HomeFragmentSBKZ.java | 58 +++++++++-------- .../home/fragment/from/DishTestActivity.java | 62 +++++++++++-------- .../home/fragment/from/DiyMemoryActivity.java | 36 +++++++---- .../home/fragment/mode/add_qupenren.java | 12 ++++ 7 files changed, 111 insertions(+), 66 deletions(-) diff --git a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java index 838113c2..e5cb533f 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java +++ b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java @@ -47,7 +47,7 @@ public class ExecuteTheRecipe { /** * 等待超时时间 */ - public static int whileTime = 5; + public static int whileTime = 40; /** * 监听变量值 @@ -67,7 +67,7 @@ public class ExecuteTheRecipe { /** * 当前配方 */ - static ArrayList all_list = new ArrayList<>(); + public static ArrayList all_list = new ArrayList<>(); static BPA_GOODSRECIPE selectpf; /** 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 6f03eaea..0f7a8ed2 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 @@ -342,7 +342,10 @@ public class BottomNavigationNewActivity extends BaseActivity { long endTime = System.currentTimeMillis(); //结束时间 int time=(int) ((endTime-startTime)/1000); Log.e("运行时长",String.format("方法使用时间 %d s",time)); + if (!ExecuteTheRecipe.IsForcedEnd){QueryDB.UpdateGoodsMakeTime(goods.id,time);} + + ExecuteTheRecipe.all_list=new ArrayList<>(); runOnUiThread(new Runnable() { @Override public void run() { 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 4798c344..81ebd572 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 @@ -539,6 +539,8 @@ public class Home1Fragment extends BaseFragment { if (!ExecuteTheRecipe.IsForcedEnd){QueryDB.UpdateGoodsMakeTime(good.id,time);} + ExecuteTheRecipe.all_list=new ArrayList<>(); + Activity activity = getActivity(); if (activity != null) { activity.runOnUiThread(new Runnable() { diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/HomeFragmentSBKZ.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/HomeFragmentSBKZ.java index 7632f364..c89408f3 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/HomeFragmentSBKZ.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/HomeFragmentSBKZ.java @@ -210,7 +210,7 @@ public class HomeFragmentSBKZ extends BaseFragment { chuchan.mListener = myClickListener; - DataBus.getInstance().SilosRefresh=new IRun() { + DataBus.getInstance().SilosRefresh = new IRun() { @Override public void Run() { RefreshLiquidSilo(); @@ -225,8 +225,7 @@ public class HomeFragmentSBKZ extends BaseFragment { SetStirFrySpeed(SpeedEnum.停, false); RefreshLiquidSilo(); - if (ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) - { + if (ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) { touliao_k.setVisibility(View.GONE); touliao_m.setVisibility(View.GONE); } @@ -235,15 +234,14 @@ public class HomeFragmentSBKZ extends BaseFragment { /** * 刷新液料仓 */ - public void RefreshLiquidSilo() - { - yeliao1.setTag(ConfigName.getInstance().SilosDisplayMaterial.get(1)+""); + public void RefreshLiquidSilo() { + yeliao1.setTag(ConfigName.getInstance().SilosDisplayMaterial.get(1) + ""); yeliao1.Init(); - yeliao2.setTag(ConfigName.getInstance().SilosDisplayMaterial.get(2)+""); + yeliao2.setTag(ConfigName.getInstance().SilosDisplayMaterial.get(2) + ""); yeliao2.Init(); - yeliao3.setTag(ConfigName.getInstance().SilosDisplayMaterial.get(3)+""); + yeliao3.setTag(ConfigName.getInstance().SilosDisplayMaterial.get(3) + ""); yeliao3.Init(); } @@ -496,7 +494,7 @@ public class HomeFragmentSBKZ extends BaseFragment { */ public void PumpWater(boolean isselectd) { ExecuteTheRecipe.WritePLC("炒锅抽水", isselectd, null); - ToastUtils.warning("锅内加水:" + (isselectd?"打开":"关闭")); + ToastUtils.warning("锅内加水:" + (isselectd ? "打开" : "关闭")); } /** @@ -506,7 +504,7 @@ public class HomeFragmentSBKZ extends BaseFragment { */ public void PotWashingWater(boolean isselectd) { ExecuteTheRecipe.WritePLC("炒锅放水", isselectd, null); - ToastUtils.warning("洗锅水枪:" + (isselectd?"打开":"关闭")); + ToastUtils.warning("洗锅水枪:" + (isselectd ? "打开" : "关闭")); } public boolean isMake = false; @@ -517,21 +515,31 @@ public class HomeFragmentSBKZ extends BaseFragment { * @param num */ public void MainDish(int num) { - if (isMake == false) { - isMake = true; - new Thread(new Runnable() { - @Override - public void run() { - BPA_GOODSRECIPE data1 = Get位置("最高", "炒菜位1"); - ExecuteTheRecipe.ExecuteOperationSteps(data1.processname, data1.processvalue); - - BPA_GOODSRECIPE data = Get主料(num); - ExecuteTheRecipe.ExecuteOperationSteps(data.processname, data.processvalue); - ToastUtils.warning("主料:" + num+"号仓投放"); - isMake = false; + Object sb = ExecuteTheRecipe.ReadPLC("平移轴在1号位"); + if (sb != null) { + if ((boolean) (sb)) { + if (isMake == false) { + isMake = true; + new Thread(new Runnable() { + @Override + public void run() { + BPA_GOODSRECIPE data1 = Get位置("最高", "炒菜位1"); + ExecuteTheRecipe.ExecuteOperationSteps(data1.processname, data1.processvalue); + + BPA_GOODSRECIPE data = Get主料(num); + ExecuteTheRecipe.ExecuteOperationSteps(data.processname, data.processvalue); + ToastUtils.warning("主料:" + num + "号仓投放"); + isMake = false; + } + }).start(); } - }).start(); + } else { + ToastUtils.warning("平移轴未复位!!!"); + } + } else { + ToastUtils.warning("PLC未连接!!!"); } + } /** @@ -542,7 +550,7 @@ public class HomeFragmentSBKZ extends BaseFragment { public void Pumping(int num, boolean isselectd) { ExecuteTheRecipe.WritePLC("料仓" + (num) + "手动开关", isselectd, null); - ToastUtils.warning("料仓:" + num + "," + (isselectd?"打开":"关闭")); + ToastUtils.warning("料仓:" + num + "," + (isselectd ? "打开" : "关闭")); } /** @@ -552,7 +560,7 @@ public class HomeFragmentSBKZ extends BaseFragment { */ public void SetFire(int data) { ExecuteTheRecipe.Write_PLC_HuoLI((int) data); - ToastUtils.warning("设置火力:" + data+"档"); + ToastUtils.warning("设置火力:" + data + "档"); } /** 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 3f402090..c2e564b2 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 @@ -849,38 +849,48 @@ public class DishTestActivity extends BaseActivity { * @param num */ public void MainDish(int num) { - SetZhiXingZhong(true); + Object sb = ExecuteTheRecipe.ReadPLC("平移轴在1号位"); + if (sb != null) { + if ((boolean) (sb)) { + SetZhiXingZhong(true); + + int time = (int) ((SystemClock.elapsedRealtime() - runtime.getBase()) / 1000);//当前点击多少秒 + int time_c = time - ClikTime; + new Thread(new Runnable() { + @Override + public void run() { - int time = (int) ((SystemClock.elapsedRealtime() - runtime.getBase()) / 1000);//当前点击多少秒 - int time_c = time - ClikTime; - new Thread(new Runnable() { - @Override - public void run() { + BPA_GOODSRECIPE data1 = Get位置("最高", "炒菜位1"); + //DataBus.getInstance().bpa_goodsrecipes.add(data1); + ExecuteTheRecipe.ExecuteOperationSteps(data1.processname, data1.processvalue); - BPA_GOODSRECIPE data1 = Get位置("最高", "炒菜位1"); - //DataBus.getInstance().bpa_goodsrecipes.add(data1); - ExecuteTheRecipe.ExecuteOperationSteps(data1.processname, data1.processvalue); - - BPA_GOODSRECIPE data = Get主料(num); + BPA_GOODSRECIPE data = Get主料(num); - ExecuteTheRecipe.ExecuteOperationSteps(data.processname, data.processvalue); + ExecuteTheRecipe.ExecuteOperationSteps(data.processname, data.processvalue); - runOnUiThread(new Runnable() { - @Override - public void run() { - if (time_c > 0)//如果大于0,那么加一个延迟 - { - DataBus.getInstance().bpa_goodsrecipes.add(Get延迟(time_c)); - } - DataBus.getInstance().bpa_goodsrecipes.add(data); - ToastUtils.warning("主料:" + num + "号仓投放"); - SetZhiXingZhong(false); - //刷新工序 - RefreshProcedure(); + runOnUiThread(new Runnable() { + @Override + public void run() { + if (time_c > 0)//如果大于0,那么加一个延迟 + { + DataBus.getInstance().bpa_goodsrecipes.add(Get延迟(time_c)); + } + DataBus.getInstance().bpa_goodsrecipes.add(data); + ToastUtils.warning("主料:" + num + "号仓投放"); + SetZhiXingZhong(false); + //刷新工序 + RefreshProcedure(); + } + }); } - }); + }).start(); + } else { + ToastUtils.warning("平移轴未复位!!!"); } - }).start(); + } else { + ToastUtils.warning("PLC未连接!!!"); + } + } /** diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyMemoryActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyMemoryActivity.java index ce774cc2..5c599fcd 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyMemoryActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyMemoryActivity.java @@ -335,22 +335,32 @@ public class DiyMemoryActivity extends BaseActivity { } public void ClickZL(int time,int time_c,int num) { - if(isRunClick()) - { - if(time_c>0)//如果大于0,那么加一个延迟 - { - DataBus.getInstance().bpa_goodsrecipes.add(Get延迟(time_c)); - } + Object sb = ExecuteTheRecipe.ReadPLC("平移轴在1号位"); + if (sb != null) { + if ((boolean) (sb)) { + if(isRunClick()) + { + if(time_c>0)//如果大于0,那么加一个延迟 + { + DataBus.getInstance().bpa_goodsrecipes.add(Get延迟(time_c)); + } - //控制去炒菜位 - BPA_GOODSRECIPE data1=Get位置("最高","炒菜位1"); - DataBus.getInstance().bpa_goodsrecipes.add(data1); + //控制去炒菜位 + BPA_GOODSRECIPE data1=Get位置("最高","炒菜位1"); + DataBus.getInstance().bpa_goodsrecipes.add(data1); - BPA_GOODSRECIPE data=Get主料(num); - DataBus.getInstance().bpa_goodsrecipes.add(data); - MakeRecipe(data);//执行主料 - ClikTime=time; + BPA_GOODSRECIPE data=Get主料(num); + DataBus.getInstance().bpa_goodsrecipes.add(data); + MakeRecipe(data);//执行主料 + ClikTime=time; + } + } else { + ToastUtils.warning("平移轴未复位!!!"); + } + } else { + ToastUtils.warning("PLC未连接!!!"); } + } public void ClickWZ(int time,int time_c,String name) { diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_qupenren.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_qupenren.java index 6038f6d9..e3d0dabd 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_qupenren.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_qupenren.java @@ -22,6 +22,7 @@ import com.bonait.bnframework.common.db.QueryDB; import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE; import com.bonait.bnframework.common.helper.I.MyClickListener; import com.bonait.bnframework.common.utils.NetworkUtils; +import com.bonait.bnframework.common.utils.ToastUtils; import com.bonait.bnframework.modules.home.fragment.from.DiyUpdateActivity; import java.util.ArrayList; @@ -145,6 +146,17 @@ public class add_qupenren extends LinearLayout { quzhizuo.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { + if (!ConfigName.getInstance().PlcIsConnect) { + ToastUtils.warning("PLC未准备就绪!!!"); + return; + } + + Object chushiover = ExecuteTheRecipe.getListingValue("初始化完成"); + //Object jiting = ExecuteTheRecipe.getListingValue("设备急停"); + if (chushiover == null || !(boolean) chushiover) { + ToastUtils.warning("设备未初始化,请先手动初始化设备!!!"); + return; + } if (mListener != null) { mListener.clickListenerNew(view, 5, mode); }