From c55e111cdab28f1c3d3de498b5aad61fe4c4b078 Mon Sep 17 00:00:00 2001 From: liup <1454939542@qq.com> Date: Mon, 23 Sep 2024 16:03:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E5=B1=95=E4=BC=9A=E6=BC=94?= =?UTF-8?q?=E7=A4=BA=E9=A1=B9=E7=9B=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/ExecuteTheRecipe.java | 54 +++++++++++++------ .../common/constant/ConfigName.java | 1 + .../bnframework/modbus/ModbusCenter.java | 13 ++--- .../newui/activity/LogRecordHActivity.java | 6 ++- .../newui/dialog/check/FoodCheckDialog3.java | 42 +++++++++++---- .../newui/dialog/check/RootTipDialog.java | 18 +++---- .../newui/dialog/check/RootTipDialog2.java | 18 +++---- .../newui/dialog/check/RootTipDialog3.java | 42 +++++++++++---- .../calssify/PropEditClassifyFragment.java | 4 +- .../layout/new/layout/dialog_food_check3.xml | 4 +- 10 files changed, 133 insertions(+), 69 deletions(-) diff --git a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java index 778b8715..ec6177b8 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java +++ b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java @@ -982,6 +982,7 @@ public class ExecuteTheRecipe { ModbusCenter.robotWritePlc(false,deviceNum+"号炒锅允许倒料",true,null); ModbusCenter.robotWritePlc(true,foodPosition+"#库取原料倒至炒锅",true,null); + RobotModbusTcpServer.get().WriteShort("GI1", (short) deviceNum, null); Thread.sleep(100); ThreadWhile(deviceNum,deviceNum+"炒锅倒原料完成"); @@ -1106,6 +1107,7 @@ public class ExecuteTheRecipe { ModbusCenter.robotWritePlc(false,deviceNum+"号炒锅允许倒料",true,null); ModbusCenter.robotWritePlc(true,foodPosition+"#库取调料倒至炒锅",true,null); + RobotModbusTcpServer.get().WriteShort("GI2", (short) deviceNum, null); Thread.sleep(100); ThreadWhile(deviceNum,deviceNum+"炒锅倒调料完成"); @@ -1154,23 +1156,45 @@ public class ExecuteTheRecipe { ConfigName.IsForcedEnd[deviceNum-1] = true; break; }else{ - Object pan1 = ModbusCenter.ReadPlc(1,"1#空盆库位检测有无"); - Object pan2 = ModbusCenter.ReadPlc(1,"2#空盆库位检测有无"); - Object pan3 = ModbusCenter.ReadPlc(1,"3#空盆库位检测有无"); - if(pan1 !=null){ - isCheck = (Boolean) pan1|| (Boolean)pan2|| (Boolean)pan3; - if( (Boolean)pan1){ - index = 21; - }else if( (Boolean)pan2){ - index = 22; - }else if( (Boolean)pan3){ - index = 23; + if(ConfigName.getInstance().isDemo){ + Object pan1 = ModbusCenter.ReadPlc(1,"1#空盆库位检测有无"); + Object pan2 = ModbusCenter.ReadPlc(1,"2#空盆库位检测有无"); + if(pan1 !=null){ + if(deviceNum == 1){ + isCheck = (Boolean) pan1; + }else { + isCheck = (Boolean) pan2; + } + if( (Boolean)pan1){ + index = 21; + }else if( (Boolean)pan2){ + index = 22; + } + RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-" + ",空盆库位检测有无:"+isCheck); + }else{ + RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-" + ",空盆库位检测有无:异常"); + } + }else { + Object pan1 = ModbusCenter.ReadPlc(1,"1#空盆库位检测有无"); + Object pan2 = ModbusCenter.ReadPlc(1,"2#空盆库位检测有无"); + Object pan3 = ModbusCenter.ReadPlc(1,"3#空盆库位检测有无"); + if(pan1 !=null){ + isCheck = (Boolean) pan1|| (Boolean)pan2|| (Boolean)pan3; + if( (Boolean)pan1){ + index = 21; + }else if( (Boolean)pan2){ + index = 22; + }else if( (Boolean)pan3){ + index = 23; + } + RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-" + ",空盆库位检测有无:"+isCheck); + }else{ + RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-" + ",空盆库位检测有无:异常"); } - RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-" + ",空盆库位检测有无:"+isCheck); - }else{ - RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-" + ",空盆库位检测有无:异常"); } - + if(!isCheck){ + NewToastUtil.getInstance().showToast("请放置出餐空盆!"); + } } Thread.sleep(100); } 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 b1ffb045..e9bbbe48 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 @@ -40,6 +40,7 @@ public class ConfigName { public final static boolean LOG_TEST = true; //region 单例模式 private static volatile ConfigName mInstance = null; //实例变量设置私有,防止直接通过类名访问 + public boolean isDemo = false;//是否是展会演示 出餐和空盆有区别 private ConfigName() { //默认构造函数私有,防止类外直接new创建对象 } 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 045349f0..be03e4f1 100644 --- a/app/src/main/java/com/bonait/bnframework/modbus/ModbusCenter.java +++ b/app/src/main/java/com/bonait/bnframework/modbus/ModbusCenter.java @@ -153,13 +153,6 @@ public class ModbusCenter { if (item.isread == 1) { if(Wok2ModbusTcpServer.get().plcIsConnect){ Object val = wokReadPlc(2,item.name); - if(item.name.equals("原点位反馈")||item.name.equals("投料位反馈")){ - if(RobotModbusTcpServer.get().plcIsConnect){ - if((boolean)val){ - ModbusCenter.robotWritePlc(false,"2号炒锅允许倒料",true,null); - } - } - } Wok2ModbusTcpServer.get().listeningValue.put(item.name, val); } } @@ -169,7 +162,7 @@ public class ModbusCenter { Object object2 = Wok2ModbusTcpServer.get().listeningValue.get("投料位反馈"); if(object1 instanceof Boolean){ if((Boolean) object2 || (Boolean)object1){ - ModbusCenter.robotWritePlc(false,"1号炒锅允许倒料",true,null); + ModbusCenter.robotWritePlc(false,"2号炒锅允许倒料",true,null); } } Object hotError = ModbusCenter.wokReadPlc(1,"异常加热故障信息"); @@ -701,7 +694,7 @@ public class ModbusCenter { if(isMain){ if (ConfigName.getInstance().robotMainIndex.get(name)!=null) { int index = ConfigName.getInstance().robotMainIndex.get(name); - LogUtils.d("robotWritePlc name="+name+";GI0 index="+index); + LogUtils.d("robotWritePlc name="+name+";GI0 index="+index+" value="+value); if (RobotModbusTcpServer.get().plcIsConnect) { RobotModbusTcpServer.get().WriteShort("GI0", (short) index, callback); } @@ -710,7 +703,7 @@ public class ModbusCenter { if (plcAddress.get(name)!=null) { BPA_PLCADDRESS plcaddress = plcAddress.get(name); assert plcaddress != null; - LogUtils.d("robotWritePlc name="+name+";plcaddress.address="+plcaddress.address); + LogUtils.d("robotWritePlc name="+name+";plcaddress.address="+plcaddress.address+" value="+value); if (!plcaddress.address.isEmpty() && RobotModbusTcpServer.get().plcIsConnect) { if (plcaddress.address.toUpperCase().startsWith("M"))//bool { diff --git a/app/src/main/java/com/bonait/bnframework/newui/activity/LogRecordHActivity.java b/app/src/main/java/com/bonait/bnframework/newui/activity/LogRecordHActivity.java index ca623190..b2cea796 100644 --- a/app/src/main/java/com/bonait/bnframework/newui/activity/LogRecordHActivity.java +++ b/app/src/main/java/com/bonait/bnframework/newui/activity/LogRecordHActivity.java @@ -92,8 +92,10 @@ public class LogRecordHActivity extends BaseActivity { ArrayAdapter adapter2 = new ArrayAdapter<>(this, R.layout.spinner_text_item,typeMap); adapter2.setDropDownViewResource(R.layout.spinner_dropdown_item); viewBinding.spinner.setAdapter(adapter2); - viewBinding.starttime.setText( new SimpleDateFormat("yyyy-MM-dd 00:00:00").format(new Date())); - viewBinding.stoptime.setText(new SimpleDateFormat("yyyy-MM-dd 23:59:59").format(new Date())); + String time = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(new Date().getTime() - 60*60 * 1000)); + String time2 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(new Date().getTime() )); + viewBinding.starttime.setText(time); + viewBinding.stoptime.setText(time2); viewBinding.starttime.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { diff --git a/app/src/main/java/com/bonait/bnframework/newui/dialog/check/FoodCheckDialog3.java b/app/src/main/java/com/bonait/bnframework/newui/dialog/check/FoodCheckDialog3.java index c017a888..fa922f12 100644 --- a/app/src/main/java/com/bonait/bnframework/newui/dialog/check/FoodCheckDialog3.java +++ b/app/src/main/java/com/bonait/bnframework/newui/dialog/check/FoodCheckDialog3.java @@ -232,22 +232,44 @@ public class FoodCheckDialog3 extends DialogFragment { break; case "出餐盆1": - if(value.exist){ - viewBinding.tvChucan1.setText("出餐盘1有盆"); - viewBinding.tvChucan1.setSelected(true); + if(ConfigName.getInstance().isDemo){ + if(value.exist){ + viewBinding.tvChucan2.setText("出餐盘1有盆"); + viewBinding.tvChucan2.setSelected(true); + }else { + viewBinding.tvChucan2.setText("出餐盘1无盆"); + viewBinding.tvChucan2.setSelected(false); + } }else { - viewBinding.tvChucan1.setText("出餐盘1无盆"); - viewBinding.tvChucan1.setSelected(false); + 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); + if(ConfigName.getInstance().isDemo){ + if(value.exist){ + viewBinding.tvChucan1.setText("出餐盘2有盆"); + viewBinding.tvChucan1.setSelected(true); + }else { + viewBinding.tvChucan1.setText("出餐盘2无盆"); + viewBinding.tvChucan1.setSelected(false); + } }else { - viewBinding.tvChucan2.setText("出餐盘2无盆"); - viewBinding.tvChucan2.setSelected(false); + 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){ 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 75ec3af4..6a6e4c7f 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 @@ -258,28 +258,28 @@ public class RootTipDialog extends DialogFragment { case "出餐盆1": if(value.exist){ viewBinding.content2.tvChucan1.setText("出餐盆1有盆"); - viewBinding.content2.right6.setSelected(true); + viewBinding.content2.tvChucan1.setSelected(true); }else { - viewBinding.content2.right6.setText("出餐盆1无盆"); - viewBinding.content2.right6.setSelected(false); + viewBinding.content2.tvChucan1.setText("出餐盆1无盆"); + viewBinding.content2.tvChucan1.setSelected(false); } break; case "出餐盆2": if(value.exist){ viewBinding.content2.tvChucan2.setText("出餐盆2有盆"); - viewBinding.content2.right6.setSelected(true); + viewBinding.content2.tvChucan2.setSelected(true); }else { - viewBinding.content2.right6.setText("出餐盆2无盆"); - viewBinding.content2.right6.setSelected(false); + viewBinding.content2.tvChucan2.setText("出餐盆2无盆"); + viewBinding.content2.tvChucan2.setSelected(false); } break; case "出餐盆3": if(value.exist){ viewBinding.content2.tvChucan3.setText("出餐盆3有盆"); - viewBinding.content2.right6.setSelected(true); + viewBinding.content2.tvChucan3.setSelected(true); }else { - viewBinding.content2.right6.setText("出餐盆3无盆"); - viewBinding.content2.right6.setSelected(false); + viewBinding.content2.tvChucan3.setText("出餐盆3无盆"); + viewBinding.content2.tvChucan3.setSelected(false); } break; } diff --git a/app/src/main/java/com/bonait/bnframework/newui/dialog/check/RootTipDialog2.java b/app/src/main/java/com/bonait/bnframework/newui/dialog/check/RootTipDialog2.java index b1d16201..c90e2252 100644 --- a/app/src/main/java/com/bonait/bnframework/newui/dialog/check/RootTipDialog2.java +++ b/app/src/main/java/com/bonait/bnframework/newui/dialog/check/RootTipDialog2.java @@ -258,28 +258,28 @@ public class RootTipDialog2 extends DialogFragment { case "出餐盆1": if(value.exist){ viewBinding.content2.tvChucan1.setText("出餐盆1有盆"); - viewBinding.content2.right6.setSelected(true); + viewBinding.content2.tvChucan1.setSelected(true); }else { - viewBinding.content2.right6.setText("出餐盆1无盆"); - viewBinding.content2.right6.setSelected(false); + viewBinding.content2.tvChucan1.setText("出餐盆1无盆"); + viewBinding.content2.tvChucan1.setSelected(false); } break; case "出餐盆2": if(value.exist){ viewBinding.content2.tvChucan2.setText("出餐盆2有盆"); - viewBinding.content2.right6.setSelected(true); + viewBinding.content2.tvChucan2.setSelected(true); }else { - viewBinding.content2.right6.setText("出餐盆2无盆"); - viewBinding.content2.right6.setSelected(false); + viewBinding.content2.tvChucan2.setText("出餐盆2无盆"); + viewBinding.content2.tvChucan2.setSelected(false); } break; case "出餐盆3": if(value.exist){ viewBinding.content2.tvChucan3.setText("出餐盆3有盆"); - viewBinding.content2.right6.setSelected(true); + viewBinding.content2.tvChucan3.setSelected(true); }else { - viewBinding.content2.right6.setText("出餐盆3无盆"); - viewBinding.content2.right6.setSelected(false); + viewBinding.content2.tvChucan3.setText("出餐盆3无盆"); + viewBinding.content2.tvChucan3.setSelected(false); } break; } diff --git a/app/src/main/java/com/bonait/bnframework/newui/dialog/check/RootTipDialog3.java b/app/src/main/java/com/bonait/bnframework/newui/dialog/check/RootTipDialog3.java index 335d1987..f7964cd3 100644 --- a/app/src/main/java/com/bonait/bnframework/newui/dialog/check/RootTipDialog3.java +++ b/app/src/main/java/com/bonait/bnframework/newui/dialog/check/RootTipDialog3.java @@ -255,22 +255,44 @@ public class RootTipDialog3 extends DialogFragment { break; case "出餐盆1": - if(value.exist){ - viewBinding.content2.tvChucan1.setText("出餐盆1有盆"); - viewBinding.content2.right6.setSelected(true); + if(ConfigName.getInstance().isDemo){ + if(value.exist){ + viewBinding.content2.tvChucan2.setText("出餐盆1有盆"); + viewBinding.content2.tvChucan2.setSelected(true); + }else { + viewBinding.content2.tvChucan2.setText("出餐盆1无盆"); + viewBinding.content2.tvChucan2.setSelected(false); + } }else { - viewBinding.content2.right6.setText("出餐盆1无盆"); - viewBinding.content2.right6.setSelected(false); + 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.right6.setSelected(true); + if(ConfigName.getInstance().isDemo){ + if(value.exist){ + viewBinding.content2.tvChucan1.setText("出餐盆2有盆"); + viewBinding.content2.tvChucan1.setSelected(true); + }else { + viewBinding.content2.tvChucan1.setText("出餐盆2无盆"); + viewBinding.content2.tvChucan1.setSelected(false); + } }else { - viewBinding.content2.right6.setText("出餐盆2无盆"); - viewBinding.content2.right6.setSelected(false); + 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; default: /*case "出餐盆3": diff --git a/app/src/main/java/com/bonait/bnframework/newui/fragment/calssify/PropEditClassifyFragment.java b/app/src/main/java/com/bonait/bnframework/newui/fragment/calssify/PropEditClassifyFragment.java index 297190bf..a97fe91e 100644 --- a/app/src/main/java/com/bonait/bnframework/newui/fragment/calssify/PropEditClassifyFragment.java +++ b/app/src/main/java/com/bonait/bnframework/newui/fragment/calssify/PropEditClassifyFragment.java @@ -419,8 +419,8 @@ public class PropEditClassifyFragment extends BaseFragment { NewToastUtil.getInstance().showToast("点击过快!"); return; } - if(GoodsClassifyDBUtil.deleteById(classifyId)){ - GoodsClassifyDBUtil.DeleteList(GoodsClassifyDBUtil.getListByName(classifyName)); + if(PropClassifyDBUtil.deleteById(classifyId)){ + PropClassifyDBUtil.DeleteList(PropClassifyDBUtil.getListByName(classifyName)); AttributeDBUtil.deleteByClassifyId(classifyId); GoodsDBUtil.deleteByPropClassifyId(classifyId); SubAttributeGroupDBUtil.deleteByClassifyId(classifyId); diff --git a/app/src/main/res/layout/new/layout/dialog_food_check3.xml b/app/src/main/res/layout/new/layout/dialog_food_check3.xml index cc108a0c..74cae71c 100644 --- a/app/src/main/res/layout/new/layout/dialog_food_check3.xml +++ b/app/src/main/res/layout/new/layout/dialog_food_check3.xml @@ -204,7 +204,7 @@ android:textSize="32sp" android:maxLines="2" android:ellipsize="end" - android:text="出餐盆1有盆" + android:text="出餐盆2有盆" android:textColor="@color/black" tools:background="@mipmap/ic_pen" /> @@ -222,7 +222,7 @@ android:textSize="32sp" android:maxLines="2" android:ellipsize="end" - android:text="出餐盆2有盆" + android:text="出餐盆1有盆" android:textColor="@color/black" tools:background="@mipmap/ic_pen" />