From c1078edbe8b8212f1d0258317d18a2f701966053 Mon Sep 17 00:00:00 2001
From: liup <1454939542@qq.com>
Date: Mon, 16 Dec 2024 12:46:50 +0800
Subject: [PATCH] =?UTF-8?q?=E5=BC=B9=E7=AA=97=E4=BF=AE=E6=94=B9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/other.xml | 329 --------------
.../bonait/bnframework/business/MainInit.java | 3 +-
.../common/constant/ConfigName.java | 61 +--
.../common/utils/DisplayManager.java | 3 -
.../bnframework/modbus/ModbusCenter.java | 36 +-
.../bnframework/modbus/ModbusTcpHelper.java | 2 +-
.../newui/activity/DiyProcessHActivity.java | 20 +-
.../newui/activity/MainHActivity.java | 373 +++------------
.../newui/adapter/order/WokNameAdapter.java | 56 +++
.../newui/dialog/check/FoodCheckDialog.java | 280 ------------
.../newui/dialog/check/FoodInfoDialog.java | 217 +++++----
.../newui/dialog/check/RootTipDialog.java | 200 ++------
.../newui/dialog/check/SubOrderDialog.java | 2 +-
.../dialog/control/ChuCanCheckDialog.java | 180 --------
.../dialog/control/RobotControlDialog.java | 120 -----
.../newui/dialog/control/SilosInfoDialog.java | 2 +-
.../dialog/control/WokControlDialog.java | 1 -
.../fragment/main/HomeDevicesFragment.java | 12 -
.../fragment/main/HomeOrderFragment.java | 110 ++---
.../newui/fragment/main/HomeWarnFragment.java | 143 ++----
.../setting/SilosSettingFragment.java | 2 +
app/src/main/res/drawable/bg_order.xml | 2 +-
.../main/res/layout/activity_system_set.xml | 6 +-
.../new/layout/activity_edit_process_h.xml | 17 +-
.../res/layout/new/layout/activity_main_h.xml | 84 ++--
.../layout/new/layout/dialog_chucan_check.xml | 130 ------
.../layout/new/layout/dialog_food_info.xml | 158 +++----
.../layout/new/layout/dialog_root2_tip.xml | 39 --
.../layout/new/layout/dialog_root3_tip.xml | 39 --
.../new/layout/fragment_home_warn_info.xml | 40 +-
.../res/layout/new/layout/item_wok_name.xml | 33 ++
.../layout/new/layout/layout_root_tip2.xml | 426 ++----------------
.../layout/new/layout/layout_root_tip3.xml | 12 +-
33 files changed, 647 insertions(+), 2491 deletions(-)
delete mode 100644 .idea/other.xml
create mode 100644 app/src/main/java/com/bonait/bnframework/newui/adapter/order/WokNameAdapter.java
delete mode 100644 app/src/main/java/com/bonait/bnframework/newui/dialog/check/FoodCheckDialog.java
delete mode 100644 app/src/main/java/com/bonait/bnframework/newui/dialog/control/ChuCanCheckDialog.java
delete mode 100644 app/src/main/res/layout/new/layout/dialog_chucan_check.xml
delete mode 100644 app/src/main/res/layout/new/layout/dialog_root2_tip.xml
delete mode 100644 app/src/main/res/layout/new/layout/dialog_root3_tip.xml
create mode 100644 app/src/main/res/layout/new/layout/item_wok_name.xml
diff --git a/.idea/other.xml b/.idea/other.xml
deleted file mode 100644
index 104e542e..00000000
--- a/.idea/other.xml
+++ /dev/null
@@ -1,329 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
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 d649334e..5786716d 100644
--- a/app/src/main/java/com/bonait/bnframework/business/MainInit.java
+++ b/app/src/main/java/com/bonait/bnframework/business/MainInit.java
@@ -111,8 +111,7 @@ public class MainInit {
//cx_cp();
ErrorCodeManager.getInstance().initData();
- //初始化菜盘位置
- ConfigName.getInstance().resetPositionList();
+
}
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 24dd20ca..394f2e8c 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
@@ -32,7 +32,7 @@ import java.util.concurrent.ConcurrentHashMap;
*/
public class ConfigName {
//是否是测试模式
- public final static boolean TEST = false;
+ public final static boolean TEST = true;
//崩溃重启
public final static boolean ERROR_ROOT = false;
//日志打印
@@ -511,65 +511,6 @@ public class ConfigName {
*/
public int AutoQXTime=10;
-
- public static HashMap positionList = new HashMap<>();
-
- public void resetPositionList(){
- positionList.clear();
- positionList.put("主料位置1号位",new CheckPositionBean("1#料仓检测有无",-1,false));
- positionList.put("主料位置2号位",new CheckPositionBean("2#料仓检测有无",-1,false));
- positionList.put("主料位置3号位",new CheckPositionBean("3#料仓检测有无",-1,false));
- positionList.put("主料位置4号位",new CheckPositionBean("4#料仓检测有无",-1,false));
- positionList.put("主料位置5号位",new CheckPositionBean("5#料仓检测有无",-1,false));
- positionList.put("主料位置6号位",new CheckPositionBean("6#料仓检测有无",-1,false));
-
- positionList.put("辅料位置1号位",new CheckPositionBean("1#调料检测有无",-1,false));
- positionList.put("辅料位置2号位",new CheckPositionBean("2#调料检测有无",-1,false));
- positionList.put("辅料位置3号位",new CheckPositionBean("3#调料检测有无",-1,false));
- positionList.put("辅料位置4号位",new CheckPositionBean("4#调料检测有无",-1,false));
- positionList.put("辅料位置5号位",new CheckPositionBean("5#调料检测有无",-1,false));
- positionList.put("辅料位置6号位",new CheckPositionBean("6#调料检测有无",-1,false));
-
- positionList.put("出餐盆1",new CheckPositionBean("1#空盆库位检测有无",-1,false));
- positionList.put("出餐盆2",new CheckPositionBean("2#空盆库位检测有无",-1,false));
- positionList.put("出餐盆3",new CheckPositionBean("3#空盆库位检测有无",-1,false));
-
- }
-
- public void checkPositionList(){
-// LogUtils.d("ReadPositionStatusPLC positionList="+positionList.size());
- for (Map.Entry entry : positionList.entrySet()) {
- String key = entry.getKey();
- CheckPositionBean value = entry.getValue();
- positionList.put(key,ReadPositionStatusPLC(value));
- }
- }
-
- /**
- * 读菜盘PLC数据
- *
- * @return
- */
- public CheckPositionBean ReadPositionStatusPLC(CheckPositionBean bean) {
- CheckPositionBean newBean = new CheckPositionBean(bean.name,bean.number,bean.exist);
- if(ConfigName.TEST){
- newBean.exist=true;
- newBean.number = newBean.number+1;
- return newBean;
- }
- try {
- boolean exist = (boolean) ModbusCenter.getRobotListingValue(bean.name);
- newBean.exist = exist;
- if(!bean.exist&&exist){
- newBean.number = newBean.number+1;
- }
- return newBean;
- } catch (Exception ex) {
- LogUtils.d("ReadPositionStatusPLC ex.getMessage()="+ex.getMessage());
- return newBean;
- }
- }
-
/**
* Bottom 按钮
*/
diff --git a/app/src/main/java/com/bonait/bnframework/common/utils/DisplayManager.java b/app/src/main/java/com/bonait/bnframework/common/utils/DisplayManager.java
index 2f9c02b2..ee6b42e9 100644
--- a/app/src/main/java/com/bonait/bnframework/common/utils/DisplayManager.java
+++ b/app/src/main/java/com/bonait/bnframework/common/utils/DisplayManager.java
@@ -476,9 +476,6 @@ public class DisplayManager
}
public static float scale32(){
- if(ConfigName.getInstance().versionSelectionEnum.equals(SceneSetFragment.deviceName4)){
- return 21;
- }
return 32;
}
}
diff --git a/app/src/main/java/com/bonait/bnframework/modbus/ModbusCenter.java b/app/src/main/java/com/bonait/bnframework/modbus/ModbusCenter.java
index bd8cb47e..70fd46f3 100644
--- a/app/src/main/java/com/bonait/bnframework/modbus/ModbusCenter.java
+++ b/app/src/main/java/com/bonait/bnframework/modbus/ModbusCenter.java
@@ -209,19 +209,19 @@ public class ModbusCenter {
}
LogUtils.d("设备数据监听 1");
if (Wok2ModbusTcpServer.get().plcIsConnect) {
- wokListener(1);
+ wokListener(2);
}else {
Wok2ModbusTcpServer.get().ReConnect("Connection refused");
}
LogUtils.d("设备数据监听 2");
if (Wok3ModbusTcpServer.get().plcIsConnect) {
- wokListener(1);
+ wokListener(3);
}else {
Wok3ModbusTcpServer.get().ReConnect("Connection refused");
}
LogUtils.d("设备数据监听 3");
if (Wok4ModbusTcpServer.get().plcIsConnect) {
- wokListener(1);
+ wokListener(4);
}else {
Wok4ModbusTcpServer.get().ReConnect("Connection refused");
}
@@ -436,8 +436,38 @@ public class ModbusCenter {
}
break;
case 3:
+ if (plcaddress!=null &&!plcaddress.address.isEmpty() && Wok3ModbusTcpServer.get().plcIsConnect) {
+ if (plcaddress.address.toUpperCase().startsWith("VD"))//int
+ {
+ Wok3ModbusTcpServer.get().WriteInt(plcaddress.address, (int) value, callback);
+ } else if (plcaddress.address.toUpperCase().startsWith("M"))//bool
+ {
+ Wok3ModbusTcpServer.get().WriteBool(plcaddress.address, (boolean) value, callback);
+ } else if (plcaddress.address.toUpperCase().startsWith("VW"))//short
+ {
+ Wok3ModbusTcpServer.get().WriteShort(plcaddress.address, Short.parseShort(value.toString()), callback);
+ } else if (plcaddress.address.toUpperCase().startsWith("VR"))//float
+ {
+ Wok3ModbusTcpServer.get().WriteFloat(plcaddress.address, Float.parseFloat(value.toString()), callback);
+ }
+ }
break;
case 4:
+ if (plcaddress!=null &&!plcaddress.address.isEmpty() && Wok4ModbusTcpServer.get().plcIsConnect) {
+ if (plcaddress.address.toUpperCase().startsWith("VD"))//int
+ {
+ Wok4ModbusTcpServer.get().WriteInt(plcaddress.address, (int) value, callback);
+ } else if (plcaddress.address.toUpperCase().startsWith("M"))//bool
+ {
+ Wok4ModbusTcpServer.get().WriteBool(plcaddress.address, (boolean) value, callback);
+ } else if (plcaddress.address.toUpperCase().startsWith("VW"))//short
+ {
+ Wok4ModbusTcpServer.get().WriteShort(plcaddress.address, Short.parseShort(value.toString()), callback);
+ } else if (plcaddress.address.toUpperCase().startsWith("VR"))//float
+ {
+ Wok4ModbusTcpServer.get().WriteFloat(plcaddress.address, Float.parseFloat(value.toString()), callback);
+ }
+ }
break;
}
}
diff --git a/app/src/main/java/com/bonait/bnframework/modbus/ModbusTcpHelper.java b/app/src/main/java/com/bonait/bnframework/modbus/ModbusTcpHelper.java
index 8216018a..5e250be8 100644
--- a/app/src/main/java/com/bonait/bnframework/modbus/ModbusTcpHelper.java
+++ b/app/src/main/java/com/bonait/bnframework/modbus/ModbusTcpHelper.java
@@ -56,7 +56,6 @@ public abstract class ModbusTcpHelper {
public void ReConnect(String error){
if(error.contains("Connection refused")||error.contains("SocketException")){
if(plcIsConnect){
- RecordManager.getInstance().addLogRecord("设备异常日志",getDeviceName()+" error:"+error+"-开始重连");
ConnectPLC();
}
}
@@ -79,6 +78,7 @@ public abstract class ModbusTcpHelper {
}
ThreadManager.get().StartLong(getDeviceName(),false, () -> {
while (!plcIsConnect){
+ RecordManager.getInstance().addLogRecord("设备异常日志",getDeviceName()+"-开始连接");
param = TcpParam.create(getAddress(), getPort())
.setTimeout(1000)
.setRetries(0)
diff --git a/app/src/main/java/com/bonait/bnframework/newui/activity/DiyProcessHActivity.java b/app/src/main/java/com/bonait/bnframework/newui/activity/DiyProcessHActivity.java
index e4b5d918..38fd33e3 100644
--- a/app/src/main/java/com/bonait/bnframework/newui/activity/DiyProcessHActivity.java
+++ b/app/src/main/java/com/bonait/bnframework/newui/activity/DiyProcessHActivity.java
@@ -425,27 +425,9 @@ public class DiyProcessHActivity extends BaseActivity {
private void showHuoJia(boolean show){
if(show){
- switch (ConfigName.getInstance().versionSelectionEnum){
- case "鸿鹄中江":
- viewBinding.layoutHuojia.getRoot().setVisibility(View.GONE);
- viewBinding.layoutHuojia2.getRoot().setVisibility(View.VISIBLE);
- viewBinding.layoutHuojia3.getRoot().setVisibility(View.GONE);
- break;
- case "鸿鹄青白江":
- viewBinding.layoutHuojia.getRoot().setVisibility(View.GONE);
- viewBinding.layoutHuojia2.getRoot().setVisibility(View.GONE);
- viewBinding.layoutHuojia3.getRoot().setVisibility(View.VISIBLE);
- break;
- default:
- viewBinding.layoutHuojia.getRoot().setVisibility(View.VISIBLE);
- viewBinding.layoutHuojia2.getRoot().setVisibility(View.GONE);
- viewBinding.layoutHuojia3.getRoot().setVisibility(View.GONE);
- break;
- }
+ viewBinding.layoutHuojia.getRoot().setVisibility(View.VISIBLE);
}else{
viewBinding.layoutHuojia.getRoot().setVisibility(View.GONE);
- viewBinding.layoutHuojia2.getRoot().setVisibility(View.GONE);
- viewBinding.layoutHuojia3.getRoot().setVisibility(View.GONE);
}
}
diff --git a/app/src/main/java/com/bonait/bnframework/newui/activity/MainHActivity.java b/app/src/main/java/com/bonait/bnframework/newui/activity/MainHActivity.java
index 8adf7d11..2c158926 100644
--- a/app/src/main/java/com/bonait/bnframework/newui/activity/MainHActivity.java
+++ b/app/src/main/java/com/bonait/bnframework/newui/activity/MainHActivity.java
@@ -18,7 +18,6 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
import androidx.viewpager.widget.ViewPager;
-
import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.api.ServerManager;
import com.bonait.bnframework.business.ConfigData;
@@ -31,34 +30,22 @@ 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.ActivityMainHBinding;
-import com.bonait.bnframework.event.SerialButtonEvent;
import com.bonait.bnframework.modbus.ModbusCenter;
import com.bonait.bnframework.modbus.RobotModbusTcpServer;
import com.bonait.bnframework.modbus.Wok2ModbusTcpServer;
import com.bonait.bnframework.modbus.Wok1ModbusTcpServer;
+import com.bonait.bnframework.modbus.Wok3ModbusTcpServer;
import com.bonait.bnframework.newui.adapter.base.GuidePageAdapter;
import com.bonait.bnframework.newui.adapter.other.TabAdapter;
-import com.bonait.bnframework.newui.dialog.check.FoodCheckDialog;
import com.bonait.bnframework.newui.dialog.check.RootTipDialog;
import com.bonait.bnframework.newui.fragment.main.HomeDevicesFragment;
import com.bonait.bnframework.newui.fragment.main.HomeGoodsFragment;
import com.bonait.bnframework.newui.fragment.main.HomeMainsFragment;
import com.bonait.bnframework.newui.fragment.main.HomeOrderFragment;
import com.bonait.bnframework.newui.fragment.main.HomeWarnFragment;
-import com.bonait.bnframework.newui.fragment.setting.SceneSetFragment;
-import com.bonait.bnframework.newui.widget.NewToastUtil;
-import com.bonait.bnframework.serial.ComBean;
-import com.bonait.bnframework.serial.SerialHelper;
-
-import org.greenrobot.eventbus.EventBus;
-
import java.io.File;
-import java.io.IOException;
-import java.security.InvalidParameterException;
import java.util.ArrayList;
-import java.util.LinkedList;
import java.util.List;
-import java.util.Queue;
/**
* @author: liup
@@ -69,11 +56,6 @@ public class MainHActivity extends BaseActivity {
private ActivityMainHBinding viewBinding;
private TabAdapter tabAdapter;
private ArrayList pages;
- SerialControl com0;
- private boolean tabSelect = true;
- private static final int MSG_Click_EVENT = 100;
- private int enconger = 0;
- private long mlLastVewClickTime;
private Handler handler = new Handler(Looper.getMainLooper()){
@Override
@@ -86,6 +68,8 @@ public class MainHActivity extends BaseActivity {
}
BPA_ORDER_DETAIL detail1 = OrderDetailUtil.getByMaking(1);
BPA_ORDER_DETAIL detail2 = OrderDetailUtil.getByMaking(2);
+ BPA_ORDER_DETAIL detail3 = OrderDetailUtil.getByMaking(3);
+ BPA_ORDER_DETAIL detail4 = OrderDetailUtil.getByMaking(4);
if(detail1!=null){
String desc = "烹饪中...";
@@ -96,11 +80,11 @@ public class MainHActivity extends BaseActivity {
}else if(detail1.status==3){
desc = "烹饪异常";
}
- viewBinding.tvWok.setVisibility(View.VISIBLE);
- viewBinding.tvWok.setText("1号炒锅:菜品【"+detail1.goodsName+(detail1.groupName==null?"":detail1.groupName)+"】"+desc);
+ viewBinding.tvWok1.setVisibility(View.VISIBLE);
+ viewBinding.tvWok1.setText("1号炒锅:菜品【"+detail1.goodsName+(detail1.groupName==null?"":detail1.groupName)+"】"+desc);
}else {
- viewBinding.tvWok.setVisibility(View.GONE);
- viewBinding.tvWok.setText("");
+ viewBinding.tvWok1.setVisibility(View.GONE);
+ viewBinding.tvWok1.setText("");
}
if(detail2!=null){
String desc = "烹饪中...";
@@ -117,27 +101,41 @@ public class MainHActivity extends BaseActivity {
viewBinding.tvWok2.setVisibility(View.GONE);
viewBinding.tvWok2.setText("");
}
+ if(detail3!=null){
+ String desc = "烹饪中...";
+ if(detail3.status==1){
+ desc = "烹饪中...";
+ }else if(detail3.status==2){
+ desc = "烹饪完成";
+ }else if(detail3.status==3){
+ desc = "烹饪异常";
+ }
+ viewBinding.tvWok3.setVisibility(View.VISIBLE);
+ viewBinding.tvWok3.setText("3号炒锅:菜品【"+detail3.goodsName+(detail3.groupName==null?"":detail3.groupName)+"】"+desc);
+ }else {
+ viewBinding.tvWok3.setVisibility(View.GONE);
+ viewBinding.tvWok3.setText("");
+ }
+ if(detail4!=null){
+ String desc = "烹饪中...";
+ if(detail4.status==1){
+ desc = "烹饪中...";
+ }else if(detail4.status==2){
+ desc = "烹饪完成";
+ }else if(detail4.status==3){
+ desc = "烹饪异常";
+ }
+ viewBinding.tvWok4.setVisibility(View.VISIBLE);
+ viewBinding.tvWok4.setText("4号炒锅:菜品【"+detail4.goodsName+(detail4.groupName==null?"":detail4.groupName)+"】"+desc);
+ }else {
+ viewBinding.tvWok4.setVisibility(View.GONE);
+ viewBinding.tvWok4.setText("");
+ }
if(handler.hasMessages(1)){
handler.removeMessages(1);
}
handler.sendEmptyMessageDelayed(1,500);
}
- else if(msg.what == MSG_Click_EVENT){
- if(tabAdapter.getCurrentPosition() == 0){
- if(ConfigName.getInstance().focusPageType == 1){
- ConfigName.getInstance().focusPageType = 2;
- EventBus.getDefault().post(new SerialButtonEvent(0,true));
- }else if(ConfigName.getInstance().focusPageType == 2){
- ConfigName.getInstance().focusPageType = 3;
- EventBus.getDefault().post(new SerialButtonEvent(0,true));
- }else if(ConfigName.getInstance().focusPageType == 3){
- EventBus.getDefault().post(new SerialButtonEvent(0,true,true));
- }
- tabSelect = false;
- tabAdapter.setSelectPos(-1);
- tabAdapter.notifyItemChanged(tabAdapter.getCurrentPosition());
- }
- }
}
};
@@ -158,14 +156,6 @@ public class MainHActivity extends BaseActivity {
}else {
PreferenceUtils.setInt("loginNum",loginNum+1);
}
-
- if(ConfigName.SERIAL_TEST){
- com0 = new SerialControl();
- com0.setiDelay(Integer.parseInt("100"));
- DispQueue = new DispQueueThread();
- DispQueue.start();
- OpenComPort(com0);
- }
}
private void init(){
@@ -179,17 +169,11 @@ public class MainHActivity extends BaseActivity {
}
private void initView(){
- if(ConfigName.getInstance().versionSelectionEnum.equals(SceneSetFragment.deviceName4)){
- viewBinding.tvShusongLine.setVisibility(View.GONE);
- viewBinding.tvLineEnter.setVisibility(View.GONE);
- viewBinding.tvLineOut.setVisibility(View.GONE);
- }
tabAdapter = new TabAdapter(){
@Override
protected void onItemClick(View v, int position) {
viewBinding.viewpager.setCurrentItem(position);
ConfigName.getInstance().focusPageType = 1;
- tabSelect = true;
}
};
List data = new ArrayList<>();
@@ -206,29 +190,17 @@ public class MainHActivity extends BaseActivity {
viewBinding.viewpager.setOnPageChangeListener(pageChangeListener);
viewBinding.viewpager.setOffscreenPageLimit(1);
- viewBinding.tvWok.setOnClickListener(v->{
+ viewBinding.tvWok1.setOnClickListener(v->{
viewBinding.viewpager.setCurrentItem(1);
});
viewBinding.tvWok2.setOnClickListener(v->{
viewBinding.viewpager.setCurrentItem(1);
});
-
- viewBinding.btnBoxCheck.setOnClickListener(v->{
- switch (ConfigName.getInstance().versionSelectionEnum){
- case "鸿鹄中江":
- FoodCheckDialog2 dialog2 = new FoodCheckDialog2();
- dialog2.show(getSupportFragmentManager(),"料盒检测");
- break;
- case "鸿鹄青白江":
- FoodCheckDialog3 dialog3 = new FoodCheckDialog3();
- dialog3.show(getSupportFragmentManager(),"料盒检测");
- break;
- default:
- FoodCheckDialog dialog = new FoodCheckDialog();
- dialog.show(getSupportFragmentManager(),"料盒检测");
- break;
- }
-
+ viewBinding.tvWok3.setOnClickListener(v->{
+ viewBinding.viewpager.setCurrentItem(1);
+ });
+ viewBinding.tvWok4.setOnClickListener(v->{
+ viewBinding.viewpager.setCurrentItem(1);
});
}
@@ -239,72 +211,39 @@ public class MainHActivity extends BaseActivity {
, content.length()-3, content.length(),
Spannable.SPAN_EXCLUSIVE_INCLUSIVE);//SPAN_EXCLUSIVE_INCLUSIVE前面不包括后面包括
viewBinding.deviceStatusWok.setText(spannable);
- String content4 = "2号炒锅:"+(Wok2ModbusTcpServer.get().plcIsConnect?"已连接":"未连接");
- SpannableStringBuilder spannable4 = new SpannableStringBuilder(content4);
- spannable4.setSpan(new ForegroundColorSpan(Wok2ModbusTcpServer.get().plcIsConnect? Color.parseColor("#567722"):Color.parseColor("#DA5A17"))
- , content4.length()-3, content4.length(),
- Spannable.SPAN_EXCLUSIVE_INCLUSIVE);//SPAN_EXCLUSIVE_INCLUSIVE前面不包括后面包括
- viewBinding.deviceStatusWok2.setText(spannable4);
-
- String content2 = "货架:"+(RackModbusTcpServer.get().plcIsConnect?"已连接":"未连接");
+ String content2 = "2号炒锅:"+(Wok2ModbusTcpServer.get().plcIsConnect?"已连接":"未连接");
SpannableStringBuilder spannable2 = new SpannableStringBuilder(content2);
- spannable2.setSpan(new ForegroundColorSpan(RackModbusTcpServer.get().plcIsConnect?Color.parseColor("#567722"):Color.parseColor("#DA5A17")), content2.length()-3, content2.length(),
+ spannable2.setSpan(new ForegroundColorSpan(Wok2ModbusTcpServer.get().plcIsConnect?
+ Color.parseColor("#567722"):Color.parseColor("#DA5A17"))
+ , content2.length()-3, content2.length(),
Spannable.SPAN_EXCLUSIVE_INCLUSIVE);//SPAN_EXCLUSIVE_INCLUSIVE前面不包括后面包括
- viewBinding.deviceStatusRack.setText(spannable2);
-
- String content3 = "机器人:"+(RobotModbusTcpServer.get().plcIsConnect?"已连接":"未连接");
+ viewBinding.deviceStatusWok2.setText(spannable2);
+ String content3 = "3号炒锅:"+(Wok3ModbusTcpServer.get().plcIsConnect?"已连接":"未连接");
SpannableStringBuilder spannable3 = new SpannableStringBuilder(content3);
- spannable3.setSpan(new ForegroundColorSpan(RobotModbusTcpServer.get().plcIsConnect?Color.parseColor("#567722"):Color.parseColor("#DA5A17")), content3.length()-3, content3.length(),
+ spannable3.setSpan(new ForegroundColorSpan(Wok3ModbusTcpServer.get().plcIsConnect?
+ Color.parseColor("#567722"):Color.parseColor("#DA5A17"))
+ , content3.length()-3, content3.length(),
Spannable.SPAN_EXCLUSIVE_INCLUSIVE);//SPAN_EXCLUSIVE_INCLUSIVE前面不包括后面包括
- viewBinding.deviceStatusRobot.setText(spannable3);
+ viewBinding.deviceStatusWok3.setText(spannable3);
+ String content4 = "4号炒锅:"+(Wok2ModbusTcpServer.get().plcIsConnect?"已连接":"未连接");
+ SpannableStringBuilder spannable4 = new SpannableStringBuilder(content4);
+ spannable4.setSpan(new ForegroundColorSpan(Wok2ModbusTcpServer.get().plcIsConnect?
+ Color.parseColor("#567722"):Color.parseColor("#DA5A17"))
+ , content4.length()-3, content4.length(),
+ Spannable.SPAN_EXCLUSIVE_INCLUSIVE);//SPAN_EXCLUSIVE_INCLUSIVE前面不包括后面包括
+ viewBinding.deviceStatusWok4.setText(spannable4);
- if(!ConfigName.getInstance().versionSelectionEnum.equals(SceneSetFragment.deviceName4)){
- Object object1 = ModbusCenter.getRobotListingValue("输送线进料菜盆检测");
- Object object3 = ModbusCenter.getRobotListingValue("输送线出料菜盆检测");
- Object object4 = ModbusCenter.getRobotListingValue("输送线运行中");
- if(object3 instanceof Boolean){
- if((boolean) object3){
- changeTextView(viewBinding.tvLineOut,"输送线出料盆:","有盆",true);
- }else{
- changeTextView(viewBinding.tvLineOut,"输送线出料盆:","无盆",false);
- }
- }else {
- changeTextView(viewBinding.tvLineOut,"输送线出料盆:","异常",true);
- }
+ String content5 = "机器人:"+(RobotModbusTcpServer.get().plcIsConnect?"已连接":"未连接");
+ SpannableStringBuilder spannable5 = new SpannableStringBuilder(content5);
+ spannable5.setSpan(new ForegroundColorSpan(RobotModbusTcpServer.get().plcIsConnect?
+ Color.parseColor("#567722"):Color.parseColor("#DA5A17")), content5.length()-3, content5.length(),
+ Spannable.SPAN_EXCLUSIVE_INCLUSIVE);//SPAN_EXCLUSIVE_INCLUSIVE前面不包括后面包括
+ viewBinding.deviceStatusRobot.setText(spannable5);
- if(object1 instanceof Boolean){
- if((boolean) object1){
- changeTextView(viewBinding.tvLineEnter,"输送线进料盆:","有盆",true);
- }else{
- changeTextView(viewBinding.tvLineEnter,"输送线进料盆:","无盆",false);
- }
- }else {
- changeTextView(viewBinding.tvLineEnter,"输送线进料盆:","异常",true);
- }
- if(object4 instanceof Boolean){
- if((Boolean)object4){
- changeTextView(viewBinding.tvShusongLine,"输送线:","运行中",false);
- }else {
- changeTextView(viewBinding.tvShusongLine,"输送线:","已停止",false);
- }
- }else {
- changeTextView(viewBinding.tvShusongLine,"输送线:","异常",true);
- }
- }
+
}
- private void changeTextView(TextView textView,String content1,String content2,boolean hasColor){
- String content3 = content1+content2;
- SpannableStringBuilder spannable3 = new SpannableStringBuilder(content3);
- if(hasColor){
- spannable3.setSpan(new ForegroundColorSpan(Color.parseColor("#DA5A17"))
- , content1.length(), content3.length(),
- Spannable.SPAN_EXCLUSIVE_INCLUSIVE);//SPAN_EXCLUSIVE_INCLUSIVE前面不包括后面包括
- }
-
- textView.setText(spannable3);
- }
/**
* viewPager里添加fragment
@@ -381,20 +320,8 @@ public class MainHActivity extends BaseActivity {
if(isFirst){
isFirst = false;
if(PreferenceUtils.getBoolean(ConfigName.rootTip,true)){
- switch (ConfigName.getInstance().versionSelectionEnum){
- case "鸿鹄中江":
- RootTipDialog2 dialog2 = new RootTipDialog2();
- dialog2.show(getSupportFragmentManager(),"开机自检");
- break;
- case "鸿鹄青白江":
- RootTipDialog3 dialog3 = new RootTipDialog3();
- dialog3.show(getSupportFragmentManager(),"开机自检");
- break;
- default:
- RootTipDialog dialog = new RootTipDialog();
- dialog.show(getSupportFragmentManager(),"开机自检");
- break;
- }
+ RootTipDialog dialog = new RootTipDialog();
+ dialog.show(getSupportFragmentManager(),"开机自检");
}
}
}
@@ -409,9 +336,6 @@ public class MainHActivity extends BaseActivity {
@Override
protected void onDestroy() {
- if(ConfigName.SERIAL_TEST){
- CloseComPort(com0);
- }
reset();
super.onDestroy();
if(handler!=null){
@@ -426,163 +350,4 @@ public class MainHActivity extends BaseActivity {
ExecuteTheRecipe.reset1(2);
OrderDetailUtil.resetOrder();
}
-
-
- //----------------------------------------------------串口控制类
- DispQueueThread DispQueue;//刷新显示线程
- //----------------------------------------------------刷新显示线程
- private class DispQueueThread extends Thread {
- private final Queue QueueList = new LinkedList();
-
- @Override
- public void run() {
- super.run();
- while (!isInterrupted()) {
- final ComBean ComData;
- while ((ComData = QueueList.poll()) != null) {
- runOnUiThread(new Runnable() {
- public void run() {
- DispRecData(ComData);
- }
- });
- try {
- Thread.sleep(100);//显示性能高的话,可以把此数值调小。
- } catch (Exception e) {
- e.printStackTrace();
- }
- break;
- }
- }
- }
-
- public synchronized void AddQueue(ComBean ComData) {
- QueueList.add(ComData);
- }
- }
-
-
- private class SerialControl extends SerialHelper {
-
- // public SerialControl(String sPort, String sBaudRate){
-// super(sPort, sBaudRate);
-// }
- public SerialControl() {
- }
-
- @Override
- protected void onDataReceived(final ComBean ComRecData) {
- //数据接收量大或接收时弹出软键盘,界面会卡顿,可能和6410的显示性能有关
- //直接刷新显示,接收数据量大时,卡顿明显,但接收与显示同步。
- //用线程定时刷新显示可以获得较流畅的显示效果,但是接收数据速度快于显示速度时,显示会滞后。
- //最终效果差不多-_-,线程定时刷新稍好一些。
- DispQueue.AddQueue(ComRecData);//线程定时刷新显示(推荐)
- /*
- runOnUiThread(new Runnable()//直接刷新显示
- {
- public void run()
- {
- DispRecData(ComRecData);
- }
- });*/
- }
- }
- //----------------------------------------------------打开串口
- private void OpenComPort(SerialHelper ComPort) {
- try {
- ComPort.open();
- } catch (SecurityException e) {
- NewToastUtil.getInstance().showToastError("打开串口失败:没有串口读/写权限!");
- } catch (IOException e) {
- NewToastUtil.getInstance().showToastError("打开串口失败:未知错误!");
- } catch (InvalidParameterException e) {
- NewToastUtil.getInstance().showToastError("打开串口失败:参数错误!");
- }
- }
- //----------------------------------------------------关闭串口
- private void CloseComPort(SerialHelper ComPort) {
- if (ComPort != null) {
- ComPort.stopSend();
- ComPort.close();
- }
- }
- //----------------------------------------------------显示接收数据
- private void DispRecData(ComBean ComRecData) {
- String value = new String(ComRecData.bRec);
- String sMsg = ComRecData.sRecTime +
- "[" +
- ComRecData.sComPort +
- "]" +
- "[Txt] " +
- new String(ComRecData.bRec) +
- "\r\n";
- LogUtils.d("DispRecData sMsg = " + sMsg);
- if(value.contains("enconger")){
- if(value.contains("true")){
- long lCurrentTime = System.currentTimeMillis();
- if (abs(lCurrentTime - mlLastVewClickTime) <= 1000) {
- handler.removeMessages(MSG_Click_EVENT);
- mlLastVewClickTime = 0L;
- ConfigName.getInstance();
- LogUtils.d("DispRecData 连续两次点击 ");
- if(ConfigName.getInstance().focusPageType == 2){
- ConfigName.getInstance().focusPageType = 1;
- handler.post(new Runnable() {
- @Override
- public void run() {
- tabSelect = true;
- tabAdapter.setSelectPos(0);
- tabAdapter.notifyItemChanged(0);
- }
- });
- EventBus.getDefault().post(new SerialButtonEvent(0,true));
- }else if(ConfigName.getInstance().focusPageType == 3){
- ConfigName.getInstance().focusPageType = 2;
- EventBus.getDefault().post(new SerialButtonEvent(0,true));
- }
- } else {
- LogUtils.d("DispRecData 单次点击 延迟1s ");
- mlLastVewClickTime = lCurrentTime;
- handler.sendEmptyMessageDelayed(MSG_Click_EVENT, 500);
- }
- }else {
- int oldEnconger = enconger;
- LogUtils.d("DispRecData "+value.substring(value.indexOf(":"),value.indexOf(",")));
- enconger = Integer.parseInt(value.substring(value.indexOf(":")+2,value.indexOf(",")));
- if(tabSelect){
- handler.post(new Runnable() {
- @Override
- public void run() {
- tabAdapter.setSelectPos(0);
- tabAdapter.notifyItemChanged(0);
- int pos = tabAdapter.getCurrentPosition();
- tabAdapter.setSelectPos(pos);
- if(enconger>oldEnconger){
- if(pos0){
- tabAdapter.setCurrentPosition(pos-1);
- tabAdapter.setSelectPos(pos-1);
- viewBinding.viewpager.setCurrentItem(pos-1);
- }
- }
- tabAdapter.notifyItemChanged(pos);
- tabAdapter.notifyItemChanged(tabAdapter.getCurrentPosition());
- }
- });
- }else {
- if(enconger>oldEnconger){
- EventBus.getDefault().post(new SerialButtonEvent(1,false));
- }else {
- EventBus.getDefault().post(new SerialButtonEvent(2,false));
- }
- }
-
- }
- }
- }
-
}
diff --git a/app/src/main/java/com/bonait/bnframework/newui/adapter/order/WokNameAdapter.java b/app/src/main/java/com/bonait/bnframework/newui/adapter/order/WokNameAdapter.java
new file mode 100644
index 00000000..8b3a96e3
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/newui/adapter/order/WokNameAdapter.java
@@ -0,0 +1,56 @@
+package com.bonait.bnframework.newui.adapter.order;
+
+import android.annotation.SuppressLint;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bonait.bnframework.common.utils.DisplayManager;
+import com.bonait.bnframework.databinding.ItemFoodInfoBinding;
+import com.bonait.bnframework.databinding.ItemWokNameBinding;
+import com.bonait.bnframework.newui.adapter.base.BaseAdapter;
+
+/**
+ * @author: liup
+ * @description: 炒锅名称
+ * @date: 2024/5/9 9:02.
+ */
+public abstract class WokNameAdapter extends BaseAdapter {
+
+ @NonNull
+ @Override
+ public WokNameAdapter.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ return new WokNameAdapter.ViewHolder(ItemWokNameBinding.inflate(LayoutInflater.from(parent.getContext()), parent, false));
+ }
+
+ @SuppressLint("SetTextI18n")
+ @Override
+ public void onBindViewHolder(@NonNull WokNameAdapter.ViewHolder holder, @SuppressLint("RecyclerView") int position) {
+ if(holder.binding.getRoot().getWidth()==0){
+ DisplayManager.scaleViewGroup(holder.binding.getRoot());
+ }
+ holder.binding.name.setText(mData.get(position));
+ holder.binding.name.setOnClickListener(v->{
+ onItemClick(v,position);
+ });
+ }
+
+ @Override
+ protected void onItemClick(View v, int position) {
+
+ }
+
+ public static class ViewHolder extends RecyclerView.ViewHolder {
+ private ItemWokNameBinding binding;
+
+
+ public ViewHolder(ItemWokNameBinding view) {
+ super(view.getRoot());
+ binding = view;
+ }
+ }
+
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/bonait/bnframework/newui/dialog/check/FoodCheckDialog.java b/app/src/main/java/com/bonait/bnframework/newui/dialog/check/FoodCheckDialog.java
deleted file mode 100644
index bec54a05..00000000
--- a/app/src/main/java/com/bonait/bnframework/newui/dialog/check/FoodCheckDialog.java
+++ /dev/null
@@ -1,280 +0,0 @@
-package com.bonait.bnframework.newui.dialog.check;
-
-import android.annotation.SuppressLint;
-import android.graphics.Color;
-import android.graphics.drawable.ColorDrawable;
-import android.os.Build;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Message;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.Window;
-import android.view.WindowManager;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.fragment.app.DialogFragment;
-
-import com.bonait.bnframework.Model.CheckPositionBean;
-import com.bonait.bnframework.R;
-import com.bonait.bnframework.common.constant.ConfigName;
-import com.bonait.bnframework.common.utils.AdbCommandUtil;
-import com.bonait.bnframework.common.utils.DisplayManager;
-import com.bonait.bnframework.databinding.DialogFoodCheckBinding;
-import com.bonait.bnframework.newui.fragment.setting.SceneSetFragment;
-
-import java.util.Map;
-
-import butterknife.ButterKnife;
-
-/**
- * @author: liup
- * @description: 机器人投料控制
- * @date: 2024/6/3 17:59.
- */
-public class FoodCheckDialog extends DialogFragment {
- private String TAG = " FoodCheckDialog =>";
- private DialogFoodCheckBinding viewBinding;
-
- @Override
- public void onCreate(@Nullable Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setStyle(STYLE_NORMAL, R.style.DialogScale);
- }
- private Handler handler = new Handler(Looper.getMainLooper()){
- @Override
- public void handleMessage(@NonNull Message msg) {
- super.handleMessage(msg);
- if(msg.what==1){
- freshView();
- if(handler.hasMessages(1)){
- handler.removeMessages(1);
- }
- handler.sendEmptyMessageDelayed(1,500);
- }
- }
- };
-
- @Nullable
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
- viewBinding = DialogFoodCheckBinding.inflate(inflater, container, false);
- DisplayManager.scaleViewGroup(viewBinding.getRoot());
- ButterKnife.bind(this, viewBinding.getRoot());
- return viewBinding.getRoot();
- }
- private void fullScreen(Window window){
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- // 全屏显示,隐藏状态栏和导航栏,拉出状态栏和导航栏显示一会儿后消失。
- // 启动游戏模式,设置状态栏和导航栏中的图标变小,变模糊或者弱化其效果
- window.getDecorView().setSystemUiVisibility(
- View.SYSTEM_UI_FLAG_LOW_PROFILE
- | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_FULLSCREEN
- | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
- } else {
- // 全屏显示,隐藏状态栏
- window.getDecorView().setSystemUiVisibility(View.INVISIBLE);
- }
- }
- }
- @Override
- public void onStart() {
- super.onStart();
- if (getDialog() != null) {
- Window window = getDialog().getWindow();
- assert window != null;
- fullScreen(window);
- window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
- WindowManager.LayoutParams params = window.getAttributes();
- params.gravity = Gravity.CENTER;
- params.width = ViewGroup.LayoutParams.WRAP_CONTENT;
- params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
- window.setAttributes(params);
- }
- AdbCommandUtil.hideStatusBar(true);
-
- initView();
- }
-
- private void initView(){
- viewBinding.btnClose1.setOnClickListener(v->{
- dismiss();
- });
-
- freshView();
- handler.sendEmptyMessageDelayed(1,200);
- }
-
- @SuppressLint("SetTextI18n")
- private void freshView(){
- for (Map.Entry entry : ConfigName.getInstance().positionList.entrySet()) {
- String key = entry.getKey();
- CheckPositionBean value = entry.getValue();
- TextView view;
- switch (key){
- case "辅料位置1号位":
- if(value.exist){
- viewBinding.top1.setText("辅料F1\n有盒");
- viewBinding.icTop1.setSelected(true);
- }else {
- viewBinding.top1.setText("辅料F1\n无盒");
- viewBinding.icTop1.setSelected(false);
- }
- break;
- case "辅料位置2号位":
- if(value.exist){
- viewBinding.top2.setText("辅料F2\n有盒");
- viewBinding.icTop2.setSelected(true);
- }else {
- viewBinding.top2.setText("辅料F2\n无盒");
- viewBinding.icTop2.setSelected(false);
- }
- break;
- case "辅料位置3号位":
- if(value.exist){
- viewBinding.top3.setText("辅料F3\n有盒");
- viewBinding.icTop3.setSelected(true);
- }else {
- viewBinding.top3.setText("辅料F3\n无盒");
- viewBinding.icTop3.setSelected(false);
- }
- break;
- case "辅料位置4号位":
- if(value.exist){
- viewBinding.top4.setText("辅料F4\n有盒");
- viewBinding.icTop4.setSelected(true);
- }else {
- viewBinding.top4.setText("辅料F4\n无盒");
- viewBinding.icTop4.setSelected(false);
- }
- break;
- case "辅料位置5号位":
- if(value.exist){
- viewBinding.top5.setText("辅料F5\n有盒");
- viewBinding.icTop5.setSelected(true);
- }else {
- viewBinding.top5.setText("辅料F5\n无盒");
- viewBinding.icTop5.setSelected(false);
- }
- break;
- case "辅料位置6号位":
- if(value.exist){
- viewBinding.top6.setText("辅料F6\n有盒");
- viewBinding.icTop6.setSelected(true);
- }else {
- viewBinding.top6.setText("辅料F6\n无盒");
- viewBinding.icTop6.setSelected(false);
- }
- break;
- case "主料位置1号位":
- if(value.exist){
- viewBinding.right1.setText("主料Z1有盆");
- viewBinding.right1.setSelected(true);
- }else {
- viewBinding.right1.setText("主料Z1无盆");
- viewBinding.right1.setSelected(false);
- }
- break;
- case "主料位置2号位":
- if(value.exist){
- viewBinding.right2.setText("主料Z2有盆");
- viewBinding.right2.setSelected(true);
- }else {
- viewBinding.right2.setText("主料Z2无盆");
- viewBinding.right2.setSelected(false);
- }
- break;
- case "主料位置3号位":
- if(value.exist){
- viewBinding.right3.setText("主料Z3有盆");
- viewBinding.right3.setSelected(true);
- }else {
- viewBinding.right3.setText("主料Z3无盆");
- viewBinding.right3.setSelected(false);
- }
- break;
- case "主料位置4号位":
- if(value.exist){
- viewBinding.right4.setText("主料Z4有盆");
- viewBinding.right4.setSelected(true);
- }else {
- viewBinding.right4.setText("主料Z4无盆");
- viewBinding.right4.setSelected(false);
- }
- break;
- case "主料位置5号位":
- if(value.exist){
- viewBinding.right5.setText("主料Z5有盆");
- viewBinding.right5.setSelected(true);
- }else {
- viewBinding.right5.setText("主料Z5无盆");
- viewBinding.right5.setSelected(false);
- }
- break;
- case "主料位置6号位":
- if(value.exist){
- viewBinding.right6.setText("主料Z6有盆");
- viewBinding.right6.setSelected(true);
- }else {
- viewBinding.right6.setText("主料Z6无盆");
- viewBinding.right6.setSelected(false);
- }
- break;
-
- case "出餐盆1":
- if(value.exist){
- viewBinding.tvChucan1.setText("出餐盘1有盆");
- viewBinding.tvChucan1.setSelected(true);
- }else {
- viewBinding.tvChucan1.setText("出餐盘1无盆");
- viewBinding.tvChucan1.setSelected(false);
- }
- break;
- case "出餐盆2":
- if(value.exist){
- viewBinding.tvChucan2.setText("出餐盘2有盆");
- viewBinding.tvChucan2.setSelected(true);
- }else {
- viewBinding.tvChucan2.setText("出餐盘2无盆");
- viewBinding.tvChucan2.setSelected(false);
- }
- break;
- case "出餐盆3":
- if(value.exist){
- viewBinding.tvChucan3.setText("出餐盘3有盆");
- viewBinding.tvChucan3.setSelected(true);
- }else {
- viewBinding.tvChucan3.setText("出餐盘3无盆");
- viewBinding.tvChucan3.setSelected(false);
- }
- break;
- }
- }
- }
- @Override
- public void dismiss() {
- super.dismiss();
- if(handler!=null){
- handler.removeCallbacksAndMessages(null);
- handler = null;
- }
- }
- @Override
- public void onDestroy() {
- super.onDestroy();
- if(handler!=null){
- handler.removeCallbacksAndMessages(null);
- handler = null;
- }
- }
-}
diff --git a/app/src/main/java/com/bonait/bnframework/newui/dialog/check/FoodInfoDialog.java b/app/src/main/java/com/bonait/bnframework/newui/dialog/check/FoodInfoDialog.java
index 7d125f34..d6457141 100644
--- a/app/src/main/java/com/bonait/bnframework/newui/dialog/check/FoodInfoDialog.java
+++ b/app/src/main/java/com/bonait/bnframework/newui/dialog/check/FoodInfoDialog.java
@@ -18,7 +18,6 @@ import androidx.fragment.app.DialogFragment;
import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.R;
-import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL;
import com.bonait.bnframework.common.db.mode.BPA_ORDER_DETAIL;
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil;
@@ -29,8 +28,8 @@ import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.databinding.DialogFoodInfoBinding;
import com.bonait.bnframework.databinding.DialogFoodPosSelectBinding;
+import com.bonait.bnframework.newui.adapter.order.WokNameAdapter;
import com.bonait.bnframework.newui.adapter.other.FoodPosSelectAdapter;
-import com.bonait.bnframework.newui.fragment.setting.SceneSetFragment;
import java.util.ArrayList;
import java.util.Arrays;
@@ -47,7 +46,7 @@ public class FoodInfoDialog extends DialogFragment {
private String TAG = " FoodInfoDialog =>";
private DialogFoodInfoBinding viewBinding;
private String orderId = "";
- private HashMap ovenMap = new LinkedHashMap<>();
+ private BPA_ORDER_DETAIL orderDetail;
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
@@ -106,6 +105,7 @@ public class FoodInfoDialog extends DialogFragment {
viewBinding.btnClose1.setOnClickListener(v->{
dismiss();
});
+ orderDetail = OrderDetailUtil.getById(orderId);
freshView();
initClick();
}
@@ -117,20 +117,41 @@ public class FoodInfoDialog extends DialogFragment {
viewBinding.top4.setText("");
viewBinding.top5.setText("");
viewBinding.top6.setText("");
- viewBinding.right1.setText("");
- viewBinding.right2.setText("");
- viewBinding.right3.setText("");
- viewBinding.right4.setText("");
- viewBinding.right5.setText("");
- viewBinding.right6.setText("");
- BPA_ORDER_DETAIL order = OrderDetailUtil.getById(orderId);
- if(order==null){
+ viewBinding.mainFood1.setText("");
+ viewBinding.mainFood2.setText("");
+ viewBinding.mainFood3.setText("");
+ viewBinding.mainFood4.setText("");
+ viewBinding.mainFood5.setText("");
+ viewBinding.mainFood6.setText("");
+ if(orderDetail==null){
dismiss();
return;
}
- List details = GoodsProcessDetailDBUtil.getByGroupId(order.groupId);
+ if(orderDetail.mainPosition!=0 && orderDetail.type!=0){
+ switch (orderDetail.mainPosition){
+ case 1:
+ viewBinding.mainFood1.setText(orderDetail.type+"号炒锅");
+ break;
+ case 2:
+ viewBinding.mainFood2.setText(orderDetail.type+"号炒锅");
+ break;
+ case 3:
+ viewBinding.mainFood3.setText(orderDetail.type+"号炒锅");
+ break;
+ case 4:
+ viewBinding.mainFood4.setText(orderDetail.type+"号炒锅");
+ break;
+ case 5:
+ viewBinding.mainFood5.setText(orderDetail.type+"号炒锅");
+ break;
+ case 6:
+ viewBinding.mainFood6.setText(orderDetail.type+"号炒锅");
+ break;
+ }
+ }
+ List details = GoodsProcessDetailDBUtil.getByGroupId(orderDetail.groupId);
for(BPA_GOODS_PROCESS_DETAIL detail:details){
- if(detail.processname.equals("主料")||detail.processname.equals("辅料")){
+ if(detail.processname.equals("辅料")){
if(!detail.processvalue.isEmpty()){
List data = new ArrayList<>();
if (detail.processvalue.contains("|")) {
@@ -147,9 +168,9 @@ public class FoodInfoDialog extends DialogFragment {
if (wl.length == 2) {
String name = wl[0];
String val = wl[1];
- if(name.equals("主料名称")||name.equals("辅料名称")||name.equals("烤菜名称")){
+ if(name.equals("辅料名称")){
foodName = val;
- }else if(name.equals("主料位置")||name.equals("辅料位置")||name.equals("菜盘位置")){
+ }else if(name.equals("辅料位置")){
foodPos = val;
}
}
@@ -157,22 +178,6 @@ public class FoodInfoDialog extends DialogFragment {
}
updateName(detail.processname,foodName,foodPos);
}
- }else if(detail.processname.equals("放入烤盘")){
- String processvalue = detail.processvalue;
- String[] res1 = processvalue.split("\\|");
- int position = -1;//货架位置
- for(String s:res1){
- String[] res2 = s.split(",");
- if(res2.length==2){
- ovenMap.put(res2[0],res2[1]);
- }else {
- ovenMap.put(res2[0],"");
- }
- if(s.contains("烤盘位置")){
- position = Integer.parseInt(res2[1].replace("K",""));
- }
- updateName("烤箱","", position+"");
- }
}
}
}
@@ -213,33 +218,13 @@ public class FoodInfoDialog extends DialogFragment {
viewBinding.top6.setText("辅料F6\n"+name);
viewBinding.top6.setVisibility(View.VISIBLE);
break;
- }
- break;
- case "主料":
- switch (position){
- case 1:
- viewBinding.right1.setText("主料Z1\n"+name);
- viewBinding.right1.setVisibility(View.VISIBLE);
- break;
- case 2:
- viewBinding.right2.setText("主料Z2\n"+name);
- viewBinding.right2.setVisibility(View.VISIBLE);
+ case 7:
+ viewBinding.top7.setText("辅料F7\n"+name);
+ viewBinding.top7.setVisibility(View.VISIBLE);
break;
- case 3:
- viewBinding.right3.setText("主料Z3\n"+name);
- viewBinding.right3.setVisibility(View.VISIBLE);
- break;
- case 4:
- viewBinding.right4.setText("主料Z4\n"+name);
- viewBinding.right4.setVisibility(View.VISIBLE);
- break;
- case 5:
- viewBinding.right5.setText("主料Z5\n"+name);
- viewBinding.right5.setVisibility(View.VISIBLE);
- break;
- case 6:
- viewBinding.right6.setText("主料Z6\n"+name);
- viewBinding.right6.setVisibility(View.VISIBLE);
+ case 8:
+ viewBinding.top8.setText("辅料F8\n"+name);
+ viewBinding.top8.setVisibility(View.VISIBLE);
break;
}
break;
@@ -248,49 +233,56 @@ public class FoodInfoDialog extends DialogFragment {
private void initClick(){
viewBinding.top1.setOnClickListener(v->{
- showDialog("辅料位置","F1");
+ showFuLiaoDialog("辅料位置","F1");
});
viewBinding.top2.setOnClickListener(v->{
- showDialog("辅料位置","F2");
+ showFuLiaoDialog("辅料位置","F2");
});
viewBinding.top3.setOnClickListener(v->{
- showDialog("辅料位置","F3");
+ showFuLiaoDialog("辅料位置","F3");
});
viewBinding.top4.setOnClickListener(v->{
- showDialog("辅料位置","F4");
+ showFuLiaoDialog("辅料位置","F4");
});
viewBinding.top5.setOnClickListener(v->{
- showDialog("辅料位置","F5");
+ showFuLiaoDialog("辅料位置","F5");
+ });
+ viewBinding.top6.setOnClickListener(v->{
+ showFuLiaoDialog("辅料位置","F6");
+ });
+ viewBinding.top7.setOnClickListener(v->{
+ showFuLiaoDialog("辅料位置","F7");
+ });
+ viewBinding.top8.setOnClickListener(v->{
+ showFuLiaoDialog("辅料位置","F8");
});
- if(!ConfigName.getInstance().versionSelectionEnum.equals(SceneSetFragment.deviceName4)){
- viewBinding.top6.setOnClickListener(v->{
- showDialog("辅料位置","F6");
- });
- }else {
- viewBinding.top6.setVisibility(View.GONE);
- }
- viewBinding.right1.setOnClickListener(v->{
- showDialog("主料位置","Z1");
+ viewBinding.mainFood1.setOnClickListener(v->{
+ showMainFoodDialog("主料位置",1);
});
- viewBinding.right2.setOnClickListener(v->{
- showDialog("主料位置","Z2");
+ viewBinding.mainFood2.setOnClickListener(v->{
+ showMainFoodDialog("主料位置",2);
});
- viewBinding.right3.setOnClickListener(v->{
- showDialog("主料位置","Z3");
+ viewBinding.mainFood3.setOnClickListener(v->{
+ showMainFoodDialog("主料位置",3);
});
- viewBinding.right4.setOnClickListener(v->{
- showDialog("主料位置","Z4");
+ viewBinding.mainFood4.setOnClickListener(v->{
+ showMainFoodDialog("主料位置",4);
});
- viewBinding.right5.setOnClickListener(v->{
- showDialog("主料位置","Z5");
+ viewBinding.mainFood5.setOnClickListener(v->{
+ showMainFoodDialog("主料位置",5);
});
- viewBinding.right6.setOnClickListener(v->{
- showDialog("主料位置","Z6");
+ viewBinding.mainFood6.setOnClickListener(v->{
+ showMainFoodDialog("主料位置",6);
});
}
- private void showDialog(String name,String positionName){
+ /**
+ * 辅料位置
+ * @param name
+ * @param positionName
+ */
+ private void showFuLiaoDialog(String name, String positionName){
AlertDialogUtils.showCancelAndConfirmDialog(getActivity(), R.layout.dialog_food_pos_select, (layoutView, xCom) -> {
DialogFoodPosSelectBinding binding = DialogFoodPosSelectBinding.bind(layoutView);
DisplayManager.scaleViewGroup(binding.getRoot());
@@ -307,11 +299,7 @@ public class FoodInfoDialog extends DialogFragment {
List details = GoodsProcessDetailDBUtil.getByGroupId(order.groupId);
for(BPA_GOODS_PROCESS_DETAIL detail:details){
- if(name.contains("主料")){
- if(detail.processname.equals("主料")){
- data1.add(detail);
- }
- }else if(name.contains("辅料")){
+ if(name.contains("辅料")){
if(detail.processname.equals("辅料")){
data1.add(detail);
}
@@ -327,26 +315,17 @@ public class FoodInfoDialog extends DialogFragment {
String posInfo = "";
String[] res2 = new String[0];
for (String s:res){
- if(name.contains("主料")){
- if(s.contains("主料位置")){
- posInfo = s;
- res2 = s.split(",");
- }
- }else if(name.contains("辅料")){
+ if(name.contains("辅料")){
if(s.contains("辅料位置")){
posInfo = s;
res2 = s.split(",");
}
}
-
}
if(posInfo.isEmpty()||res2.length==0){
return;
}
- if(name.contains("主料")){
- detail.processvalue = detail.processvalue.replace(posInfo,"主料位置,"+positionName);
- detail.processms = detail.processms.replace(res2[1],positionName);
- }else if(name.contains("辅料")){
+ if(name.contains("辅料")){
detail.processvalue = detail.processvalue.replace(posInfo,"辅料位置,"+positionName);
detail.processms = detail.processms.replace(res2[1],positionName);
}
@@ -361,6 +340,48 @@ public class FoodInfoDialog extends DialogFragment {
});
}
+ /**
+ * 主料位置
+ * @param name
+ * @param mainPosition
+ */
+ private void showMainFoodDialog(String name, int mainPosition){
+ AlertDialogUtils.showCancelAndConfirmDialog(getActivity(), R.layout.dialog_food_pos_select, (layoutView, xCom) -> {
+ DialogFoodPosSelectBinding binding = DialogFoodPosSelectBinding.bind(layoutView);
+ DisplayManager.scaleViewGroup(binding.getRoot());
+ binding.title.setText(name+" Z"+mainPosition);
+ binding.btnClose.setOnClickListener(v->{
+ xCom.dismissX();
+ });
+ BPA_ORDER_DETAIL order = OrderDetailUtil.getById(orderId);
+ if(order==null){
+ dismiss();
+ return;
+ }
+ List data1 = new ArrayList<>();
+ if(mainPosition==1||mainPosition==2||mainPosition==3){
+ data1.add("1号炒锅");
+ data1.add("4号炒锅");
+ }else {
+ data1.add("2号炒锅");
+ data1.add("3号炒锅");
+ }
+
+ WokNameAdapter adapter = new WokNameAdapter(){
+ @Override
+ protected void onItemClick(View v, int position) {
+ orderDetail.type = Integer.parseInt(mData.get(position).substring(0,1));
+ orderDetail.mainPosition = mainPosition;
+ OrderDetailUtil.update(orderDetail);
+ freshView();
+ }
+ };
+
+ adapter.setNewData(data1);
+ binding.recycleView.setAdapter(adapter);
+ });
+ }
+
private MyClickListener listener;
public void setListener(MyClickListener listener) {
diff --git a/app/src/main/java/com/bonait/bnframework/newui/dialog/check/RootTipDialog.java b/app/src/main/java/com/bonait/bnframework/newui/dialog/check/RootTipDialog.java
index fb8ad503..0ce78ab5 100644
--- a/app/src/main/java/com/bonait/bnframework/newui/dialog/check/RootTipDialog.java
+++ b/app/src/main/java/com/bonait/bnframework/newui/dialog/check/RootTipDialog.java
@@ -32,6 +32,8 @@ import com.bonait.bnframework.modbus.ModbusCenter;
import com.bonait.bnframework.modbus.RobotModbusTcpServer;
import com.bonait.bnframework.modbus.Wok2ModbusTcpServer;
import com.bonait.bnframework.modbus.Wok1ModbusTcpServer;
+import com.bonait.bnframework.modbus.Wok3ModbusTcpServer;
+import com.bonait.bnframework.modbus.Wok4ModbusTcpServer;
import com.bonait.bnframework.newui.fragment.setting.SceneSetFragment;
import java.util.Map;
@@ -141,162 +143,40 @@ public class RootTipDialog extends DialogFragment {
}
private void freshView(){
- for (Map.Entry entry : ConfigName.getInstance().positionList.entrySet()) {
- String key = entry.getKey();
- CheckPositionBean value = entry.getValue();
- TextView view;
- switch (key){
- case "辅料位置1号位":
- if(value.exist){
- viewBinding.content2.top1.setText("辅料F1\n有盒");
- viewBinding.content2.icTop1.setSelected(true);
- }else {
- viewBinding.content2.top1.setText("辅料F1\n无盒");
- viewBinding.content2.icTop1.setSelected(false);
- }
- break;
- case "辅料位置2号位":
- if(value.exist){
- viewBinding.content2.top2.setText("辅料F2\n有盒");
- viewBinding.content2.icTop2.setSelected(true);
- }else {
- viewBinding.content2.top2.setText("辅料F2\n无盒");
- viewBinding.content2.icTop2.setSelected(false);
- }
- break;
- case "辅料位置3号位":
- if(value.exist){
- viewBinding.content2.top3.setText("辅料F3\n有盒");
- viewBinding.content2.icTop3.setSelected(true);
- }else {
- viewBinding.content2.top3.setText("辅料F3\n无盒");
- viewBinding.content2.icTop3.setSelected(false);
- }
- break;
- case "辅料位置4号位":
- if(value.exist){
- viewBinding.content2.top4.setText("辅料F4\n有盒");
- viewBinding.content2.icTop4.setSelected(true);
- }else {
- viewBinding.content2.top4.setText("辅料F4\n无盒");
- viewBinding.content2.icTop4.setSelected(false);
- }
- break;
- case "辅料位置5号位":
- if(value.exist){
- viewBinding.content2.top5.setText("辅料F5\n有盒");
- viewBinding.content2.icTop5.setSelected(true);
- }else {
- viewBinding.content2.top5.setText("辅料F5\n无盒");
- viewBinding.content2.icTop5.setSelected(false);
- }
- break;
- case "辅料位置6号位":
- if(value.exist){
- viewBinding.content2.top6.setText("辅料F6\n有盒");
- viewBinding.content2.icTop6.setSelected(true);
- }else {
- viewBinding.content2.top6.setText("辅料F6\n无盒");
- viewBinding.content2.icTop6.setSelected(false);
- }
- break;
- case "主料位置1号位":
- if(value.exist){
- viewBinding.content2.right1.setText("主料Z1有盆");
- viewBinding.content2.right1.setSelected(true);
- }else {
- viewBinding.content2.right1.setText("主料Z1无盆");
- viewBinding.content2.right1.setSelected(false);
- }
- break;
- case "主料位置2号位":
- if(value.exist){
- viewBinding.content2.right2.setText("主料Z2有盆");
- viewBinding.content2.right2.setSelected(true);
- }else {
- viewBinding.content2.right2.setText("主料Z2无盆");
- viewBinding.content2.right2.setSelected(false);
- }
- break;
- case "主料位置3号位":
- if(value.exist){
- viewBinding.content2.right3.setText("主料Z3有盆");
- viewBinding.content2.right3.setSelected(true);
- }else {
- viewBinding.content2.right3.setText("主料Z3无盆");
- viewBinding.content2.right3.setSelected(false);
- }
- break;
- case "主料位置4号位":
- if(value.exist){
- viewBinding.content2.right4.setText("主料Z4有盆");
- viewBinding.content2.right4.setSelected(true);
- }else {
- viewBinding.content2.right4.setText("主料Z4无盆");
- viewBinding.content2.right4.setSelected(false);
- }
- break;
- case "主料位置5号位":
- if(value.exist){
- viewBinding.content2.right5.setText("主料Z5有盆");
- viewBinding.content2.right5.setSelected(true);
- }else {
- viewBinding.content2.right5.setText("主料Z5无盆");
- viewBinding.content2.right5.setSelected(false);
- }
- break;
- case "主料位置6号位":
- if(value.exist){
- viewBinding.content2.right6.setText("主料Z6有盆");
- viewBinding.content2.right6.setSelected(true);
- }else {
- viewBinding.content2.right6.setText("主料Z6无盆");
- viewBinding.content2.right6.setSelected(false);
- }
- break;
-
- case "出餐盆1":
- if(value.exist){
- viewBinding.content2.tvChucan1.setText("出餐盆1有盆");
- viewBinding.content2.tvChucan1.setSelected(true);
- }else {
- viewBinding.content2.tvChucan1.setText("出餐盆1无盆");
- viewBinding.content2.tvChucan1.setSelected(false);
- }
-
- break;
- case "出餐盆2":
- if(value.exist){
- viewBinding.content2.tvChucan2.setText("出餐盆2有盆");
- viewBinding.content2.tvChucan2.setSelected(true);
- }else {
- viewBinding.content2.tvChucan2.setText("出餐盆2无盆");
- viewBinding.content2.tvChucan2.setSelected(false);
- }
- break;
- case "出餐盆3":
- if(value.exist){
- viewBinding.content2.tvChucan3.setText("出餐盆3有盆");
- viewBinding.content2.tvChucan3.setSelected(true);
- }else {
- viewBinding.content2.tvChucan3.setText("出餐盆3无盆");
- viewBinding.content2.tvChucan3.setSelected(false);
- }
- break;
- }
- }
+ //出餐盆1 2 3 4
try {
- Object object1 = ModbusCenter.getRobotListingValue("输送线进料菜盆检测");
- Object object4 = ModbusCenter.getRobotListingValue("输送线出料菜盆检测");
- if(object1 instanceof Boolean){
- viewBinding.content2.tvEnter.setText("输送线进料菜盆:"+(((Boolean)object1)?"有盆":"无盆"));
- }else {
- viewBinding.content2.tvEnter.setText("输送线进料菜盆:检测异常");
- }
- if(object4 instanceof Boolean){
- viewBinding.content2.tvOut.setText("输送线出料菜盆:"+(((Boolean)object4)?"有盆":"无盆"));
- }else {
- viewBinding.content2.tvOut.setText("输送线出料菜盆:检测异常");
+ for (int i=1;i<=4;i++){
+ Object kongPen = ModbusCenter.ReadPlc(0,i+"#空盆库位检测有无");
+ switch (i){
+ case 1:
+ if(kongPen instanceof Boolean){
+ viewBinding.content2.tvKongPen1.setText("炒锅"+i+"出餐盆:有:"+(((Boolean)kongPen)?"有":"无"));
+ }else {
+ viewBinding.content2.tvKongPen1.setText("炒锅"+i+"出餐盆:异常");
+ }
+ break;
+ case 2:
+ if(kongPen instanceof Boolean){
+ viewBinding.content2.tvKongPen2.setText("炒锅"+i+"出餐盆:有:"+(((Boolean)kongPen)?"有":"无"));
+ }else {
+ viewBinding.content2.tvKongPen2.setText("炒锅"+i+"出餐盆:异常");
+ }
+ break;
+ case 3:
+ if(kongPen instanceof Boolean){
+ viewBinding.content2.tvKongPen3.setText("炒锅"+i+"出餐盆:有:"+(((Boolean)kongPen)?"有":"无"));
+ }else {
+ viewBinding.content2.tvKongPen3.setText("炒锅"+i+"出餐盆:异常");
+ }
+ break;
+ case 4:
+ if(kongPen instanceof Boolean){
+ viewBinding.content2.tvKongPen4.setText("炒锅"+i+"出餐盆:有:"+(((Boolean)kongPen)?"有":"无"));
+ }else {
+ viewBinding.content2.tvKongPen4.setText("炒锅"+i+"出餐盆:异常");
+ }
+ break;
+ }
}
}catch (Exception ignored){
}
@@ -317,19 +197,19 @@ public class RootTipDialog extends DialogFragment {
Spannable.SPAN_EXCLUSIVE_INCLUSIVE);//SPAN_EXCLUSIVE_INCLUSIVE前面不包括后面包括
viewBinding.content0.deviceStatusWok2.setText(spannable2);
- String content3 = "3号炒锅:"+(Wok2ModbusTcpServer.get().plcIsConnect?"已连接":"未连接");
+ String content3 = "3号炒锅:"+(Wok3ModbusTcpServer.get().plcIsConnect?"已连接":"未连接");
SpannableStringBuilder spannable3 = new SpannableStringBuilder(content3);
- spannable3.setSpan(new ForegroundColorSpan(Wok2ModbusTcpServer.get().plcIsConnect? Color.parseColor("#567722"):Color.parseColor("#DA5A17"))
+ spannable3.setSpan(new ForegroundColorSpan(Wok3ModbusTcpServer.get().plcIsConnect? Color.parseColor("#567722"):Color.parseColor("#DA5A17"))
, content3.length()-3, content3.length(),
Spannable.SPAN_EXCLUSIVE_INCLUSIVE);//SPAN_EXCLUSIVE_INCLUSIVE前面不包括后面包括
viewBinding.content0.deviceStatusWok3.setText(spannable3);
- String content4 = "4号炒锅:"+(Wok2ModbusTcpServer.get().plcIsConnect?"已连接":"未连接");
+ String content4 = "4号炒锅:"+(Wok4ModbusTcpServer.get().plcIsConnect?"已连接":"未连接");
SpannableStringBuilder spannable4 = new SpannableStringBuilder(content4);
- spannable4.setSpan(new ForegroundColorSpan(Wok2ModbusTcpServer.get().plcIsConnect? Color.parseColor("#567722"):Color.parseColor("#DA5A17"))
+ spannable4.setSpan(new ForegroundColorSpan(Wok4ModbusTcpServer.get().plcIsConnect? Color.parseColor("#567722"):Color.parseColor("#DA5A17"))
, content4.length()-3, content4.length(),
Spannable.SPAN_EXCLUSIVE_INCLUSIVE);//SPAN_EXCLUSIVE_INCLUSIVE前面不包括后面包括
- viewBinding.content0.deviceStatusWok2.setText(spannable4);
+ viewBinding.content0.deviceStatusWok4.setText(spannable4);
String content5 = "机器人:"+(RobotModbusTcpServer.get().plcIsConnect?"已连接":"未连接");
SpannableStringBuilder spannable5 = new SpannableStringBuilder(content5);
diff --git a/app/src/main/java/com/bonait/bnframework/newui/dialog/check/SubOrderDialog.java b/app/src/main/java/com/bonait/bnframework/newui/dialog/check/SubOrderDialog.java
index 05d405e4..e9ddffa5 100644
--- a/app/src/main/java/com/bonait/bnframework/newui/dialog/check/SubOrderDialog.java
+++ b/app/src/main/java/com/bonait/bnframework/newui/dialog/check/SubOrderDialog.java
@@ -32,7 +32,7 @@ import java.util.List;
/**
* @author: liup
- * @description:
+ * @description: 订单记录
* @date: 2024/6/3 17:59.
*/
public class SubOrderDialog extends DialogFragment {
diff --git a/app/src/main/java/com/bonait/bnframework/newui/dialog/control/ChuCanCheckDialog.java b/app/src/main/java/com/bonait/bnframework/newui/dialog/control/ChuCanCheckDialog.java
deleted file mode 100644
index 23b9c38a..00000000
--- a/app/src/main/java/com/bonait/bnframework/newui/dialog/control/ChuCanCheckDialog.java
+++ /dev/null
@@ -1,180 +0,0 @@
-package com.bonait.bnframework.newui.dialog.control;
-
-import android.graphics.Color;
-import android.graphics.drawable.ColorDrawable;
-import android.os.Build;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.Looper;
-import android.os.Message;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.view.Window;
-import android.view.WindowManager;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.fragment.app.DialogFragment;
-
-import com.bonait.bnframework.R;
-import com.bonait.bnframework.common.constant.ConfigName;
-import com.bonait.bnframework.common.utils.AdbCommandUtil;
-import com.bonait.bnframework.common.utils.DisplayManager;
-import com.bonait.bnframework.databinding.DialogChucanCheckBinding;
-import com.bonait.bnframework.modbus.ModbusCenter;
-import com.bonait.bnframework.newui.widget.NewToastUtil;
-
-import butterknife.ButterKnife;
-
-/**
- * @author: liup
- * @description: 机器人投料控制 出餐架
- * @date: 2024/6/3 17:59.
- */
-public class ChuCanCheckDialog extends DialogFragment {
- private String TAG = " ChuCanCheckDialog =>";
- private DialogChucanCheckBinding viewBinding;
-
- @Override
- public void onCreate(@Nullable Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setStyle(STYLE_NORMAL, R.style.DialogScale);
- }
- private Handler handler = new Handler(Looper.getMainLooper()){
- @Override
- public void handleMessage(@NonNull Message msg) {
- super.handleMessage(msg);
- if(msg.what==1){
- freshView();
- if(handler.hasMessages(1)){
- handler.removeMessages(1);
- }
- handler.sendEmptyMessageDelayed(1,500);
- }
- }
- };
-
- @Nullable
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
- viewBinding = DialogChucanCheckBinding.inflate(inflater, container, false);
- DisplayManager.scaleViewGroup(viewBinding.getRoot());
- ButterKnife.bind(this, viewBinding.getRoot());
- return viewBinding.getRoot();
- }
- private void fullScreen(Window window){
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
- if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
- // 全屏显示,隐藏状态栏和导航栏,拉出状态栏和导航栏显示一会儿后消失。
- // 启动游戏模式,设置状态栏和导航栏中的图标变小,变模糊或者弱化其效果
- window.getDecorView().setSystemUiVisibility(
- View.SYSTEM_UI_FLAG_LOW_PROFILE
- | View.SYSTEM_UI_FLAG_LAYOUT_STABLE
- | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
- | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
- | View.SYSTEM_UI_FLAG_FULLSCREEN
- | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
- } else {
- // 全屏显示,隐藏状态栏
- window.getDecorView().setSystemUiVisibility(View.INVISIBLE);
- }
- }
- }
- @Override
- public void onStart() {
- super.onStart();
- if (getDialog() != null) {
- Window window = getDialog().getWindow();
- assert window != null;
- fullScreen(window);
- window.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
- WindowManager.LayoutParams params = window.getAttributes();
- params.gravity = Gravity.CENTER;
- params.width = ViewGroup.LayoutParams.WRAP_CONTENT;
- params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
- window.setAttributes(params);
- }
- AdbCommandUtil.hideStatusBar(true);
-
- initView();
- }
-
- private void initView(){
- viewBinding.btnClose1.setOnClickListener(v->{
- dismiss();
- });
-
- freshView();
- handler.sendEmptyMessageDelayed(1,200);
- viewBinding.btnStart.setOnClickListener(v->{
- if(ConfigName.getInstance().isFastClick()){
- NewToastUtil.getInstance().showToast("点击过快!");
- return;
- }
- if(!RackModbusTcpServer.get().plcIsConnect&&!ConfigName.TEST){
- NewToastUtil.getInstance().showToastError("货架设备未连接!");
- return;
- }
- try{
- ModbusCenter.rackWritePlc("输送线启动",true,null);
- Thread.sleep(500);
- ModbusCenter.rackWritePlc("输送线启动",false,null);
- }catch (Exception e){
- }
- });
- viewBinding.btnStop.setOnClickListener(v->{
- if(ConfigName.getInstance().isFastClick()){
- NewToastUtil.getInstance().showToast("点击过快!");
- return;
- }
- if(!RackModbusTcpServer.get().plcIsConnect&&!ConfigName.TEST){
- NewToastUtil.getInstance().showToastError("货架设备未连接!");
- return;
- }
- try{
- ModbusCenter.rackWritePlc("输送线停止",true,null);
- Thread.sleep(500);
- ModbusCenter.rackWritePlc("输送线停止",false,null);
- }catch (Exception e){
- }
- });
-
- }
-
- private void freshView(){
- try {
- Object object1 = ModbusCenter.getRobotListingValue("输送线进料菜盆检测");
- Object object4 = ModbusCenter.getRobotListingValue("输送线出料菜盆检测");
- if(object1 instanceof Boolean){
- viewBinding.tvEnter.setText("输送线进料菜盆:"+(((Boolean)object1)?"有盆":"无盆"));
- }else {
- viewBinding.tvEnter.setText("输送线进料菜盆:检测异常");
- }
- if(object4 instanceof Boolean){
- viewBinding.tvOut.setText("输送线出料菜盆:"+(((Boolean)object4)?"有盆":"无盆"));
- }else {
- viewBinding.tvOut.setText("输送线出料菜盆:检测异常");
- }
- }catch (Exception ignored){
- }
- }
- @Override
- public void dismiss() {
- super.dismiss();
- if(handler!=null){
- handler.removeCallbacksAndMessages(null);
- handler = null;
- }
- }
- @Override
- public void onDestroy() {
- super.onDestroy();
- if(handler!=null){
- handler.removeCallbacksAndMessages(null);
- handler = null;
- }
- }
-}
diff --git a/app/src/main/java/com/bonait/bnframework/newui/dialog/control/RobotControlDialog.java b/app/src/main/java/com/bonait/bnframework/newui/dialog/control/RobotControlDialog.java
index 10860b69..262662c0 100644
--- a/app/src/main/java/com/bonait/bnframework/newui/dialog/control/RobotControlDialog.java
+++ b/app/src/main/java/com/bonait/bnframework/newui/dialog/control/RobotControlDialog.java
@@ -71,7 +71,6 @@ public class RobotControlDialog extends DialogFragment {
public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
if(msg.what==1){
- freshView();
Object object = ModbusCenter.getRobotListingValue("机器人到达维护位");
Object object2 = ModbusCenter.getRobotListingValue("机器人在原点");
if(object instanceof Boolean){
@@ -186,125 +185,6 @@ public class RobotControlDialog extends DialogFragment {
});
}
- @SuppressLint("SetTextI18n")
- private void freshView(){
- for (Map.Entry entry : ConfigName.getInstance().positionList.entrySet()) {
- String key = entry.getKey();
- CheckPositionBean value = entry.getValue();
- TextView view;
- switch (key){
- case "辅料位置1号位":
- if(value.exist){
- viewBinding.top1.setText("辅料F1\n有盒");
-// viewBinding.icTop1.setSelected(true);
- }else {
- viewBinding.top1.setText("辅料F1\n无盒");
-// viewBinding.icTop1.setSelected(false);
- }
- break;
- case "辅料位置2号位":
- if(value.exist){
- viewBinding.top2.setText("辅料F2\n有盒");
-// viewBinding.icTop2.setSelected(true);
- }else {
- viewBinding.top2.setText("辅料F2\n无盒");
-// viewBinding.icTop2.setSelected(false);
- }
- break;
- case "辅料位置3号位":
- if(value.exist){
- viewBinding.top3.setText("辅料F3\n有盒");
-// viewBinding.icTop3.setSelected(true);
- }else {
- viewBinding.top3.setText("辅料F3\n无盒");
-// viewBinding.icTop3.setSelected(false);
- }
- break;
- case "辅料位置4号位":
- if(value.exist){
- viewBinding.top4.setText("辅料F4\n有盒");
-// viewBinding.icTop4.setSelected(true);
- }else {
- viewBinding.top4.setText("辅料F4\n无盒");
-// viewBinding.icTop4.setSelected(false);
- }
- break;
- case "辅料位置5号位":
- if(value.exist){
- viewBinding.top5.setText("辅料F5\n有盒");
-// viewBinding.icTop3.setSelected(true);
- }else {
- viewBinding.top5.setText("辅料F5\n无盒");
-// viewBinding.icTop3.setSelected(false);
- }
- break;
- case "辅料位置6号位":
- if(value.exist){
- viewBinding.top6.setText("辅料F6\n有盒");
-// viewBinding.icTop4.setSelected(true);
- }else {
- viewBinding.top6.setText("辅料F6\n无盒");
-// viewBinding.icTop4.setSelected(false);
- }
- break;
- case "主料位置1号位":
- if(value.exist){
- viewBinding.right6.setText("主料Z1有盆");
-// viewBinding.right1.setSelected(true);
- }else {
- viewBinding.right6.setText("主料Z1无盆");
-// viewBinding.right1.setSelected(false);
- }
- break;
- case "主料位置2号位":
- if(value.exist){
- viewBinding.right5.setText("主料Z2有盆");
-// viewBinding.right2.setSelected(true);
- }else {
- viewBinding.right5.setText("主料Z2无盆");
-// viewBinding.right2.setSelected(false);
- }
- break;
- case "主料位置3号位":
- if(value.exist){
- viewBinding.right4.setText("主料Z3有盆");
-// viewBinding.right3.setSelected(true);
- }else {
- viewBinding.right4.setText("主料Z3无盆");
-// viewBinding.right3.setSelected(false);
- }
- break;
- case "主料位置4号位":
- if(value.exist){
- viewBinding.right3.setText("主料Z4有盆");
-// viewBinding.right4.setSelected(true);
- }else {
- viewBinding.right3.setText("主料Z4无盆");
-// viewBinding.right4.setSelected(false);
- }
- break;
- case "主料位置5号位":
- if(value.exist){
- viewBinding.right2.setText("主料Z5有盆");
-// viewBinding.right5.setSelected(true);
- }else {
- viewBinding.right2.setText("主料Z5无盆");
-// viewBinding.right5.setSelected(false);
- }
- break;
- case "主料位置6号位":
- if(value.exist){
- viewBinding.right1.setText("主料Z6有盆");
-// viewBinding.right6.setSelected(true);
- }else {
- viewBinding.right1.setText("主料Z6无盆");
-// viewBinding.right6.setSelected(false);
- }
- break;
- }
- }
- }
-
private HashMap data = new HashMap<>();;
@SuppressLint("NonConstantResourceId")
@OnClick({R.id.top1, R.id.top2,R.id.top3,R.id.top4,R.id.top5,R.id.top6,R.id.top7,R.id.top8,
diff --git a/app/src/main/java/com/bonait/bnframework/newui/dialog/control/SilosInfoDialog.java b/app/src/main/java/com/bonait/bnframework/newui/dialog/control/SilosInfoDialog.java
index 9e57a5ef..6623536d 100644
--- a/app/src/main/java/com/bonait/bnframework/newui/dialog/control/SilosInfoDialog.java
+++ b/app/src/main/java/com/bonait/bnframework/newui/dialog/control/SilosInfoDialog.java
@@ -47,7 +47,7 @@ import butterknife.OnClick;
/**
* @author: liup
- * @description: 机器人投料控制
+ * @description: 料仓设置 校准
* @date: 2024/6/3 17:59.
*/
public class SilosInfoDialog extends DialogFragment {
diff --git a/app/src/main/java/com/bonait/bnframework/newui/dialog/control/WokControlDialog.java b/app/src/main/java/com/bonait/bnframework/newui/dialog/control/WokControlDialog.java
index 32ea98e5..89b0ea19 100644
--- a/app/src/main/java/com/bonait/bnframework/newui/dialog/control/WokControlDialog.java
+++ b/app/src/main/java/com/bonait/bnframework/newui/dialog/control/WokControlDialog.java
@@ -66,7 +66,6 @@ public class WokControlDialog extends DialogFragment {
private DialogChaoguoControlBinding viewBinding;
private int deviceNum = 1;
private boolean showRobot = true;
- private static final String checkNames = "搅拌速度,抽料位,原点位,倒菜位,维护位,清洗位,炒菜位1,炒菜位2,炒菜位3";
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
diff --git a/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeDevicesFragment.java b/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeDevicesFragment.java
index cff66f79..e2ecd55a 100644
--- a/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeDevicesFragment.java
+++ b/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeDevicesFragment.java
@@ -23,8 +23,6 @@ import com.bonait.bnframework.modbus.Wok2ModbusTcpServer;
import com.bonait.bnframework.modbus.Wok1ModbusTcpServer;
import com.bonait.bnframework.modbus.Wok3ModbusTcpServer;
import com.bonait.bnframework.modbus.Wok4ModbusTcpServer;
-import com.bonait.bnframework.newui.dialog.control.ChuCanCheckDialog;
-import com.bonait.bnframework.newui.dialog.check.FoodCheckDialog;
import com.bonait.bnframework.newui.dialog.control.RobotControlDialog;
import com.bonait.bnframework.newui.dialog.control.WokControlDialog;
import com.bonait.bnframework.newui.widget.NewToastUtil;
@@ -82,16 +80,6 @@ public class HomeDevicesFragment extends BaseFragment {
}
showWokDialog(2);
});
-
- viewBinding.btnDishCheck.setOnClickListener(v->{
- if(ConfigName.getInstance().isFastClick()){
- return;
- }
- FoodCheckDialog dialog = new FoodCheckDialog();
- if(getActivity()!=null){
- dialog.show(getActivity().getSupportFragmentManager(),"料盒检测");
- }
- });
}
/**
diff --git a/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeOrderFragment.java b/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeOrderFragment.java
index 0e98d494..c8b1cfe4 100644
--- a/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeOrderFragment.java
+++ b/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeOrderFragment.java
@@ -67,7 +67,7 @@ public class HomeOrderFragment extends BaseFragment {
private List orderDetails1;
private List foodInfoList = new ArrayList<>();
private BPA_ORDER_DETAIL orderDetail;
- private DeviceStatusView deviceStatusView1,deviceStatusView2;
+ private DeviceStatusView deviceStatusView1,deviceStatusView2,deviceStatusView3,deviceStatusView4;
@Override
protected View onCreateView() {
@@ -84,10 +84,16 @@ public class HomeOrderFragment extends BaseFragment {
viewBinding.llDevices.removeAllViews();
deviceStatusView1 = new DeviceStatusView(getContext(),null,1);
deviceStatusView2 = new DeviceStatusView(getContext(),null,2);
+ deviceStatusView3 = new DeviceStatusView(getContext(),null,3);
+ deviceStatusView4 = new DeviceStatusView(getContext(),null,4);
getLifecycle().addObserver((LifecycleObserver) deviceStatusView1);
getLifecycle().addObserver((LifecycleObserver) deviceStatusView2);
+ getLifecycle().addObserver((LifecycleObserver) deviceStatusView3);
+ getLifecycle().addObserver((LifecycleObserver) deviceStatusView4);
viewBinding.llDevices.addView(deviceStatusView1);
viewBinding.llDevices.addView(deviceStatusView2);
+ viewBinding.llDevices.addView(deviceStatusView3);
+ viewBinding.llDevices.addView(deviceStatusView4);
LogUtils.d("Home4Fragment onViewCreated");
}
@@ -101,6 +107,12 @@ public class HomeOrderFragment extends BaseFragment {
if(deviceStatusView2!=null){
getLifecycle().removeObserver(deviceStatusView2);
}
+ if(deviceStatusView3!=null){
+ getLifecycle().removeObserver(deviceStatusView3);
+ }
+ if(deviceStatusView4!=null){
+ getLifecycle().removeObserver(deviceStatusView4);
+ }
}catch (Exception e){
}
@@ -469,36 +481,29 @@ public class HomeOrderFragment extends BaseFragment {
*
**/
private void makingOrderDialog(BPA_ORDER_DETAIL orderDetail,int status,String name,String error,int position){
- Object isClose = ModbusCenter.listeningValue.get("电柜门关到位检测");
- if(isClose instanceof Boolean){
- if((Boolean) isClose){
- NewToastUtil.getInstance().showToastError("电柜门未关闭,请关闭!");
- return;
- }
- }
+// Object isClose = ModbusCenter.listeningValue.get("电柜门关到位检测");
+// if(isClose instanceof Boolean){
+// if((Boolean) isClose){
+// NewToastUtil.getInstance().showToastError("电柜门未关闭,请关闭!");
+// return;
+// }
+// }
AlertDialogUtils.showCancelAndConfirmDialog((AppCompatActivity) getActivity(), R.layout.dialog_order, (layoutView, xCom) -> {
DialogOrderBinding binding = DialogOrderBinding.bind(layoutView);
String desc = "【"+name+"】订单";
switch (status){
case -1:
- if(error.contains("未放置")){
- binding.submit.setText("确认已放料盆,开始制作");
- }else {
- binding.submit.setText("确认已补料,开始制作");
- }
- desc = "【"+name+"】检测到配料位不正确,请确认\n"+error;
+ binding.submit.setText("确认");
+ desc = error;
binding.cancel.setVisibility(View.GONE);
-
break;
case 0:
desc = "【"+name+"】订单准备就绪,是否开始制作?";
binding.cancel.setText("开始制作");
binding.submit.setText("制作并查看流程");
break;
- case 1:
- break;
case 2:
- desc = "【"+name+"】订单已完成,是否确认?";
+ desc = "【"+name+"】订单已完成,是否删除?";
binding.cancel.setText("取消");
binding.submit.setText("确认");
break;
@@ -517,7 +522,6 @@ public class HomeOrderFragment extends BaseFragment {
return;
}
switch (status){
- case -1:
case 0:
orderDetails1.get(position).status = 1;
BPA_ORDER_DETAIL bean = orderDetails1.get(position);
@@ -530,7 +534,7 @@ public class HomeOrderFragment extends BaseFragment {
startMakingThread(bean);
jumpToCook(bean);
break;
- case 1:
+ case -1:
break;
case 2:
case 3:
@@ -585,67 +589,17 @@ public class HomeOrderFragment extends BaseFragment {
return "";
}
try {
- StringBuilder check = new StringBuilder();
+ String check = "";
+ boolean hasMainFood = false;
List processDetails = GoodsProcessDetailDBUtil.getByGroupId(orderDetail.groupId);
for(BPA_GOODS_PROCESS_DETAIL processDetail:processDetails){
if(processDetail.processname.equals("主料")){
- String[] res = processDetail.processvalue.split("\\|");
- String[] res2= res[1].split(",");
- for(String s : res){
- if(s.contains("主料位置")){
- res2 = s.split(",");
- }
- }
- String pos = res2[1].replace("Z","");
- CheckPositionBean positionBean = ConfigName.getInstance().positionList.get("主料位置"+pos+"号位");
- if(positionBean!=null){
- if(positionBean.exist){
- if(positionBean.number%2 != 0){
- check.append("主料Z").append(res2[1]).append("未补料;");
- }
- }else {
- check.append("主料Z").append(res2[1]).append("未放置;");
- }
- }else {
- check.append("主料位置解析失败;");
- }
- }else if(processDetail.processname.equals("辅料")){
- String[] res = processDetail.processvalue.split("\\|");
- String[] res2= res[1].split(",");
- for(String s : res){
- if(s.contains("辅料位置")){
- res2 = s.split(",");
- }
- }
- String pos = res2[1].replace("F","");
- CheckPositionBean positionBean = ConfigName.getInstance().positionList.get("辅料位置"+pos+"号位");
- if(positionBean!=null){
- if(positionBean.exist){
- if(positionBean.number%2 != 0){
- check.append("辅料F").append(res2[1]).append("未补料;");
- }
- }else {
- check.append("辅料F").append(res2[1]).append("未放置;");
- }
- }else {
- check.append("辅料位置解析失败;");
- }
- }else if(processDetail.processname.equals("放入烤盘")){
- String[] res = processDetail.processvalue.split("\\|");
- for(String s : res){
- if(s.equals("烤盘位置")){
- String[] res2= s.split(",");
- String pos = res2[1].replace("K","");
- CheckPositionBean positionBean = ConfigName.getInstance().positionList.get("烤盘位置"+pos+"号位");
- if(positionBean!=null && positionBean.exist){
- check.append("烤盘K").append(res2[1]).append("未放置;");
- }else {
- check.append("烤盘位置解析失败;");
- }
- break;
- }
- }
-
+ hasMainFood = true;
+ }
+ }
+ if(hasMainFood){
+ if(orderDetail.type==0||orderDetail.mainPosition==0){
+ check = "请先设置主料位置以及炒锅位置!";
}
}
return check.toString();
diff --git a/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeWarnFragment.java b/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeWarnFragment.java
index b480340b..24cb60a5 100644
--- a/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeWarnFragment.java
+++ b/app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeWarnFragment.java
@@ -85,7 +85,7 @@ public class HomeWarnFragment extends BaseFragment {
}
public void freshPlc(){
- ThreadManager.get().StartLong(TAG, false, () -> {
+ ThreadManager.get().execute(()->{
try{
ModbusCenter.ReadPLCStatus(deviceNum);
ModbusCenter.setWokListeningValue(deviceNum,"搅拌电机");
@@ -100,25 +100,47 @@ public class HomeWarnFragment extends BaseFragment {
private void initView(){
warnInfoList = new ArrayList<>();
rightDataList = new ArrayList<>();
- viewBinding.titleChaoguo.setSelected(true);
+ viewBinding.titleWok1.setSelected(true);
- viewBinding.titleChaoguo.setOnClickListener(v->{
- viewBinding.titleChaoguo.setSelected(true);
- viewBinding.titleKaoxiang.setSelected(false);
+ viewBinding.titleWok1.setOnClickListener(v->{
+ viewBinding.titleWok1.setSelected(true);
+ viewBinding.titleWok2.setSelected(false);
+ viewBinding.titleWok3.setSelected(false);
+ viewBinding.titleWok4.setSelected(false);
viewBinding.titleRobot.setSelected(false);
changeContent(1);
});
- viewBinding.titleKaoxiang.setOnClickListener(v->{
- viewBinding.titleChaoguo.setSelected(false);
- viewBinding.titleKaoxiang.setSelected(true);
+ viewBinding.titleWok2.setOnClickListener(v->{
+ viewBinding.titleWok1.setSelected(false);
+ viewBinding.titleWok2.setSelected(true);
+ viewBinding.titleWok3.setSelected(false);
+ viewBinding.titleWok4.setSelected(false);
viewBinding.titleRobot.setSelected(false);
changeContent(2);
});
+ viewBinding.titleWok3.setOnClickListener(v->{
+ viewBinding.titleWok1.setSelected(false);
+ viewBinding.titleWok2.setSelected(false);
+ viewBinding.titleWok3.setSelected(true);
+ viewBinding.titleWok4.setSelected(false);
+ viewBinding.titleRobot.setSelected(false);
+ changeContent(3);
+ });
+ viewBinding.titleWok4.setOnClickListener(v->{
+ viewBinding.titleWok1.setSelected(false);
+ viewBinding.titleWok2.setSelected(false);
+ viewBinding.titleWok3.setSelected(false);
+ viewBinding.titleWok4.setSelected(true);
+ viewBinding.titleRobot.setSelected(false);
+ changeContent(4);
+ });
viewBinding.titleRobot.setOnClickListener(v->{
- viewBinding.titleChaoguo.setSelected(false);
- viewBinding.titleKaoxiang.setSelected(false);
+ viewBinding.titleWok1.setSelected(false);
+ viewBinding.titleWok2.setSelected(false);
+ viewBinding.titleWok3.setSelected(false);
+ viewBinding.titleWok4.setSelected(false);
viewBinding.titleRobot.setSelected(true);
- changeContent(3);
+ changeContent(5);
});
viewBinding.btnReset.setOnClickListener(v->{
@@ -133,20 +155,6 @@ public class HomeWarnFragment extends BaseFragment {
warnInfoAdapter = new WarnInfoAdapter() {
@Override
protected void onResetItemClick(View v, String value) {
-// AlertDialogUtils.showCancelAndConfirmDialog(getActivity(), R.layout.dialog_tip, (layoutView, xCom) -> {
-// DialogTipBinding binding = DialogTipBinding.bind(layoutView);
-// DisplayManager.scaleViewGroup(binding.getRoot());
-// binding.title.setText("确认机器人指令");
-// if(value.contains("超时")){
-// binding.message.setText(value+",请检查,是否复位?");
-// }
-// binding.close.setOnClickListener(view1->{
-// xCom.dismissX();
-// });
-// binding.submit.setOnClickListener(view1 -> {
-// xCom.dismissX();
-// });
-// });
}
};
warnInfoAdapter.setNewData(warnInfoList);
@@ -188,73 +196,22 @@ public class HomeWarnFragment extends BaseFragment {
}
private void updateRobotInfo(){
- Object object2 = ModbusCenter.listeningValue.get("机器人急停");
- Object object3 = ModbusCenter.listeningValue.get("机器人光栅");
- Object object4 = ModbusCenter.listeningValue.get("输送电机过载");
- Object object5 = ModbusCenter.listeningValue.get("输送电机通讯异常");
- if(object2 instanceof Boolean){
- if((Boolean) object2){
- warnInfoList.add("机器人急停:检测到急停");
- if(!rightDataList.contains("机器人急停:检测到急停")){
- rightDataList.add("机器人急停:检测到急停");
- }
- }else {
- warnInfoList.add("机器人急停:无故障");
- }
- }else {
- warnInfoList.add("机器人急停:检测异常");
- if(!rightDataList.contains("机器人急停:检测异常")){
- rightDataList.add("机器人急停:检测异常");
- }
- }
- if(object3 instanceof Boolean){
- if((Boolean) object3){
- warnInfoList.add("机器人光栅:光栅检测到物体");
- if(!rightDataList.contains("机器人光栅:光栅检测到物体")){
- rightDataList.add("机器人光栅:光栅检测到物体");
- }
- }else {
- warnInfoList.add("机器人光栅:无故障");
- }
- }else {
- warnInfoList.add("机器人光栅:检测异常");
- if(!rightDataList.contains("机器人光栅:检测异常")){
- rightDataList.add("机器人光栅:检测异常");
- }
- }
- if(ConfigName.getInstance().versionSelectionEnum.equals("鸿鹄大邑")||ConfigName.getInstance().versionSelectionEnum.equals("鸿鹄中江")){
- if(object4 instanceof Boolean){
- if((Boolean) object4){
- warnInfoList.add("输送电机过载:过载");
- if(!rightDataList.contains("输送电机过载:过载")){
- rightDataList.add("输送电机过载:过载");
- }
- }else {
- warnInfoList.add("输送电机过载:无故障");
- }
- }else {
- warnInfoList.add("输送电机过载:检测异常");
- if(!rightDataList.contains("输送电机过载:检测异常")){
- rightDataList.add("输送电机过载:检测异常");
- }
- }
- if(object5 instanceof Boolean){
- if((Boolean) object5){
- warnInfoList.add("输送电机通讯:异常");
- if(!rightDataList.contains("输送电机通讯:异常")){
- rightDataList.add("输送电机通讯:异常");
- }
- }else {
- warnInfoList.add("输送电机通讯:无故障");
- }
- }else {
- warnInfoList.add("输送电机通讯:检测异常");
- if(!rightDataList.contains("输送电机通讯:检测异常")){
- rightDataList.add("输送电机通讯:检测异常");
- }
- }
- }
-
+// Object object2 = ModbusCenter.listeningValue.get("机器人急停");
+// if(object2 instanceof Boolean){
+// if((Boolean) object2){
+// warnInfoList.add("机器人急停:检测到急停");
+// if(!rightDataList.contains("机器人急停:检测到急停")){
+// rightDataList.add("机器人急停:检测到急停");
+// }
+// }else {
+// warnInfoList.add("机器人急停:无故障");
+// }
+// }else {
+// warnInfoList.add("机器人急停:检测异常");
+// if(!rightDataList.contains("机器人急停:检测异常")){
+// rightDataList.add("机器人急停:检测异常");
+// }
+// }
}
private void updateWokInfo(int deviceNum){
@@ -329,7 +286,7 @@ public class HomeWarnFragment extends BaseFragment {
/**
* 切换标题内容
- * @param type 1炒锅 2烤箱 3机器人
+ * @param type 1 2 3 4炒锅 5机器人
*/
private void changeContent(int type){
this.type = type;
diff --git a/app/src/main/java/com/bonait/bnframework/newui/fragment/setting/SilosSettingFragment.java b/app/src/main/java/com/bonait/bnframework/newui/fragment/setting/SilosSettingFragment.java
index e7dc0b8f..8d204446 100644
--- a/app/src/main/java/com/bonait/bnframework/newui/fragment/setting/SilosSettingFragment.java
+++ b/app/src/main/java/com/bonait/bnframework/newui/fragment/setting/SilosSettingFragment.java
@@ -49,6 +49,8 @@ public class SilosSettingFragment extends BaseFragment {
List devices = new ArrayList<>();
devices.add("1号炒锅");
devices.add("2号炒锅");
+ devices.add("3号炒锅");
+ devices.add("4号炒锅");
ArrayAdapter spinnerAdapter2 = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, devices);
spinnerAdapter2.setDropDownViewResource(R.layout.spinner_dropdown_item);
viewBinding.spinnerWok.setAdapter(spinnerAdapter2);
diff --git a/app/src/main/res/drawable/bg_order.xml b/app/src/main/res/drawable/bg_order.xml
index 3fd1d303..d810875d 100644
--- a/app/src/main/res/drawable/bg_order.xml
+++ b/app/src/main/res/drawable/bg_order.xml
@@ -1,6 +1,6 @@
-
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_system_set.xml b/app/src/main/res/layout/activity_system_set.xml
index c638782a..58732ca2 100644
--- a/app/src/main/res/layout/activity_system_set.xml
+++ b/app/src/main/res/layout/activity_system_set.xml
@@ -70,7 +70,7 @@
>
-
-
+
diff --git a/app/src/main/res/layout/new/layout/activity_main_h.xml b/app/src/main/res/layout/new/layout/activity_main_h.xml
index b05627ce..c4787698 100644
--- a/app/src/main/res/layout/new/layout/activity_main_h.xml
+++ b/app/src/main/res/layout/new/layout/activity_main_h.xml
@@ -36,7 +36,7 @@
android:paddingBottom="10dp"
>
+
+
+
+
-
-
-
-
+
-
diff --git a/app/src/main/res/layout/new/layout/dialog_chucan_check.xml b/app/src/main/res/layout/new/layout/dialog_chucan_check.xml
deleted file mode 100644
index 41b4c210..00000000
--- a/app/src/main/res/layout/new/layout/dialog_chucan_check.xml
+++ /dev/null
@@ -1,130 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/new/layout/dialog_food_info.xml b/app/src/main/res/layout/new/layout/dialog_food_info.xml
index 5a806bd3..bd6e5ba6 100644
--- a/app/src/main/res/layout/new/layout/dialog_food_info.xml
+++ b/app/src/main/res/layout/new/layout/dialog_food_info.xml
@@ -33,145 +33,131 @@
+
-
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/new/layout/dialog_root3_tip.xml b/app/src/main/res/layout/new/layout/dialog_root3_tip.xml
deleted file mode 100644
index 19171145..00000000
--- a/app/src/main/res/layout/new/layout/dialog_root3_tip.xml
+++ /dev/null
@@ -1,39 +0,0 @@
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout/new/layout/fragment_home_warn_info.xml b/app/src/main/res/layout/new/layout/fragment_home_warn_info.xml
index 145b52d8..d9b975eb 100644
--- a/app/src/main/res/layout/new/layout/fragment_home_warn_info.xml
+++ b/app/src/main/res/layout/new/layout/fragment_home_warn_info.xml
@@ -16,12 +16,12 @@
android:orientation="vertical"
android:layout_height="match_parent">
+
+
+
+
diff --git a/app/src/main/res/layout/new/layout/item_wok_name.xml b/app/src/main/res/layout/new/layout/item_wok_name.xml
new file mode 100644
index 00000000..82fa98a6
--- /dev/null
+++ b/app/src/main/res/layout/new/layout/item_wok_name.xml
@@ -0,0 +1,33 @@
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/new/layout/layout_root_tip2.xml b/app/src/main/res/layout/new/layout/layout_root_tip2.xml
index aba4d146..b258f985 100644
--- a/app/src/main/res/layout/new/layout/layout_root_tip2.xml
+++ b/app/src/main/res/layout/new/layout/layout_root_tip2.xml
@@ -6,13 +6,12 @@
android:layout_gravity="center"
android:gravity="center"
android:background="@color/transparent"
- tools:layout_height="1008dp"
android:layout_height="wrap_content">
+ android:layout_width="1000dp"
+ android:layout_height="900dp">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ app:layout_constraintStart_toStartOf="parent"
+ android:layout_marginTop="250dp"
+ android:layout_marginStart="100dp"
+ android:layout_marginEnd="100dp"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content">
-
-
-
-
-
+
-
-
-
-
-
-
-
-
-
-
-
-
+ android:gravity="center"
+ android:background="@mipmap/ic_pen"
+ />
+
-
-
-
-
+