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 9f84d78c..c37669e1 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java +++ b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java @@ -486,6 +486,22 @@ public class ExecuteTheRecipe { } } + + + //判断是否有烹饪时间 + int val=0; + for (HashMap.Entry entry : data.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if (key.contains("秒")) { + val = Integer.parseInt(value); + } + } + if(val>0) + { + Thread.sleep(val * 1000); + } + } catch (Exception ex) { ToastUtils.error("异常信息:" + ex.getMessage()); } 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 f5fedd3a..57580c9b 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 @@ -240,25 +240,30 @@ public class ConfigName { add(new Res_PLCADDRESS("搅拌", "M10.3", 0, 1)); add(new Res_PLCADDRESS("搅拌速度", "VW102", 1, 1)); - //翻转正转模型 翻转反转模型 + //翻转正转模型 add(new Res_PLCADDRESS("翻转正转", "M10.4", 0, 1)); add(new Res_PLCADDRESS("翻转反转", "M10.5", 0, 1)); add(new Res_PLCADDRESS("转动速度", "VW104", 1, 1)); + //加热模型 add(new Res_PLCADDRESS("加热", "M10.6", 0, 1)); add(new Res_PLCADDRESS("加热功率", "VW100", 1, 1)); + //主料 + add(new Res_PLCADDRESS("主料", "M17.4", 0, 1)); + //抽水放水 add(new Res_PLCADDRESS("炒锅抽水", "M10.7", 0, 1)); add(new Res_PLCADDRESS("炒锅放水", "M11.0", 0, 1)); + //出菜模型 add(new Res_PLCADDRESS("出菜", "M11.5", 0, 1)); + //位置动作 add(new Res_PLCADDRESS("原点位", "M11.4", 0, 1)); - add(new Res_PLCADDRESS("投料位", "M11.4", 0, 1)); add(new Res_PLCADDRESS("倒菜位", "M12.7", 0, 1)); add(new Res_PLCADDRESS("抽料位", "M11.7", 0, 1)); add(new Res_PLCADDRESS("清洗位", "M13.0", 0, 1)); @@ -276,16 +281,20 @@ public class ConfigName { add(new Res_PLCADDRESS("料仓2校准值", "VW116", 1, 1)); add(new Res_PLCADDRESS("料仓3校准值", "VW118", 1, 1)); add(new Res_PLCADDRESS("开始校正", "M12.6", 0, 1)); - add(new Res_PLCADDRESS("料仓1下料手动", "M12.3", 0, 1)); - add(new Res_PLCADDRESS("料仓2下料手动", "M12.4", 0, 1)); - add(new Res_PLCADDRESS("料仓3下料手动", "M12.5", 0, 1)); + add(new Res_PLCADDRESS("料仓1开关", "M12.3", 0, 1)); + add(new Res_PLCADDRESS("料仓2开关", "M12.4", 0, 1)); + add(new Res_PLCADDRESS("料仓3开关", "M12.5", 0, 1)); + add(new Res_PLCADDRESS("料仓1需求值", "VW106", 1, 1)); - add(new Res_PLCADDRESS("料仓2需求值", "VW108", 1, 1)); - add(new Res_PLCADDRESS("料仓3需求值", "VW110", 1, 1)); add(new Res_PLCADDRESS("料仓1下料", "M11.1", 0, 1)); + add(new Res_PLCADDRESS("料仓2需求值", "VW108", 1, 1)); add(new Res_PLCADDRESS("料仓2下料", "M11.2", 0, 1)); + add(new Res_PLCADDRESS("料仓3需求值", "VW110", 1, 1)); add(new Res_PLCADDRESS("料仓3下料", "M11.3", 0, 1)); + add(new Res_PLCADDRESS("料仓1开关", "M13.1", 1, 1)); + add(new Res_PLCADDRESS("料仓2开关", "M13.2", 1, 1)); + add(new Res_PLCADDRESS("料仓3开关", "M13.3", 1, 1)); //上下限 add(new Res_PLCADDRESS("位置上下限", "-------------", 0, 0)); @@ -348,7 +357,6 @@ public class ConfigName { add(new Res_PLCADDRESS("搅拌电机", "VW350", 1, 0)); add(new Res_PLCADDRESS("翻转电机", "VW352", 1, 0)); add(new Res_PLCADDRESS("炒锅", "VW354", 1, 0)); - }}; /** * 大炒工序模型 @@ -431,6 +439,10 @@ public class ConfigName { add(new Res_PLCADDRESS("料仓3需求值", "VW110", 1, 1)); add(new Res_PLCADDRESS("料仓3下料", "M11.3", 0, 1)); + add(new Res_PLCADDRESS("料仓1开关", "M13.1", 1, 1)); + add(new Res_PLCADDRESS("料仓2开关", "M13.2", 1, 1)); + add(new Res_PLCADDRESS("料仓3开关", "M13.3", 1, 1)); + //上下限 add(new Res_PLCADDRESS("位置上下限", "-------------", 0, 0)); add(new Res_PLCADDRESS("原点位置下限", "VD150", 1, 1)); @@ -474,8 +486,6 @@ public class ConfigName { add(new Res_PLCADDRESS("平移-4号位置值", "VD248", 1, 1)); add(new Res_PLCADDRESS("平移-4#位置设定", "M15.3", 0, 1)); - - //自动投料-翻转轴 add(new Res_PLCADDRESS("翻转轴控制", "-------------", 0, 0)); add(new Res_PLCADDRESS("翻转-伺服当前值", "VD260", 1, 1)); @@ -562,7 +572,7 @@ 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("延迟(秒)"))); @@ -635,6 +645,10 @@ public class ConfigName { add(new Res_PLCADDRESS("料仓3需求值", "VW110", 1, 1)); add(new Res_PLCADDRESS("料仓3下料", "M11.3", 0, 1)); + add(new Res_PLCADDRESS("料仓1开关", "M13.1", 1, 1)); + add(new Res_PLCADDRESS("料仓2开关", "M13.2", 1, 1)); + add(new Res_PLCADDRESS("料仓3开关", "M13.3", 1, 1)); + //上下限 add(new Res_PLCADDRESS("位置上下限", "-------------", 0, 0)); add(new Res_PLCADDRESS("原点位置下限", "VD150", 1, 1)); @@ -654,6 +668,56 @@ public class ConfigName { add(new Res_PLCADDRESS("炒锅工作范围下限", "VD206", 1, 1)); add(new Res_PLCADDRESS("炒锅工作范围上限", "VD210", 1, 1)); + //自动投料-平移轴 + add(new Res_PLCADDRESS("平移轴控制", "-------------", 0, 0)); + add(new Res_PLCADDRESS("平移-伺服当前值", "VD220", 1, 1)); + add(new Res_PLCADDRESS("平移-点动速度", "VD224", 1, 1)); + add(new Res_PLCADDRESS("平移-回原点速度", "VD228", 1, 1)); + add(new Res_PLCADDRESS("平移-定位运行速度", "VD232", 1, 1)); + + add(new Res_PLCADDRESS("平移-点动正转", "M14.0", 0, 1)); + add(new Res_PLCADDRESS("平移-点动反转", "M14.1", 0, 1)); + add(new Res_PLCADDRESS("平移-回原点", "M14.2", 0, 1)); + add(new Res_PLCADDRESS("平移-去1号位", "M14.3", 0, 1)); + add(new Res_PLCADDRESS("平移-去2号位", "M14.4", 0, 1)); + add(new Res_PLCADDRESS("平移-去3号位", "M14.5", 0, 1)); + add(new Res_PLCADDRESS("平移-去4号位", "M14.6", 0, 1)); + + add(new Res_PLCADDRESS("平移-1号位置值", "VD236", 1, 1)); + add(new Res_PLCADDRESS("平移-1#位置设定", "M15.0", 0, 1)); + add(new Res_PLCADDRESS("平移-2号位置值", "VD240", 1, 1)); + add(new Res_PLCADDRESS("平移-2#位置设定", "M15.1", 0, 1)); + add(new Res_PLCADDRESS("平移-3号位置值", "VD244", 1, 1)); + add(new Res_PLCADDRESS("平移-3#位置设定", "M15.2", 0, 1)); + add(new Res_PLCADDRESS("平移-4号位置值", "VD248", 1, 1)); + add(new Res_PLCADDRESS("平移-4#位置设定", "M15.3", 0, 1)); + + //自动投料-翻转轴 + add(new Res_PLCADDRESS("翻转轴控制", "-------------", 0, 0)); + add(new Res_PLCADDRESS("翻转-伺服当前值", "VD260", 1, 1)); + add(new Res_PLCADDRESS("翻转-点动速度", "VD264", 1, 1)); + add(new Res_PLCADDRESS("翻转-回原点速度", "VD268", 1, 1)); + add(new Res_PLCADDRESS("翻转-定位运行速度", "VD272", 1, 1)); + + add(new Res_PLCADDRESS("翻转-点动正转", "M16.0", 0, 1)); + add(new Res_PLCADDRESS("翻转-点动反转", "M16.1", 0, 1)); + add(new Res_PLCADDRESS("翻转-回原点", "M16.2", 0, 1)); + add(new Res_PLCADDRESS("翻转-去1号位", "M16.3", 0, 1)); + add(new Res_PLCADDRESS("翻转-去2号位", "M16.4", 0, 1)); + add(new Res_PLCADDRESS("翻转-去3号位", "M16.5", 0, 1)); + add(new Res_PLCADDRESS("翻转-去4号位", "M16.6", 0, 1)); + + add(new Res_PLCADDRESS("翻转-1号位置值", "VD276", 1, 1)); + add(new Res_PLCADDRESS("翻转-1#位置设定", "M17.0", 0, 1)); + add(new Res_PLCADDRESS("翻转-2号位置值", "VD280", 1, 1)); + add(new Res_PLCADDRESS("翻转-2#位置设定", "M17.1", 0, 1)); + add(new Res_PLCADDRESS("翻转-3号位置值", "VD284", 1, 1)); + add(new Res_PLCADDRESS("翻转-3#位置设定", "M17.2", 0, 1)); + add(new Res_PLCADDRESS("翻转-4号位置值", "VD288", 1, 1)); + add(new Res_PLCADDRESS("翻转-4#位置设定", "M17.3", 0, 1)); + add(new Res_PLCADDRESS("倒菜启动", "M17.4", 0, 1)); + add(new Res_PLCADDRESS("磁铁吸合", "M17.5", 0, 1)); + //反馈信号 add(new Res_PLCADDRESS("反馈信号", "-------------", 0, 0)); add(new Res_PLCADDRESS("初始化完成", "M40.0", 1, 0)); @@ -714,7 +778,7 @@ 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("延迟(秒)"))); diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/lc_adapter.java b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/lc_adapter.java index 23ed819c..b5627c4c 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/lc_adapter.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/lc_adapter.java @@ -1,5 +1,6 @@ package com.bonait.bnframework.modules.home.adapter; +import android.annotation.SuppressLint; import android.app.Activity; import android.content.Context; import android.content.ContextWrapper; @@ -12,12 +13,16 @@ import android.widget.ImageView; import android.widget.LinearLayout; import com.bonait.bnframework.R; +import com.bonait.bnframework.business.ExecuteTheRecipe; import com.bonait.bnframework.common.constant.DataBus; import com.bonait.bnframework.common.db.res.lcMode; +import com.bonait.bnframework.common.helper.I.IWriteCallBack; import com.bonait.bnframework.common.utils.AlertDialogUtils; +import com.bonait.bnframework.common.utils.ToastUtils; import com.qmuiteam.qmui.widget.dialog.QMUIDialog; import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; import com.qmuiteam.qmui.widget.textview.QMUILinkTextView; +import com.suke.widget.SwitchButton; import java.util.List; @@ -59,32 +64,103 @@ public class lc_adapter extends RecyclerView.Adapter { { bfb=((yl*100)/zl)>=100?100:((yl*100)/zl); } - myViewHolder.bfb.setText(bfb+"%"); myViewHolder.type.setText((lcModes.get(position).materiallx==0?"液料":"酱料")); - myViewHolder.add.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - show_jm(position); - } - }); + //手动开关 myViewHolder.m_click_layout.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - show_jm(position); + String kg= myViewHolder.imageView.getTag().toString(); + if(kg.equals("关闭")) + { + kg="打开"; + }else + { + kg="关闭"; + } + String title = "料仓操作提示!"; + String message = "请问客官确定要将["+lcModes.get(position).materialName+"]"+kg+"?"; + String finalKg = kg; + AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() { + @Override + public void onClick(QMUIDialog dialog, int index) { + if(finalKg.equals("打开")) + { + //打开 + myViewHolder.imageView.setTag(finalKg); + myViewHolder.imageView.setImageDrawable(context.getResources().getDrawable(R.mipmap.shuiguan_g)); + + ExecuteTheRecipe.WritePLC("料仓"+(position+1)+"开关", true, null); + ToastUtils.info("料仓"+(position+1)+"开关," + finalKg); + }else + { + //关闭 + myViewHolder.imageView.setTag(finalKg); + myViewHolder.imageView.setImageDrawable(context.getResources().getDrawable(R.mipmap.shuiguan_k2)); + + ExecuteTheRecipe.WritePLC("料仓"+(position+1)+"开关", false, null); + ToastUtils.info("料仓"+(position+1)+"开关," + finalKg); + } + dialog.dismiss(); + } + }); } }); + + myViewHolder.name.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { - show_jm(position); - } - }); - myViewHolder.type.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View view) { - show_jm(position); + String kg= myViewHolder.imageView.getTag().toString(); + if(kg.equals("关闭")) + { + kg="打开"; + }else + { + kg="关闭"; + } + String title = "料仓操作提示!"; + String message = "请问客官确定要将["+lcModes.get(position).materialName+"]"+kg+"?"; + String finalKg = kg; + AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() { + @Override + public void onClick(QMUIDialog dialog, int index) { + if(finalKg.equals("打开")) + { + //打开 + myViewHolder.imageView.setTag(finalKg); + myViewHolder.imageView.setImageDrawable(context.getResources().getDrawable(R.mipmap.shuiguan_g)); + + ExecuteTheRecipe.WritePLC("料仓"+(position+1)+"开关", true, null); + ToastUtils.info("料仓"+(position+1)+"开关," + finalKg); + }else + { + //关闭 + myViewHolder.imageView.setTag(finalKg); + myViewHolder.imageView.setImageDrawable(context.getResources().getDrawable(R.mipmap.shuiguan_k2)); + + ExecuteTheRecipe.WritePLC("料仓"+(position+1)+"开关", false, null); + ToastUtils.info("料仓"+(position+1)+"开关," + finalKg); + } + dialog.dismiss(); + } + }); } }); + //myViewHolder.bfb.setText(bfb+"%"); +// myViewHolder.add.setOnClickListener(new View.OnClickListener() { +// @Override +// public void onClick(View view) { +// String title = "料仓操作提示!"; +// String message = "请问客官确定要将["+lcModes.get(position).materialName+"]加满吗?"; +// AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() { +// @Override +// public void onClick(QMUIDialog dialog, int index) { +// DataBus.getInstance().TopUp(position); +// dialog.dismiss(); +// } +// }); +// } +// }); } } catch (Exception e) { e.printStackTrace(); @@ -146,20 +222,21 @@ public class lc_adapter extends RecyclerView.Adapter { } public static class MyLCViewHolder extends RecyclerView.ViewHolder { - ImageView add;//加满按钮 + //ImageView add;//加满按钮 QMUILinkTextView type;//物料类型 QMUILinkTextView name;//物料名称 - QMUILinkTextView bfb;//料仓余量百分比 - + //QMUILinkTextView bfb;//料仓余量百分比 + ImageView imageView; LinearLayout m_click_layout; public MyLCViewHolder(View view) { super(view); - add=view.findViewById(R.id.add); + //add=view.findViewById(R.id.add); type=view.findViewById(R.id.type); name=view.findViewById(R.id.name); - bfb=view.findViewById(R.id.bfb); + //bfb=view.findViewById(R.id.bfb); m_click_layout=view.findViewById(R.id.m_click_layout); + imageView=view.findViewById(R.id.imageView); } } } 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 94c71ed7..3d37baaa 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 @@ -248,7 +248,8 @@ public class Home1Fragment extends BaseFragment { * Image Button 按钮点击事件 */ public void ControlClicked() { -// //搅拌挡位 + //region 临时屏蔽 + // //搅拌挡位 // jiaoban_control.mListener = new MyClickListener() { // @Override // public void clickListener(View v, Object data) { @@ -348,6 +349,8 @@ public class Home1Fragment extends BaseFragment { // // } // }; + //endregion + //抽水启动 choushui_control.mListener = new MyClickListener() { @Override diff --git a/app/src/main/res/layout/fragment_home1.xml b/app/src/main/res/layout/fragment_home1.xml index 61612b2a..cd15f83d 100644 --- a/app/src/main/res/layout/fragment_home1.xml +++ b/app/src/main/res/layout/fragment_home1.xml @@ -243,7 +243,8 @@ android:orientation="vertical"> android:id="@+id/btn_jiaoban" android:layout_width="80dp" android:layout_height="wrap_content" - android:focusable="true"> + android:focusable="true"> + @@ -8,7 +9,7 @@ android:id="@+id/m_click_layout" android:layout_width="match_parent" android:layout_height="wrap_content" - android:layout_centerInParent="true" + android:layout_marginTop="@dimen/dp_10" android:orientation="vertical"> - + + + + + + + + - - + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/mipmap-xxhdpi/shuiguan_g.png b/app/src/main/res/mipmap-xxhdpi/shuiguan_g.png new file mode 100644 index 00000000..6ca991c7 Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/shuiguan_g.png differ diff --git a/app/src/main/res/mipmap-xxhdpi/shuiguan_k2.png b/app/src/main/res/mipmap-xxhdpi/shuiguan_k2.png new file mode 100644 index 00000000..0fb7f1fe Binary files /dev/null and b/app/src/main/res/mipmap-xxhdpi/shuiguan_k2.png differ