From aa8d21934f7429eb168e251ecd8af501be67d539 Mon Sep 17 00:00:00 2001 From: fyf Date: Thu, 24 Aug 2023 11:44:07 +0800 Subject: [PATCH] =?UTF-8?q?7.=E8=87=AA=E5=8A=A8=E5=8A=A0=E7=83=AD=E5=A2=9E?= =?UTF-8?q?=E5=8A=A0=E6=8E=A7=E5=88=B6=E6=8C=89=E9=92=AE=208.=E8=B0=83?= =?UTF-8?q?=E6=95=B4=E6=89=8B=E5=8A=A8=E6=8E=A7=E5=88=B6bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/example/bpa/config/ConfigName.java | 7 +- .../com/example/bpa/service/DeviceData.java | 9 +-- .../example/bpa/view/from/lcsz_activity.java | 14 ++-- .../bpa/view/from/wdgl_new_Activity.java | 40 ++++++++++- .../layout/from/layout/activity_wdgl_new.xml | 68 +++++++++++++++++++ 5 files changed, 124 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/com/example/bpa/config/ConfigName.java b/app/src/main/java/com/example/bpa/config/ConfigName.java index 0595a24..12eb421 100644 --- a/app/src/main/java/com/example/bpa/config/ConfigName.java +++ b/app/src/main/java/com/example/bpa/config/ConfigName.java @@ -248,8 +248,13 @@ public class ConfigName { add(new Res_PLCADDRESS("M50.7","M100.7","水箱排水阀",1,1)); add(new Res_PLCADDRESS("M53.1","M103.1","水箱加热",1,1)); add(new Res_PLCADDRESS("M53.2","M103.2","水箱水泵(正)",1,1)); - add(new Res_PLCADDRESS("M41.7","M103.2","水箱水泵(反)",1,1)); + add(new Res_PLCADDRESS("M53.7","M103.7","水箱水泵(反)",1,1)); add(new Res_PLCADDRESS("M53.3","M103.3","外部管道加热",1,1)); + + add(new Res_PLCADDRESS("M53.4","M103.4","绿灯",1,1)); + add(new Res_PLCADDRESS("M53.5","M103.5","红灯",1,1)); + add(new Res_PLCADDRESS("M53.6","M103.6","黄灯",1,1)); + }}; /** diff --git a/app/src/main/java/com/example/bpa/service/DeviceData.java b/app/src/main/java/com/example/bpa/service/DeviceData.java index eac9f79..59bdd77 100644 --- a/app/src/main/java/com/example/bpa/service/DeviceData.java +++ b/app/src/main/java/com/example/bpa/service/DeviceData.java @@ -82,12 +82,7 @@ public class DeviceData { }); //读取手动模式状态 - ModbusTcpServer.get().ReadBool("M50.0", 1, booleans -> { - WeightCalibrationMode = booleans[0]; - }); - - //读取手动模式状态 - ModbusTcpServer.get().ReadBool("M50.0", 28, booleans -> { + ModbusTcpServer.get().ReadBool("M50.0", 32, booleans -> { for (int i=0;i { + ModbusTcpServer.get().ReadBool("M100.0", 32, booleans -> { for (int i=0;i m = QueryDB.GetMaterialBySilosID(silo.id); - if (m.size() > 0) { - datas.add(new lcMode(silo.id, silo.num, m.get(0).name, "0", m.get(0).id, silo.warningValue, silo.thrsoleValue,silo.name)); - } else { - datas.add(new lcMode(silo.id, silo.num, "未设置", "0", "", silo.warningValue, silo.thrsoleValue,silo.name)); + + if(silo.num!=10) + { + List m = QueryDB.GetMaterialBySilosID(silo.id); + if (m.size() > 0) { + datas.add(new lcMode(silo.id, silo.num, m.get(0).name, "0", m.get(0).id, silo.warningValue, silo.thrsoleValue,silo.name)); + } else { + datas.add(new lcMode(silo.id, silo.num, "未设置", "0", "", silo.warningValue, silo.thrsoleValue,silo.name)); + } } } } diff --git a/app/src/main/java/com/example/bpa/view/from/wdgl_new_Activity.java b/app/src/main/java/com/example/bpa/view/from/wdgl_new_Activity.java index 0358f5e..fc3d8c5 100644 --- a/app/src/main/java/com/example/bpa/view/from/wdgl_new_Activity.java +++ b/app/src/main/java/com/example/bpa/view/from/wdgl_new_Activity.java @@ -45,7 +45,7 @@ public class wdgl_new_Activity extends AppCompatActivity implements View.OnClick */ Button mwSave_button1, mwSave_button2; - Switch Switch_2,Switch_3; + Switch Switch_2,Switch_3,Switch_zyc,Switch_zygdbw,Switch_wbgdjr; //endregion //region 私有函数 @@ -80,6 +80,16 @@ public class wdgl_new_Activity extends AppCompatActivity implements View.OnClick Switch_2 = this.findViewById(R.id.Switch_2); Switch_3 = this.findViewById(R.id.Switch_3); + + Switch_zyc=this.findViewById(R.id.Switch_zyc); + Switch_zygdbw=this.findViewById(R.id.Switch_zygdbw); + Switch_wbgdjr=this.findViewById(R.id.Switch_wbgdjr); + + Switch_zyc.setChecked(DeviceData.Get().getAutomationValue("M101.7")); + Switch_zygdbw.setChecked(DeviceData.Get().getAutomationValue("M102.1")); + Switch_wbgdjr.setChecked(DeviceData.Get().getAutomationValue("M103.3")); + + Switch_2.setChecked(ConfigName.getInstance().AutomaticHeating); Switch_3.setChecked(ConfigName.getInstance().JRX_AutomaticHeating); //通过Activity.getIntent()获取当前页面接收到的Intent。 getXxxExtra方法获取Intent传递过来的数据 @@ -130,6 +140,34 @@ public class wdgl_new_Activity extends AppCompatActivity implements View.OnClick } } }); + + + Switch_zyc.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean b) { + String addr= Switch_zyc.getTag().toString(); + DeviceData.Get().setSwitch(b,addr,null); + T.show(getBaseContext(), Switch_zyc.getText().toString()+",地址:"+addr+".状态:"+b); + } + }); + + Switch_zygdbw.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean b) { + String addr= Switch_zygdbw.getTag().toString(); + DeviceData.Get().setSwitch(b,addr,null); + T.show(getBaseContext(), Switch_zygdbw.getText().toString()+",地址:"+addr+".状态:"+b); + } + }); + + Switch_wbgdjr.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean b) { + String addr= Switch_wbgdjr.getTag().toString(); + DeviceData.Get().setSwitch(b,addr,null); + T.show(getBaseContext(), Switch_wbgdjr.getText().toString()+",地址:"+addr+".状态:"+b); + } + }); } /** diff --git a/app/src/main/res/layout/from/layout/activity_wdgl_new.xml b/app/src/main/res/layout/from/layout/activity_wdgl_new.xml index d786bd7..56108e5 100644 --- a/app/src/main/res/layout/from/layout/activity_wdgl_new.xml +++ b/app/src/main/res/layout/from/layout/activity_wdgl_new.xml @@ -285,6 +285,74 @@ + + + + + + + + + + + + + + + + + + +