Browse Source

修复监视界面

tags/old_version_1
fyf 1 year ago
parent
commit
219bf072c7
6 changed files with 93 additions and 63 deletions
  1. +3
    -0
      app/build.gradle
  2. +17
    -36
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  3. +9
    -0
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemDeviceinFragment.java
  4. +53
    -23
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/fragment_plc_control.java
  5. +1
    -0
      app/src/main/res/layout/fragment_my.xml
  6. +10
    -4
      app/src/main/res/layout/item/layout/fragment_item_plc_control.xml

+ 3
- 0
app/build.gradle View File

@@ -144,4 +144,7 @@ dependencies {

//阿里云文件上传
implementation 'com.aliyun.dpa:oss-android-sdk:2.5.0'

//轻量级sw
implementation 'com.github.zcweng:switch-button:0.0.3@aar'
}

+ 17
- 36
app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java View File

@@ -236,30 +236,22 @@ public class ConfigName {
add(new Res_PLCADDRESS("搅拌", "M10.3", 0, 1));
add(new Res_PLCADDRESS("搅拌速度", "VW102", 1, 1));

//翻转正转模型
//翻转正转模型 翻转反转模型
add(new Res_PLCADDRESS("翻转正转", "M10.4", 0, 1));
add(new Res_PLCADDRESS("转动速度", "VW104", 1, 1));


//翻转反转模型
add(new Res_PLCADDRESS("翻转反转", "M10.5", 0, 1));
add(new Res_PLCADDRESS("转动速度", "VW104", 1, 1));


//加热模型
add(new Res_PLCADDRESS("加热", "M10.6", 0, 1));
add(new Res_PLCADDRESS("加热功率", "VW100", 1, 1));


//抽水放水
add(new Res_PLCADDRESS("炒锅抽水", "M10.7", 0, 1));
add(new Res_PLCADDRESS("炒锅放水", "M11.0", 0, 1));


//出菜模型
add(new Res_PLCADDRESS("出菜", "M11.5", 0, 1));


//位置动作
add(new Res_PLCADDRESS("原点位", "M11.4", 0, 1));
add(new Res_PLCADDRESS("投料位", "M11.4", 0, 1));
@@ -275,20 +267,20 @@ public class ConfigName {

//液体料模型
add(new Res_PLCADDRESS("液体料", "-------------", 0, 0));
add(new Res_PLCADDRESS("料仓1下料", "M11.1", 0, 1));
add(new Res_PLCADDRESS("料仓2下料", "M11.2", 0, 1));
add(new Res_PLCADDRESS("料仓3下料", "M11.3", 0, 1));
add(new Res_PLCADDRESS("校准时间", "VW112", 1, 1));
add(new Res_PLCADDRESS("料仓1校准值", "VW114", 1, 1));
add(new Res_PLCADDRESS("料仓2校准值", "VW116", 1, 1));
add(new Res_PLCADDRESS("料仓3校准值", "VW118", 1, 1));
add(new Res_PLCADDRESS("开始校正", "M12.6", 0, 1));
add(new Res_PLCADDRESS("料仓1下料手动", "M12.3", 0, 1));
add(new Res_PLCADDRESS("料仓2下料手动", "M12.4", 0, 1));
add(new Res_PLCADDRESS("料仓3下料手动", "M12.5", 0, 1));
add(new Res_PLCADDRESS("开始校正", "M12.6", 0, 1));
add(new Res_PLCADDRESS("料仓1需求值", "VW106", 1, 1));
add(new Res_PLCADDRESS("料仓2需求值", "VW108", 1, 1));
add(new Res_PLCADDRESS("料仓3需求值", "VW110", 1, 1));
add(new Res_PLCADDRESS("校准时间", "VW112", 1, 1));
add(new Res_PLCADDRESS("料仓1校准值", "VW114", 1, 1));
add(new Res_PLCADDRESS("料仓2校准值", "VW116", 1, 1));
add(new Res_PLCADDRESS("料仓3校准值", "VW118", 1, 1));
add(new Res_PLCADDRESS("料仓1下料", "M11.1", 0, 1));
add(new Res_PLCADDRESS("料仓2下料", "M11.2", 0, 1));
add(new Res_PLCADDRESS("料仓3下料", "M11.3", 0, 1));


//上下限
@@ -385,10 +377,6 @@ public class ConfigName {

//翻转正转模型
add(new Res_PLCADDRESS("翻转正转", "M10.4", 0, 1));
add(new Res_PLCADDRESS("转动速度", "VW104", 1, 1));


//翻转反转模型
add(new Res_PLCADDRESS("翻转反转", "M10.5", 0, 1));
add(new Res_PLCADDRESS("转动速度", "VW104", 1, 1));

@@ -424,21 +412,20 @@ public class ConfigName {

//液体料模型
add(new Res_PLCADDRESS("液体料", "-------------", 0, 0));
add(new Res_PLCADDRESS("料仓1下料", "M11.1", 0, 1));
add(new Res_PLCADDRESS("料仓2下料", "M11.2", 0, 1));
add(new Res_PLCADDRESS("料仓3下料", "M11.3", 0, 1));
add(new Res_PLCADDRESS("校准时间", "VW112", 1, 1));
add(new Res_PLCADDRESS("料仓1校准值", "VW114", 1, 1));
add(new Res_PLCADDRESS("料仓2校准值", "VW116", 1, 1));
add(new Res_PLCADDRESS("料仓3校准值", "VW118", 1, 1));
add(new Res_PLCADDRESS("开始校正", "M12.6", 0, 1));
add(new Res_PLCADDRESS("料仓1下料手动", "M12.3", 0, 1));
add(new Res_PLCADDRESS("料仓2下料手动", "M12.4", 0, 1));
add(new Res_PLCADDRESS("料仓3下料手动", "M12.5", 0, 1));
add(new Res_PLCADDRESS("开始校正", "M12.6", 0, 1));
add(new Res_PLCADDRESS("料仓1需求值", "VW106", 1, 1));
add(new Res_PLCADDRESS("料仓2需求值", "VW108", 1, 1));
add(new Res_PLCADDRESS("料仓3需求值", "VW110", 1, 1));
add(new Res_PLCADDRESS("校准时间", "VW112", 1, 1));
add(new Res_PLCADDRESS("料仓1校准值", "VW114", 1, 1));
add(new Res_PLCADDRESS("料仓2校准值", "VW116", 1, 1));
add(new Res_PLCADDRESS("料仓3校准值", "VW118", 1, 1));

add(new Res_PLCADDRESS("料仓1下料", "M11.1", 0, 1));
add(new Res_PLCADDRESS("料仓2下料", "M11.2", 0, 1));
add(new Res_PLCADDRESS("料仓3下料", "M11.3", 0, 1));

//上下限
add(new Res_PLCADDRESS("位置上下限", "-------------", 0, 0));
@@ -535,7 +522,6 @@ public class ConfigName {
add(new Res_PLCADDRESS("翻转轴在4号位", "M44.3", 1, 0));
add(new Res_PLCADDRESS("倒菜完成", "M44.4", 1, 0));


//检测信号
add(new Res_PLCADDRESS("监测信号", "-------------", 0, 0));
add(new Res_PLCADDRESS("当前锅底温度", "VD300", 1, 0));
@@ -838,9 +824,4 @@ public class ConfigName {
*/
public String versionSelectionEnum = "大炒版本";
//endregion

//region 阿里云文件上传地址


//endregion
}

+ 9
- 0
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemDeviceinFragment.java View File

@@ -75,6 +75,15 @@ public class SystemDeviceinFragment extends BaseFragment {
{
new MyBitmapUtils().disPlay(image,ConfigName.getInstance().organizeMode.logo);
}
}else
{
edittext1.setText(ConfigName.getInstance().DeviceId);
edittext2.setText(ConfigName.getInstance().versionSelectionEnum);
edittext3.setText("未知");
edittext4.setText("");
edittext5.setText("未知");
edittext6.setText("未知");
edittext7.setText("未知");
}
}
@Override


+ 53
- 23
app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/fragment_plc_control.java View File

@@ -23,6 +23,7 @@ import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
import com.suke.widget.SwitchButton;

import butterknife.BindView;
import butterknife.ButterKnife;
@@ -51,7 +52,7 @@ public class fragment_plc_control extends LinearLayout {
Button update_plc;//下发按钮

@BindView(R.id.control_switch)
Switch control_switch;//下发按钮
SwitchButton control_switch;//下发按钮

@BindView(R.id.text_wb)
TextView text_wb;//分组
@@ -87,13 +88,6 @@ public class fragment_plc_control extends LinearLayout {
if(val!=null)
{
control_switch.setChecked((boolean)val);
// if ((boolean)val)
// {
// control_switch.setText("打开");
// }else
// {
// control_switch.setText("关闭");
// }
}
}
} else //文本
@@ -116,34 +110,70 @@ public class fragment_plc_control extends LinearLayout {
wenben.setVisibility(View.GONE);
kaiguan.setVisibility(View.GONE);
Object val= ExecuteTheRecipe.ListeningValue.get(model.name);
if(val!=null)
if(model.address.startsWith("M"))//开关状态
{
text_wb.setText(val+"");
if(val!=null)
{
if((boolean)val)
{
text_wb.setText("打开");
text_wb.setTextColor(this.getResources().getColor(R.color.green_primary_dark));
}else
{
text_wb.setText("关闭");
text_wb.setTextColor(this.getResources().getColor(R.color.red_primary_dark));
}
}else
{
text_wb.setText("关闭");
text_wb.setTextColor(this.getResources().getColor(R.color.red_primary_dark));
}
}else //文本
{
int val_k=0;
String dw="";
if(val!=null)
{
val_k=Integer.parseInt(String.valueOf(val));
}

if(model.name.contains("温度"))
{
dw=" °C";
}else if(model.name.contains("电压"))
{
dw=" V";
}else if(model.name.contains("电流"))
{
dw=" A";
}else if(model.name.contains("转速"))
{
dw=" r/min";
}else if(model.name.contains("频率"))
{
dw=" Hz";
}else if(model.name.contains("功率"))
{
dw=" KW";
}else if(model.name.contains("挡位"))
{
dw=" 挡";
}
text_wb.setText(val_k+dw);
}
}
}


control_switch.setOnClickListener(new OnClickListener() {
control_switch.setOnCheckedChangeListener(new SwitchButton.OnCheckedChangeListener() {
@Override
public void onClick(View view) {
public void onCheckedChanged(SwitchButton view, boolean isChecked) {
boolean ischick= control_switch.isChecked();
// if (ischick)
// {
// control_switch.setText("打开");
// }else
// {
// control_switch.setText("关闭");
// }

ExecuteTheRecipe.WritePLC(model.name,ischick,null);
ToastUtils.info("写入地址:"+model.address+"成功!状态:"+(ischick?"打开":"关闭"));

}
});
}
public BPA_PLCADDRESS model=null;

@OnClick({R.id.update_plc})
public void onViewClicked(View view) {
switch (view.getId()) {


+ 1
- 0
app/src/main/res/layout/fragment_my.xml View File

@@ -120,6 +120,7 @@

</LinearLayout>
</ScrollView>

</LinearLayout>

</com.qmuiteam.qmui.widget.QMUIWindowInsetLayout>

+ 10
- 4
app/src/main/res/layout/item/layout/fragment_item_plc_control.xml View File

@@ -83,12 +83,18 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content">

<Switch
<com.suke.widget.SwitchButton
android:id="@+id/control_switch"
android:layout_width="wrap_content"
android:layout_width="80dp"
android:layout_height="wrap_content"
android:focusable="true"
/>
android:focusable="true">

</com.suke.widget.SwitchButton>
<!-- <Switch-->
<!-- android:layout_width="wrap_content"-->
<!-- android:layout_height="wrap_content"-->
<!-- android:focusable="true"-->
<!-- />-->
</RelativeLayout>

<RelativeLayout


Loading…
Cancel
Save