diff --git a/app/build.gradle b/app/build.gradle
index 9dccfee8..f501acfc 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -152,9 +152,9 @@ dependencies {
//轮播图
implementation 'com.youth.banner:banner:1.4.10'
- //图片加载
- implementation 'com.github.bumptech.glide:glide:4.11.0'
- annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
+// //图片加载
+// implementation 'com.github.bumptech.glide:glide:4.11.0'
+// annotationProcessor 'com.github.bumptech.glide:compiler:4.11.0'
implementation 'com.yanzhenjie:permission:2.0.0-rc12'
@@ -198,4 +198,8 @@ dependencies {
//leak 内存泄漏检测
debugImplementation 'com.squareup.leakcanary:leakcanary-android:2.0-alpha-3'
+
+ //腾讯bugly
+ //sdk地址 https://bugly.qq.com/docs/user-guide/instruction-manual-android/?v=1.0.0
+ implementation 'com.tencent.bugly:crashreport:latest.release' //其中latest.release指代最新Bugly SDK版本号,也可以指定明确的版本号,例如4.0.3
}
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index f3a3ebf6..609100f3 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -37,9 +37,9 @@
android:name=".ViewModel.ActivityViewModel.DiyUpdate1Activity"
android:screenOrientation="portrait"
android:exported="false" />
+
res = ReadShort(statusModel.PlcAddress,1);
if(res.isSuccess){
- statusModel.Value.setValue(res.Content);
+// statusModel.Value.setValue(res.Content);
+ byte[] bytes = DataConvertLib.shorts2Bytes(res.Content);
+ if(bytes.length>=2){
+ deviceErrorCode = bytes[0] & 0xFF;
+ }
}
-
-
Thread.sleep(ConfigName.TEST?2000:200);
});
}
+
+ private int deviceErrorCode = 0;
+
+ public int getDeviceErrorCode() {
+ return deviceErrorCode;
+ }
+
+ public void setDeviceErrorCode(int deviceErrorCode) {
+ this.deviceErrorCode = deviceErrorCode;
+ }
+
+ public boolean getDisconnect(){
+ return isDisconnect;
+ }
}
diff --git a/app/src/main/java/com/bonait/bnframework/ViewModel/CustomView/item_gx.java b/app/src/main/java/com/bonait/bnframework/ViewModel/CustomView/item_gx.java
index 94da7960..da86092f 100644
--- a/app/src/main/java/com/bonait/bnframework/ViewModel/CustomView/item_gx.java
+++ b/app/src/main/java/com/bonait/bnframework/ViewModel/CustomView/item_gx.java
@@ -9,4 +9,14 @@ public class item_gx {
public String data;
public boolean IsWL=false;
+
+ @Override
+ public String toString() {
+ return "item_gx{" +
+ "name='" + name + '\'' +
+ ", datatype=" + datatype +
+ ", data='" + data + '\'' +
+ ", IsWL=" + IsWL +
+ '}';
+ }
}
diff --git a/app/src/main/java/com/bonait/bnframework/ViewModel/FragmentViewModel/HomeDeviceFragment.java b/app/src/main/java/com/bonait/bnframework/ViewModel/FragmentViewModel/HomeDeviceFragment.java
index 539ec96b..3bcac745 100644
--- a/app/src/main/java/com/bonait/bnframework/ViewModel/FragmentViewModel/HomeDeviceFragment.java
+++ b/app/src/main/java/com/bonait/bnframework/ViewModel/FragmentViewModel/HomeDeviceFragment.java
@@ -1,8 +1,5 @@
package com.bonait.bnframework.ViewModel.FragmentViewModel;
-import static com.bonait.bnframework.MainApplication.getContext;
-import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
-
import android.annotation.SuppressLint;
import android.graphics.Color;
import android.os.Bundle;
@@ -20,22 +17,15 @@ import android.widget.ArrayAdapter;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
-import androidx.core.content.ContextCompat;
import com.apkfuns.logutils.LogUtils;
-import com.bonait.bnframework.HBL.DataUtil.DataConvertLib;
import com.bonait.bnframework.HBL.DataUtil.ErrorCodeManager;
-import com.bonait.bnframework.HBL.DataUtil.NotifyPropVar;
import com.bonait.bnframework.HBL.Interface.IRunT;
-import com.bonait.bnframework.HBL.Result.OperateResultT;
import com.bonait.bnframework.HBL.Thread.ThreadManager;
import com.bonait.bnframework.Model.ErrorCodeBean;
import com.bonait.bnframework.R;
-import com.bonait.bnframework.Service.ControlAdress;
import com.bonait.bnframework.Service.ModbusHelper;
-import com.bonait.bnframework.Service.PLCModel;
import com.bonait.bnframework.common.base.BaseFragment;
-import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.databinding.FragmentHomeDeviceBinding;
@@ -58,8 +48,7 @@ public class HomeDeviceFragment extends BaseFragment {
private List mainFoodList;
private int seasoningPos = -1;
private int mainFoodPos = -1;
- private static final int MSG_UPDATE_STATUS = 1;
- private static final int MSG_UPDATE_ERROR_CODE = 2;
+ private static final int MSG_FRESH_DEVICE = 1000;
@@ -69,18 +58,17 @@ public class HomeDeviceFragment extends BaseFragment {
public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
switch (msg.what){
- case MSG_UPDATE_STATUS:
- boolean status = (boolean) msg.obj;
- changeTextDeviceStatus(2,status?"掉线":"在线");
-
- break;
- case MSG_UPDATE_ERROR_CODE:
- int code = (int) msg.obj;
+ case MSG_FRESH_DEVICE:
+ if(hasMessages(MSG_FRESH_DEVICE)){
+ removeMessages(MSG_FRESH_DEVICE);
+ }
+ sendEmptyMessageDelayed(MSG_FRESH_DEVICE,500);
for(ErrorCodeBean bean : ErrorCodeManager.getInstance().getDataBeans()){
- if(bean.getCode() == code){
+ if(bean.getCode() == ModbusHelper.get().getDeviceErrorCode()){
changeTextDeviceStatus(1,bean.getName()+" "+bean.getDescription());
}
}
+ changeTextDeviceStatus(2,ModbusHelper.get().getConnected()?"在线":"掉线");
break;
}
}
@@ -121,87 +109,13 @@ public class HomeDeviceFragment extends BaseFragment {
mainFoodList.add("主料仓4(投料4)");
mainFoodList.add("主料仓5(投料5)");
mainFoodList.add("主料仓6(投料6)");
- handler.post(() -> {
- try {
- PLCModel statusModel = ModbusHelper.get().controlAddress.get(ControlAdress.状态读取);
-// ModbusHelper.get().WriteBool(ModbusHelper.get().getPLC(ControlAdress.状态读取启动).PlcAddress,true);
- OperateResultT res = ModbusHelper.get().ReadShort(statusModel.PlcAddress,1);
- byte[] bytes = DataConvertLib.shorts2Bytes(res.Content);
- if(bytes.length>=2){
- progressFire = bytes[1] & 0xFF;
- }
- if(!release){
- viewBinding.fireProgress.setValue(progressFire,true);
- }
+ if(handler.hasMessages(MSG_FRESH_DEVICE)){
+ handler.removeMessages(MSG_FRESH_DEVICE);
+ }
+ handler.sendEmptyMessageDelayed(MSG_FRESH_DEVICE,500);
- PLCModel statusModel2 = ModbusHelper.get().controlAddress.get(ControlAdress.搅拌档位);
- OperateResultT res2 = ModbusHelper.get().ReadShort(statusModel2.PlcAddress,1);
- byte[] bytes2 = DataConvertLib.shorts2Bytes(res2.Content);
- progressStir = bytes2[0] & 0xFF;
- if(!release){
- viewBinding.stirProgress.setValue(progressStir,true);
- }
- LogUtils.d("HomeDeviceFragment initData progressFire="+progressFire +" progressStir="+progressStir);
- }catch (Exception e){
- LogUtils.d(e.getMessage()+"");
- }
- });
- NotifyPropVar notifyPropVar1 = (NotifyPropVar)ModbusHelper.get().getPLC(ControlAdress.状态读取).Value;
- notify1 = new IRunT() {
- @Override
- public void Run(short[] shorts) {
- byte[] bytes = DataConvertLib.shorts2Bytes(shorts);
- String result = DataConvertLib.bytesToString(bytes);
- if(ConfigName.LOG_TEST){
- LogUtils.d("HomeDeviceFragment result="+result +" bytes.length="+bytes.length);
- }
- if(handler!=null){
- if(ErrorCodeManager.getInstance().getDataBeans()!=null){
- int code = 0;
- if(bytes.length>=2){
- code = bytes[0] & 0xFF;
- if(ConfigName.LOG_TEST){
- LogUtils.d("HomeDeviceFragment code="+code );
- }
- }
- Message message = new Message();
- message.what = MSG_UPDATE_ERROR_CODE;
- message.obj = code;
- if(handler.hasMessages(MSG_UPDATE_ERROR_CODE)){
- handler.removeMessages(MSG_UPDATE_ERROR_CODE);
- }
- handler.sendMessageDelayed(message,500);
- }
- }
- }
- };
- if(notifyPropVar1!=null){
- notifyPropVar1.Register(HomeDeviceFragment.class.getSimpleName(), notify1);
- }
-
- NotifyPropVar notifyPropVar = (NotifyPropVar)ModbusHelper.get().getPLC(ControlAdress.掉线标志).Value;
- notify = new IRunT() {
- @Override
- public void Run(Boolean status) {
- if(ConfigName.LOG_TEST){
- LogUtils.d("HomeDeviceFragment status="+status );
- }
- if(handler!=null){
- Message message = new Message();
- message.what = 1;
- message.obj = status;
- if(handler.hasMessages(MSG_UPDATE_STATUS)){
- handler.removeMessages(MSG_UPDATE_STATUS);
- }
- handler.sendMessageDelayed(message,500);
- }
- }
- };
- if(notifyPropVar!=null){
- notifyPropVar.Register(HomeDeviceFragment.class.getSimpleName(), notify);
- }
}
private void initView(){
diff --git a/app/src/main/java/com/bonait/bnframework/common/db/util/GoodsProcessDetailDBUtil.java b/app/src/main/java/com/bonait/bnframework/common/db/util/GoodsProcessDetailDBUtil.java
index a88d24ab..0a978243 100644
--- a/app/src/main/java/com/bonait/bnframework/common/db/util/GoodsProcessDetailDBUtil.java
+++ b/app/src/main/java/com/bonait/bnframework/common/db/util/GoodsProcessDetailDBUtil.java
@@ -74,14 +74,14 @@ public class GoodsProcessDetailDBUtil {
public static ArrayList getByGroupId(String groupId) {
String orderby = QueryDB.Desc_Sort_Up + ',' + QueryDB.Desc_Time_Up;
String where = "goodsSubAttributeGroupId=?";
- String[] args = new String[]{"0", groupId};
+ String[] args = new String[]{groupId};
ArrayList data = new ArrayList<>();
ArrayList