Browse Source

1. 修改下位控制逻辑。2. 修改实时监控显示。3. 修改系统参数配置。

味魔方Android
Nah 1 year ago
parent
commit
894c3212a1
13 changed files with 362 additions and 247 deletions
  1. +0
    -3
      .idea/.gitignore
  2. +0
    -6
      .idea/compiler.xml
  3. +0
    -20
      .idea/gradle.xml
  4. +5
    -10
      .idea/jarRepositories.xml
  5. +0
    -4
      .idea/misc.xml
  6. +26
    -17
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  7. +105
    -56
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  8. +5
    -0
      app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_SYSTEMSET.java
  9. +4
    -18
      app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java
  10. +23
    -105
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/RealTimeActivity.java
  11. +104
    -3
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParameterActivity.java
  12. +61
    -1
      app/src/main/res/layout/activity_systemparameter.xml
  13. +29
    -4
      app/src/main/res/values/strings.xml

+ 0
- 3
.idea/.gitignore View File

@@ -1,3 +0,0 @@
# Default ignored files
/shelf/
/workspace.xml

+ 0
- 6
.idea/compiler.xml View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>

+ 0
- 20
.idea/gradle.xml View File

@@ -1,20 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="gradleJvm" value="Android Studio default JDK" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

+ 5
- 10
.idea/jarRepositories.xml View File

@@ -11,6 +11,11 @@
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://maven.aliyun.com/nexus/content/repositories/releases/" />
</remote-repository>
<remote-repository>
<option name="id" value="BintrayJCenter" />
<option name="name" value="BintrayJCenter" />
@@ -26,15 +31,5 @@
<option name="name" value="Google" />
<option name="url" value="https://dl.google.com/dl/android/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="MavenRepo" />
<option name="name" value="MavenRepo" />
<option name="url" value="https://repo.maven.apache.org/maven2/" />
</remote-repository>
<remote-repository>
<option name="id" value="maven2" />
<option name="name" value="maven2" />
<option name="url" value="https://maven.aliyun.com/nexus/content/repositories/releases/" />
</remote-repository>
</component>
</project>

+ 0
- 4
.idea/misc.xml View File

@@ -1,4 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK" />
</project>

+ 26
- 17
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

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


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

@@ -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<String, BPA_PLCADDRESS> PLC_Address = new ConcurrentHashMap<String, BPA_PLCADDRESS>();


//region 味魔方
/**
* 奶茶机基础PLC模型
* 味魔方基础PLC模型
*/
public List<Res_PLCADDRESS> PlcAddress_味魔方 = new ArrayList<Res_PLCADDRESS>() {{

//通道校准
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<ResSilosModel> Silos_味魔方 = new ArrayList<ResSilosModel>() {{
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<Res_PLCADDRESS1> PlcAddress_味魔方_手动=new ArrayList<Res_PLCADDRESS1>(){{
//
// 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 主页


+ 5
- 0
app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_SYSTEMSET.java View File

@@ -12,6 +12,11 @@ public class BPA_SYSTEMSET extends ModeBase{
* 2 PLC端口
* 3 门店id
* 4 设备id
* 20 串口波特率
* 21 串口数据位
* 22 串口校验位
* 23 串口停止位
*
*/
public int type;
//值


+ 4
- 18
app/src/main/java/com/bonait/bnframework/modules/home/activity/BottomNavigationMainActivity.java View File

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



+ 23
- 105
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/RealTimeActivity.java View File

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


+ 104
- 3
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParameterActivity.java View File

@@ -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<String, Integer> material_map = new LinkedHashMap<>();
Map<String, Integer> material_map_vis = new LinkedHashMap<>();

Map<String, Integer> baudRate_map = new LinkedHashMap<>();
Map<String, Integer> dataBits_map = new LinkedHashMap<>();
Map<String, Integer> parity_map = new LinkedHashMap<>();
Map<String, Integer> 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<String> 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<String> 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<String> 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<String> 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();


+ 61
- 1
app/src/main/res/layout/activity_systemparameter.xml View File

@@ -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">
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
@@ -69,7 +69,67 @@
android:textSize="12dp"
android:text="0"/>
</TableRow>
<!--#region 串口参数设置-->
<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp">
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="@string/serialBaudRate" />
<Spinner
android:id="@+id/serialBaudRate"
style="@style/commonSpinnerStyle"
android:layout_width="80dp"
android:layout_height="24dp"
android:layout_centerVertical="true" />
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="@string/serialDataBits" />
<Spinner
android:id="@+id/serialDataBits"
style="@style/commonSpinnerStyle"
android:layout_width="80dp"
android:layout_height="24dp"
android:layout_centerVertical="true" />
</TableRow>

<TableRow
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp">
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="@string/serialParity" />
<Spinner
android:id="@+id/serialParity"
style="@style/commonSpinnerStyle"
android:layout_width="80dp"
android:layout_height="24dp"
android:layout_centerVertical="true" />
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView
android:layout_marginLeft="@dimen/dp_10"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="right"
android:text="@string/serialStopBits" />
<Spinner
android:id="@+id/serialStopBits"
style="@style/commonSpinnerStyle"
android:layout_width="80dp"
android:layout_height="24dp"
android:layout_centerVertical="true" />
</TableRow>
<!--#endregion-->
<!-- Table2-->
<TableRow
android:layout_width="wrap_content"


+ 29
- 4
app/src/main/res/values/strings.xml View File

@@ -9,13 +9,38 @@
<string name="file_select_max">最多选择%d个文件</string>
<string name="file_select_res1">保存本地%s</string>


<!-- TODO: Remove or change this placeholder text -->
<string name="welcome_use">欢迎使用</string>
<string name="user_account">请输入用户名</string>
<string name="user_password">请输入密码</string>
<string name="remember_pwd">记住密码</string>
<string name="forget_pwd">忘记密码?</string>
<string name="login">登录</string>

<!--#region 菜单-->
<!--#region 菜单——功能 -->
<string name="menu_func">功能</string>
<string name="menu_func_siloManagement">料仓管理(绑定物料)</string>
<string name="menu_func_RecipeManagement">配方管理</string>
<string name="menu_func_LogManagement">日志管理</string>
<string name="menu_func_BaseDataManagement">基础数据管理</string>
<string name="menu_func_RealTimeMonitorManagement">实时监控管理</string>

<!--#endregion-->


<!-- TODO: 系统设置 -->

<!-- TODO: 物料表格设置 -->
<!--#endregion-->
<string name="serialBaudRate">串口波特率:</string>
<string name="serialDataBits">串口数据位:</string>
<string name="serialParity">串口校验位:</string>
<string name="serialStopBits">串口停止位:</string>

<string name="app_initing">软件初始化加载中,请稍候...</string>
<string name="func_one_button_full_pipe">一键满管</string>
<string name="func_one_button_full_tank">一键加满</string>
<string name="func_one_button_clean">一键清洗</string>
<string name="func_one_button_setup">一键设置</string>
<string name="func_msg_one">点击料仓图形设置或控制料仓</string>
<string name="func_msg_two">料仓物料低于最低值会警示</string>

</resources>

Loading…
Cancel
Save