From 0c964e17fe77e4e64cbe3f406fb838a4a6ea884b Mon Sep 17 00:00:00 2001 From: liup <1454939542@qq.com> Date: Thu, 30 May 2024 00:35:06 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/NewExecuteTheRecipe.java | 14 +++-------- .../ui/activity/CookingActivity.java | 13 ++++------ .../ui/activity/EditClassifyActivity.java | 4 +++ .../ui/dialog/EditGoodsDialog.java | 11 +++++--- .../main/res/drawable/bg_round25_gray_btn.xml | 6 +++++ .../dialog/layout/dialog_attribute_select.xml | 23 ++++++++++------- .../layout_edit_goods_sub_attribute.xml | 25 +++++++++++-------- 7 files changed, 56 insertions(+), 40 deletions(-) create mode 100644 app/src/main/res/drawable/bg_round25_gray_btn.xml diff --git a/app/src/main/java/com/bonait/bnframework/business/NewExecuteTheRecipe.java b/app/src/main/java/com/bonait/bnframework/business/NewExecuteTheRecipe.java index e4f120e2..dfec1aff 100644 --- a/app/src/main/java/com/bonait/bnframework/business/NewExecuteTheRecipe.java +++ b/app/src/main/java/com/bonait/bnframework/business/NewExecuteTheRecipe.java @@ -296,14 +296,12 @@ public class NewExecuteTheRecipe { int val = 0; int position = 0; int type = 0; - String dang = ""; for (HashMap.Entry entry : data.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); if (key.contains("(秒)")) { val = Integer.parseInt(value); } else if(key.contains("搅拌档位")){ - dang = value; if(value.contains("档")){ position = Integer.parseInt(value.replace("档",""))*10; }else { @@ -316,7 +314,7 @@ public class NewExecuteTheRecipe { } } String tip = type==0?"正转":"反转"; - NewToastUtil.getInstance().showToast("工序:" + "搅拌控制," + tip+";档位,"+dang+"档"); + NewToastUtil.getInstance().showToast("工序:" + "搅拌控制," + tip+";档位,"+position/10+"档"); if(!isTest){ ModbusHelper.get().setStirModel(type); } @@ -372,14 +370,12 @@ public class NewExecuteTheRecipe { int position = 0; int time1 = 0; int time2 = 0; - String dang = ""; for (HashMap.Entry entry : data.entrySet()) { String key = entry.getKey(); String value = entry.getValue(); if (key.contains("(秒)")) { val = Integer.parseInt(value); } else if(key.contains("搅拌档位")){ - dang = value; if(value.contains("档")){ position = Integer.parseInt(value.replace("档",""))*10; }else { @@ -391,7 +387,7 @@ public class NewExecuteTheRecipe { time2= Integer.parseInt(value); } } - NewToastUtil.getInstance().showToast("工序:" + "搅拌控制,正反转切换;档位,"+dang+"档"); + NewToastUtil.getInstance().showToast("工序:" + "搅拌控制,正反转切换;档位,"+position/10+"档"); if(!isTest){ ModbusHelper.get().setStirModel(2); ModbusHelper.get().setStirTime(1,time1); @@ -519,7 +515,6 @@ public class NewExecuteTheRecipe { try { int val = 0; int hotNum = 0;//加热档位 - String dang = ""; boolean startHot = false;//是否启动加热 for (HashMap.Entry entry : data.entrySet()) { String key = entry.getKey(); @@ -527,7 +522,6 @@ public class NewExecuteTheRecipe { if (key.contains("(秒)")) { val = Integer.parseInt(value); } else if(key.contains("档位")){ - dang = value; if(value.contains("档")){ hotNum = Integer.parseInt(value.replace("档",""))*10; }else { @@ -542,11 +536,11 @@ public class NewExecuteTheRecipe { } } String tip = startHot? "启动加热":"停止加热"; - NewToastUtil.getInstance().showToast("工序:" + "加热控制," + tip+";档位,"+dang+"档"); + NewToastUtil.getInstance().showToast("工序:" + "加热控制," + tip+";档位,"+hotNum/10+"档"); if(!isTest){ ModbusHelper.get().Heating(hotNum,startHot); } - EventBus.getDefault().post(new ProcessMakingEvent(1,tip+"|"+dang)); + EventBus.getDefault().post(new ProcessMakingEvent(1,tip+"|"+hotNum/10)); if (val > 0) { diff --git a/app/src/main/java/com/bonait/bnframework/ui/activity/CookingActivity.java b/app/src/main/java/com/bonait/bnframework/ui/activity/CookingActivity.java index 6f0e60bb..d3914214 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/activity/CookingActivity.java +++ b/app/src/main/java/com/bonait/bnframework/ui/activity/CookingActivity.java @@ -132,8 +132,10 @@ public class CookingActivity extends BaseActivity { return; } if(!isMaking){ + isMaking = true; onRecordStart(); }else { + isMaking = false; onRecordStop(); NewExecuteTheRecipe.IsForcedEnd = false; setReset(); @@ -157,14 +159,11 @@ public class CookingActivity extends BaseActivity { if(!isTest){ ThreadManager.get().execute(new Thread(()->{ ModbusHelper.get().reset(); + ModbusHelper.get().setCookStatus(false); })); ThreadManager.get().execute(new Thread(() -> { ModbusHelper.get().addWater(0f,true); - })); - ThreadManager.get().execute(new Thread(() -> { ModbusHelper.get().addThickenWater(0f,true); - })); - ThreadManager.get().execute(new Thread(() -> { for(int i =1;i<=9;i++){ ModbusHelper.get().addMaterial(0f,i,true); } @@ -265,6 +264,7 @@ public class CookingActivity extends BaseActivity { LogUtils.d("异常信息:" + ex.getMessage()); NewToastUtil.getInstance().showToastError("异常信息:" + ex.getMessage()); } finally { + isMaking = false; NewExecuteTheRecipe.IsStart = false; if (!NewExecuteTheRecipe.IsForcedEnd && !isError && !isTest){ long endTime = System.currentTimeMillis(); //结束时间 @@ -422,14 +422,11 @@ public class CookingActivity extends BaseActivity { if(!isTest){ ThreadManager.get().execute(new Thread(()->{ ModbusHelper.get().reset(); + ModbusHelper.get().setCookStatus(false); })); ThreadManager.get().execute(new Thread(() -> { ModbusHelper.get().addWater(0f,true); - })); - ThreadManager.get().execute(new Thread(() -> { ModbusHelper.get().addThickenWater(0f,true); - })); - ThreadManager.get().execute(new Thread(() -> { for(int i =1;i<=9;i++){ ModbusHelper.get().addMaterial(0f,i,true); } diff --git a/app/src/main/java/com/bonait/bnframework/ui/activity/EditClassifyActivity.java b/app/src/main/java/com/bonait/bnframework/ui/activity/EditClassifyActivity.java index 59203c71..a4883e1c 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/activity/EditClassifyActivity.java +++ b/app/src/main/java/com/bonait/bnframework/ui/activity/EditClassifyActivity.java @@ -376,6 +376,10 @@ public class EditClassifyActivity extends BaseActivity { * 添加属性 */ private void addAttribute(){ + if(attributeList.size()>=6){ + NewToastUtil.getInstance().showToast("属性已达到上限"); + return; + } if(classifyPosition==0){ return; } diff --git a/app/src/main/java/com/bonait/bnframework/ui/dialog/EditGoodsDialog.java b/app/src/main/java/com/bonait/bnframework/ui/dialog/EditGoodsDialog.java index 226a7db4..c4cf8658 100644 --- a/app/src/main/java/com/bonait/bnframework/ui/dialog/EditGoodsDialog.java +++ b/app/src/main/java/com/bonait/bnframework/ui/dialog/EditGoodsDialog.java @@ -177,7 +177,8 @@ public class EditGoodsDialog extends DialogFragment { // } // return; // } - if(!hasGroup().isEmpty()){ +// if(!hasGroup().isEmpty()){ + if(viewBinding.layoutAttribute.groupDesc.getText().toString().equals("存在选中组合")){ changePage(3); }else { NewToastUtil.getInstance().showToast("不存在该组合"); @@ -457,6 +458,7 @@ public class EditGoodsDialog extends DialogFragment { public void onClick() { if(!hasGroup().isEmpty()){ viewBinding.layoutAttribute.groupDesc.setText("存在选中组合"); + viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_yellow_btn); int pos = 0; for(int i =0;i adapterView, View view, int i, long l) { if(isUserClicked){ if(i==0){ viewBinding.layoutAttribute.groupDesc.setText(""); + viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_gray_btn); updateAttributeData(viewBinding.layoutAttribute.spinnerList.getSelectedItem().toString()); }else { updateAttributeData(viewBinding.layoutAttribute.spinnerList.getSelectedItem().toString()); - viewBinding.layoutAttribute.groupDesc.setText("存在该组合"); + viewBinding.layoutAttribute.groupDesc.setText("存在选中组合"); + viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_yellow_btn); } isUserClicked = false; } diff --git a/app/src/main/res/drawable/bg_round25_gray_btn.xml b/app/src/main/res/drawable/bg_round25_gray_btn.xml new file mode 100644 index 00000000..a072d217 --- /dev/null +++ b/app/src/main/res/drawable/bg_round25_gray_btn.xml @@ -0,0 +1,6 @@ + + + + + + diff --git a/app/src/main/res/layout/dialog/layout/dialog_attribute_select.xml b/app/src/main/res/layout/dialog/layout/dialog_attribute_select.xml index ee7edd21..e28d0c84 100644 --- a/app/src/main/res/layout/dialog/layout/dialog_attribute_select.xml +++ b/app/src/main/res/layout/dialog/layout/dialog_attribute_select.xml @@ -8,7 +8,7 @@ - + app:layout_constraintBottom_toTopOf="@id/btn_submit" + android:layout_margin="@dimen/dp_20"> + + + @@ -42,18 +42,22 @@ android:layout_marginStart="@dimen/dp_20" /> - + app:layout_constraintTop_toBottomOf="@id/spinner_list" + app:layout_constraintBottom_toTopOf="@id/btn_last2"> + + +