Bladeren bron

7.自动加热增加控制按钮

8.调整手动控制bug
调味吧台
fyf 1 jaar geleden
bovenliggende
commit
aa8d21934f
5 gewijzigde bestanden met toevoegingen van 124 en 14 verwijderingen
  1. +6
    -1
      app/src/main/java/com/example/bpa/config/ConfigName.java
  2. +2
    -7
      app/src/main/java/com/example/bpa/service/DeviceData.java
  3. +9
    -5
      app/src/main/java/com/example/bpa/view/from/lcsz_activity.java
  4. +39
    -1
      app/src/main/java/com/example/bpa/view/from/wdgl_new_Activity.java
  5. +68
    -0
      app/src/main/res/layout/from/layout/activity_wdgl_new.xml

+ 6
- 1
app/src/main/java/com/example/bpa/config/ConfigName.java Bestand weergeven

@@ -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));

}};

/**


+ 2
- 7
app/src/main/java/com/example/bpa/service/DeviceData.java Bestand weergeven

@@ -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<booleans.length;i++)
{
ManualValue.put(i,booleans[i]);
@@ -95,7 +90,7 @@ public class DeviceData {
});

//读取自动模式状态
ModbusTcpServer.get().ReadBool("M100.0", 28, booleans -> {
ModbusTcpServer.get().ReadBool("M100.0", 32, booleans -> {
for (int i=0;i<booleans.length;i++)
{
AutomationValue.put(i,booleans[i]);


+ 9
- 5
app/src/main/java/com/example/bpa/view/from/lcsz_activity.java Bestand weergeven

@@ -115,11 +115,15 @@ public class lcsz_activity extends AppCompatActivity implements View.OnClickList
// }
//
// }
List<BPA_MATERIAL> 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<BPA_MATERIAL> 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));
}
}
}
}


+ 39
- 1
app/src/main/java/com/example/bpa/view/from/wdgl_new_Activity.java Bestand weergeven

@@ -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);
}
});
}

/**


+ 68
- 0
app/src/main/res/layout/from/layout/activity_wdgl_new.xml Bestand weergeven

@@ -285,6 +285,74 @@

</RelativeLayout>


<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">

<LinearLayout
android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="10dp"
android:layout_marginLeft="20dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginTop="10dp"
android:text="其他温度控制"
android:textStyle="bold"
android:textSize="24dp"
android:textColor="@color/white"/>
<LinearLayout
android:layout_marginTop="10dp"
android:layout_width="wrap_content"
android:layout_height="60dp"
android:orientation="horizontal">
<Switch
android:id="@+id/Switch_zyc"
android:layout_centerInParent="true"
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="30dp"
android:tag="M101.7"
android:background="@drawable/qs_switch"
android:text="猪油仓加热"
android:layout_margin="5dp"/>
<Switch
android:id="@+id/Switch_zygdbw"
android:layout_centerInParent="true"
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="@drawable/qs_switch"
android:text="猪油管道保温"
android:tag="M102.1"
android:layout_margin="5dp"/>
<Switch
android:id="@+id/Switch_wbgdjr"
android:layout_centerInParent="true"
android:layout_marginTop="20dp"
android:layout_width="match_parent"
android:layout_height="30dp"
android:background="@drawable/qs_switch"
android:text="外部管道加热"
android:tag="M103.3"
android:layout_margin="5dp"/>
</LinearLayout>

</LinearLayout>

</LinearLayout>


</RelativeLayout>

</LinearLayout>
</RelativeLayout>
</RelativeLayout>

Laden…
Annuleren
Opslaan