diff --git a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java index f16b0145..b5780f02 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java +++ b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java @@ -1143,7 +1143,7 @@ public class ConfigData { processModel.name = item; processModel.sort = chidindex; processModel.data = ConfigName.getInstance().GetProcessTypeVal(item); - processModel.datatype = ((item.equals("主料名称") ? 1 : (processModel.data.isEmpty() ? 0 : 2))); + processModel.datatype = ((item.equals("名称") ? 1 : (processModel.data.isEmpty() ? 0 : 2))); QueryDB.AddProcessModel(processModel); chidindex++; } 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 b79cd91c..17b7d611 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java +++ b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java @@ -149,7 +149,7 @@ public class ExecuteTheRecipe { ExecuteMaterialIssuance(recipe.processvalue); } else if (recipe.materialType == 1)//工序模型 { - if (recipe.processname.equals("加水")) { + if (recipe.processname.equals("加水") || recipe.processname.equals("并行出料")) { BPA_GOODSRECIPE data2 = Get位置("高速", "抽料位"); ExecuteOperationSteps(data2.processname, data2.processvalue); } else if (recipe.processname.equals("主料")) { @@ -312,6 +312,9 @@ public class ExecuteTheRecipe { case "加水": Write_PLC_Water(formulation); break; + case "并行出料": + Write_PLC_ParallelDischarge(formulation); + break; case "延迟": Write_PLC_Delay(formulation); break; @@ -639,10 +642,20 @@ public class ExecuteTheRecipe { } } - //默认去炒制位置1去等待 - BPA_GOODSRECIPE data3 = Get位置("高速", "炒菜位1"); + + //判断炒制位置 + String czwz="炒菜位1"; + for (HashMap.Entry entry : data.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if (key.contains("炒制位置")) { + czwz=value; + } + } + BPA_GOODSRECIPE data3 = Get位置("高速", czwz); ExecuteOperationSteps(data3.processname, data3.processvalue); + //判断是否有烹饪时间 int val = 0; for (HashMap.Entry entry : data.entrySet()) { @@ -798,6 +811,79 @@ public class ExecuteTheRecipe { } } + /** + * 写PLC 并行出料 + * + * @param data + */ + private static void Write_PLC_ParallelDischarge(HashMap data) { + try { + int val = 0;int cl_value=0; + for (HashMap.Entry entry : data.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if (key.contains("(秒)")) { + val = Integer.parseInt(value); + }else if (key.contains("出料克数")){ + //1000.0 10000/3 3333 + cl_value= (int) Math.round((Double.parseDouble(value) * 10)); + } + } + + + + HashMap formulation = new HashMap<>(); + List bpa_silos = QueryDB. GetSilosALL(); + for (BPA_SILOS item:bpa_silos) + { + if (item.num==1 || item.num==2 || item.num==3) + { + if((cl_value/3)>0) + { + formulation.put(item, cl_value/3); + } + } + } + + //写入PLC,直接出料,不用等待 + for (Map.Entry entry : formulation.entrySet()) { + BPA_SILOS silos = entry.getKey(); + Integer value = entry.getValue(); + Write_PLC_Material(silos, value); + } + + Thread.sleep(200);//等待写入完成 + + //一直等待下料完成 否则就一直等待 40s超时 + for (Map.Entry entry : formulation.entrySet()) { + BPA_SILOS silos = entry.getKey(); + String name = "料仓" + silos.num + "下料完成"; + final boolean[] IsComplete = {false}; + long a = System.currentTimeMillis(); + while (!IsComplete[0] && !IsForcedEnd) { + if ((System.currentTimeMillis() - a) > 1000 * whileTime) { + break; + } else { + Object sb = ReadPLC(name);// ListeningValue.get(name); + if (sb != null) { + IsComplete[0] = (boolean) (sb); + } + } + Thread.sleep(100);//10 *6 + } + ToastUtils.info(name); + } + + + if (val > 0 && !IsForcedEnd) { + ThreadDelay(val); + //Thread.sleep(val * 1000); + } + } catch (Exception ex) { + ToastUtils.error("异常信息:" + ex.getMessage()); + } + } + /** * 写PLC 延迟 * @@ -1032,8 +1118,16 @@ public class ExecuteTheRecipe { WriteMainPLC("炒锅投主料完成", true, null); } - //默认去炒制位置1去等待 - BPA_GOODSRECIPE data3 = Get位置("高速", "炒菜位1"); + //判断炒制位置 + String czwz="炒菜位1"; + for (HashMap.Entry entry : data.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if (key.contains("炒制位置")) { + czwz=value; + } + } + BPA_GOODSRECIPE data3 = Get位置("高速", czwz); ExecuteOperationSteps(data3.processname, data3.processvalue); //判断是否有烹饪时间 @@ -1174,8 +1268,16 @@ public class ExecuteTheRecipe { WriteMainPLC("炒锅投主料完成", true, null); } - //默认去炒制位置1去等待 - BPA_GOODSRECIPE data3 = Get位置("高速", "炒菜位1"); + //判断炒制位置 + String czwz="炒菜位1"; + for (HashMap.Entry entry : data.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if (key.contains("炒制位置")) { + czwz=value; + } + } + BPA_GOODSRECIPE data3 = Get位置("高速", czwz); ExecuteOperationSteps(data3.processname, data3.processvalue); //判断是否有烹饪时间 @@ -1248,8 +1350,16 @@ public class ExecuteTheRecipe { ExecuteTheRecipe.WritePLC("加热", true, null); }//再次释放加热 - //默认去炒制位置1去等待 - BPA_GOODSRECIPE data3 = Get位置("高速", "炒菜位1"); + //判断炒制位置 + String czwz="炒菜位1"; + for (HashMap.Entry entry : data.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if (key.contains("炒制位置")) { + czwz=value; + } + } + BPA_GOODSRECIPE data3 = Get位置("高速", czwz); ExecuteOperationSteps(data3.processname, data3.processvalue); if (val > 0 && !IsForcedEnd) { diff --git a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java index cf6a163b..e0a6997b 100644 --- a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java +++ b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java @@ -414,8 +414,9 @@ public class ConfigName { add(new ProcessT("搅拌", Arrays.asList("搅拌速度", "延迟(秒)"))); add(new ProcessT("位置", Arrays.asList("转动速度", "位置动作", "延迟(秒)"))); add(new ProcessT("加热", Arrays.asList("加热功率", "延迟(秒)"))); - add(new ProcessT("主料", Arrays.asList("主料名称", "主料重量"))); + add(new ProcessT("主料", Arrays.asList("主料名称", "主料重量","炒制位置"))); add(new ProcessT("液体料", new ArrayList<>())); + add(new ProcessT("并行出料", Arrays.asList("出料克数","等待(秒)"))); add(new ProcessT("延迟", Arrays.asList("延迟(秒)"))); add(new ProcessT("出菜", Arrays.asList("等待(秒)"))); add(new ProcessT("清洗", Arrays.asList("等待(秒)"))); @@ -634,8 +635,9 @@ public class ConfigName { add(new ProcessT("搅拌", Arrays.asList("搅拌速度", "延迟(秒)"))); add(new ProcessT("位置", Arrays.asList("转动速度", "位置动作", "延迟(秒)"))); add(new ProcessT("加热", Arrays.asList("加热功率", "延迟(秒)"))); - add(new ProcessT("主料", Arrays.asList("主料名称", "主料位置", "主料重量", "投料动作","烹饪(秒)"))); + add(new ProcessT("主料", Arrays.asList("主料名称", "主料位置", "主料重量", "投料动作","炒制位置","烹饪(秒)"))); add(new ProcessT("液体料", new ArrayList<>())); + add(new ProcessT("并行出料", Arrays.asList("出料克数","等待(秒)"))); add(new ProcessT("延迟", Arrays.asList("延迟(秒)"))); add(new ProcessT("出菜", Arrays.asList("等待(秒)"))); add(new ProcessT("清洗", Arrays.asList("等待(秒)"))); @@ -853,8 +855,9 @@ public class ConfigName { add(new ProcessT("搅拌", Arrays.asList("搅拌速度", "延迟(秒)"))); add(new ProcessT("位置", Arrays.asList("转动速度", "位置动作", "延迟(秒)"))); add(new ProcessT("加热", Arrays.asList("加热功率", "延迟(秒)"))); - add(new ProcessT("主料", Arrays.asList("主料名称", "主料位置", "主料重量", "投料动作","烹饪(秒)"))); + add(new ProcessT("主料", Arrays.asList("主料名称", "主料位置", "主料重量", "投料动作","炒制位置","烹饪(秒)"))); add(new ProcessT("液体料", new ArrayList<>())); + add(new ProcessT("并行出料", Arrays.asList("出料克数","等待(秒)"))); add(new ProcessT("延迟", Arrays.asList("延迟(秒)"))); add(new ProcessT("出菜", Arrays.asList("等待(秒)"))); add(new ProcessT("清洗", Arrays.asList("等待(秒)"))); @@ -1108,9 +1111,10 @@ public class ConfigName { add(new ProcessT("搅拌", Arrays.asList("搅拌速度", "延迟(秒)"))); add(new ProcessT("位置", Arrays.asList("转动速度", "位置动作", "延迟(秒)"))); add(new ProcessT("加热", Arrays.asList("加热功率", "延迟(秒)"))); - add(new ProcessT("主料", Arrays.asList("主料名称", "主料位置", "主料重量", "投料动作","烹饪(秒)"))); - add(new ProcessT("辅料", Arrays.asList("辅料名称", "烹饪(秒)"))); + add(new ProcessT("主料", Arrays.asList("主料名称", "主料位置", "主料重量", "投料动作","炒制位置","烹饪(秒)"))); + add(new ProcessT("辅料", Arrays.asList("辅料名称", "炒制位置","烹饪(秒)"))); add(new ProcessT("液体料", new ArrayList<>())); + add(new ProcessT("并行出料", Arrays.asList("出料克数","等待(秒)"))); add(new ProcessT("延迟", Arrays.asList("延迟(秒)"))); add(new ProcessT("出菜", Arrays.asList("等待(秒)"))); add(new ProcessT("清洗", Arrays.asList("等待(秒)"))); @@ -1157,7 +1161,9 @@ public class ConfigName { data = "正转反转、一直正转、一直反转"; } else if (item.equals("位置动作")) { data = "原点位、出餐启动、倒菜位、抽料位、清洗位、炒菜位1、炒菜位2、炒菜位3"; - } else if (item.equals("投料动作")) { + } else if (item.equals("炒制位置")) { + data = "炒菜位1、炒菜位2、炒菜位3、原点位"; + }else if (item.equals("投料动作")) { //data = "投出抖动三次、投出等待三秒、直接投出、手动投料"; data = "投出等待三秒、直接投出、手动投料"; } else if (item.equals("主料位置")) { diff --git a/app/src/main/res/layout/fragment_auto_test_more.xml b/app/src/main/res/layout/fragment_auto_test_more.xml index 99f1f736..f66d545b 100644 --- a/app/src/main/res/layout/fragment_auto_test_more.xml +++ b/app/src/main/res/layout/fragment_auto_test_more.xml @@ -7,7 +7,8 @@ tools:context=".modules.home.fragment.from.fragment.AutoTestMoreFragment"> + android:layout_height="match_parent" + android:background="@color/main_background"> + + android:layout_height="match_parent"> + + android:focusable="true" + android:visibility="gone" /> + > + android:text="锅体正转反转" /> + android:text="圈为一循环" /> + + + + + @@ -131,7 +143,7 @@ + android:orientation="horizontal"> - - + + android:text="0" + android:textColor="#CC04EF" + android:textSize="60dp" + android:textStyle="bold" /> - - - - + @@ -391,32 +396,26 @@ + android:orientation="horizontal"> + android:text="已运行:" /> - - - + android:text="0" + android:textColor="#CC04EF" + android:textSize="60dp" + android:textStyle="bold" /> - - + @@ -486,32 +485,26 @@ + android:orientation="horizontal"> + android:text="已运行:" /> - + android:text="0" + android:textColor="#CC04EF" + android:textSize="60dp" + android:textStyle="bold" /> - - - - + @@ -537,32 +530,44 @@ android:layout_height="wrap_content" android:layout_centerInParent="true" android:orientation="vertical"> + + + android:text="当前加热" /> + + + + + + android:text="加热持续" /> + + + + android:text="冷却锅体" /> + + + android:layout_marginLeft="5dp" + android:text="分钟" /> + + android:text="执行循环" /> @@ -645,32 +657,29 @@ + android:orientation="horizontal"> + android:text="已运行:" /> - + android:text="0" + android:textColor="#CC04EF" + android:textSize="60dp" + android:layout_marginLeft="5dp" + android:textStyle="bold" /> - + - - @@ -685,8 +694,7 @@ android:layout_height="match_parent" android:layout_margin="@dimen/dp_10" android:orientation="vertical" - android:visibility="gone" - > + android:visibility="gone"> + + + android:text="加热挡位" /> + + + android:text="加热持续" /> + + + + android:text="停止冷却" /> + + + + android:text="执行循环" /> @@ -798,7 +818,6 @@ android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_marginTop="@dimen/dp_10"> - + android:orientation="horizontal"> - - + + android:text="0" + android:textColor="#CC04EF" + android:textSize="60dp" + android:textStyle="bold" /> - + - - @@ -846,8 +860,8 @@ android:layout_width="match_parent" android:layout_height="match_parent" android:layout_margin="@dimen/dp_10" - android:orientation="vertical"> - + android:orientation="vertical" + android:visibility="gone"> @@ -857,32 +871,44 @@ android:layout_height="wrap_content" android:layout_centerInParent="true" android:orientation="vertical"> + + + + + + + + android:text="预先加热" /> + + + + + + + android:text="执行循环" /> @@ -963,32 +998,27 @@ + android:orientation="horizontal"> - - + + android:text="0" + android:textColor="#CC04EF" + android:textSize="60dp" + android:textStyle="bold" /> - + - - @@ -999,12 +1029,18 @@ - + + @@ -1017,7 +1053,7 @@ + android:layout_marginRight="140dp"> @@ -1042,31 +1078,32 @@ - + android:layout_height="180dp"> +