From b10d7ad81c57587405e439c57b3971d6d2f1b4df Mon Sep 17 00:00:00 2001
From: liup <1454939542@qq.com>
Date: Sat, 12 Oct 2024 17:14:54 +0800
Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E5=BC=80=E9=97=A8=E9=80=9F?=
=?UTF-8?q?=E5=BA=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/easycode.ignore | 13 +
.idea/git_toolbox_blame.xml | 6 +
app/release/output-metadata.json | 6 +-
.../bnframework/business/ConfigData.java | 3 +
.../bonait/bnframework/business/MainInit.java | 6 +-
.../common/constant/ConfigName.java | 6 +
.../dialog/control/OvenControlDialog.java | 1 +
.../fragment/main/HomeMainsFragment.java | 2 +-
.../fragment/setting/SceneSetFragment.java | 125 +++++++++-
.../main/res/layout/fragment_scene_set.xml | 232 +++++++++++++++---
.../new/layout/dialog_oven_door_tip.xml | 90 +++++++
build.gradle | 4 +-
12 files changed, 449 insertions(+), 45 deletions(-)
create mode 100644 .idea/easycode.ignore
create mode 100644 .idea/git_toolbox_blame.xml
create mode 100644 app/src/main/res/layout/new/layout/dialog_oven_door_tip.xml
diff --git a/.idea/easycode.ignore b/.idea/easycode.ignore
new file mode 100644
index 00000000..be585df4
--- /dev/null
+++ b/.idea/easycode.ignore
@@ -0,0 +1,13 @@
+node_modules/
+dist/
+vendor/
+cache/
+.*/
+*.min.*
+*.test.*
+*.spec.*
+*.bundle.*
+*.bundle-min.*
+*.*.js
+*.*.ts
+*.log
diff --git a/.idea/git_toolbox_blame.xml b/.idea/git_toolbox_blame.xml
new file mode 100644
index 00000000..7dc12496
--- /dev/null
+++ b/.idea/git_toolbox_blame.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/release/output-metadata.json b/app/release/output-metadata.json
index 3b4c47a8..0bf6d0dd 100644
--- a/app/release/output-metadata.json
+++ b/app/release/output-metadata.json
@@ -11,9 +11,9 @@
"type": "SINGLE",
"filters": [],
"attributes": [],
- "versionCode": 105,
- "versionName": "1.0.5",
- "outputFile": "shmz-xiaochao-v105-202410090954-unsigned-release.apk"
+ "versionCode": 106,
+ "versionName": "1.0.6",
+ "outputFile": "shmz-xiaochao-v106-202410121437-unsigned-release.apk"
}
],
"elementType": "File"
diff --git a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java
index a4c913fa..1727a43e 100644
--- a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java
+++ b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java
@@ -52,6 +52,7 @@ import com.bonait.bnframework.common.model.mode.UpdateBomInfo;
import com.bonait.bnframework.common.model.mode.UpdateCloudGood;
import com.bonait.bnframework.common.oss.OssHelper;
import com.bonait.bnframework.common.utils.NetworkUtils;
+import com.bonait.bnframework.common.utils.PreferenceUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.common.view.GoodEditDialog;
import com.bonait.bnframework.newui.http.UpdateDataService;
@@ -121,10 +122,12 @@ public class ConfigData {
if(systemset.type==-203){
ConfigName.getInstance().Key = systemset.value;
UpdateDataService.key = systemset.value;
+ PreferenceUtils.setString(ConfigName.serviceKey,systemset.value);
}else if(systemset.type==-100){
ConfigName.getInstance().versionSelectionEnum = systemset.value;
}else if(systemset.type==-101){
ConfigName.getInstance().DeviceAutoKey = systemset.value;
+ PreferenceUtils.setString(ConfigName.deviceNumber,systemset.value);
}
}
// for(BPA_SYSTEMSET item:bpa_systemsets)
diff --git a/app/src/main/java/com/bonait/bnframework/business/MainInit.java b/app/src/main/java/com/bonait/bnframework/business/MainInit.java
index 558b8a9d..958f0936 100644
--- a/app/src/main/java/com/bonait/bnframework/business/MainInit.java
+++ b/app/src/main/java/com/bonait/bnframework/business/MainInit.java
@@ -62,7 +62,8 @@ public class MainInit {
*/
public static void Init(Application app)
{
-
+// 配置sharedPreferences
+ PreferenceUtils.initPreference(app, AppUtils.getAppName(app), Activity.MODE_PRIVATE);
//1.设置程序active,初始化Main函数进程,初始化消息日志
InitMsgLog();
@@ -80,8 +81,7 @@ public class MainInit {
// 全局配置OkGo
initOkGo(app);
- // 配置sharedPreferences
- PreferenceUtils.initPreference(app, AppUtils.getAppName(app), Activity.MODE_PRIVATE);
+
// 初始化通知栏消息渠道
MainNotification.initNotificationChannel(app);
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 938d0b72..3ed123f2 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
@@ -330,6 +330,12 @@ public class ConfigName {
add(new Res_PLCADDRESS("烤箱关门成功", "M100.0", 1, 0,3));
add(new Res_PLCADDRESS("烤箱关门故障", "M100.1", 1, 0,3));
+ add(new Res_PLCADDRESS("自动关门快速", "VW500", 0, 1,3));
+ add(new Res_PLCADDRESS("自动关门慢速", "VW502", 0, 1,3));
+ add(new Res_PLCADDRESS("自动开门速度", "VW504", 0, 1,3));
+ add(new Res_PLCADDRESS("手动强制开门", "M5.0", 0, 1,3));
+ add(new Res_PLCADDRESS("手动强制关门", "M5.1", 0, 1,3));
+ add(new Res_PLCADDRESS("手动烤箱门速度", "VW510", 0, 1,3));
}};
/**
diff --git a/app/src/main/java/com/bonait/bnframework/newui/dialog/control/OvenControlDialog.java b/app/src/main/java/com/bonait/bnframework/newui/dialog/control/OvenControlDialog.java
index 07c56bd6..b25398c7 100644
--- a/app/src/main/java/com/bonait/bnframework/newui/dialog/control/OvenControlDialog.java
+++ b/app/src/main/java/com/bonait/bnframework/newui/dialog/control/OvenControlDialog.java
@@ -29,6 +29,7 @@ import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.common.utils.PreferenceUtils;
import com.bonait.bnframework.databinding.DialogOvenControlBinding;
+import com.bonait.bnframework.databinding.DialogOvenDoorTipBinding;
import com.bonait.bnframework.databinding.DialogTipBinding;
import com.bonait.bnframework.modbus.ModbusCenter;
import com.bonait.bnframework.modbus.OvenModbusTcpServer;
diff --git a/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeMainsFragment.java b/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeMainsFragment.java
index ee848b83..8d871dfc 100644
--- a/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeMainsFragment.java
+++ b/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeMainsFragment.java
@@ -108,7 +108,7 @@ public class HomeMainsFragment extends BaseFragment {
});
binding.llSetting.setOnClickListener(v->{
- if(!ConfigName.getInstance().user.name.equals("管理员")){
+ if(!ConfigName.getInstance().user.name.contains("管理员")){
NewToastUtil.getInstance().showToast("管理员才能进行操作");
return;
}
diff --git a/app/src/main/java/com/bonait/bnframework/newui/fragment/setting/SceneSetFragment.java b/app/src/main/java/com/bonait/bnframework/newui/fragment/setting/SceneSetFragment.java
index b61f3f21..2a816afa 100644
--- a/app/src/main/java/com/bonait/bnframework/newui/fragment/setting/SceneSetFragment.java
+++ b/app/src/main/java/com/bonait/bnframework/newui/fragment/setting/SceneSetFragment.java
@@ -2,17 +2,21 @@ package com.bonait.bnframework.newui.fragment.setting;
import static com.lzy.okgo.utils.HttpUtils.runOnUiThread;
+import android.annotation.SuppressLint;
import android.os.Bundle;
import android.view.LayoutInflater;
+import android.view.MotionEvent;
import android.view.View;
import android.widget.ArrayAdapter;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
+import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.HBL.Thread.ThreadManager;
import com.bonait.bnframework.MainApplication;
import com.bonait.bnframework.R;
+import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.db.QueryDB;
@@ -23,14 +27,18 @@ import com.bonait.bnframework.common.db.mode.BPA_ORDER_LIST;
import com.bonait.bnframework.common.db.mode.BPA_ORDER_RECORD;
import com.bonait.bnframework.common.db.mode.BPA_SUBORDER_RECORD;
import com.bonait.bnframework.common.db.mode.BPA_SYSTEMSET;
+import com.bonait.bnframework.common.helper.I.IWriteCallBack;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.DisplayManager;
+import com.bonait.bnframework.common.utils.NetworkUtils;
import com.bonait.bnframework.common.utils.PreferenceUtils;
import com.bonait.bnframework.databinding.DialogTipBinding;
import com.bonait.bnframework.databinding.FragmentSceneSetBinding;
+import com.bonait.bnframework.modbus.ModbusCenter;
import com.bonait.bnframework.newui.http.UpdateDataService;
import com.bonait.bnframework.newui.viewmodel.HomeGoodsViewModel;
import com.bonait.bnframework.newui.widget.NewToastUtil;
+import com.bonait.bnframework.newui.widget.WaitProcessUtil;
import java.util.ArrayList;
import java.util.List;
@@ -60,6 +68,7 @@ public class SceneSetFragment extends BaseFragment {
initView();
}
+ @SuppressLint("ClickableViewAccessibility")
private void initView(){
ArrayAdapter spinnerAdapter = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, environmentList);
spinnerAdapter.setDropDownViewResource(R.layout.spinner_dropdown_item);
@@ -105,6 +114,7 @@ public class SceneSetFragment extends BaseFragment {
PreferenceUtils.setString(ConfigName.serviceKey,viewBinding.editKey.getText().toString());
PreferenceUtils.setString(ConfigName.deviceNumber,viewBinding.editDeviceNumber.getText().toString());
PreferenceUtils.setBoolean(ConfigName.rootTip,viewBinding.zijianSwitch.isChecked());
+
NewToastUtil.getInstance().showToast("保存成功");
ConfigName.getInstance().DeviceAutoKey = viewBinding.editDeviceNumber.getText().toString();
@@ -126,11 +136,61 @@ public class SceneSetFragment extends BaseFragment {
ConfigName.getInstance().versionSelectionEnum = viewBinding.spinnerVersion.getSelectedItem().toString();
BPA_SYSTEMSET set_main1 = new BPA_SYSTEMSET();
- set_main4.type = -100;
- set_main4.value = ConfigName.getInstance().versionSelectionEnum;
- set_main4.deviceID = ConfigName.getInstance().DeviceId;
- set_main4.userID = ConfigName.getInstance().user.userID;
+ set_main1.type = -100;
+ set_main1.value = ConfigName.getInstance().versionSelectionEnum;
+ set_main1.deviceID = ConfigName.getInstance().DeviceId;
+ set_main1.userID = ConfigName.getInstance().user.userID;
QueryDB.AddSystemset(set_main1);
+
+ short speed1 = Short.parseShort(viewBinding.editAutoCloseFast.getText().toString());
+ short speed2 = Short.parseShort(viewBinding.editAutoCloseSlow.getText().toString());
+ short speed3 = Short.parseShort(viewBinding.editAutoOpen.getText().toString());
+ short speed4 = Short.parseShort(viewBinding.editShoudongSpeed.getText().toString());
+
+ ModbusCenter.ovenWritePlc("自动关门快速",speed1, new IWriteCallBack() {
+ @Override
+ public void onSuccess() {
+ NewToastUtil.getInstance().showToast("速度写入成功");
+ }
+
+ @Override
+ public void onFailure(String ErrorMsg) {
+ NewToastUtil.getInstance().showToast("自动关门快速速度写入失败");
+ }
+ });
+ ModbusCenter.ovenWritePlc("自动关门慢速",speed2, new IWriteCallBack() {
+ @Override
+ public void onSuccess() {
+ NewToastUtil.getInstance().showToast("速度写入成功");
+ }
+
+ @Override
+ public void onFailure(String ErrorMsg) {
+ NewToastUtil.getInstance().showToast("自动关门慢速速度写入失败");
+ }
+ });
+ ModbusCenter.ovenWritePlc("自动开门速度", speed3, new IWriteCallBack() {
+ @Override
+ public void onSuccess() {
+ NewToastUtil.getInstance().showToast("速度写入成功");
+ }
+
+ @Override
+ public void onFailure(String ErrorMsg) {
+ NewToastUtil.getInstance().showToast("自动开门速度速度写入失败");
+ }
+ });
+ ModbusCenter.ovenWritePlc("手动烤箱门速度", speed4, new IWriteCallBack() {
+ @Override
+ public void onSuccess() {
+ NewToastUtil.getInstance().showToast("速度写入成功");
+ }
+
+ @Override
+ public void onFailure(String ErrorMsg) {
+ NewToastUtil.getInstance().showToast("手动烤箱门速度速度写入失败");
+ }
+ });
});
viewBinding.btnClearLog.setOnClickListener(v->{
@@ -171,6 +231,46 @@ public class SceneSetFragment extends BaseFragment {
});
});
});
+
+ viewBinding.btnShoudongOpenOven.setOnTouchListener((view, motionEvent) -> {
+ if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
+ ModbusCenter.ovenWritePlc("手动强制开门", true, new IWriteCallBack() {
+ @Override
+ public void onSuccess() {
+ NewToastUtil.getInstance().showToast("手动强制开门中");
+ }
+
+ @Override
+ public void onFailure(String ErrorMsg) {
+
+ }
+ });
+ } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
+ ModbusCenter.ovenWritePlc("手动强制开门",false,null);
+ }
+ return false;
+ });
+ viewBinding.btnShoudongCloseOven.setOnTouchListener(new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View view, MotionEvent motionEvent) {
+ if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
+ ModbusCenter.ovenWritePlc("手动强制关门",true, new IWriteCallBack() {
+ @Override
+ public void onSuccess() {
+ NewToastUtil.getInstance().showToast("手动强制关门");
+ }
+
+ @Override
+ public void onFailure(String ErrorMsg) {
+
+ }
+ });
+ } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
+ ModbusCenter.ovenWritePlc("手动强制关门",false,null);
+ }
+ return false;
+ }
+ });
}
private void initData(){
@@ -182,5 +282,22 @@ public class SceneSetFragment extends BaseFragment {
versionList.clear();
versionList.add("一拖二");
versionList.add("一拖二不带输送线");
+
+
+ try {
+ short speed1 = (short) ModbusCenter.ovenReadPlc("自动关门快速");
+ short speed2 = (short) ModbusCenter.ovenReadPlc("自动关门慢速");
+ short speed3 = (short) ModbusCenter.ovenReadPlc("自动开门速度");
+ short speed4 = (short) ModbusCenter.ovenReadPlc("手动烤箱门速度");
+
+ viewBinding.editAutoCloseFast.setText(speed1+"");
+ viewBinding.editAutoCloseSlow.setText(speed2+"");
+ viewBinding.editAutoOpen.setText(speed3+"");
+ viewBinding.editShoudongSpeed.setText(speed4+"");
+ }catch (Exception e){
+ e.printStackTrace();
+ NewToastUtil.getInstance().showToastError("获取速度参数失败");
+ }
+
}
}
diff --git a/app/src/main/res/layout/fragment_scene_set.xml b/app/src/main/res/layout/fragment_scene_set.xml
index 2828f612..303cae8a 100644
--- a/app/src/main/res/layout/fragment_scene_set.xml
+++ b/app/src/main/res/layout/fragment_scene_set.xml
@@ -109,6 +109,7 @@
-
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+ android:background="@drawable/bg_round15_yellow_btn"
+ android:text="烤箱:手动强制开门"
+ android:textColor="@color/white"
+ android:textSize="32sp"/>
-