@@ -248,8 +248,13 @@ public class ConfigName { | |||||
add(new Res_PLCADDRESS("M50.7","M100.7","水箱排水阀",1,1)); | 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.1","M103.1","水箱加热",1,1)); | ||||
add(new Res_PLCADDRESS("M53.2","M103.2","水箱水泵(正)",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.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)); | |||||
}}; | }}; | ||||
/** | /** | ||||
@@ -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++) | for (int i=0;i<booleans.length;i++) | ||||
{ | { | ||||
ManualValue.put(i,booleans[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++) | for (int i=0;i<booleans.length;i++) | ||||
{ | { | ||||
AutomationValue.put(i,booleans[i]); | AutomationValue.put(i,booleans[i]); | ||||
@@ -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)); | |||||
} | |||||
} | } | ||||
} | } | ||||
} | } | ||||
@@ -45,7 +45,7 @@ public class wdgl_new_Activity extends AppCompatActivity implements View.OnClick | |||||
*/ | */ | ||||
Button mwSave_button1, mwSave_button2; | Button mwSave_button1, mwSave_button2; | ||||
Switch Switch_2,Switch_3; | |||||
Switch Switch_2,Switch_3,Switch_zyc,Switch_zygdbw,Switch_wbgdjr; | |||||
//endregion | //endregion | ||||
//region 私有函数 | //region 私有函数 | ||||
@@ -80,6 +80,16 @@ public class wdgl_new_Activity extends AppCompatActivity implements View.OnClick | |||||
Switch_2 = this.findViewById(R.id.Switch_2); | Switch_2 = this.findViewById(R.id.Switch_2); | ||||
Switch_3 = this.findViewById(R.id.Switch_3); | 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_2.setChecked(ConfigName.getInstance().AutomaticHeating); | ||||
Switch_3.setChecked(ConfigName.getInstance().JRX_AutomaticHeating); | Switch_3.setChecked(ConfigName.getInstance().JRX_AutomaticHeating); | ||||
//通过Activity.getIntent()获取当前页面接收到的Intent。 getXxxExtra方法获取Intent传递过来的数据 | //通过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); | |||||
} | |||||
}); | |||||
} | } | ||||
/** | /** | ||||
@@ -285,6 +285,74 @@ | |||||
</RelativeLayout> | </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> | </LinearLayout> | ||||
</RelativeLayout> | </RelativeLayout> | ||||
</RelativeLayout> | </RelativeLayout> |