Browse Source

修改

桌面小炒机
liup 7 months ago
parent
commit
5576b05a90
9 changed files with 731 additions and 512 deletions
  1. +1
    -1
      app/src/main/AndroidManifest.xml
  2. +96
    -0
      app/src/main/java/com/bonait/bnframework/common/db/util/GoodsProcessDetailDBUtil.java
  3. +0
    -2
      app/src/main/java/com/bonait/bnframework/common/db/util/SubAttributeGroupDBUtil.java
  4. +82
    -0
      app/src/main/java/com/bonait/bnframework/common/utils/CookTimeUtils.java
  5. +6
    -0
      app/src/main/java/com/bonait/bnframework/common/utils/UpdateAppUtils.java
  6. +45
    -9
      app/src/main/java/com/bonait/bnframework/ui/activity/DiyProcessActivity.java
  7. +491
    -491
      app/src/main/java/com/bonait/bnframework/ui/activity/RecProcessActivity.java
  8. +1
    -1
      app/src/main/java/com/bonait/bnframework/ui/adapter/DiyStepAdapter.java
  9. +9
    -8
      app/src/main/res/layout/dialog/layout/layout_add_goods_mainfood.xml

+ 1
- 1
app/src/main/AndroidManifest.xml View File

@@ -210,7 +210,7 @@
<category android:name="android.intent.category.LAUNCHER" />
<!-- <category android:name="android.intent.category.LEANBACK_LAUNCHER" />-->
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.HOME" />
<!-- <category android:name="android.intent.category.HOME" />-->
</intent-filter>
</activity>
<activity android:name=".ViewModel.ActivityViewModel.LoginActivity"


+ 96
- 0
app/src/main/java/com/bonait/bnframework/common/db/util/GoodsProcessDetailDBUtil.java View File

@@ -1,5 +1,6 @@
package com.bonait.bnframework.common.db.util;

import android.content.ContentValues;
import android.database.sqlite.SQLiteDatabase;

import com.apkfuns.logutils.LogUtils;
@@ -8,8 +9,11 @@ import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.file.DBHelper;
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL;
import com.bonait.bnframework.common.db.mode.BPA_GOODS_SUBATTRIBUTE_GROUP;
import com.bonait.bnframework.common.helper.Tools;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
* @author: liup
@@ -50,6 +54,98 @@ public class GoodsProcessDetailDBUtil {
return QueryDB.Delete(BPA_GOODS_PROCESS_DETAIL.class, data.id);
}

/**
* 批量新增
* @param list
* @return
*/
public static boolean addList( List<BPA_GOODS_PROCESS_DETAIL> list) {
if(list.isEmpty()){
return true;
}
QueryDB.lock.lock();
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase();
try {
long insert=-1;
db.beginTransaction();
for(int i = 0; i < list.size(); i++){
ContentValues cv = new ContentValues();

Map<String, Object> map = Tools.getObjValue(list.get(i));
if (map.get("id").toString().isEmpty())
return false;
for (String key : map.keySet()) {
Object value = map.get(key);
if (value instanceof String) {
cv.put(key, (String) value);
} else if (value instanceof Integer) {
cv.put(key, ((Integer) value).intValue());
} else if (value instanceof Double) {
cv.put(key, ((Double) value).doubleValue());
} else if (value instanceof Float) {
cv.put(key, ((Float) value).floatValue());
} else if (value instanceof Long) {
cv.put(key, ((Long) value).longValue());
} else if (value instanceof Boolean) {
cv.put(key, ((Boolean) value).booleanValue());
}
}
insert = db.insertOrThrow(BPA_GOODS_PROCESS_DETAIL.class.getSimpleName(), null, cv);
if (insert == -1) {
throw new Exception("Failed to insert data at index " + i);
}
}
LogUtils.d("removeList 批量添加工序");

db.setTransactionSuccessful();
return insert > 0;
} catch (Exception e) {
LogUtils.d("GoodsProcessDetailDBUtil 批量新增异常");
} finally {
db.endTransaction();
db.close();
QueryDB.lock.unlock();
}
return false;
}

/**
* 批量删除
* @param list
* @return
*/
public static boolean removeList( List<BPA_GOODS_PROCESS_DETAIL> list) {
if(list.isEmpty()){
return true;
}
QueryDB.lock.lock();
SQLiteDatabase db = DBHelper.getInstance(ConfigName.getInstance().dishesCon).getWritableDatabase();
try {
db.beginTransaction();
boolean isSuccess =true;
for(int i = 0; i < list.size(); i++){
if (list.get(i).id.isEmpty())
return false;
long delete = db.delete(BPA_GOODS_PROCESS_DETAIL.class.getSimpleName(), "id = ?",
new String[]{list.get(i).id});
if(delete<=0){
isSuccess = false;
}
}
db.setTransactionSuccessful();
LogUtils.d("removeList 批量删除工序");

return isSuccess;
} catch (Exception e) {
LogUtils.d("GoodsProcessDetailDBUtil 批量新增异常");
} finally {
db.endTransaction();
db.close();
QueryDB.lock.unlock();
}
return false;
}

/**
* 根据商品工艺详情id获取商品工艺详情
*


+ 0
- 2
app/src/main/java/com/bonait/bnframework/common/db/util/SubAttributeGroupDBUtil.java View File

@@ -88,8 +88,6 @@ public class SubAttributeGroupDBUtil {
}

/**
* 根据子属性组合id获取子属性组合
*
* @param id
* @return BPA_GOODS_SUBATTRIBUTE_GROUP
*/


+ 82
- 0
app/src/main/java/com/bonait/bnframework/common/utils/CookTimeUtils.java View File

@@ -4,6 +4,7 @@ import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.Service.AnalogConvert;
import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE;
import com.bonait.bnframework.common.db.mode.BPA_GOODS_PROCESS_DETAIL;
import com.bonait.bnframework.common.db.mode.BPA_SILOS;
import com.bonait.bnframework.common.db.mode.BPA_SILOS_CALIBRATE;

@@ -87,6 +88,87 @@ public class CookTimeUtils {
}


}
}
}
}
LogUtils.d(" measureCookTime total=" +time);
}catch (Exception e){
e.printStackTrace();
}
return time>0?time:180;
}

public static int measureCookingTime(List<BPA_GOODS_PROCESS_DETAIL> list){
int time = 0;
try {
for (int k = 0; k < list.size(); k++) {
BPA_GOODS_PROCESS_DETAIL item = list.get(k);
LogUtils.d(" measureCookTime materialType="+item.materialType+"; processvalue="+item.processvalue);
if(item.materialType == 0){
String values = item.processvalue;
List<String> data = new ArrayList<>();
if (values.contains("|")) {
String[] res = values.split("[|]");
data.addAll(Arrays.asList(res));
} else {
data.add(values);
}
LogUtils.d(" //////////////////// "+data);
for (String value : data) {
if (value !=null && value.contains(",")) {
String[] wl = value.split("[,]");
if (wl.length == 2) {
float val;
String name = wl[0];
val = Float.parseFloat(wl[1]);

// 根据名称查询料仓号 重量需根据校准值换算成时间
List<BPA_SILOS> silos = QueryDB.GetSolisByMaterialName(name);
if(!silos.isEmpty()){
BPA_SILOS_CALIBRATE bean = (BPA_SILOS_CALIBRATE) QueryDB.GetSilosCalibrateByNum( silos.get(0).num);
int valueDeal = AnalogConvert.Scale( val, bean.inputWightMax, bean.inputWightMin,
bean.outputTimeMax, bean.outputTimeMin);
time += valueDeal;
LogUtils.d("measureCookTime name="+name+";重量="+val+";换算时间="+valueDeal);
}
}
}
}
}else {
String value = item.processvalue;
if(value!=null && value.contains("(秒),")){
String[] res = value.split("秒");
if(res.length==2){
int val = 0;
if(res[1].contains(".")){
val = (int) Math.round((Double.parseDouble(res[1].substring(2))));
}else {
val = Integer.parseInt(res[1].substring(2));
}
time += val;
}
}else if(value!=null && value.contains("(克),")){
String[] res = value.split("克");
if(res.length==2){
float val = 0;
val = Float.parseFloat(res[1].substring(2));
//1
if(item.processname.contains("加水")){
BPA_SILOS_CALIBRATE bean = (BPA_SILOS_CALIBRATE) QueryDB.GetSilosCalibrateByNum(10);
int valueDeal = AnalogConvert.Scale( val, bean.inputWightMax, bean.inputWightMin,
bean.outputTimeMax, bean.outputTimeMin);
LogUtils.d("measureCookTime 加水重量="+val+";换算加水时间="+valueDeal);
time += valueDeal;
}else if(item.processname.contains("勾芡")){
BPA_SILOS_CALIBRATE bean = (BPA_SILOS_CALIBRATE) QueryDB.GetSilosCalibrateByNum(11);
int valueDeal = AnalogConvert.Scale( val, bean.inputWightMax, bean.inputWightMin,
bean.outputTimeMax, bean.outputTimeMin);
LogUtils.d("measureCookTime 加水重量="+val+";换算加水时间="+valueDeal);
time += valueDeal;
}


}
}
}


+ 6
- 0
app/src/main/java/com/bonait/bnframework/common/utils/UpdateAppUtils.java View File

@@ -83,6 +83,12 @@ public class UpdateAppUtils {
mode.moduleCode="xcdjbbd";
mode.serverCode="1680766359592243200";
mode.branchCode="1679308917918404609";

// mode.productCode="1769564215952125952";
// mode.moduleCode="desktopplbt";
// mode.serverCode="1769564338190921728";//服务器
// mode.branchCode="1789857238682284033";

String msg= new Json<VersionMode>().objectToJson(VersionMode.class, mode);
String getNewVersionUrl =ConfigName.getInstance().UpdateVersion;
MediaType JSON = MediaType.parse("application/json; charset=utf-8");


+ 45
- 9
app/src/main/java/com/bonait/bnframework/ui/activity/DiyProcessActivity.java View File

@@ -5,6 +5,7 @@ import static com.bonait.bnframework.MainApplication.getContext;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.os.Bundle;
import android.view.MotionEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
@@ -24,6 +25,9 @@ import com.bonait.bnframework.common.db.mode.BPA_PROCESS;
import com.bonait.bnframework.common.db.mode.BPA_PROCESSModel;
import com.bonait.bnframework.common.db.util.GoodsDBUtil;
import com.bonait.bnframework.common.db.util.GoodsProcessDetailDBUtil;
import com.bonait.bnframework.common.db.util.SubAttributeGroupDBUtil;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.CookTimeUtils;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.common.utils.ProcessValueUtil;
import com.bonait.bnframework.databinding.ActivityEditProcessBinding;
@@ -35,6 +39,7 @@ import com.bonait.bnframework.ui.widget.ProcessValueView;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import butterknife.ButterKnife;
@@ -74,7 +79,7 @@ public class DiyProcessActivity extends BaseActivity {
/**
* 工序步骤
*/
private ArrayList<BPA_GOODS_PROCESS_DETAIL> processDetails = new ArrayList<>();
private List<BPA_GOODS_PROCESS_DETAIL> processDetails = new ArrayList<>();

/**
* 左边步骤adapter
@@ -199,7 +204,11 @@ public class DiyProcessActivity extends BaseActivity {
});
//模拟炒制
viewBinding.btnSimulation.setOnClickListener(view -> {
//TODO 跳转
AlertDialogUtils.showTipDialog(this,"温馨提示!","正在开发,功能暂未开通哦...",null);
});
//录制工序
viewBinding.btnJumpRecordProcess.setOnClickListener(view -> {
AlertDialogUtils.showTipDialog(this,"温馨提示!","正在开发,功能暂未开通哦...",null);
});
viewBinding.llInsert.setVisibility(View.GONE);
viewBinding.btnInsert.setOnClickListener(view -> {
@@ -246,6 +255,10 @@ public class DiyProcessActivity extends BaseActivity {
});
}

/**
* 是否人工单击
*/
public boolean isUserClicked = false;
/**
* 初始化工序模型
*/
@@ -266,11 +279,23 @@ public class DiyProcessActivity extends BaseActivity {
adapter_kk.setDropDownViewResource(R.layout.spinner_dropdown_item);
viewBinding.spinnerProcess.setAdapter(adapter_kk);

viewBinding.spinnerProcess.setOnTouchListener(new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
isUserClicked = true;
view.performClick();
return false;
}
});
viewBinding.spinnerProcess.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
@Override
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) {
String id = processMap.get(viewBinding.spinnerProcess.getSelectedItem().toString());
selectItemFrom(id);
if(isUserClicked){
String id = processMap.get(viewBinding.spinnerProcess.getSelectedItem().toString());
selectItemFrom(id);
isUserClicked = false;
}

}

@Override
@@ -287,7 +312,6 @@ public class DiyProcessActivity extends BaseActivity {
BPA_GOODS_PROCESS_DETAIL goodsrecipe = getSelectItemFromValue();
if (goodsrecipe != null) {
BPA_GOODS_PROCESS_DETAIL processDetail = getSelectItemFromValue();
GoodsProcessDetailDBUtil.add(processDetail);
processDetails.add(processDetail);
stepAdapter.setCurrentPosition(processDetails.size()-1);
stepAdapter.notifyDataSetChanged();
@@ -306,7 +330,6 @@ public class DiyProcessActivity extends BaseActivity {
int index_update = stepAdapter.getCurrentPosition();
if (index_update >= 0 && processDetails.size()>0) {
BPA_GOODS_PROCESS_DETAIL processDetail = getSelectItemFromValue();
GoodsProcessDetailDBUtil.add(processDetail);
processDetails.add(index_update,processDetail);
stepAdapter.setCurrentPosition(index_update);
stepAdapter.notifyDataSetChanged();
@@ -326,7 +349,6 @@ public class DiyProcessActivity extends BaseActivity {
int index_update = stepAdapter.getCurrentPosition();
if (index_update >= 0 && !processDetails.isEmpty()) {
BPA_GOODS_PROCESS_DETAIL processDetail = getSelectItemFromValue();
GoodsProcessDetailDBUtil.add(processDetail);
processDetails.add(index_update+1,processDetail);
stepAdapter.setCurrentPosition(index_update+1);
stepAdapter.notifyDataSetChanged();
@@ -350,7 +372,6 @@ public class DiyProcessActivity extends BaseActivity {
return;
}
BPA_GOODS_PROCESS_DETAIL processDetail = getSelectItemFromValue();
GoodsProcessDetailDBUtil.update(processDetail);
processDetails.set(index_update, getSelectItemFromValue());
stepAdapter.notifyDataSetChanged();
NewToastUtil.getInstance().showToast("修改步骤[" + (index_update + 1) + ":" + obj_update.processname + "]成功!");
@@ -367,7 +388,6 @@ public class DiyProcessActivity extends BaseActivity {
if (index_delete >= 0 && index_delete < processDetails.size()) {
BPA_GOODS_PROCESS_DETAIL processDetail = (BPA_GOODS_PROCESS_DETAIL) processDetails.get(index_delete);
processDetails.remove(processDetail);
GoodsProcessDetailDBUtil.delete(processDetail);
stepAdapter.notifyDataSetChanged();
//移动光标
if (index_delete - 1 >= 0) {
@@ -557,6 +577,7 @@ public class DiyProcessActivity extends BaseActivity {
for (int i = 0; i < viewBinding.llProcessValue.getChildCount(); i++) {
ProcessValueView processValueView = (ProcessValueView) viewBinding.llProcessValue.getChildAt(i);
String res = formulation.get(processValueView.model.name);
LogUtils.d(" updateProcessSpinner res="+res+";processValueView.model.name="+processValueView.model.name);
if (res != null) {
processValueView.SetValues(res);
}else {
@@ -587,4 +608,19 @@ public class DiyProcessActivity extends BaseActivity {
}
}
}

@Override
protected void onPause() {
super.onPause();
LogUtils.d(TAG+" onPause1");
List<BPA_GOODS_PROCESS_DETAIL> processDetails1 = GoodsProcessDetailDBUtil.getByGroupId(subAttributeGroupId);
GoodsProcessDetailDBUtil.removeList(processDetails1);
for (int i =0;i<processDetails.size();i++){
processDetails.get(i).sort = i+1;
processDetails.get(i).goodsSubAttributeGroupId = subAttributeGroupId;
}
GoodsProcessDetailDBUtil.addList(processDetails);
SubAttributeGroupDBUtil.updateMakeTime(subAttributeGroupId, CookTimeUtils.measureCookingTime(processDetails));
LogUtils.d(TAG+" onPause2");
}
}

+ 491
- 491
app/src/main/java/com/bonait/bnframework/ui/activity/RecProcessActivity.java View File

@@ -1,491 +1,491 @@
package com.bonait.bnframework.ui.activity;
import static com.bonait.bnframework.MainApplication.getContext;
import android.annotation.SuppressLint;
import android.content.Intent;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.os.Message;
import android.os.SystemClock;
import android.view.View;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.bonait.bnframework.HBL.Thread.ThreadManager;
import com.bonait.bnframework.R;
import com.bonait.bnframework.Service.ModbusHelper;
import com.bonait.bnframework.ViewModel.Adapter.gongxubuzhou_adapter1;
import com.bonait.bnframework.ViewModel.Adapter.gongxubuzhou_adapter2;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE;
import com.bonait.bnframework.common.utils.DimensUtil;
import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.databinding.ActivityRecProcessBinding;
import com.bonait.bnframework.ui.adapter.RecProcessAdapter;
import com.bonait.bnframework.ui.dialog.DeviceControlDialog;
import com.bonait.bnframework.ui.widget.NewToastUtil;
import java.util.ArrayList;
import java.util.Collections;
/**
* @author: liup
* @description: 录制工序
* @date: 2024/5/25 16:00.
*/
public class RecProcessActivity extends BaseActivity {
protected ActivityRecProcessBinding viewBinding;
private DeviceControlDialog deviceControlDialog;
private boolean isFire = false;
private boolean isStir = false;
private boolean isUp = true;
private final int MSG_STOP_FOOD = 1001;
private final int MSG_STOP_SILOS = 1002;
private final int MSG_STOP_STIR = 1003;
private final int MSG_STOP_UPDOWN = 1004;
/**
* 1-6个主料仓名称
*/
private ArrayList<String> mainFoods = new ArrayList<>();
/**
* 商品id
*/
private String goodId = "";
/**
* 子属性组合id 属性组合名称
*/
private String subAttributeGroupId = "";
private String subAttributeGroupName = "";
@SuppressLint("HandlerLeak")
private Handler handler = new Handler(Looper.getMainLooper()){
@Override
public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg);
switch (msg.what){
case MSG_STOP_FOOD:
viewBinding.device.btnMainFood.setBackgroundResource(R.drawable.bg_device_position_btn);
break;
case MSG_STOP_SILOS:
viewBinding.device.btnSilos.setBackgroundResource(R.drawable.bg_device_position_btn);
break;
case MSG_STOP_STIR:
viewBinding.device.btnFire.setBackgroundResource(R.drawable.bg_device_position_btn);
break;
case MSG_STOP_UPDOWN:
viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_device_position_btn);
break;
}
}
};
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
viewBinding = ActivityRecProcessBinding.inflate(getLayoutInflater());
setContentView(viewBinding.getRoot());
DisplayManager.scaleViewGroup(viewBinding.getRoot());
Intent intent = getIntent();
if(intent != null){
if(intent.getStringArrayListExtra("mainFoods")!=null){
mainFoods = intent.getStringArrayListExtra("mainFoods");
}
goodId = intent.getStringExtra("goodId");
subAttributeGroupId = intent.getStringExtra("subAttributeGroupId");
subAttributeGroupName = intent.getStringExtra("subAttributeGroupName");
}
initView();
}
private void initView(){
viewBinding.device.btnMainFood.setOnClickListener(view->{
showControlDialog(3);
});
viewBinding.device.btnSilos.setOnClickListener(view->{
showControlDialog(2);
});
viewBinding.device.btnStir.setOnClickListener(view->{
showControlDialog(4);
});
viewBinding.device.btnUpDown.setOnClickListener(view->{
showControlDialog(4);
});
viewBinding.device.btnFire.setOnClickListener(view->{
showControlDialog(1);
});
viewBinding.title.setText(subAttributeGroupName+"");
}
/**
* 重置
*/
private void clear(){
viewBinding.device.btnMainFood.setBackgroundResource(R.drawable.bg_device_position_btn);
viewBinding.device.btnSilos.setBackgroundResource(R.drawable.bg_device_position_btn);
viewBinding.device.btnFire.setBackgroundResource(R.drawable.bg_device_position_btn);
viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_device_position_btn);
viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_device_position_btn);
viewBinding.device.fireView.SetLevel(0);
isFire = false;
isUp = true;
isStir = false;
changeDevicePic();
close();
}
/**
* 关闭所有接口
*/
private void close(){
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setStirMotor(0,2)));
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setUpdDownMotor(1)));
ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().Heating(0,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);
}
}));
}
private DeviceControlDialog.DeviceCallBack deviceCallBack = new DeviceControlDialog.DeviceCallBack() {
@Override
public void onClickEvent(int type, String value,long time) {
switch (type){
case 1:
if(value.contains("启动加热")){
isFire = true;
String[] res = value.split("\\|");
if(res[1].equals("0")){
isFire=false;
viewBinding.device.fireView.SetLevel(0);
}else {
viewBinding.device.fireView.SetLevel(Integer.parseInt(res[1]));
}
}else if(value.contains("停止加热")){
isFire=false;
viewBinding.device.fireView.SetLevel(0);
}
changeDevicePic();
break;
case 2:
viewBinding.device.btnSilos.setBackgroundResource(R.drawable.bg_btn_run_anim_looper);
((AnimationDrawable)viewBinding.device.btnSilos.getBackground()).start();
handler.removeMessages(MSG_STOP_SILOS);
handler.sendEmptyMessageDelayed(MSG_STOP_SILOS,time);
break;
case 3:
viewBinding.device.btnMainFood.setBackgroundResource(R.drawable.bg_btn_run_anim_looper);
((AnimationDrawable)viewBinding.device.btnMainFood.getBackground()).start();
handler.removeMessages(MSG_STOP_FOOD);
handler.sendEmptyMessageDelayed(MSG_STOP_FOOD,time);
break;
case 4:
switch (value){
case "开始搅拌":
isStir=true;
viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_btn_run_anim_looper);
((AnimationDrawable)viewBinding.device.btnStir.getBackground()).start();
handler.removeMessages(MSG_STOP_SILOS);
handler.sendEmptyMessageDelayed(MSG_STOP_SILOS,time);
break;
case "停止搅拌":
viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_device_position_btn);
isStir=false;
break;
case "电机下降":
ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) viewBinding.device.btnUpDown.getLayoutParams();
params.topMargin = DimensUtil.getDimens(250);
viewBinding.device.btnUpDown.setLayoutParams(params);
ConstraintLayout.LayoutParams paramsFood = (ConstraintLayout.LayoutParams) viewBinding.device.btnMainFood.getLayoutParams();
paramsFood.topMargin = DimensUtil.getDimens(200);
viewBinding.device.btnMainFood.setLayoutParams(paramsFood);
viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_btn_run_anim_looper);
((AnimationDrawable)viewBinding.device.btnUpDown.getBackground()).start();
handler.removeMessages(MSG_STOP_UPDOWN);
handler.sendEmptyMessageDelayed(MSG_STOP_UPDOWN,time);
isUp=false;
break;
case "电机上升":
ConstraintLayout.LayoutParams params2 = (ConstraintLayout.LayoutParams) viewBinding.device.btnUpDown.getLayoutParams();
params2.topMargin = DimensUtil.getDimens(150);
viewBinding.device.btnUpDown.setLayoutParams(params2);
ConstraintLayout.LayoutParams paramsFood2 = (ConstraintLayout.LayoutParams) viewBinding.device.btnMainFood.getLayoutParams();
paramsFood2.topMargin = DimensUtil.getDimens(20);
viewBinding.device.btnMainFood.setLayoutParams(paramsFood2);
viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_btn_run_anim_looper);
((AnimationDrawable)viewBinding.device.btnUpDown.getBackground()).start();
handler.removeMessages(MSG_STOP_UPDOWN);
handler.sendEmptyMessageDelayed(MSG_STOP_UPDOWN,time);
isUp=true;
break;
}
changeDevicePic();
break;
}
}
@Override
public void onClickDismiss() {
}
};
private void changeDevicePic(){
if(isFire){
if(isStir){
if(isUp){
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_stir_up);
}else {
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_stir_down);
}
}else{
if(isUp){
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_unstir_up);
}else {
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_unstir_down);
}
}
}else {
if(isStir){
if(isUp){
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_stir_up);
}else {
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_stir_down);
}
}else{
if(isUp){
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_unstir_up);
}else {
viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_unstir_down);
}
}
}
}
/**
*
* @param type 1加热 2液体 3主料 4搅拌
*/
private void showControlDialog(int type){
if(ModbusHelper.get().isBtnStop()){
NewToastUtil.getInstance().showToast("设备已急停,请关闭急停按钮再调试!");
return;
}
if(deviceControlDialog == null){
deviceControlDialog = new DeviceControlDialog();
}
Bundle bundle =new Bundle();
bundle.putInt("type",type);
deviceControlDialog.setArguments(bundle);
deviceControlDialog.setDeviceCallBack(deviceCallBack);
deviceControlDialog.show(getSupportFragmentManager(), "deviceControl");
}
//region 计时器
/**
* 是否启动
*/
public static boolean IsStart = false;
/**
* 是否暂停
*/
public static boolean IsPause = false;
/**
* 当前运行总时长
*/
public int TimeOut = 0;
/**
* 上一次点击时间
*/
public int ClikTime = 0;
/**
* 记录下来的总时间
*/
private long recordingTime = 0;
/**
* 工序步骤
*/
public ArrayList<BPA_GOODSRECIPE> goodsRecipeList = new ArrayList<>();
private RecProcessAdapter recProcessAdapter;
/**
* 刷新工序
*/
public void RefreshProcedure() {
recProcessAdapter.updateData(goodsRecipeList);
}
/**
* 启动定时器
*/
public void onRecordStart() {
runOnUiThread(new Runnable() {
@Override
public void run() {
viewBinding.runtime.setBase(SystemClock.elapsedRealtime() - recordingTime);// 跳过已经记录了的时间,起到继续计时的作用
viewBinding.runtime.start();
viewBinding.textMs.setText("请先{开始}录制");
viewBinding.textMs.setVisibility(View.GONE);
//重置暂停开关
IsPause = false;
viewBinding.pauseGoodmake.SetStatus(false);
viewBinding.pauseGoodmake.setVisibility(View.VISIBLE);
ExecuteTheRecipe.WritePLC("暂停开关", false, null);
IsStart = true;
goodsRecipeList.clear();//清空所有工序
//刷新工序
RefreshProcedure();
TimeOut = 0;
ClikTime = 0;
}
});
}
/**
* 停止计时器
*/
public void onRecordStop() {
runOnUiThread(new Runnable() {
@Override
public void run() {
runtime.stop();
start_goodmake.SetStatus(false);
IsStart = false;
kaishiorstop.setVisibility(View.VISIBLE);
text_ms.setText("请先{开始}录制");
recordingTime = 0;
long elapsedMillis = SystemClock.elapsedRealtime() - runtime.getBase();
TimeOut = (int) (elapsedMillis / 1000);
DataBus.getInstance().TimeOut = TimeOut;
//重置暂停开关
IsPause = false;
zanting_goodmake.SetStatus(false);
zanting_goodmake.setVisibility(View.GONE);
ExecuteTheRecipe.WritePLC("暂停开关", false, null);
ExecuteTheRecipe.WritePLC("搅拌", false, null);
ExecuteTheRecipe.WritePLC("加热", false, null);
ConfigName.getInstance().IsOpenHuoLi = false;
ExecuteTheRecipe.BottomClick("平移-去1号位");
}
});
//自动出餐
AutomaticServing();
gongyibuzhoujilu.setVisibility(View.VISIBLE);
}
/**
* 暂停计时器
*/
public void onRecordPause() {
runOnUiThread(new Runnable() {
@Override
public void run() {
runtime.stop();
text_ms.setText("录制{暂停}中");
recordingTime = SystemClock.elapsedRealtime() - runtime.getBase();// 保存这次记录了的时间
IsPause = true;
kaishiorstop.setVisibility(View.VISIBLE);
ExecuteTheRecipe.WritePLC("暂停开关", true, null);
}
});
}
/**
* 继续计时器
*/
public void onRecordPauseStart() {
runOnUiThread(new Runnable() {
@Override
public void run() {
runtime.setBase(SystemClock.elapsedRealtime() - recordingTime);// 跳过已经记录了的时间,起到继续计时的作用
runtime.start();
text_ms.setText("请先{开始}录制");
IsPause = false;
kaishiorstop.setVisibility(View.GONE);
ExecuteTheRecipe.WritePLC("暂停开关", false, null);
}
});
}
/**
* 启动定时器
*/
public void onRecordStart_CS() {
runOnUiThread(new Runnable() {
@Override
public void run() {
guoneichoushui.setVisibility(View.VISIBLE);
runtime_cs.setBase(SystemClock.elapsedRealtime());
runtime_cs.start();
}
});
}
/**
* 停止计时器
*/
public void onRecordStop_CS() {
runOnUiThread(new Runnable() {
@Override
public void run() {
guoneichoushui.setVisibility(View.GONE);
runtime_cs.stop();
long elapsedMillis = SystemClock.elapsedRealtime() - runtime_cs.getBase();
DataBus.getInstance().PumpWaterTimeOut = (int) (elapsedMillis / 1000);
ClikTime = (int) ((SystemClock.elapsedRealtime() - runtime.getBase()) / 1000);
}
});
}
//endregion
@Override
public void onResume() {
super.onResume();
}
@Override
public void onPause() {
super.onPause();
if(handler!=null){
handler.removeCallbacksAndMessages(null);
}
}
@Override
public void onDestroy() {
super.onDestroy();
if(handler != null){
handler.removeCallbacksAndMessages(null);
handler = null;
}
deviceCallBack = null;
}
}
//package com.bonait.bnframework.ui.activity;
//
//import static com.bonait.bnframework.MainApplication.getContext;
//
//import android.annotation.SuppressLint;
//import android.content.Intent;
//import android.graphics.drawable.AnimationDrawable;
//import android.os.Bundle;
//import android.os.Handler;
//import android.os.Looper;
//import android.os.Message;
//import android.os.SystemClock;
//import android.view.View;
//
//import androidx.annotation.NonNull;
//import androidx.annotation.Nullable;
//import androidx.constraintlayout.widget.ConstraintLayout;
//
//import com.bonait.bnframework.HBL.Thread.ThreadManager;
//import com.bonait.bnframework.R;
//import com.bonait.bnframework.Service.ModbusHelper;
//import com.bonait.bnframework.ViewModel.Adapter.gongxubuzhou_adapter1;
//import com.bonait.bnframework.ViewModel.Adapter.gongxubuzhou_adapter2;
//import com.bonait.bnframework.business.ExecuteTheRecipe;
//import com.bonait.bnframework.common.base.BaseActivity;
//import com.bonait.bnframework.common.constant.ConfigName;
//import com.bonait.bnframework.common.constant.DataBus;
//import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE;
//import com.bonait.bnframework.common.utils.DimensUtil;
//import com.bonait.bnframework.common.utils.DisplayManager;
//import com.bonait.bnframework.databinding.ActivityRecProcessBinding;
//import com.bonait.bnframework.ui.adapter.RecProcessAdapter;
//import com.bonait.bnframework.ui.dialog.DeviceControlDialog;
//import com.bonait.bnframework.ui.widget.NewToastUtil;
//
//import java.util.ArrayList;
//import java.util.Collections;
//
///**
// * @author: liup
// * @description: 录制工序
// * @date: 2024/5/25 16:00.
// */
//public class RecProcessActivity extends BaseActivity {
// protected ActivityRecProcessBinding viewBinding;
// private DeviceControlDialog deviceControlDialog;
// private boolean isFire = false;
// private boolean isStir = false;
// private boolean isUp = true;
// private final int MSG_STOP_FOOD = 1001;
// private final int MSG_STOP_SILOS = 1002;
// private final int MSG_STOP_STIR = 1003;
// private final int MSG_STOP_UPDOWN = 1004;
// /**
// * 1-6个主料仓名称
// */
// private ArrayList<String> mainFoods = new ArrayList<>();
// /**
// * 商品id
// */
// private String goodId = "";
// /**
// * 子属性组合id 属性组合名称
// */
// private String subAttributeGroupId = "";
// private String subAttributeGroupName = "";
//
// @SuppressLint("HandlerLeak")
// private Handler handler = new Handler(Looper.getMainLooper()){
// @Override
// public void handleMessage(@NonNull Message msg) {
// super.handleMessage(msg);
// switch (msg.what){
// case MSG_STOP_FOOD:
// viewBinding.device.btnMainFood.setBackgroundResource(R.drawable.bg_device_position_btn);
// break;
// case MSG_STOP_SILOS:
// viewBinding.device.btnSilos.setBackgroundResource(R.drawable.bg_device_position_btn);
// break;
// case MSG_STOP_STIR:
// viewBinding.device.btnFire.setBackgroundResource(R.drawable.bg_device_position_btn);
// break;
// case MSG_STOP_UPDOWN:
// viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_device_position_btn);
// break;
// }
// }
// };
// @Override
// protected void onCreate(@Nullable Bundle savedInstanceState) {
// super.onCreate(savedInstanceState);
// viewBinding = ActivityRecProcessBinding.inflate(getLayoutInflater());
// setContentView(viewBinding.getRoot());
// DisplayManager.scaleViewGroup(viewBinding.getRoot());
// Intent intent = getIntent();
// if(intent != null){
// if(intent.getStringArrayListExtra("mainFoods")!=null){
// mainFoods = intent.getStringArrayListExtra("mainFoods");
// }
// goodId = intent.getStringExtra("goodId");
// subAttributeGroupId = intent.getStringExtra("subAttributeGroupId");
// subAttributeGroupName = intent.getStringExtra("subAttributeGroupName");
// }
// initView();
//
// }
//
// private void initView(){
// viewBinding.device.btnMainFood.setOnClickListener(view->{
// showControlDialog(3);
// });
// viewBinding.device.btnSilos.setOnClickListener(view->{
// showControlDialog(2);
// });
// viewBinding.device.btnStir.setOnClickListener(view->{
// showControlDialog(4);
// });
// viewBinding.device.btnUpDown.setOnClickListener(view->{
// showControlDialog(4);
// });
// viewBinding.device.btnFire.setOnClickListener(view->{
// showControlDialog(1);
// });
// viewBinding.title.setText(subAttributeGroupName+"");
//
// }
//
// /**
// * 重置
// */
// private void clear(){
// viewBinding.device.btnMainFood.setBackgroundResource(R.drawable.bg_device_position_btn);
// viewBinding.device.btnSilos.setBackgroundResource(R.drawable.bg_device_position_btn);
// viewBinding.device.btnFire.setBackgroundResource(R.drawable.bg_device_position_btn);
// viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_device_position_btn);
// viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_device_position_btn);
// viewBinding.device.fireView.SetLevel(0);
// isFire = false;
// isUp = true;
// isStir = false;
// changeDevicePic();
// close();
// }
//
// /**
// * 关闭所有接口
// */
// private void close(){
// ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setStirMotor(0,2)));
// ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().setUpdDownMotor(1)));
// ThreadManager.get().execute(new Thread(() -> ModbusHelper.get().Heating(0,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);
// }
// }));
// }
//
// private DeviceControlDialog.DeviceCallBack deviceCallBack = new DeviceControlDialog.DeviceCallBack() {
// @Override
// public void onClickEvent(int type, String value,long time) {
// switch (type){
// case 1:
// if(value.contains("启动加热")){
// isFire = true;
// String[] res = value.split("\\|");
// if(res[1].equals("0")){
// isFire=false;
// viewBinding.device.fireView.SetLevel(0);
// }else {
// viewBinding.device.fireView.SetLevel(Integer.parseInt(res[1]));
// }
// }else if(value.contains("停止加热")){
// isFire=false;
// viewBinding.device.fireView.SetLevel(0);
// }
// changeDevicePic();
// break;
// case 2:
// viewBinding.device.btnSilos.setBackgroundResource(R.drawable.bg_btn_run_anim_looper);
// ((AnimationDrawable)viewBinding.device.btnSilos.getBackground()).start();
// handler.removeMessages(MSG_STOP_SILOS);
// handler.sendEmptyMessageDelayed(MSG_STOP_SILOS,time);
// break;
// case 3:
// viewBinding.device.btnMainFood.setBackgroundResource(R.drawable.bg_btn_run_anim_looper);
// ((AnimationDrawable)viewBinding.device.btnMainFood.getBackground()).start();
// handler.removeMessages(MSG_STOP_FOOD);
// handler.sendEmptyMessageDelayed(MSG_STOP_FOOD,time);
// break;
// case 4:
// switch (value){
// case "开始搅拌":
// isStir=true;
// viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_btn_run_anim_looper);
// ((AnimationDrawable)viewBinding.device.btnStir.getBackground()).start();
// handler.removeMessages(MSG_STOP_SILOS);
// handler.sendEmptyMessageDelayed(MSG_STOP_SILOS,time);
// break;
// case "停止搅拌":
// viewBinding.device.btnStir.setBackgroundResource(R.drawable.bg_device_position_btn);
// isStir=false;
// break;
// case "电机下降":
// ConstraintLayout.LayoutParams params = (ConstraintLayout.LayoutParams) viewBinding.device.btnUpDown.getLayoutParams();
// params.topMargin = DimensUtil.getDimens(250);
// viewBinding.device.btnUpDown.setLayoutParams(params);
//
// ConstraintLayout.LayoutParams paramsFood = (ConstraintLayout.LayoutParams) viewBinding.device.btnMainFood.getLayoutParams();
// paramsFood.topMargin = DimensUtil.getDimens(200);
// viewBinding.device.btnMainFood.setLayoutParams(paramsFood);
//
// viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_btn_run_anim_looper);
// ((AnimationDrawable)viewBinding.device.btnUpDown.getBackground()).start();
// handler.removeMessages(MSG_STOP_UPDOWN);
// handler.sendEmptyMessageDelayed(MSG_STOP_UPDOWN,time);
// isUp=false;
// break;
// case "电机上升":
// ConstraintLayout.LayoutParams params2 = (ConstraintLayout.LayoutParams) viewBinding.device.btnUpDown.getLayoutParams();
// params2.topMargin = DimensUtil.getDimens(150);
// viewBinding.device.btnUpDown.setLayoutParams(params2);
// ConstraintLayout.LayoutParams paramsFood2 = (ConstraintLayout.LayoutParams) viewBinding.device.btnMainFood.getLayoutParams();
// paramsFood2.topMargin = DimensUtil.getDimens(20);
// viewBinding.device.btnMainFood.setLayoutParams(paramsFood2);
//
// viewBinding.device.btnUpDown.setBackgroundResource(R.drawable.bg_btn_run_anim_looper);
// ((AnimationDrawable)viewBinding.device.btnUpDown.getBackground()).start();
// handler.removeMessages(MSG_STOP_UPDOWN);
// handler.sendEmptyMessageDelayed(MSG_STOP_UPDOWN,time);
// isUp=true;
// break;
// }
// changeDevicePic();
// break;
// }
// }
//
// @Override
// public void onClickDismiss() {
// }
// };
//
// private void changeDevicePic(){
// if(isFire){
// if(isStir){
// if(isUp){
// viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_stir_up);
// }else {
// viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_stir_down);
// }
// }else{
// if(isUp){
// viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_unstir_up);
// }else {
// viewBinding.device.imgDevice.setImageResource(R.mipmap.device_fire_unstir_down);
// }
// }
// }else {
// if(isStir){
// if(isUp){
// viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_stir_up);
// }else {
// viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_stir_down);
// }
// }else{
// if(isUp){
// viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_unstir_up);
// }else {
// viewBinding.device.imgDevice.setImageResource(R.mipmap.device_unfire_unstir_down);
// }
// }
// }
// }
//
// /**
// *
// * @param type 1加热 2液体 3主料 4搅拌
// */
// private void showControlDialog(int type){
// if(ModbusHelper.get().isBtnStop()){
// NewToastUtil.getInstance().showToast("设备已急停,请关闭急停按钮再调试!");
// return;
// }
// if(deviceControlDialog == null){
// deviceControlDialog = new DeviceControlDialog();
// }
// Bundle bundle =new Bundle();
// bundle.putInt("type",type);
// deviceControlDialog.setArguments(bundle);
// deviceControlDialog.setDeviceCallBack(deviceCallBack);
// deviceControlDialog.show(getSupportFragmentManager(), "deviceControl");
// }
//
// //region 计时器
// /**
// * 是否启动
// */
// public static boolean IsStart = false;
// /**
// * 是否暂停
// */
// public static boolean IsPause = false;
// /**
// * 当前运行总时长
// */
// public int TimeOut = 0;
// /**
// * 上一次点击时间
// */
// public int ClikTime = 0;
// /**
// * 记录下来的总时间
// */
// private long recordingTime = 0;
// /**
// * 工序步骤
// */
// public ArrayList<BPA_GOODSRECIPE> goodsRecipeList = new ArrayList<>();
// private RecProcessAdapter recProcessAdapter;
//
// /**
// * 刷新工序
// */
// public void RefreshProcedure() {
// recProcessAdapter.updateData(goodsRecipeList);
// }
//
// /**
// * 启动定时器
// */
// public void onRecordStart() {
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// viewBinding.runtime.setBase(SystemClock.elapsedRealtime() - recordingTime);// 跳过已经记录了的时间,起到继续计时的作用
// viewBinding.runtime.start();
// viewBinding.textMs.setText("请先{开始}录制");
// viewBinding.textMs.setVisibility(View.GONE);
// //重置暂停开关
// IsPause = false;
// viewBinding.pauseGoodmake.SetStatus(false);
// viewBinding.pauseGoodmake.setVisibility(View.VISIBLE);
// ExecuteTheRecipe.WritePLC("暂停开关", false, null);
//
// IsStart = true;
//
// goodsRecipeList.clear();//清空所有工序
// //刷新工序
// RefreshProcedure();
// TimeOut = 0;
// ClikTime = 0;
// }
// });
// }
//
// /**
// * 停止计时器
// */
// public void onRecordStop() {
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// runtime.stop();
// start_goodmake.SetStatus(false);
// IsStart = false;
// kaishiorstop.setVisibility(View.VISIBLE);
// text_ms.setText("请先{开始}录制");
//
//
// recordingTime = 0;
// long elapsedMillis = SystemClock.elapsedRealtime() - runtime.getBase();
// TimeOut = (int) (elapsedMillis / 1000);
// DataBus.getInstance().TimeOut = TimeOut;
//
// //重置暂停开关
// IsPause = false;
// zanting_goodmake.SetStatus(false);
// zanting_goodmake.setVisibility(View.GONE);
// ExecuteTheRecipe.WritePLC("暂停开关", false, null);
//
// ExecuteTheRecipe.WritePLC("搅拌", false, null);
// ExecuteTheRecipe.WritePLC("加热", false, null);
// ConfigName.getInstance().IsOpenHuoLi = false;
// ExecuteTheRecipe.BottomClick("平移-去1号位");
// }
// });
// //自动出餐
// AutomaticServing();
// gongyibuzhoujilu.setVisibility(View.VISIBLE);
// }
//
// /**
// * 暂停计时器
// */
// public void onRecordPause() {
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// runtime.stop();
// text_ms.setText("录制{暂停}中");
// recordingTime = SystemClock.elapsedRealtime() - runtime.getBase();// 保存这次记录了的时间
// IsPause = true;
// kaishiorstop.setVisibility(View.VISIBLE);
//
// ExecuteTheRecipe.WritePLC("暂停开关", true, null);
// }
// });
// }
//
// /**
// * 继续计时器
// */
// public void onRecordPauseStart() {
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// runtime.setBase(SystemClock.elapsedRealtime() - recordingTime);// 跳过已经记录了的时间,起到继续计时的作用
// runtime.start();
// text_ms.setText("请先{开始}录制");
// IsPause = false;
// kaishiorstop.setVisibility(View.GONE);
// ExecuteTheRecipe.WritePLC("暂停开关", false, null);
// }
// });
// }
//
// /**
// * 启动定时器
// */
// public void onRecordStart_CS() {
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// guoneichoushui.setVisibility(View.VISIBLE);
// runtime_cs.setBase(SystemClock.elapsedRealtime());
// runtime_cs.start();
// }
// });
// }
//
// /**
// * 停止计时器
// */
// public void onRecordStop_CS() {
// runOnUiThread(new Runnable() {
// @Override
// public void run() {
// guoneichoushui.setVisibility(View.GONE);
// runtime_cs.stop();
//
// long elapsedMillis = SystemClock.elapsedRealtime() - runtime_cs.getBase();
// DataBus.getInstance().PumpWaterTimeOut = (int) (elapsedMillis / 1000);
//
// ClikTime = (int) ((SystemClock.elapsedRealtime() - runtime.getBase()) / 1000);
// }
// });
// }
// //endregion
//
//
//
// @Override
// public void onResume() {
// super.onResume();
// }
//
// @Override
// public void onPause() {
// super.onPause();
// if(handler!=null){
// handler.removeCallbacksAndMessages(null);
// }
// }
//
// @Override
// public void onDestroy() {
// super.onDestroy();
// if(handler != null){
// handler.removeCallbacksAndMessages(null);
// handler = null;
// }
// deviceCallBack = null;
// }
//}

+ 1
- 1
app/src/main/java/com/bonait/bnframework/ui/adapter/DiyStepAdapter.java View File

@@ -35,7 +35,7 @@ public abstract class DiyStepAdapter extends BaseAdapter<BPA_GOODS_PROCESS_DETAI
holder.binding.root.setSelected(mCurrentPosition == position);
holder.binding.removeUp.setVisibility(mCurrentPosition == position?View.VISIBLE:View.GONE);
holder.binding.removeDown.setVisibility(mCurrentPosition == position?View.VISIBLE:View.GONE);
holder.binding.name.setText("1."+mData.get(position).processname);
holder.binding.name.setText((position+1)+"."+mData.get(position).processname);
holder.binding.root.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {


+ 9
- 8
app/src/main/res/layout/dialog/layout/layout_add_goods_mainfood.xml View File

@@ -224,28 +224,29 @@
android:layout_marginBottom="@dimen/dp_20"
android:gravity="center"
app:layout_constraintLeft_toLeftOf="parent">

<TextView
android:id="@+id/btn_edit_process"
android:id="@+id/btn_to_cook"
android:layout_width="@dimen/dp_255"
android:layout_height="@dimen/dp_120"
android:gravity="center"
android:textSize="@dimen/sp_48"
android:textColor="@color/white"
android:background="@drawable/bg_round25_green_btn"
android:text="编辑工序"
android:background="@drawable/bg_round25_yellow_btn"
android:text="去烹饪"
/>
<TextView
android:id="@+id/btn_to_cook"
android:id="@+id/btn_edit_process"
android:layout_width="@dimen/dp_255"
android:layout_height="@dimen/dp_120"
android:layout_marginLeft="@dimen/dp_50"
android:layout_marginLeft="@dimen/dp_80"

android:gravity="center"
android:textSize="@dimen/sp_48"
android:textColor="@color/white"
android:background="@drawable/bg_round25_yellow_btn"
android:text="去烹饪"
android:background="@drawable/bg_round25_green_btn"
android:text="编辑工序"
/>

</LinearLayout>




Loading…
Cancel
Save