From 8e834ab73bd2d9aaa27a399068aea74dfbf1d0c2 Mon Sep 17 00:00:00 2001 From: fyf Date: Fri, 7 Jul 2023 18:29:51 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0333rt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bnframework/business/DeviceData.java | 192 ++++++++---------- .../business/ExecuteTheRecipe.java | 14 ++ .../business/address/PlcAddress.java | 11 + .../modules/home/fragment/Home1Fragment.java | 3 +- .../modules/home/fragment/Home2Fragment.java | 5 - .../modules/mine/fragment/MyFragment.java | 1 + 6 files changed, 110 insertions(+), 116 deletions(-) create mode 100644 app/src/main/java/com/bonait/bnframework/business/address/PlcAddress.java diff --git a/app/src/main/java/com/bonait/bnframework/business/DeviceData.java b/app/src/main/java/com/bonait/bnframework/business/DeviceData.java index 587f2d5f..51220f49 100644 --- a/app/src/main/java/com/bonait/bnframework/business/DeviceData.java +++ b/app/src/main/java/com/bonait/bnframework/business/DeviceData.java @@ -62,115 +62,89 @@ public class DeviceData { @Override public void Run() throws InterruptedException { - //获取校准值-增加两个果糖通道 - ModbusTcpServer.get().ReadShort("VW100", 12, (shorts) -> { - for (int i = 0; i < shorts.length; i++) { - CalibrationValue.put(i + 1, shorts[i]); - } - }); - - //获取称当前重量 - ModbusTcpServer.get().ReadInt("VD260", 9, ints -> { - for (int i = 0; i < ints.length; i++) { - CallCurrentWeight.put(i + 1, ints[i]); - } - }); - - //获取校准基准时间 - ModbusTcpServer.get().ReadInt("VD124", 1, ints -> { - CalibrationReferenceTime = ints[0]; - }); - - //获取温度参数 - ModbusTcpServer.get().ReadInt("VD310", 3, ints -> { - FructoseTemperature1=ints[0]; - FructoseTemperature2=ints[1]; - WashTheTankTemperature=ints[2]; - }); - - //获取温度上下限 - ModbusTcpServer.get().ReadInt("VD388", 6, ints -> { - FructoseTemperature1_up=ints[0]; - FructoseTemperature1_down=ints[1]; - FructoseTemperature2_up=ints[2]; - FructoseTemperature2_down=ints[3]; - WashTheTankTemperature_up=ints[4]; - WashTheTankTemperature_down=ints[5]; - }); - - //获取清洗参数 - ModbusTcpServer.get().ReadShort("VW140", 5, shorts -> { - DrainageTime = shorts[0]; - AddCleaningAgentTime = shorts[1]; - InletTime = shorts[2]; - CyclicCleaningTime = shorts[3]; - CleaningAndHeatingTime = shorts[4]; - }); - - //获取清洗参数 - ModbusTcpServer.get().ReadBool("M6.5", 1, booleans -> { - WeightCalibrationMode = booleans[0]; - }); - - ModbusTcpServer.get().ReadBool("M6.5", 1, booleans -> { - WeightCalibrationMode = booleans[0]; - }); - //IoStatus - - //读取1号果糖机按钮状态 - ModbusTcpServer.get().ReadBool("M51.7", 1, booleans -> { - ReheatSwitch1 = booleans[0]; - }); - - //读取2号果糖机按钮状态 - ModbusTcpServer.get().ReadBool("M52.0", 1, booleans -> { - ReheatSwitch2 = booleans[0]; - }); - - //读取当前扫码信息 - ModbusTcpServer.get().ReadString("VW342", 20, (data) -> { - - if(!Code.equals(data)) - { - if(!data.isEmpty() && OnScanTheCodeInformationT!=null) - { - MessageLog.ShowInfo("当前扫码信息:"+data); - OnScanTheCodeInformationT.Run(data); - } - Code=data; - } - //1.查询订单信息 - //2.展示订单界面 - //3.制作订单信息 - //4.回馈订单信息 - }); - - //读取实时状态 - ModbusTcpServer.get().ReadStatus("VW382", 3, 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); - } - }); - - //配料完成 M0.3 - CompleteListen("M0.3", "配料完成", OnChargeMixtureCompleteNotify); - - //清洗完成 M0.6 - CompleteListen("M0.6", "清洗完成", OnCleaningCompleteNotify); - - //去皮完成 M1.3 - CompleteListen("M1.3", "去皮完成", OnPeelingCompleteNotify); - - //扫码信号 M1.5 - //CompleteListen("M1.5", "扫码信号", OnScanTheCodeInformation); +// //获取校准值-增加两个果糖通道 +// ModbusTcpServer.get().ReadShort("VW100", 12, (shorts) -> { +// for (int i = 0; i < shorts.length; i++) { +// CalibrationValue.put(i + 1, shorts[i]); +// } +// }); +// +// //获取称当前重量 +// ModbusTcpServer.get().ReadInt("VD260", 9, ints -> { +// for (int i = 0; i < ints.length; i++) { +// CallCurrentWeight.put(i + 1, ints[i]); +// } +// }); +// +// //获取温度参数 +// ModbusTcpServer.get().ReadInt("VD310", 3, ints -> { +// FructoseTemperature1=ints[0]; +// FructoseTemperature2=ints[1]; +// WashTheTankTemperature=ints[2]; +// }); +// +// +// //获取清洗参数 +// ModbusTcpServer.get().ReadShort("VW140", 5, shorts -> { +// DrainageTime = shorts[0]; +// AddCleaningAgentTime = shorts[1]; +// InletTime = shorts[2]; +// CyclicCleaningTime = shorts[3]; +// CleaningAndHeatingTime = shorts[4]; +// }); +// +// //获取清洗参数 +// ModbusTcpServer.get().ReadBool("M6.5", 1, booleans -> { +// WeightCalibrationMode = booleans[0]; +// }); +// +// ModbusTcpServer.get().ReadBool("M6.5", 1, booleans -> { +// WeightCalibrationMode = booleans[0]; +// }); +// //IoStatus +// +// +// //读取当前扫码信息 +// ModbusTcpServer.get().ReadString("VW342", 20, (data) -> { +// +// if(!Code.equals(data)) +// { +// if(!data.isEmpty() && OnScanTheCodeInformationT!=null) +// { +// MessageLog.ShowInfo("当前扫码信息:"+data); +// OnScanTheCodeInformationT.Run(data); +// } +// Code=data; +// } +// //1.查询订单信息 +// //2.展示订单界面 +// //3.制作订单信息 +// //4.回馈订单信息 +// }); +// +// //读取实时状态 +// ModbusTcpServer.get().ReadStatus("VW382", 3, 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); +// } +// }); +// +// //配料完成 M0.3 +// CompleteListen("M0.3", "配料完成", OnChargeMixtureCompleteNotify); +// +// //清洗完成 M0.6 +// CompleteListen("M0.6", "清洗完成", OnCleaningCompleteNotify); +// +// //去皮完成 M1.3 +// CompleteListen("M1.3", "去皮完成", OnPeelingCompleteNotify); Thread.sleep(10); } 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 8d7e0336..fd045aae 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java +++ b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java @@ -436,5 +436,19 @@ public class ExecuteTheRecipe { ToastUtils.error("异常信息:" + ex.getMessage()); } } + /** + * 火力点击 + * @param data + */ + public static void Write_PLC_HuoLI(int data) + { + try + { + ToastUtils.info("火力按钮点击,当前级别:" + data); + }catch (Exception ex) + { + ToastUtils.error("异常信息:" + ex.getMessage()); + } + } //endregion } diff --git a/app/src/main/java/com/bonait/bnframework/business/address/PlcAddress.java b/app/src/main/java/com/bonait/bnframework/business/address/PlcAddress.java new file mode 100644 index 00000000..9d4f245a --- /dev/null +++ b/app/src/main/java/com/bonait/bnframework/business/address/PlcAddress.java @@ -0,0 +1,11 @@ +package com.bonait.bnframework.business.address; + +/** + * PLC地址管理 + */ +public interface PlcAddress { + + //region 火力电机 + String HuoLi="M30.0"; + //endregion +} 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 6f3a89a7..043ed16c 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 @@ -143,7 +143,7 @@ public class Home1Fragment extends BaseFragment { huoli.mListener = new MyClickListener() { @Override public void clickListener(View v, Object data) { - ToastUtils.info("火力按钮点击,当前级别:" + data); + ExecuteTheRecipe.Write_PLC_HuoLI((int)data); } @Override @@ -163,7 +163,6 @@ public class Home1Fragment extends BaseFragment { @Override public void clickListenerNew(View v, int k, Object data) { - ToastUtils.info("刷新界面"); initData(); } }; diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home2Fragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home2Fragment.java index 378e68ed..dbedc3db 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home2Fragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home2Fragment.java @@ -63,23 +63,18 @@ public class Home2Fragment extends BaseFragment { switch (view.getId()) { case R.id.kshr://开始制作商品 MessageManager.getInstance().sendMessage(MessageName.SelectZY,"Open"); - ToastUtils.info("打开烹饪界面"); break; case R.id.diy://diy模式 skipToActivity(DiyActivity.class); - ToastUtils.info("打开diy界面"); break; case R.id.cp://菜谱 skipToActivity(CpActivity.class); - ToastUtils.info("打开菜谱界面"); break; case R.id.wh://维护界面 skipToActivity(WhActivity.class); - ToastUtils.info("打开维护界面界面"); break; case R.id.sz://系统设置界面 skipToActivity(SzActivity.class); - ToastUtils.info("打开系统设置界面"); break; } } diff --git a/app/src/main/java/com/bonait/bnframework/modules/mine/fragment/MyFragment.java b/app/src/main/java/com/bonait/bnframework/modules/mine/fragment/MyFragment.java index cc2f68ee..695a2dc5 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/mine/fragment/MyFragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/mine/fragment/MyFragment.java @@ -110,6 +110,7 @@ public class MyFragment extends BaseFragment { } private void initView() { initData(ConfigName.getInstance().user); + stvUpdate.setRightString(ConfigName.getInstance().Version); /* * 版本更新,点击事件 * */