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 @@ + + + + + + + + + + + + + + + + + + +