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 ed452532..077e5a69 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java +++ b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java @@ -813,6 +813,19 @@ public class ConfigData { try { List plcaddresses = ConfigName.getInstance().PlcAddress_大炒; List processTS = ConfigName.getInstance().Process_大炒; + + if(ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) + { + plcaddresses = ConfigName.getInstance().PlcAddress_大炒; + processTS = ConfigName.getInstance().Process_大炒; + } else if (ConfigName.getInstance().versionSelectionEnum.equals("大炒自动投料版本")) { + plcaddresses = ConfigName.getInstance().PlcAddress_大炒自动投料; + processTS = ConfigName.getInstance().Process_大炒自动投料; + }else if (ConfigName.getInstance().versionSelectionEnum.equals("小炒版本")) { + plcaddresses = ConfigName.getInstance().PlcAddress_小炒; + processTS = ConfigName.getInstance().Process_小炒; + } + //region 恢复PLC ArrayList arrayList = QueryDB.GetPlcaddressALL(); for (BPA_PLCADDRESS item : arrayList) { @@ -854,8 +867,8 @@ public class ConfigData { processModel.processid = process.id; processModel.name = item; processModel.sort = chidindex; - processModel.datatype = ((item.equals("主料名称") ? 1 : (item.equals("液体料") ? 0 : 2))); processModel.data=ConfigName.getInstance().GetProcessTypeVal(item); + processModel.datatype = ((item.equals("主料名称") ? 1 : (processModel.data.isEmpty() ? 0 : 2))); QueryDB.AddProcessModel(processModel); chidindex++; } @@ -867,101 +880,6 @@ public class ConfigData { } } - -// /** -// * 还原PLC -// */ -// public void RevertPLC() { -// try { -// ArrayList arrayList = QueryDB.GetPlcaddressALL(); -// for (BPA_PLCADDRESS item : arrayList) { -// QueryDB.DeletePlcaddress(item); -// } -// int k = 1; -// for (Res_PLCADDRESS item : ConfigName.getInstance().PlcAddress_大炒) { -// BPA_PLCADDRESS plc = new BPA_PLCADDRESS(); -// plc.name = item.name; -// plc.address = item.address; -// plc.isread = item.isread; -// plc.iswrite = item.iswrite; -// plc.sort = k; -// k++; -// QueryDB.AddPlcaddress(plc); -// } -// } catch (Exception ex) { -// -// } -// } -// -// /** -// * 还原工序模型 -// */ -// public void RevertProcess() { -// ArrayList arrayList = QueryDB.GetProcessALL(); -// for (BPA_PROCESS item : arrayList) { -// ArrayList arrayList1 = QueryDB.GetProcessModelALL(); -// for (BPA_PROCESSModel item1 : arrayList1) { -// QueryDB.DeleteProcessModel(item1); -// } -// QueryDB.DeleteProcess(item); -// } -// InitProcessData(); -// } -// -// /** -// * 初始化工序模型表 -// */ -// public void InitProcessData() { -// List mxname = Arrays.asList("搅拌", "位置", "加热", "主料", "液体料", "延迟", "出菜"); -// Map> mx = new IdentityHashMap<>(); -// mx.put("搅拌", Arrays.asList("搅拌速度", "延迟(秒)")); -// mx.put("位置", Arrays.asList("转动速度", "位置动作", "延迟(秒)")); -// mx.put("加热", Arrays.asList("加热功率", "延迟(秒)")); -// mx.put("主料", Arrays.asList("主料名称", "主料重量", "延迟(秒)", "投料动作")); -// mx.put("液体料", new ArrayList<>()); -// mx.put("延迟", Arrays.asList("延迟(秒)")); -// mx.put("出菜", Arrays.asList("延迟(秒)")); -// int index = 1; -// for (String key : mxname) { -// List values = mx.get(key); -// BPA_PROCESS process = new BPA_PROCESS(); -// process.sort = index; -// process.name = key; -// QueryDB.AddProcess(process);//增加模型 -// -// int chidindex = 1; -// for (String item : values)//模型 -// { -// BPA_PROCESSModel processModel = new BPA_PROCESSModel(); -// processModel.processid = process.id; -// processModel.name = item; -// processModel.sort = chidindex; -// if (item.equals("搅拌动作")) { -// processModel.datatype = 2; -// processModel.data = "正转反转、一直正转、一直反转"; -// } else if (item.equals("位置动作")) { -// processModel.datatype = 2; -// processModel.data = "原点位、投料位、出餐启动、倒菜位、抽料位、清洗位、炒菜位1、炒菜位2、炒菜位3"; -// } else if (item.equals("投料动作")) { -// processModel.datatype = 2; -// processModel.data = "投出抖动三次、投出等待三秒、直接投出、手动投料"; -// } else if (item.equals("正转速度") || item.equals("反转速度") || item.equals("转动速度") || item.equals("搅拌速度")) { -// processModel.datatype = 2; -// processModel.data = "停止、最低、低速、中速、高速、最高、极高"; -// } else if (item.equals("加热功率") || item.equals("热锅功率")) { -// processModel.datatype = 2; -// processModel.data = "停止、一档、二档、三档、四档、五档"; -// } else if (item.equals("主料名称")) { -// processModel.datatype = 1; -// } else { -// processModel.datatype = 0; -// } -// QueryDB.AddProcessModel(processModel); -// chidindex++; -// } -// index++; -// } -// } //endregion //region PLC初始化 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 7a07f8b2..70ef6439 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java +++ b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java @@ -39,7 +39,7 @@ public class ExecuteTheRecipe { /** * 等待超时时间 */ - public static int whileTime=2; + public static int whileTime = 2; /** * 监听变量值 @@ -52,7 +52,8 @@ public class ExecuteTheRecipe { * @param recipe * @return */ - public static Context context=null; + public static Context context = null; + public static boolean Execute(BPA_GOODSRECIPE recipe) { boolean status = false; try { @@ -193,26 +194,25 @@ public class ExecuteTheRecipe { WritePLC("料仓" + num + "需求值", val, new IWriteCallBack() { @Override public void onSuccess() { - WritePLC("料仓" + num +"下料",true,null); + WritePLC("料仓" + num + "下料", true, null); } + @Override public void onFailure(String ErrorMsg) { } }); //一直等待下料完成 否则就一直等待 6s超时 - String name="料仓" + num +"下料完成"; + String name = "料仓" + num + "下料完成"; final boolean[] IsComplete = {false}; long a = System.currentTimeMillis(); while (!IsComplete[0]) { if ((System.currentTimeMillis() - a) > 1000 * whileTime) { break; - }else - { - Object sb= ListeningValue.get(name); - if(sb!=null) - { - IsComplete[0]=(boolean)(sb); + } else { + Object sb = ListeningValue.get(name); + if (sb != null) { + IsComplete[0] = (boolean) (sb); } } Thread.sleep(100);//10 *6 @@ -243,18 +243,17 @@ public class ExecuteTheRecipe { int val = Integer.parseInt(value); Thread.sleep(val * 1000); } else { - int writeValue = GetMXValue(key,value); + int writeValue = GetMXValue(key, value); WritePLC(key, writeValue, new IWriteCallBack() { @Override public void onSuccess() { - if(writeValue==0) - { - WritePLC("搅拌",false,null); - }else - { - WritePLC("搅拌",true,null); + if (writeValue == 0) { + WritePLC("搅拌", false, null); + } else { + WritePLC("搅拌", true, null); } } + @Override public void onFailure(String ErrorMsg) { } @@ -265,6 +264,7 @@ public class ExecuteTheRecipe { ToastUtils.error("异常信息:" + ex.getMessage()); } } + /** * 写PLC位置 * @@ -280,25 +280,23 @@ public class ExecuteTheRecipe { int val = Integer.parseInt(value); Thread.sleep(val * 1000); } else if (key.contains("速度")) { - int writeValue = GetMXValue(key,value); - WritePLC(key, writeValue,null); + int writeValue = GetMXValue(key, value); + WritePLC(key, writeValue, null); } else { //原点位,等待机器移动倒响应位置 - WritePLC(value, true,null); + WritePLC(value, true, null); //一直等待机器移动到该位置,否则就一直等待 6s超时 - String name=value+"反馈"; + String name = value + "反馈"; final boolean[] IsComplete = {false}; long a = System.currentTimeMillis(); while (!IsComplete[0]) { if ((System.currentTimeMillis() - a) > 1000 * whileTime) { break; - }else - { - Object sb= ListeningValue.get(name); - if(sb!=null) - { - IsComplete[0]=(boolean)(sb); + } else { + Object sb = ListeningValue.get(name); + if (sb != null) { + IsComplete[0] = (boolean) (sb); } } Thread.sleep(100);//10 *6 @@ -317,50 +315,134 @@ public class ExecuteTheRecipe { */ private static void Write_PLC_Ingredients(HashMap data) { try { - String name=""; - String zl=""; - int val=0; - for (HashMap.Entry entry : data.entrySet()) { - String key = entry.getKey(); - String value = entry.getValue(); - if(key.contains("名称")) - { - name=value; - }else if(key.contains("重量")) - { - zl=value; + //是否手动 + boolean ishand=true; + + //region 判断是否手动 + if(ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) + { + ishand=true; + }else + { + for (HashMap.Entry entry : data.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if (key.contains("投料动作")) { + if(value.contains("手动投料")) + { + ishand=true; + }else + { + ishand=false; + } + } } } - ToastUtils.info("工序:手动投料," + name + "," + zl); - String title = "手动投料-温馨提示!"; - String message = "客官请投入主料,["+name+"]重量"+zl+"g,投入后点击[确定]继续流程!"; + //endregion - final boolean[] IsComplete = {false}; - Activity activity = findActivity(context); - if (activity != null) { - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - try { - AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() { + + + if(ishand) + { + String name = ""; + String zl = ""; + int val = 0; + for (HashMap.Entry entry : data.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if (key.contains("名称")) { + name = value; + } else if (key.contains("重量")) { + zl = value; + } + } + ToastUtils.info("工序:手动投料," + name + "," + zl); + String title = "手动投料-温馨提示!"; + String message = "客官请投入主料,[" + name + "]重量" + zl + "g,投入后点击[确定]继续流程!"; + + final boolean[] IsComplete = {false}; + Activity activity = findActivity(context); + if (activity != null) { + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + try { + AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() { + @Override + public void onClick(QMUIDialog dialog, int index) { + IsComplete[0] = true; + dialog.dismiss(); + } + }); + } catch (Exception e) { + + } + } + }); + } + + while (!IsComplete[0]) { + Thread.sleep(100);//10 *6 + } + ToastUtils.info("确定完成,继续制作!"); + }else + { + //自动投料 + if(ConfigName.getInstance().versionSelectionEnum.equals("大炒自动投料版本")) + { + String writeValue = "1#位置"; + for (HashMap.Entry entry : data.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if (key.contains("主料位置")) { + writeValue=value; + } + } + WritePLC(writeValue, true, new IWriteCallBack() { + @Override + public void onSuccess() { + WritePLC("主料", true, new IWriteCallBack() { @Override - public void onClick(QMUIDialog dialog, int index) { - IsComplete[0]=true; - dialog.dismiss(); + public void onSuccess() { + ToastUtils.info("主料倒入完成,继续制作!"); + } + @Override + public void onFailure(String ErrorMsg) { } }); - } catch (Exception e) { - + } + @Override + public void onFailure(String ErrorMsg) { + } + }); + } else if (ConfigName.getInstance().versionSelectionEnum.equals("小炒版本")) { + String writeValue = "1#位置"; + for (HashMap.Entry entry : data.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if (key.contains("主料位置")) { + writeValue=value; } } - }); - } - - while (!IsComplete[0]) { - Thread.sleep(100);//10 *6 + WritePLC(writeValue, true, new IWriteCallBack() { + @Override + public void onSuccess() { + WritePLC("主料", true, new IWriteCallBack() { + @Override + public void onSuccess() { + ToastUtils.info("主料倒入完成,继续制作!"); + } + @Override + public void onFailure(String ErrorMsg) { + } + }); + } + @Override + public void onFailure(String ErrorMsg) { + } + }); + } } - ToastUtils.info("确定完成,继续制作!"); - } catch (Exception ex) { ToastUtils.error("异常信息:" + ex.getMessage()); } @@ -391,18 +473,17 @@ public class ExecuteTheRecipe { int val = Integer.parseInt(value); Thread.sleep(val * 1000); } else { - int writeValue = GetMXValue(key,value); + int writeValue = GetMXValue(key, value); WritePLC(key, writeValue, new IWriteCallBack() { @Override public void onSuccess() { - if(writeValue==0) - { - WritePLC("加热",false,null); - }else - { - WritePLC("加热",true,null); + if (writeValue == 0) { + WritePLC("加热", false, null); + } else { + WritePLC("加热", true, null); } } + @Override public void onFailure(String ErrorMsg) { } @@ -451,7 +532,7 @@ public class ExecuteTheRecipe { Thread.sleep(val * 1000); } } - WritePLC("出菜", true,null); + WritePLC("出菜", true, null); } catch (Exception ex) { ToastUtils.error("异常信息:" + ex.getMessage()); } @@ -469,11 +550,11 @@ public class ExecuteTheRecipe { try { if (data == MyStatus.Start) { ToastUtils.info("炒锅开始清洗!"); - WritePLC("炒锅清洗", true,null); + WritePLC("炒锅清洗", true, null); } else if (data == MyStatus.Stop) { ToastUtils.info("炒锅停止清洗!"); - WritePLC("炒锅清洗", false,null); + WritePLC("炒锅清洗", false, null); } } catch (Exception ex) { ToastUtils.error("异常信息:" + ex.getMessage()); @@ -487,9 +568,9 @@ public class ExecuteTheRecipe { */ public static void Write_PLC_Location(String data) { try { - ToastUtils.info("点击按钮:"+data); + ToastUtils.info("点击按钮:" + data); //原点位,等待机器移动倒响应位置 - WritePLC(data, true,null); + WritePLC(data, true, null); } catch (Exception ex) { ToastUtils.error("异常信息:" + ex.getMessage()); } @@ -520,17 +601,16 @@ public class ExecuteTheRecipe { */ public static void Write_PLC_HuoLI(int data) { try { - WritePLC("加热功率", data*2, new IWriteCallBack() { + WritePLC("加热功率", data * 2, new IWriteCallBack() { @Override public void onSuccess() { - if(data==0) - { - WritePLC("加热",false,null); - }else - { - WritePLC("加热",true,null); + if (data == 0) { + WritePLC("加热", false, null); + } else { + WritePLC("加热", true, null); } } + @Override public void onFailure(String ErrorMsg) { } @@ -646,8 +726,10 @@ public class ExecuteTheRecipe { * 实时状态 */ public static ConcurrentHashMap IoStatus = new ConcurrentHashMap(); + /** * 获取实时状态 + * * @param ch * @return */ @@ -660,6 +742,7 @@ public class ExecuteTheRecipe { /** * 获取搅拌电机 + * * @param * @return */ @@ -667,18 +750,17 @@ public class ExecuteTheRecipe { if (!ListeningValue.containsKey(name)) { return 0; } - Object obj= ListeningValue.get(name); - if(obj==null) - { + Object obj = ListeningValue.get(name); + if (obj == null) { return 0; - }else - { - return (int)obj; + } else { + return (int) obj; } } /** * 获取监听变量 + * * @param * @return */ @@ -692,21 +774,20 @@ public class ExecuteTheRecipe { /** * 读取状态 */ - public static void ReadPLCStatus() - { + public static void ReadPLCStatus() { try { if (ConfigName.getInstance().PlcIsConnect) { ModbusTcpServer.get().ReadStatus("VW354", 1, data -> { for (int i = 0; i < data.length; i++) { - byte status=data[i];//0x92 - IoStatus.put(i*8+0, ByteHelper.getBit(status,0)==1); - IoStatus.put(i*8+1, ByteHelper.getBit(status,1)==1); - IoStatus.put(i*8+2, ByteHelper.getBit(status,2)==1); - IoStatus.put(i*8+3, ByteHelper.getBit(status,3)==1); - IoStatus.put(i*8+4, ByteHelper.getBit(status,4)==1); - IoStatus.put(i*8+5, ByteHelper.getBit(status,5)==1); - IoStatus.put(i*8+6, ByteHelper.getBit(status,6)==1); - IoStatus.put(i*8+7, ByteHelper.getBit(status,7)==1); + byte status = data[i];//0x92 + IoStatus.put(i * 8 + 0, ByteHelper.getBit(status, 0) == 1); + IoStatus.put(i * 8 + 1, ByteHelper.getBit(status, 1) == 1); + IoStatus.put(i * 8 + 2, ByteHelper.getBit(status, 2) == 1); + IoStatus.put(i * 8 + 3, ByteHelper.getBit(status, 3) == 1); + IoStatus.put(i * 8 + 4, ByteHelper.getBit(status, 4) == 1); + IoStatus.put(i * 8 + 5, ByteHelper.getBit(status, 5) == 1); + IoStatus.put(i * 8 + 6, ByteHelper.getBit(status, 6) == 1); + IoStatus.put(i * 8 + 7, ByteHelper.getBit(status, 7) == 1); } }); } @@ -718,8 +799,10 @@ public class ExecuteTheRecipe { //endregion //region 获取基础挡位变量 + /** * 获取挡位变量 + * * @param name * @param value * @return 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 e9e3f122..fdb0606b 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 @@ -358,6 +358,354 @@ public class ConfigName { * 大炒工序模型 */ public List Process_大炒 = new ArrayList() {{ + 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("延迟(秒)"))); + }}; + + /** + * 大炒自动投料基础PLC模型 + */ + public List PlcAddress_大炒自动投料 = new ArrayList() {{ + + //硬件设备 初始化 + add(new Res_PLCADDRESS("硬件设备", "-------------", 0, 0)); + add(new Res_PLCADDRESS("初始化", "M10.0", 1, 1)); + add(new Res_PLCADDRESS("停止", "M10.1", 1, 1)); + add(new Res_PLCADDRESS("复位", "M10.2", 0, 1)); + + //搅拌模型 + add(new Res_PLCADDRESS("模型控制", "-------------", 0, 0)); + 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("转动速度", "VW104", 1, 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)); + add(new Res_PLCADDRESS("炒菜位1", "M12.0", 0, 1)); + add(new Res_PLCADDRESS("炒菜位2", "M12.1", 0, 1)); + add(new Res_PLCADDRESS("炒菜位3", "M12.2", 0, 1)); + + add(new Res_PLCADDRESS("出餐启动", "M11.5", 0, 1)); + add(new Res_PLCADDRESS("炒锅清洗", "M11.6", 0, 1)); + + //液体料模型 + add(new Res_PLCADDRESS("液体料", "-------------", 0, 0)); + add(new Res_PLCADDRESS("料仓1下料", "M11.1", 0, 1)); + add(new Res_PLCADDRESS("料仓2下料", "M11.2", 0, 1)); + add(new Res_PLCADDRESS("料仓3下料", "M11.3", 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("开始校正", "M12.6", 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("校准时间", "VW112", 1, 1)); + add(new Res_PLCADDRESS("料仓1校准值", "VW114", 1, 1)); + add(new Res_PLCADDRESS("料仓2校准值", "VW116", 1, 1)); + add(new Res_PLCADDRESS("料仓3校准值", "VW118", 1, 1)); + + + //上下限 + add(new Res_PLCADDRESS("位置上下限", "-------------", 0, 0)); + add(new Res_PLCADDRESS("原点位置下限", "VD150", 1, 1)); + add(new Res_PLCADDRESS("原点位置上限", "VD154", 1, 1)); + add(new Res_PLCADDRESS("洗锅位置下限", "VD158", 1, 1)); + add(new Res_PLCADDRESS("洗锅位置上限", "VD162", 1, 1)); + add(new Res_PLCADDRESS("倒菜位置下限", "VD166", 1, 1)); + add(new Res_PLCADDRESS("倒菜位置上限", "VD170", 1, 1)); + add(new Res_PLCADDRESS("抽调料位置下限", "VD174", 1, 1)); + add(new Res_PLCADDRESS("抽调料位置上限", "VD178", 1, 1)); + add(new Res_PLCADDRESS("1#炒制位置下限", "VD182", 1, 1)); + add(new Res_PLCADDRESS("1#炒制位置上限", "VD186", 1, 1)); + add(new Res_PLCADDRESS("2#炒制位置下限", "VD190", 1, 1)); + add(new Res_PLCADDRESS("2#炒制位置上限", "VD194", 1, 1)); + add(new Res_PLCADDRESS("3#炒制位置下限", "VD198", 1, 1)); + add(new Res_PLCADDRESS("3#炒制位置上限", "VD202", 1, 1)); + add(new Res_PLCADDRESS("炒锅工作范围下限", "VD206", 1, 1)); + add(new Res_PLCADDRESS("炒锅工作范围上限", "VD210", 1, 1)); + + //自动投料-平移轴 + add(new Res_PLCADDRESS("转轴控制", "-------------", 0, 0)); + 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#位置设定", "M15.0", 0, 1)); + add(new Res_PLCADDRESS("平移-2#位置设定", "M15.1", 0, 1)); + add(new Res_PLCADDRESS("平移-3#位置设定", "M15.2", 0, 1)); + add(new Res_PLCADDRESS("平移-4#位置设定", "M15.3", 0, 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#位置设定", "M17.0", 0, 1)); + add(new Res_PLCADDRESS("翻转-2#位置设定", "M17.1", 0, 1)); + add(new Res_PLCADDRESS("翻转-3#位置设定", "M17.2", 0, 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("平移-伺服当前值", "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("平移-1号位置值", "VD236", 1, 1)); + add(new Res_PLCADDRESS("平移-2号位置值", "VD240", 1, 1)); + add(new Res_PLCADDRESS("平移-3号位置值", "VD244", 1, 1)); + add(new Res_PLCADDRESS("平移-4号位置值", "VD248", 1, 1)); + + 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("翻转-1号位置值", "VD276", 1, 1)); + add(new Res_PLCADDRESS("翻转-2号位置值", "VD280", 1, 1)); + add(new Res_PLCADDRESS("翻转-3号位置值", "VD284", 1, 1)); + add(new Res_PLCADDRESS("翻转-4号位置值", "VD288", 1, 1)); + + //反馈信号 + add(new Res_PLCADDRESS("反馈信号", "-------------", 0, 0)); + add(new Res_PLCADDRESS("初始化完成", "M40.0", 1, 0)); + add(new Res_PLCADDRESS("设备急停", "M40.1", 1, 0)); + add(new Res_PLCADDRESS("原点位反馈", "M40.2", 1, 0)); + add(new Res_PLCADDRESS("抽料位反馈", "M40.3", 1, 0)); + add(new Res_PLCADDRESS("炒菜位1反馈", "M40.4", 1, 0)); + add(new Res_PLCADDRESS("炒菜位2反馈", "M40.5", 1, 0)); + add(new Res_PLCADDRESS("炒菜位3反馈", "M40.6", 1, 0)); + add(new Res_PLCADDRESS("倒菜位反馈", "M40.7", 1, 0)); + add(new Res_PLCADDRESS("投料位反馈", "M41.0", 1, 0)); + add(new Res_PLCADDRESS("清洗位反馈", "M41.1", 1, 0)); + add(new Res_PLCADDRESS("料仓1下料完成", "M41.2", 1, 0)); + add(new Res_PLCADDRESS("料仓2下料完成", "M41.3", 1, 0)); + add(new Res_PLCADDRESS("料仓3下料完成", "M41.4", 1, 0)); + add(new Res_PLCADDRESS("炒锅清洗反馈", "M41.5", 1, 0)); + add(new Res_PLCADDRESS("出餐启动反馈", "M41.6", 1, 0)); + add(new Res_PLCADDRESS("炒锅倒菜减速位", "M41.7", 1, 0)); + add(new Res_PLCADDRESS("轴在1号位", "M43.0", 1, 0)); + add(new Res_PLCADDRESS("轴在2号位", "M43.1", 1, 0)); + add(new Res_PLCADDRESS("轴在3号位", "M43.2", 1, 0)); + add(new Res_PLCADDRESS("轴在4号位", "M43.3", 1, 0)); + + + //检测信号 + add(new Res_PLCADDRESS("监测信号", "-------------", 0, 0)); + add(new Res_PLCADDRESS("当前锅底温度", "VD300", 1, 0)); + add(new Res_PLCADDRESS("炒锅搅拌转速", "VD304", 1, 0)); + add(new Res_PLCADDRESS("当前加热档位", "VD308", 1, 0)); + add(new Res_PLCADDRESS("炒锅当前电压", "VD312", 1, 0)); + add(new Res_PLCADDRESS("炒锅当前电流", "VD316", 1, 0)); + add(new Res_PLCADDRESS("炒锅当前功率", "VD320", 1, 0)); + add(new Res_PLCADDRESS("搅拌频率", "VW324", 1, 0)); + add(new Res_PLCADDRESS("搅拌电机电流", "VW326", 1, 0)); + add(new Res_PLCADDRESS("搅拌电机电压", "VW328", 1, 0)); + add(new Res_PLCADDRESS("搅拌变频器温度", "VW330", 1, 0)); + add(new Res_PLCADDRESS("翻转频率", "VW332", 1, 0)); + add(new Res_PLCADDRESS("翻转电机电流", "VW334", 1, 0)); + add(new Res_PLCADDRESS("翻转电机电压", "VW336", 1, 0)); + add(new Res_PLCADDRESS("翻转变频器温度", "VW338", 1, 0)); + add(new Res_PLCADDRESS("编码器当前位值", "VD340", 1, 0)); + + //状态上报 + add(new Res_PLCADDRESS("状态上报", "-------------", 0, 0)); + add(new Res_PLCADDRESS("搅拌电机", "VW350", 1, 0)); + add(new Res_PLCADDRESS("翻转电机", "VW352", 1, 0)); + add(new Res_PLCADDRESS("炒锅", "VW354", 1, 0)); + + }}; + /** + * 大炒自动投料工序模型 + */ + public List Process_大炒自动投料 = new ArrayList() {{ + 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("延迟(秒)"))); + }}; + /** + * 小炒基础PLC模型 + */ + public List PlcAddress_小炒 = new ArrayList() {{ + + //硬件设备 初始化 + add(new Res_PLCADDRESS("硬件设备", "-------------", 0, 0)); + add(new Res_PLCADDRESS("初始化", "M10.0", 1, 1)); + add(new Res_PLCADDRESS("停止", "M10.1", 1, 1)); + add(new Res_PLCADDRESS("复位", "M10.2", 0, 1)); + + //搅拌模型 + add(new Res_PLCADDRESS("模型控制", "-------------", 0, 0)); + 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("转动速度", "VW104", 1, 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("炒锅抽水", "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)); + add(new Res_PLCADDRESS("炒菜位1", "M12.0", 0, 1)); + add(new Res_PLCADDRESS("炒菜位2", "M12.1", 0, 1)); + add(new Res_PLCADDRESS("炒菜位3", "M12.2", 0, 1)); + + add(new Res_PLCADDRESS("出餐启动", "M11.5", 0, 1)); + add(new Res_PLCADDRESS("炒锅清洗", "M11.6", 0, 1)); + + //液体料模型 + add(new Res_PLCADDRESS("液体料", "-------------", 0, 0)); + add(new Res_PLCADDRESS("料仓1下料", "M11.1", 0, 1)); + add(new Res_PLCADDRESS("料仓2下料", "M11.2", 0, 1)); + add(new Res_PLCADDRESS("料仓3下料", "M11.3", 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("开始校正", "M12.6", 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("校准时间", "VW112", 1, 1)); + add(new Res_PLCADDRESS("料仓1校准值", "VW114", 1, 1)); + add(new Res_PLCADDRESS("料仓2校准值", "VW116", 1, 1)); + add(new Res_PLCADDRESS("料仓3校准值", "VW118", 1, 1)); + + + //上下限 + add(new Res_PLCADDRESS("位置上下限", "-------------", 0, 0)); + add(new Res_PLCADDRESS("原点位置下限", "VD150", 1, 1)); + add(new Res_PLCADDRESS("原点位置上限", "VD154", 1, 1)); + add(new Res_PLCADDRESS("洗锅位置下限", "VD158", 1, 1)); + add(new Res_PLCADDRESS("洗锅位置上限", "VD162", 1, 1)); + add(new Res_PLCADDRESS("倒菜位置下限", "VD166", 1, 1)); + add(new Res_PLCADDRESS("倒菜位置上限", "VD170", 1, 1)); + add(new Res_PLCADDRESS("抽调料位置下限", "VD174", 1, 1)); + add(new Res_PLCADDRESS("抽调料位置上限", "VD178", 1, 1)); + add(new Res_PLCADDRESS("1#炒制位置下限", "VD182", 1, 1)); + add(new Res_PLCADDRESS("1#炒制位置上限", "VD186", 1, 1)); + add(new Res_PLCADDRESS("2#炒制位置下限", "VD190", 1, 1)); + add(new Res_PLCADDRESS("2#炒制位置上限", "VD194", 1, 1)); + add(new Res_PLCADDRESS("3#炒制位置下限", "VD198", 1, 1)); + add(new Res_PLCADDRESS("3#炒制位置上限", "VD202", 1, 1)); + add(new Res_PLCADDRESS("炒锅工作范围下限", "VD206", 1, 1)); + add(new Res_PLCADDRESS("炒锅工作范围上限", "VD210", 1, 1)); + + //反馈信号 + add(new Res_PLCADDRESS("反馈信号", "-------------", 0, 0)); + add(new Res_PLCADDRESS("初始化完成", "M40.0", 1, 0)); + add(new Res_PLCADDRESS("设备急停", "M40.1", 1, 0)); + add(new Res_PLCADDRESS("原点位反馈", "M40.2", 1, 0)); + add(new Res_PLCADDRESS("抽料位反馈", "M40.3", 1, 0)); + add(new Res_PLCADDRESS("炒菜位1反馈", "M40.4", 1, 0)); + add(new Res_PLCADDRESS("炒菜位2反馈", "M40.5", 1, 0)); + add(new Res_PLCADDRESS("炒菜位3反馈", "M40.6", 1, 0)); + add(new Res_PLCADDRESS("倒菜位反馈", "M40.7", 1, 0)); + add(new Res_PLCADDRESS("投料位反馈", "M41.0", 1, 0)); + add(new Res_PLCADDRESS("清洗位反馈", "M41.1", 1, 0)); + add(new Res_PLCADDRESS("料仓1下料完成", "M41.2", 1, 0)); + add(new Res_PLCADDRESS("料仓2下料完成", "M41.3", 1, 0)); + add(new Res_PLCADDRESS("料仓3下料完成", "M41.4", 1, 0)); + add(new Res_PLCADDRESS("炒锅清洗反馈", "M41.5", 1, 0)); + add(new Res_PLCADDRESS("出餐启动反馈", "M41.6", 1, 0)); + add(new Res_PLCADDRESS("炒锅倒菜减速位", "M41.7", 1, 0)); + + //检测信号 + add(new Res_PLCADDRESS("监测信号", "-------------", 0, 0)); + add(new Res_PLCADDRESS("当前锅底温度", "VD300", 1, 0)); + add(new Res_PLCADDRESS("炒锅搅拌转速", "VD304", 1, 0)); + add(new Res_PLCADDRESS("当前加热档位", "VD308", 1, 0)); + add(new Res_PLCADDRESS("炒锅当前电压", "VD312", 1, 0)); + add(new Res_PLCADDRESS("炒锅当前电流", "VD316", 1, 0)); + add(new Res_PLCADDRESS("炒锅当前功率", "VD320", 1, 0)); + add(new Res_PLCADDRESS("搅拌频率", "VW324", 1, 0)); + add(new Res_PLCADDRESS("搅拌电机电流", "VW326", 1, 0)); + add(new Res_PLCADDRESS("搅拌电机电压", "VW328", 1, 0)); + add(new Res_PLCADDRESS("搅拌变频器温度", "VW330", 1, 0)); + add(new Res_PLCADDRESS("翻转频率", "VW332", 1, 0)); + add(new Res_PLCADDRESS("翻转电机电流", "VW334", 1, 0)); + add(new Res_PLCADDRESS("翻转电机电压", "VW336", 1, 0)); + add(new Res_PLCADDRESS("翻转变频器温度", "VW338", 1, 0)); + add(new Res_PLCADDRESS("编码器当前位值", "VD340", 1, 0)); + + //状态上报 + add(new Res_PLCADDRESS("状态上报", "-------------", 0, 0)); + add(new Res_PLCADDRESS("搅拌电机", "VW350", 1, 0)); + add(new Res_PLCADDRESS("翻转电机", "VW352", 1, 0)); + add(new Res_PLCADDRESS("炒锅", "VW354", 1, 0)); + + }}; + /** + * 小炒工序模型 + */ + public List Process_小炒 = new ArrayList() {{ add(new ProcessT("搅拌", Arrays.asList("搅拌速度", "延迟(秒)"))); add(new ProcessT("位置", Arrays.asList("转动速度", "位置动作", "延迟(秒)"))); add(new ProcessT("加热", Arrays.asList("加热功率", "延迟(秒)"))); @@ -366,8 +714,10 @@ public class ConfigName { add(new ProcessT("延迟", Arrays.asList("延迟(秒)"))); add(new ProcessT("出菜", Arrays.asList("延迟(秒)"))); }}; + /** * 根据名称获取变量 + * * @param item * @return */ @@ -378,7 +728,10 @@ public class ConfigName { } else if (item.equals("位置动作")) { data = "原点位、投料位、出餐启动、倒菜位、抽料位、清洗位、炒菜位1、炒菜位2、炒菜位3"; } else if (item.equals("投料动作")) { - data = "投出抖动三次、投出等待三秒、直接投出、手动投料"; + //data = "投出抖动三次、投出等待三秒、直接投出、手动投料"; + data = "投出等待三秒、直接投出、手动投料"; + } else if (item.equals("主料位置")) { + data = "1#位置、2#位置、3#位置、4#位置"; } else if (item.equals("正转速度") || item.equals("反转速度") || item.equals("转动速度") || item.equals("搅拌速度")) { data = "停止、最低、低速、中速、高速、最高、极高"; } else if (item.equals("加热功率") || item.equals("热锅功率")) { diff --git a/app/src/main/res/layout/activity_bottom_navigation2.xml b/app/src/main/res/layout/activity_bottom_navigation2.xml index 73907989..ede5bc50 100644 --- a/app/src/main/res/layout/activity_bottom_navigation2.xml +++ b/app/src/main/res/layout/activity_bottom_navigation2.xml @@ -38,6 +38,6 @@ app:water_mark_text="四川黑菠萝科技" app:water_mark_textColor="@color/watermarkcolor" app:water_mark_textBold="false" - app:water_mark_textSize="30px" /> + app:water_mark_textSize="12px" /> \ No newline at end of file