From 894c3212a1fadfbe1738ce969f98faa3f540fad3 Mon Sep 17 00:00:00 2001
From: Nah <15196688790@163.com>
Date: Fri, 10 Nov 2023 11:57:39 +0800
Subject: [PATCH] =?UTF-8?q?1.=20=E4=BF=AE=E6=94=B9=E4=B8=8B=E4=BD=8D?=
=?UTF-8?q?=E6=8E=A7=E5=88=B6=E9=80=BB=E8=BE=91=E3=80=822.=20=E4=BF=AE?=
=?UTF-8?q?=E6=94=B9=E5=AE=9E=E6=97=B6=E7=9B=91=E6=8E=A7=E6=98=BE=E7=A4=BA?=
=?UTF-8?q?=E3=80=823.=20=E4=BF=AE=E6=94=B9=E7=B3=BB=E7=BB=9F=E5=8F=82?=
=?UTF-8?q?=E6=95=B0=E9=85=8D=E7=BD=AE=E3=80=82?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/.gitignore | 3 -
.idea/compiler.xml | 6 -
.idea/gradle.xml | 20 ---
.idea/jarRepositories.xml | 15 +-
.idea/misc.xml | 4 -
.../business/ExecuteTheRecipe.java | 43 +++--
.../common/constant/ConfigName.java | 161 ++++++++++++------
.../common/db/mode/BPA_SYSTEMSET.java | 5 +
.../BottomNavigationMainActivity.java | 22 +--
.../home/fragment/from/RealTimeActivity.java | 128 +++-----------
.../from/SystemParameterActivity.java | 107 +++++++++++-
.../res/layout/activity_systemparameter.xml | 62 ++++++-
app/src/main/res/values/strings.xml | 33 +++-
13 files changed, 362 insertions(+), 247 deletions(-)
delete mode 100644 .idea/.gitignore
delete mode 100644 .idea/compiler.xml
delete mode 100644 .idea/gradle.xml
delete mode 100644 .idea/misc.xml
diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 26d33521..00000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# Default ignored files
-/shelf/
-/workspace.xml
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
deleted file mode 100644
index fb7f4a8a..00000000
--- a/.idea/compiler.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/gradle.xml b/.idea/gradle.xml
deleted file mode 100644
index 6e5389ed..00000000
--- a/.idea/gradle.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
index 9ce8da6d..bbe9e7b3 100644
--- a/.idea/jarRepositories.xml
+++ b/.idea/jarRepositories.xml
@@ -11,6 +11,11 @@
+
+
+
+
+
@@ -26,15 +31,5 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 2e691a23..00000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
index ab9ca5e7..e390c1a8 100644
--- a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
+++ b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
@@ -3,6 +3,7 @@ package com.bonait.bnframework.business;
import android.app.Activity;
import android.content.Context;
import android.content.ContextWrapper;
+import android.graphics.Bitmap;
import android.media.MediaPlayer;
import android.os.Handler;
import android.os.Looper;
@@ -11,6 +12,7 @@ import android.util.Log;
import androidx.annotation.NonNull;
import com.bonait.bnframework.R;
+import com.bonait.bnframework.business.devicesControl.PLCControl;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.db.QueryDB;
@@ -34,6 +36,7 @@ import com.bonait.bnframework.common.helper.MediaPlayerHelper;
import com.bonait.bnframework.common.helper.MessageLog;
import com.bonait.bnframework.common.helper.RTrig;
import com.bonait.bnframework.common.helper.ThreadManager;
+import com.bonait.bnframework.common.modbus.ModbusRTUServer;
import com.bonait.bnframework.common.modbus.ModbusTcpServer;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
@@ -656,24 +659,30 @@ public class ExecuteTheRecipe {
*/
public static void ReadPLCStatus() {
try {
- if (ConfigName.getInstance().PLC_Address.containsKey("实时状态")) {
- BPA_PLCADDRESS plcaddress = ConfigName.getInstance().PLC_Address.get("实时状态");
- if (!plcaddress.address.isEmpty() && ConfigName.getInstance().PlcIsConnect) {
- ModbusTcpServer.get().ReadStatus(plcaddress.address, 4, (data) -> {
- for (int i = 0; i < data.length; i++) {
- byte status=data[i];//0x92
- IoStatus.put(i*8+0, ByteHelper.getBit(status,0)==1);
- IoStatus.put(i*8+1, ByteHelper.getBit(status,1)==1);
- IoStatus.put(i*8+2, ByteHelper.getBit(status,2)==1);
- IoStatus.put(i*8+3, ByteHelper.getBit(status,3)==1);
- IoStatus.put(i*8+4, ByteHelper.getBit(status,4)==1);
- IoStatus.put(i*8+5, ByteHelper.getBit(status,5)==1);
- IoStatus.put(i*8+6, ByteHelper.getBit(status,6)==1);
- IoStatus.put(i*8+7, ByteHelper.getBit(status,7)==1);
- }
- });
- }
+// if (ConfigName.getInstance().PLC_Address.containsKey("实时状态")) {
+// BPA_PLCADDRESS plcaddress = ConfigName.getInstance().PLC_Address.get("实时状态");
+// if (!plcaddress.address.isEmpty() && ConfigName.getInstance().PlcIsConnect) {
+// ModbusTcpServer.get().ReadStatus(plcaddress.address, 4, (data) -> {
+// for (int i = 0; i < data.length; i++) {
+// byte status=data[i];//0x92
+// IoStatus.put(i*8+0, ByteHelper.getBit(status,0)==1);
+// IoStatus.put(i*8+1, ByteHelper.getBit(status,1)==1);
+// IoStatus.put(i*8+2, ByteHelper.getBit(status,2)==1);
+// IoStatus.put(i*8+3, ByteHelper.getBit(status,3)==1);
+// IoStatus.put(i*8+4, ByteHelper.getBit(status,4)==1);
+// IoStatus.put(i*8+5, ByteHelper.getBit(status,5)==1);
+// IoStatus.put(i*8+6, ByteHelper.getBit(status,6)==1);
+// IoStatus.put(i*8+7, ByteHelper.getBit(status,7)==1);
+// }
+// });
+// }
+// }
+ //TODO:修改实时状态更新
+ boolean[] result= PLCControl.get().getAllMotorStatus();
+ for (int i=0;i< result.length;i++){
+ IoStatus.put(i,result[i]);
}
+
} catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage());
} finally {
diff --git a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
index 8561c1e5..d0bd0f71 100644
--- a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
+++ b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
@@ -3,41 +3,20 @@ package com.bonait.bnframework.common.constant;
import android.app.Application;
import android.content.Context;
-import androidx.fragment.app.Fragment;
-import androidx.fragment.app.FragmentManager;
-
-import com.bonait.bnframework.R;
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS;
-import com.bonait.bnframework.common.db.mode.BPA_SILOS;
import com.bonait.bnframework.common.db.mode.BPA_USER;
import com.bonait.bnframework.common.db.mode.Res_PLCADDRESS;
import com.bonait.bnframework.common.db.res.Res_PLCADDRESS1;
import com.bonait.bnframework.common.db.res.Res_ZDSF;
-import com.bonait.bnframework.common.db.res.StatusMode;
-import com.bonait.bnframework.common.model.AddrType;
import com.bonait.bnframework.common.model.mode.CloudGood;
import com.bonait.bnframework.common.model.mode.DeviceInformation;
import com.bonait.bnframework.common.model.mode.OrganizeMode;
-import com.bonait.bnframework.common.model.mode.ProcessT;
import com.bonait.bnframework.common.model.mode.ResALLData;
import com.bonait.bnframework.common.model.mode.ResSilosModel;
-import com.bonait.bnframework.common.model.mode.VersionSelectionEnum;
-import com.bonait.bnframework.common.utils.ScreenUtils;
import com.bonait.bnframework.modules.home.adapter.FragmentAdapter;
-import com.bonait.bnframework.modules.home.fragment.DingDanfragment;
-import com.bonait.bnframework.modules.home.fragment.GongnengFragment;
-import com.bonait.bnframework.modules.home.fragment.GuanLifragment;
-import com.bonait.bnframework.modules.home.fragment.JiaoYanFragment;
-import com.bonait.bnframework.modules.home.fragment.MakeGoodFragment;
-import com.bonait.bnframework.modules.home.fragment.SheZhifragment;
-import com.bonait.bnframework.modules.mine.fragment.MyFragment;
import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
import java.util.List;
-import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -178,6 +157,32 @@ public class ConfigName {
public int Post = 502;
//endregion
+//region 串口PLC连接参数
+ /**
+ * 串口是否连接。
+ * */
+ public boolean SerialIsConnect =false;
+
+ /**
+ * 串口波特率
+ */
+ public int SerialBaudRate = 9600;
+ /**
+ * 串口数据位
+ */
+ public int SerialDataBits = 8;
+
+ /**
+ * 串口校验位
+ * */
+ public int SerialParity=0;
+ /**
+ * 串口停止位
+ * */
+ public int SerialStopBits=1;
+
+ //endregion
+
//region URL
//Sass地址
public String SaasAddress = "http://order.test1.com";
@@ -205,50 +210,91 @@ public class ConfigName {
*/
public static ConcurrentHashMap PLC_Address = new ConcurrentHashMap();
+
+ //region 味魔方
/**
- * 奶茶机基础PLC模型
+ * 味魔方基础PLC模型
*/
public List PlcAddress_味魔方 = new ArrayList() {{
- //通道校准
- add(new Res_PLCADDRESS("基础控制", "-------------", 0, 0));
- add(new Res_PLCADDRESS("料仓1", "M5.0", 1, 1));
- add(new Res_PLCADDRESS("料仓2", "M5.0", 1, 1));
- add(new Res_PLCADDRESS("料仓3", "M5.0", 1, 1));
- add(new Res_PLCADDRESS("料仓4", "M5.0", 1, 1));
- add(new Res_PLCADDRESS("料仓5", "M5.0", 1, 1));
- add(new Res_PLCADDRESS("料仓6", "M5.0", 1, 1));
- add(new Res_PLCADDRESS("料仓7", "M5.0", 1, 1));
- add(new Res_PLCADDRESS("料仓8", "M5.0", 1, 1));
- add(new Res_PLCADDRESS("料仓9", "M5.0", 1, 1));
- add(new Res_PLCADDRESS("料仓10", "M5.0", 1, 1));
- add(new Res_PLCADDRESS("料仓11", "M5.0", 1, 1));
- add(new Res_PLCADDRESS("料仓12", "M5.0", 1, 1));
- add(new Res_PLCADDRESS("料仓13", "M5.0", 1, 1));
- add(new Res_PLCADDRESS("料仓14", "M5.0", 1, 1));
+ //region 料仓通道开关
+ add(new Res_PLCADDRESS("通道1开关", "D10", 1, 1));
+ add(new Res_PLCADDRESS("通道2开关", "D11", 1, 1));
+ add(new Res_PLCADDRESS("通道3开关", "D12", 1, 1));
+ add(new Res_PLCADDRESS("通道4开关", "D13", 1, 1));
+ add(new Res_PLCADDRESS("通道5开关", "D14", 1, 1));
+ add(new Res_PLCADDRESS("通道6开关", "D15", 1, 1));
+ add(new Res_PLCADDRESS("通道7开关", "D16", 1, 1));
+ add(new Res_PLCADDRESS("通道8开关", "D17", 1, 1));
+ add(new Res_PLCADDRESS("通道9开关", "D18", 1, 1));
+ add(new Res_PLCADDRESS("通道10开关", "D19", 1, 1));
+ add(new Res_PLCADDRESS("通道11开关", "D20", 1, 1));
+ add(new Res_PLCADDRESS("通道12开关", "D21", 1, 1));
+ add(new Res_PLCADDRESS("通道13开关", "D22", 1, 1));
+ add(new Res_PLCADDRESS("通道14开关", "D23", 1, 1));
+ //endregion
+
+ //region 心跳变量
+ add(new Res_PLCADDRESS("心跳时间", "D0", 0, 1));
+ add(new Res_PLCADDRESS("超时标志", "M0", 1, 1));
+
+ //endregion
+
}};
/**
- * 奶茶机料仓模型
+ * 味魔方料仓模型
*/
public List Silos_味魔方 = new ArrayList() {{
- add(new ResSilosModel("粉料仓",1 , 1 ));
- add(new ResSilosModel("粉料仓",2 , 2 ));
- add(new ResSilosModel("粉料仓",3 , 3 ));
- add(new ResSilosModel("粉料仓",4 , 4 ));
- add(new ResSilosModel("粉料仓",5 , 5 ));
- add(new ResSilosModel("粉料仓",6 , 6 ));
- add(new ResSilosModel("外置仓",7 , 7 ));
- add(new ResSilosModel("外置仓",8 , 8 ));
- add(new ResSilosModel("外置仓",9 , 9 ));
- add(new ResSilosModel("外置仓",10, 10));
- add(new ResSilosModel("外置仓",11, 11));
- add(new ResSilosModel("外置仓",12, 12));
- add(new ResSilosModel("外置仓",13, 13));
- add(new ResSilosModel("外置仓",14, 14));
+ add(new ResSilosModel("外置仓", 1,1));
+ add(new ResSilosModel("液体仓", 2,2));
+ add(new ResSilosModel("液体仓", 3,3));
+ add(new ResSilosModel("外置仓", 4,4));
+
+ add(new ResSilosModel("外置仓", 5,5));
+ add(new ResSilosModel("液体仓", 6,6));
+ add(new ResSilosModel("液体仓", 7,7));
+ add(new ResSilosModel("外置仓", 8,8));
+
+ add(new ResSilosModel("粉料仓", 9,9));
+ add(new ResSilosModel("粉料仓", 10,10));
+ add(new ResSilosModel("粉料仓", 11,11));
+ add(new ResSilosModel("粉料仓", 12,12));
+ add(new ResSilosModel("粉料仓", 13,13));
+ add(new ResSilosModel("粉料仓", 14,14));
}};
+ /**
+ * 单机味魔方料仓手动控制
+ */
+// public List PlcAddress_味魔方_手动=new ArrayList(){{
+//
+// add(new Res_PLCADDRESS1("-------------","","外置仓",0,0));
+// add(new Res_PLCADDRESS1("Y0", "Y0", "通道1开关", 1, 1));
+// add(new Res_PLCADDRESS1("Y3", "Y3", "通道4开关", 1, 1));
+// add(new Res_PLCADDRESS1("Y4", "Y4", "通道5开关", 1, 1));
+// add(new Res_PLCADDRESS1("Y7", "Y7", "通道8开关", 1, 1));
+//
+// add(new Res_PLCADDRESS1("-------------","","液体仓",0,0));
+// add(new Res_PLCADDRESS1("Y1", "Y1", "通道2开关", 1, 1));
+// add(new Res_PLCADDRESS1("Y2", "Y2", "通道3开关", 1, 1));
+// add(new Res_PLCADDRESS1("Y5", "Y5", "通道6开关", 1, 1));
+// add(new Res_PLCADDRESS1("Y6", "Y6", "通道7开关", 1, 1));
+//
+// add(new Res_PLCADDRESS1("-------------","","粉料仓",0,0));
+// add(new Res_PLCADDRESS1("Y10", "Y10", "通道9开关", 1, 1));
+// add(new Res_PLCADDRESS1( "Y11", "Y11","通道10开关", 1, 1));
+// add(new Res_PLCADDRESS1( "Y12", "Y12","通道11开关", 1, 1));
+// add(new Res_PLCADDRESS1( "Y13", "Y13","通道12开关", 1, 1));
+// add(new Res_PLCADDRESS1( "Y14", "Y14","通道13开关", 1, 1));
+// add(new Res_PLCADDRESS1( "Y15", "Y15","通道14开关", 1, 1));
+//
+// }};
+
+ //endregion
+
+ //region 奶茶机
/**
* 奶茶机基础PLC模型
*/
@@ -546,9 +592,9 @@ public class ConfigName {
}};
+//endregion
-
-
+ //region 配料吧台
/**
* 配料吧台基础PLC模型
*/
@@ -851,6 +897,9 @@ public class ConfigName {
}};
+ //endregion
+
+
/**
* 出料算法
*/
@@ -942,7 +991,7 @@ public class ConfigName {
/**
* 选配版本信息
*/
- public String versionSelectionEnum = "奶茶机";
+ public String versionSelectionEnum = "味魔方";
//endregion
//region 主页
diff --git a/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_SYSTEMSET.java b/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_SYSTEMSET.java
index 78ed5d73..13b2fa22 100644
--- a/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_SYSTEMSET.java
+++ b/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_SYSTEMSET.java
@@ -12,6 +12,11 @@ public class BPA_SYSTEMSET extends ModeBase{
* 2 PLC端口
* 3 门店id
* 4 设备id
+ * 20 串口波特率
+ * 21 串口数据位
+ * 22 串口校验位
+ * 23 串口停止位
+ *
*/
public int type;
//值
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java
index fe3686c0..d46c574d 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java
@@ -20,6 +20,7 @@ import com.bonait.bnframework.common.helper.MQTT;
import com.bonait.bnframework.common.helper.MediaPlayerHelper;
import com.bonait.bnframework.common.helper.MessageLog;
import com.bonait.bnframework.common.helper.ThreadManager;
+import com.bonait.bnframework.common.modbus.ModbusRTUServer;
import com.bonait.bnframework.common.modbus.ModbusTcpServer;
import com.bonait.bnframework.common.tabbar.MainNavigateTabBar;
import com.bonait.bnframework.common.utils.NetworkUtils;
@@ -126,27 +127,12 @@ public class BottomNavigationMainActivity extends BaseActivity {
@Override
public void Run() throws InterruptedException {
try {
- if (ConfigName.getInstance().PlcIsConnect) {
- //ping 不通
- boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1);
- if (!status) //ping 不通 连接
- {
- MessageLog.ShowInfo("PLC状态断开,尝试连接...");
- ConfigName.getInstance().PlcIsConnect = false;
- }
- } else {
- boolean status = ModbusTcpServer.ping2(ConfigName.getInstance().Address, 1, 1);
- if (status) {
- MessageLog.ShowInfo("设备 " + ConfigName.getInstance().Address + " PLC通讯正常,准备连接!");
- ModbusTcpServer.ConnectPLC();
- } else {
- MessageLog.ShowInfo("PLC状态断开,尝试连接...");
- ConfigName.getInstance().PlcIsConnect = false;
- }
+ if (!ConfigName.getInstance().SerialIsConnect) {
+ ModbusRTUServer.get().ConnectPLC();
}
Thread.sleep(10000);
} catch (Exception e) {
- Log.i("PLC", "PLC重连接失败!" + e.getMessage());
+ Log.i("PLC", "串口重连失败!" + e.getMessage());
}
}
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/RealTimeActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/RealTimeActivity.java
index 7394d397..9b091d2b 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/RealTimeActivity.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/RealTimeActivity.java
@@ -84,77 +84,27 @@ public class RealTimeActivity extends BaseActivity {
public void Initdata()
{
try{
-
- if (!ConfigName.getInstance().versionSelectionEnum.equals("配料吧台"))
- {
+ if (ConfigName.getInstance().versionSelectionEnum.equals("味魔方")){
DataBus.getInstance().statusModes=new ArrayList<>();
- DataBus.getInstance().statusModes.add(new StatusMode("出料口光电",R.mipmap.gd1,R.mipmap.gd2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("果糖电机(左)",R.mipmap.djcgq1,R.mipmap.djcgq2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("清洗池浮球",R.mipmap.fq1,R.mipmap.fq2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("果糖电机(右)",R.mipmap.djcgq1,R.mipmap.djcgq2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("果糖液位检测(左)",R.mipmap.fq1,R.mipmap.fq2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("果糖液位检测(右)",R.mipmap.fq1,R.mipmap.fq2,false));
-
- //16
- DataBus.getInstance().statusModes.add(new StatusMode("果糖加热(左)",R.mipmap.lcjr1,R.mipmap.lcjr2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("果糖加热(右)",R.mipmap.lcjr1,R.mipmap.lcjr2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("清洗池加热",R.mipmap.lcjr1,R.mipmap.lcjr2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("三色灯(红)",R.mipmap.ssd1,R.mipmap.ssd2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("三色灯(黄)",R.mipmap.ssd1,R.mipmap.ssd2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("三色灯(绿)",R.mipmap.ssd1,R.mipmap.ssd2,false));
+ DataBus.getInstance().statusModes.add(new StatusMode("通道一开关",R.mipmap.rdl1,R.mipmap.rdl2,false));
+ DataBus.getInstance().statusModes.add(new StatusMode("通道二开关",R.mipmap.csf1,R.mipmap.csf2,false));
+ DataBus.getInstance().statusModes.add(new StatusMode("通道三开关",R.mipmap.csf1,R.mipmap.csf2,false));
+ DataBus.getInstance().statusModes.add(new StatusMode("通道四开关",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("蠕动泵(一)",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("蠕动泵(二)",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("蠕动泵(三)",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("蠕动泵(四)",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("蠕动泵(五)",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("隔膜泵(一)",R.mipmap.lxl1,R.mipmap.lxl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("隔膜泵(二)",R.mipmap.lxl1,R.mipmap.lxl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("隔膜泵(三)",R.mipmap.lxl1,R.mipmap.lxl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("隔膜泵(四)",R.mipmap.lxl1,R.mipmap.lxl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("隔膜泵(五)",R.mipmap.lxl1,R.mipmap.lxl2,false));
+ DataBus.getInstance().statusModes.add(new StatusMode("通道五开关",R.mipmap.rdl1,R.mipmap.rdl2,false));
+ DataBus.getInstance().statusModes.add(new StatusMode("通道六开关",R.mipmap.csf1,R.mipmap.csf2,false));
+ DataBus.getInstance().statusModes.add(new StatusMode("通道七开关",R.mipmap.csf1,R.mipmap.csf2,false));
+ DataBus.getInstance().statusModes.add(new StatusMode("通道八开关",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("果糖泵(左)",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("果糖泵(右)",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("清洗剂泵",R.mipmap.lxl1,R.mipmap.lxl2,false));
-
- DataBus.getInstance().statusModes.add(new StatusMode("排水阀开",R.mipmap.csf1,R.mipmap.csf2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("排水阀关",R.mipmap.csf1,R.mipmap.csf2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("进水阀",R.mipmap.jsf1,R.mipmap.jsf2,false));
- }else
- {
- DataBus.getInstance().statusModes=new ArrayList<>();
- DataBus.getInstance().statusModes.add(new StatusMode("出料口按钮",R.mipmap.gd1,R.mipmap.gd2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("清洗池浮球",R.mipmap.fq1,R.mipmap.fq2,false));
+ DataBus.getInstance().statusModes.add(new StatusMode("通道九开关",R.mipmap.djcgq1,R.mipmap.djcgq2,false));
+ DataBus.getInstance().statusModes.add(new StatusMode("通道十开关",R.mipmap.djcgq1,R.mipmap.djcgq2,false));
+ DataBus.getInstance().statusModes.add(new StatusMode("通道十一开关",R.mipmap.djcgq1,R.mipmap.djcgq2,false));
+ DataBus.getInstance().statusModes.add(new StatusMode("通道十二开关",R.mipmap.djcgq1,R.mipmap.djcgq2,false));
+ DataBus.getInstance().statusModes.add(new StatusMode("通道十三开关",R.mipmap.djcgq1,R.mipmap.djcgq2,false));
+ DataBus.getInstance().statusModes.add(new StatusMode("通道十四开关",R.mipmap.djcgq1,R.mipmap.djcgq2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵正转(一)",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵正转(二)",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵正转(三)",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵正转(四)",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵正转(五)",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵正转(六)",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵反转(一)",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵反转(二)",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵反转(三)",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵反转(四)",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵反转(五)",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("外置仓泵反转(六)",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("粉料电机(一)",R.mipmap.djcgq1,R.mipmap.djcgq2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("粉料电机(二)",R.mipmap.djcgq1,R.mipmap.djcgq2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("粉料电机(三)",R.mipmap.djcgq1,R.mipmap.djcgq2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("酱油泵",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("醋泵",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("猪油泵",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("牛油泵",R.mipmap.rdl1,R.mipmap.rdl2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("水池进水阀",R.mipmap.jsf1,R.mipmap.jsf2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("水池排水阀",R.mipmap.csf1,R.mipmap.csf2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("猪油管道保温",R.mipmap.lcjr1,R.mipmap.lcjr2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("牛油管道保温",R.mipmap.lcjr1,R.mipmap.lcjr2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("水池加热",R.mipmap.lcjr1,R.mipmap.lcjr2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("三色灯(绿)",R.mipmap.ssd1,R.mipmap.ssd2,false));
- DataBus.getInstance().statusModes.add(new StatusMode("三色灯(红)",R.mipmap.ssd1,R.mipmap.ssd2,false));
}
Run();
@@ -192,47 +142,15 @@ public class RealTimeActivity extends BaseActivity {
@Override
public void run() {
try {
- if (!ConfigName.getInstance().versionSelectionEnum.equals("配料吧台"))
- {
- //64位
- //1.出口 0-15
- SetStatus(0,ExecuteTheRecipe.getConcurrentHash(0));
- SetStatus(1,ExecuteTheRecipe.getConcurrentHash(1));
- SetStatus(2,ExecuteTheRecipe.getConcurrentHash(2));
- SetStatus(3,ExecuteTheRecipe.getConcurrentHash(3));
- SetStatus(4,ExecuteTheRecipe.getConcurrentHash(4));
- SetStatus(5,ExecuteTheRecipe.getConcurrentHash(5));
-
- //3.
- for(int i=0;i<6;i++)//25
- {
- SetStatus(6+i,ExecuteTheRecipe.getConcurrentHash(16+i));
- }
-
- for(int i=0;i<16;i++)//25
- {
- SetStatus(12+i,ExecuteTheRecipe.getConcurrentHash(32+i));
- }
- adapter.refresh();
-
- }else
- {
- //64位
- //1.出口 0-15
- SetStatus(0,ExecuteTheRecipe.getConcurrentHash(0));
- SetStatus(1,ExecuteTheRecipe.getConcurrentHash(1));
- //3.
- for(int i=0;i<10;i++)//25
- {
- SetStatus(2+i,ExecuteTheRecipe.getConcurrentHash(16+i));
- }
-
- for(int i=0;i<16;i++)//25
- {
- SetStatus(12+i,ExecuteTheRecipe.getConcurrentHash(32+i));
- }
- adapter.refresh();
+ String sysName=ConfigName.getInstance().versionSelectionEnum;
+ switch (sysName){
+ case "味魔方":
+ for (int i=0;i<14;i++){
+ SetStatus(i,ExecuteTheRecipe.getConcurrentHash(i));
+ }
+ break;
}
+ adapter.refresh();
} catch (Exception e) {
}
}
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParameterActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParameterActivity.java
index 6f629363..6d351878 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParameterActivity.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParameterActivity.java
@@ -51,6 +51,17 @@ public class SystemParameterActivity extends BaseActivity {
EditText edittext3;
@BindView(R.id.edittext4)
EditText edittext4;
+
+ @BindView(R.id.serialBaudRate)
+ Spinner serialBaudRate;
+
+ @BindView(R.id.serialDataBits)
+ Spinner serialDataBits;
+ @BindView(R.id.serialParity)
+ Spinner serialParity;
+ @BindView(R.id.serialStopBits)
+ Spinner serialStopBits;
+
@BindView(R.id.environment)
Spinner environment;
@@ -63,6 +74,11 @@ public class SystemParameterActivity extends BaseActivity {
Map material_map = new LinkedHashMap<>();
Map material_map_vis = new LinkedHashMap<>();
+ Map baudRate_map = new LinkedHashMap<>();
+ Map dataBits_map = new LinkedHashMap<>();
+ Map parity_map = new LinkedHashMap<>();
+ Map stop_Bits = new LinkedHashMap<>();
+
/**
* 系统设置参数
*/
@@ -75,8 +91,13 @@ public class SystemParameterActivity extends BaseActivity {
context=getContext();
initTopBar();
initFragment();
- initData();
- initSelect();
+ try {
+ initData();
+ initSelect();
+ }catch (Exception e){
+
+ }
+
}
private void initTopBar() {
@@ -104,6 +125,20 @@ public class SystemParameterActivity extends BaseActivity {
material_map.put("测试环境", 1);
material_map.put("正式环境", 2);
+ baudRate_map.put("9600",0);
+ baudRate_map.put("19200",1);
+ baudRate_map.put("115200",2);
+
+ dataBits_map.put("7",0);
+ dataBits_map.put("8",1);
+
+ parity_map.put("0",0);
+ parity_map.put("1",1);
+ parity_map.put("2",2);
+
+ stop_Bits.put("1",0);
+ stop_Bits.put("2",1);
+
for (int i = 0; i < ConfigName.getInstance().versionSelectionValues.length; i++) {
material_map_vis.put(ConfigName.getInstance().versionSelectionValues[i], i);
}
@@ -117,6 +152,23 @@ public class SystemParameterActivity extends BaseActivity {
adapter1.setDropDownViewResource(R.layout.spinner_dropdown_item);
versionselection.setAdapter(adapter1);
+ ArrayAdapter adapter2 = new ArrayAdapter<>(context, R.layout.spinner_text_item, new ArrayList<>(baudRate_map.keySet()));
+ adapter2.setDropDownViewResource(R.layout.spinner_dropdown_item);
+ serialBaudRate.setAdapter(adapter2);
+
+ ArrayAdapter adapter3 = new ArrayAdapter<>(context, R.layout.spinner_text_item, new ArrayList<>(dataBits_map.keySet()));
+ adapter3.setDropDownViewResource(R.layout.spinner_dropdown_item);
+ serialDataBits.setAdapter(adapter3);
+
+ ArrayAdapter adapter4 = new ArrayAdapter<>(context, R.layout.spinner_text_item, new ArrayList<>(parity_map.keySet()));
+ adapter4.setDropDownViewResource(R.layout.spinner_dropdown_item);
+ serialParity.setAdapter(adapter4);
+
+ ArrayAdapter adapter5 = new ArrayAdapter<>(context, R.layout.spinner_text_item, new ArrayList<>(stop_Bits.keySet()));
+ adapter5.setDropDownViewResource(R.layout.spinner_dropdown_item);
+ serialStopBits.setAdapter(adapter5);
+
+
bpa_systemsets = QueryDB.GetSystemsetALL();
for (BPA_SYSTEMSET item : bpa_systemsets) {
@@ -145,7 +197,22 @@ public class SystemParameterActivity extends BaseActivity {
ConfigName.getInstance().DeviceAutoKey = item.value;
edittext4.setText(item.value);
break;
-
+ case 20:
+ ConfigName.getInstance().SerialBaudRate = Integer.parseInt(item.value);
+ serialBaudRate.setSelection(baudRate_map.get(item.value));
+ break;
+ case 21:
+ ConfigName.getInstance().SerialDataBits = Integer.parseInt(item.value);
+ serialDataBits.setSelection(dataBits_map.get(item.value));
+ break;
+ case 22:
+ ConfigName.getInstance().SerialParity = Integer.parseInt(item.value);
+ serialParity.setSelection(parity_map.get(item.value));
+ break;
+ case 23:
+ ConfigName.getInstance().SerialStopBits = Integer.parseInt(item.value);
+ serialStopBits.setSelection(stop_Bits.get(item.value));
+ break;
}
}
}
@@ -200,6 +267,9 @@ public class SystemParameterActivity extends BaseActivity {
set_vis.deviceID = ConfigName.getInstance().DeviceId;
set_vis.userID = ConfigName.getInstance().user.userID;
QueryDB.AddSystemset(set_vis);
+
+ saveSerialParam();
+
if (isgb) {
ConfigData.getInstance().RevertPLCProcess();
}
@@ -210,6 +280,37 @@ public class SystemParameterActivity extends BaseActivity {
}
//-------------------------配置viewPager与fragment关联----------------------------//
+ /**保存串口设置参数*/
+ private void saveSerialParam(){
+ BPA_SYSTEMSET set_baudrate = new BPA_SYSTEMSET();
+ set_baudrate.type = 20;
+ set_baudrate.value =serialBaudRate.getSelectedItem().toString();
+ set_baudrate.deviceID = ConfigName.getInstance().DeviceId;
+ set_baudrate.userID = ConfigName.getInstance().user.userID;
+ QueryDB.AddSystemset(set_baudrate);
+
+ BPA_SYSTEMSET set_dataBits = new BPA_SYSTEMSET();
+ set_dataBits.type = 21;
+ set_dataBits.value = serialDataBits.getSelectedItem().toString();
+ set_dataBits.deviceID = ConfigName.getInstance().DeviceId;
+ set_dataBits.userID = ConfigName.getInstance().user.userID;
+ QueryDB.AddSystemset(set_dataBits);
+
+ BPA_SYSTEMSET set_parity = new BPA_SYSTEMSET();
+ set_parity.type = 22;
+ set_parity.value =serialParity.getSelectedItem().toString();
+ set_parity.deviceID = ConfigName.getInstance().DeviceId;
+ set_parity.userID = ConfigName.getInstance().user.userID;
+ QueryDB.AddSystemset(set_parity);
+
+ BPA_SYSTEMSET set_stopBits = new BPA_SYSTEMSET();
+ set_stopBits.type = 23;
+ set_stopBits.value = serialStopBits.getSelectedItem().toString();
+ set_stopBits.deviceID = ConfigName.getInstance().DeviceId;
+ set_stopBits.userID = ConfigName.getInstance().user.userID;
+ QueryDB.AddSystemset(set_stopBits);
+ }
+
@Override
public void onDestroy() {
super.onDestroy();
diff --git a/app/src/main/res/layout/activity_systemparameter.xml b/app/src/main/res/layout/activity_systemparameter.xml
index 1ddd2cb2..7332631f 100644
--- a/app/src/main/res/layout/activity_systemparameter.xml
+++ b/app/src/main/res/layout/activity_systemparameter.xml
@@ -32,7 +32,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
- android:layout_margin="5dp">
+ android:layout_margin="5dp" android:visibility="gone">
+
+
+
+
+
+
+
+
+
+
+
+
+
+
最多选择%d个文件
保存本地%s
-
-
+ 欢迎使用
请输入用户名
+ 请输入密码
+ 记住密码
+ 忘记密码?
+ 登录
+
+
+
+ 功能
+ 料仓管理(绑定物料)
+ 配方管理
+ 日志管理
+ 基础数据管理
+ 实时监控管理
+
+
+
-
-
+
+ 串口波特率:
+ 串口数据位:
+ 串口校验位:
+ 串口停止位:
+ 软件初始化加载中,请稍候...
+ 一键满管
+ 一键加满
+ 一键清洗
+ 一键设置
+ 点击料仓图形设置或控制料仓
+ 料仓物料低于最低值会警示