Browse Source

修改bug

桌面小炒机
liup 7 months ago
parent
commit
0c964e17fe
7 changed files with 56 additions and 40 deletions
  1. +4
    -10
      app/src/main/java/com/bonait/bnframework/business/NewExecuteTheRecipe.java
  2. +5
    -8
      app/src/main/java/com/bonait/bnframework/ui/activity/CookingActivity.java
  3. +4
    -0
      app/src/main/java/com/bonait/bnframework/ui/activity/EditClassifyActivity.java
  4. +8
    -3
      app/src/main/java/com/bonait/bnframework/ui/dialog/EditGoodsDialog.java
  5. +6
    -0
      app/src/main/res/drawable/bg_round25_gray_btn.xml
  6. +14
    -9
      app/src/main/res/layout/dialog/layout/dialog_attribute_select.xml
  7. +15
    -10
      app/src/main/res/layout/dialog/layout/layout_edit_goods_sub_attribute.xml

+ 4
- 10
app/src/main/java/com/bonait/bnframework/business/NewExecuteTheRecipe.java View File

@@ -296,14 +296,12 @@ public class NewExecuteTheRecipe {
int val = 0;
int position = 0;
int type = 0;
String dang = "";
for (HashMap.Entry<String, String> 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<String, String> 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<String, String> 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) {


+ 5
- 8
app/src/main/java/com/bonait/bnframework/ui/activity/CookingActivity.java View File

@@ -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);
}


+ 4
- 0
app/src/main/java/com/bonait/bnframework/ui/activity/EditClassifyActivity.java View File

@@ -376,6 +376,10 @@ public class EditClassifyActivity extends BaseActivity {
* 添加属性
*/
private void addAttribute(){
if(attributeList.size()>=6){
NewToastUtil.getInstance().showToast("属性已达到上限");
return;
}
if(classifyPosition==0){
return;
}


+ 8
- 3
app/src/main/java/com/bonait/bnframework/ui/dialog/EditGoodsDialog.java View File

@@ -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<groupList.size();i++){
if(groupList.get(i).equals(selectAttributeListAdapter.getSubAttributeNameList())){
@@ -466,6 +468,7 @@ public class EditGoodsDialog extends DialogFragment {
viewBinding.layoutAttribute.spinnerList.setSelection(pos);
}else{
viewBinding.layoutAttribute.groupDesc.setText("不存在选中组合");
viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_gray_btn);
}
}
});
@@ -500,17 +503,19 @@ public class EditGoodsDialog extends DialogFragment {
return false;
}
});
viewBinding.layoutAttribute.btnNext2.setBackgroundResource(R.drawable.bg_round25_gray_btn);
viewBinding.layoutAttribute.spinnerList.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> 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;
}


+ 6
- 0
app/src/main/res/drawable/bg_round25_gray_btn.xml View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">

<corners android:radius="@dimen/dp_25"/>
<solid android:color="@color/color3"/>
</shape>

+ 14
- 9
app/src/main/res/layout/dialog/layout/dialog_attribute_select.xml View File

@@ -8,7 +8,7 @@
<!--子属性选择-->
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="@dimen/dp_740"
android:layout_height="@dimen/dp_1100"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
@@ -26,17 +26,22 @@
android:text="导入已有组合工序"
/>

<ListView
android:id="@+id/list_attribute"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/title2"
app:layout_constraintBottom_toTopOf="@id/btn_submit"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_margin="@dimen/dp_20"
android:divider="#00000000"
android:orientation="vertical"
/>
app:layout_constraintBottom_toTopOf="@id/btn_submit"
android:layout_margin="@dimen/dp_20">
<ListView
android:id="@+id/list_attribute"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="#00000000"
android:orientation="vertical"
/>
</FrameLayout>


<TextView
android:id="@+id/btn_submit"


+ 15
- 10
app/src/main/res/layout/dialog/layout/layout_edit_goods_sub_attribute.xml View File

@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="@dimen/dp_740"
android:layout_height="@dimen/dp_1100"
android:layout_height="wrap_content"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:background="@drawable/bg_round25_white">
@@ -42,18 +42,22 @@
android:layout_marginStart="@dimen/dp_20"
/>

<ListView
android:id="@+id/list_attribute"
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_height="wrap_content"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintBottom_toTopOf="@id/btn_last2"
app:layout_constraintTop_toBottomOf="@id/spinner_list"
android:layout_margin="@dimen/dp_20"
android:divider="#00000000"
android:orientation="vertical"
android:layout_marginBottom="@dimen/dp_100"
/>
app:layout_constraintTop_toBottomOf="@id/spinner_list"
app:layout_constraintBottom_toTopOf="@id/btn_last2">
<ListView
android:id="@+id/list_attribute"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:divider="#00000000"
android:orientation="vertical"
/>
</FrameLayout>


<TextView
android:id="@+id/group_desc"
@@ -80,6 +84,7 @@
android:layout_marginBottom="@dimen/dp_20"
android:layout_marginTop="@dimen/dp_30"
style="@style/TextView_btn_dialog"
tools:background="@drawable/bg_round25_gray_btn"
android:text="下一步"
/>



Loading…
Cancel
Save