Browse Source

切换设备控制弹窗;炒锅控制,可输入液体重量

炒锅机器人_一拖多
liup 1 month ago
parent
commit
aa39c0983e
36 changed files with 901 additions and 252 deletions
  1. +1
    -1
      app/release/output-metadata.json
  2. +69
    -12
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  3. +2
    -1
      app/src/main/java/com/bonait/bnframework/business/MainInit.java
  4. +4
    -4
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  5. +13
    -0
      app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java
  6. +3
    -0
      app/src/main/java/com/bonait/bnframework/common/model/mode/MouthFacingEnum.java
  7. +9
    -0
      app/src/main/java/com/bonait/bnframework/common/utils/DisplayManager.java
  8. +25
    -6
      app/src/main/java/com/bonait/bnframework/common/utils/ProcessValueUtil.java
  9. +2
    -0
      app/src/main/java/com/bonait/bnframework/newui/activity/WelcomeActivity.java
  10. +6
    -3
      app/src/main/java/com/bonait/bnframework/newui/adapter/classify/ClassifySpinnerAdapter.java
  11. +3
    -1
      app/src/main/java/com/bonait/bnframework/newui/adapter/goods/CloudGoodsAdapter.java
  12. +17
    -14
      app/src/main/java/com/bonait/bnframework/newui/adapter/goods/HomeGoodsAdapter.java
  13. +3
    -1
      app/src/main/java/com/bonait/bnframework/newui/adapter/goods/LocalGoodsAdapter.java
  14. +11
    -6
      app/src/main/java/com/bonait/bnframework/newui/adapter/other/TabAdapter.java
  15. +35
    -12
      app/src/main/java/com/bonait/bnframework/newui/dialog/check/FoodCheckDialog.java
  16. +32
    -10
      app/src/main/java/com/bonait/bnframework/newui/dialog/check/RootTipDialog.java
  17. +53
    -11
      app/src/main/java/com/bonait/bnframework/newui/dialog/control/RobotControlDialog.java
  18. +52
    -12
      app/src/main/java/com/bonait/bnframework/newui/dialog/control/RobotControlDialog2.java
  19. +54
    -12
      app/src/main/java/com/bonait/bnframework/newui/dialog/control/RobotControlDialog3.java
  20. +98
    -11
      app/src/main/java/com/bonait/bnframework/newui/dialog/control/WokControlDialog.java
  21. +73
    -100
      app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeDevicesFragment.java
  22. +64
    -2
      app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeGoodsFragment.java
  23. +10
    -0
      app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeOrderFragment.java
  24. +6
    -0
      app/src/main/java/com/bonait/bnframework/newui/fragment/setting/SceneSetFragment.java
  25. +18
    -0
      app/src/main/java/com/bonait/bnframework/newui/widget/ProcessValueView.java
  26. +1
    -0
      app/src/main/res/layout/fragment_scene_set.xml
  27. +20
    -1
      app/src/main/res/layout/item/layout/view_process_value.xml
  28. +87
    -12
      app/src/main/res/layout/new/layout/dialog_chaoguo_control.xml
  29. +28
    -1
      app/src/main/res/layout/new/layout/dialog_food_control.xml
  30. +27
    -1
      app/src/main/res/layout/new/layout/dialog_food_control2.xml
  31. +27
    -1
      app/src/main/res/layout/new/layout/dialog_food_control3.xml
  32. +31
    -0
      app/src/main/res/layout/new/layout/fragment_home_goods.xml
  33. +12
    -12
      app/src/main/res/layout/new/layout/item_home_goods.xml
  34. +1
    -1
      app/src/main/res/values-en/strings.xml
  35. +1
    -1
      app/src/main/res/values/strings.xml
  36. +3
    -3
      app/src/main/res/values/styles.xml

+ 1
- 1
app/release/output-metadata.json View File

@@ -13,7 +13,7 @@
"attributes": [], "attributes": [],
"versionCode": 105, "versionCode": 105,
"versionName": "1.0.5", "versionName": "1.0.5",
"outputFile": "robot-xiaochao-v105-202410281311-unsigned-release.apk"
"outputFile": "robot-xiaochao-v105-202411071556-unsigned-release.apk"
} }
], ],
"elementType": "File" "elementType": "File"

+ 69
- 12
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

@@ -21,6 +21,7 @@ import com.bonait.bnframework.modbus.RackModbusTcpServer;
import com.bonait.bnframework.modbus.RobotModbusTcpServer; import com.bonait.bnframework.modbus.RobotModbusTcpServer;
import com.bonait.bnframework.modbus.Wok2ModbusTcpServer; import com.bonait.bnframework.modbus.Wok2ModbusTcpServer;
import com.bonait.bnframework.modbus.Wok1ModbusTcpServer; import com.bonait.bnframework.modbus.Wok1ModbusTcpServer;
import com.bonait.bnframework.newui.fragment.setting.SceneSetFragment;
import com.bonait.bnframework.newui.widget.NewToastUtil; import com.bonait.bnframework.newui.widget.NewToastUtil;


import org.greenrobot.eventbus.EventBus; import org.greenrobot.eventbus.EventBus;
@@ -313,6 +314,9 @@ public class ExecuteTheRecipe {
int jzzz_1 = jzzz == 0 ? 500 : jzzz; int jzzz_1 = jzzz == 0 ? 500 : jzzz;
int ztime = (int) (val / (jzzz_1 / 5.0)); int ztime = (int) (val / (jzzz_1 / 5.0));
MaxValue = ztime > MaxValue ? ztime : MaxValue; MaxValue = ztime > MaxValue ? ztime : MaxValue;
}else {
NewToastUtil.getInstance().showToastError("料仓" + silos.num + "校准值为空");
RecordManager.getInstance().addLogRecord("订单处理日志","料仓" + silos.num + "校准值为空");
} }
} }
} }
@@ -462,7 +466,7 @@ public class ExecuteTheRecipe {
* @param silos * @param silos
* @param val * @param val
*/ */
private static void Write_PLC_Material(int deviceNum,BPA_SILOS silos, int val) {
public static void Write_PLC_Material(int deviceNum,BPA_SILOS silos, int val) {
try { try {
String name = "料仓" + silos.num + "下料完成"; String name = "料仓" + silos.num + "下料完成";


@@ -597,7 +601,8 @@ public class ExecuteTheRecipe {
BottomClick1(deviceNum,value); BottomClick1(deviceNum,value);


//一直等待机器移动到该位置 //一直等待机器移动到该位置
ThreadWhile(deviceNum,value + "反馈");
// ThreadWhile(deviceNum,value + "反馈");
ThreadWhileBottomClick(deviceNum,value,value + "反馈");
} }
} }


@@ -644,7 +649,7 @@ public class ExecuteTheRecipe {
Log.e("按钮按下", name); Log.e("按钮按下", name);
WritePLC(deviceNum,name, true, null); WritePLC(deviceNum,name, true, null);
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅("+deviceNum+")-BottomClick1-"+name+":true"); RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅("+deviceNum+")-BottomClick1-"+name+":true");
Thread.sleep(500);
Thread.sleep(800);
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅("+deviceNum+")-BottomClick1-"+name+":false"); RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅("+deviceNum+")-BottomClick1-"+name+":false");
WritePLC(deviceNum,name, false, null); WritePLC(deviceNum,name, false, null);
Log.e("按钮复位", name); Log.e("按钮复位", name);
@@ -1159,7 +1164,9 @@ public class ExecuteTheRecipe {
} }
WritePLC(deviceNum,"加热", false, null); WritePLC(deviceNum,"加热", false, null);
showlog("关闭搅拌、关闭加热!"); showlog("关闭搅拌、关闭加热!");
ThreadWhileFalse(deviceNum,"输送线进料菜盆检测");
if(!ConfigName.getInstance().versionSelectionEnum.equals(SceneSetFragment.deviceName4)){
ThreadWhileFalse(deviceNum,"输送线进料菜盆检测");
}


Wait_Robot_No_Working(deviceNum);//等待机器人空闲 Wait_Robot_No_Working(deviceNum);//等待机器人空闲


@@ -1320,11 +1327,15 @@ public class ExecuteTheRecipe {
try{ try{
ThreadWhile(deviceNum,deviceNum+"炒锅出餐完成"); ThreadWhile(deviceNum,deviceNum+"炒锅出餐完成");
ConfigName.getInstance().isPutFinish = true; ConfigName.getInstance().isPutFinish = true;
ModbusCenter.rackWritePlc("输送线启动",true,null);
Thread.sleep(500);
ModbusCenter.rackWritePlc("输送线启动",false,null);



try{ try{
if(ConfigName.getInstance().versionSelectionEnum.equals(SceneSetFragment.deviceName4)){
return;
}
ModbusCenter.rackWritePlc("输送线启动",true,null);
Thread.sleep(500);
ModbusCenter.rackWritePlc("输送线启动",false,null);
if(ModbusCenter.getListingValue("输送线出料菜盆检测") instanceof Boolean){ if(ModbusCenter.getListingValue("输送线出料菜盆检测") instanceof Boolean){
boolean isStart = (boolean) ModbusCenter.getListingValue("输送线出料菜盆检测"); boolean isStart = (boolean) ModbusCenter.getListingValue("输送线出料菜盆检测");
long a = System.currentTimeMillis(); long a = System.currentTimeMillis();
@@ -1363,6 +1374,9 @@ public class ExecuteTheRecipe {
@Override @Override
public void run() { public void run() {
try{ try{
if(ConfigName.getInstance().versionSelectionEnum.equals(SceneSetFragment.deviceName4)){
return;
}
if(ModbusCenter.getListingValue("输送线出料菜盆检测") instanceof Boolean){ if(ModbusCenter.getListingValue("输送线出料菜盆检测") instanceof Boolean){
boolean isStart = (boolean) ModbusCenter.getListingValue("输送线出料菜盆检测"); boolean isStart = (boolean) ModbusCenter.getListingValue("输送线出料菜盆检测");
long a = System.currentTimeMillis(); long a = System.currentTimeMillis();
@@ -1513,7 +1527,7 @@ public class ExecuteTheRecipe {
long startTime = System.currentTimeMillis(); long startTime = System.currentTimeMillis();
while ((System.currentTimeMillis() - startTime) <= (delay * 1000) && !ConfigName.IsForcedEnd[deviceNum-1] &&!ConfigName.IsPause[deviceNum-1]) { while ((System.currentTimeMillis() - startTime) <= (delay * 1000) && !ConfigName.IsForcedEnd[deviceNum-1] &&!ConfigName.IsPause[deviceNum-1]) {
try { try {
Thread.sleep(100);
Thread.sleep(500);
int mmmm = delay - (int) ((System.currentTimeMillis() - startTime) / 1000); int mmmm = delay - (int) ((System.currentTimeMillis() - startTime) / 1000);
if (AtPresentTime != mmmm) { if (AtPresentTime != mmmm) {
AtPresentTime = mmmm; AtPresentTime = mmmm;
@@ -1562,7 +1576,7 @@ public class ExecuteTheRecipe {
AtPresentTime = mmmm; AtPresentTime = mmmm;
} }


Thread.sleep(100);//10 *6
Thread.sleep(500);//10 *6
} catch (InterruptedException e) { } catch (InterruptedException e) {
IsComplete[0] = true; IsComplete[0] = true;
showlog(name + ",异常退出!" + e.getMessage()); showlog(name + ",异常退出!" + e.getMessage());
@@ -1607,7 +1621,50 @@ public class ExecuteTheRecipe {
} }
} }
try { try {
Thread.sleep(100);//10 *6
Thread.sleep(500);//10 *6
} catch (InterruptedException e) {
IsComplete[0] = true;
showlog(name + ",异常退出!" + e.getMessage());
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile-"+name + ",异常退出");
}
}
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile-"+name + ",等待结束");
}

public static void ThreadWhileBottomClick(int deviceNum,String value,String name) {
LogUtils.d(TAG+" ThreadWhile name="+name);
final boolean[] IsComplete = {false};
long a = System.currentTimeMillis();
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile-"+name + ",等待中");
int num = 0;

while (!IsComplete[0] && !ConfigName.IsForcedEnd[deviceNum-1] && !ConfigName.TEST) {
if ((System.currentTimeMillis() - a) > 1000 * whileTime) {
showlog(name + ",异常超时退出!");
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile-"+name + ",异常超时退出");
break;
} else {
Object sb = ReadPLC(deviceNum,name);
if (sb != null) {
IsComplete[0] = (boolean) (sb);
if (IsComplete[0]) {
LogUtils.d(TAG+" ThreadWhile name="+name+" true ////");
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile-"+name + ",true");
}else {
num++;
if(num%10==9){
BottomClick1(deviceNum,value);
}
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile-"+name + ",false");
NewToastUtil.getInstance().showToast(deviceNum+"号炒锅,等待"+name);
LogUtils.d(TAG+" ThreadWhile name="+name+" false");
}
}else {
RecordManager.getInstance().addLogRecord("订单处理日志",deviceNum+"号炒锅-ThreadWhile-"+name + ",null");
}
}
try {
Thread.sleep(500);//10 *6
} catch (InterruptedException e) { } catch (InterruptedException e) {
IsComplete[0] = true; IsComplete[0] = true;
showlog(name + ",异常退出!" + e.getMessage()); showlog(name + ",异常退出!" + e.getMessage());
@@ -1648,7 +1705,7 @@ public class ExecuteTheRecipe {
} }
} }
try { try {
Thread.sleep(100);//10 *6
Thread.sleep(500);//10 *6
} catch (InterruptedException e) { } catch (InterruptedException e) {
IsComplete[0] = true; IsComplete[0] = true;
showlog(name + ",异常退出!" + e.getMessage()); showlog(name + ",异常退出!" + e.getMessage());
@@ -1691,7 +1748,7 @@ public class ExecuteTheRecipe {
} }
} }
try { try {
Thread.sleep(100);//10 *6
Thread.sleep(500);//10 *6
} catch (InterruptedException e) { } catch (InterruptedException e) {
IsComplete[0] = true; IsComplete[0] = true;
showlog(name + ",异常退出!" + e.getMessage()); showlog(name + ",异常退出!" + e.getMessage());


+ 2
- 1
app/src/main/java/com/bonait/bnframework/business/MainInit.java View File

@@ -216,7 +216,8 @@ public class MainInit {
} }




if(QueryDB.GetProcessALL().isEmpty() || ConfigName.LOG_TEST){
if(QueryDB.GetProcessALL().isEmpty() || ConfigName.LOG_TEST || PreferenceUtils.getInt("PlcInit",1)==1){
PreferenceUtils.setInt("PlcInit",2);
ConfigData.getInstance().RevertPLCProcess(); ConfigData.getInstance().RevertPLCProcess();
} }




+ 4
- 4
app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java View File

@@ -170,9 +170,9 @@ public class ConfigName {
add(new Res_PLCADDRESS("维护位", "M20.0", 0, 1)); add(new Res_PLCADDRESS("维护位", "M20.0", 0, 1));
add(new Res_PLCADDRESS("清洗位", "M13.0", 0, 1)); add(new Res_PLCADDRESS("清洗位", "M13.0", 0, 1));
add(new Res_PLCADDRESS("炒菜位1", "M12.0", 0, 1)); add(new Res_PLCADDRESS("炒菜位1", "M12.0", 0, 1));
add(new Res_PLCADDRESS("炒菜位高", "M12.1", 0, 1));
add(new Res_PLCADDRESS("炒菜位高", "M12.0", 0, 1));
add(new Res_PLCADDRESS("炒菜位2", "M12.1", 0, 1)); add(new Res_PLCADDRESS("炒菜位2", "M12.1", 0, 1));
add(new Res_PLCADDRESS("炒菜位低", "M12.2", 0, 1));
add(new Res_PLCADDRESS("炒菜位低", "M12.1", 0, 1));
add(new Res_PLCADDRESS("炒菜位3", "M12.2", 0, 1)); add(new Res_PLCADDRESS("炒菜位3", "M12.2", 0, 1));


add(new Res_PLCADDRESS("出餐启动", "M11.5", 0, 1)); add(new Res_PLCADDRESS("出餐启动", "M11.5", 0, 1));
@@ -242,8 +242,8 @@ public class ConfigName {
add(new Res_PLCADDRESS("抽料位反馈", "M40.3", 1, 0)); add(new Res_PLCADDRESS("抽料位反馈", "M40.3", 1, 0));
add(new Res_PLCADDRESS("炒菜位1反馈", "M40.4", 0, 0)); add(new Res_PLCADDRESS("炒菜位1反馈", "M40.4", 0, 0));
add(new Res_PLCADDRESS("炒菜位2反馈", "M40.5", 0, 0)); add(new Res_PLCADDRESS("炒菜位2反馈", "M40.5", 0, 0));
add(new Res_PLCADDRESS("炒菜位高反馈", "M40.5", 0, 0));
add(new Res_PLCADDRESS("炒菜位低反馈", "M40.6", 0, 0));
add(new Res_PLCADDRESS("炒菜位高反馈", "M40.4", 0, 0));
add(new Res_PLCADDRESS("炒菜位低反馈", "M40.5", 0, 0));
add(new Res_PLCADDRESS("炒菜位3反馈", "M40.6", 0, 0)); add(new Res_PLCADDRESS("炒菜位3反馈", "M40.6", 0, 0));
add(new Res_PLCADDRESS("倒菜位反馈", "M40.7", 0, 0)); add(new Res_PLCADDRESS("倒菜位反馈", "M40.7", 0, 0));
add(new Res_PLCADDRESS("投料位反馈", "M41.0", 1, 0)); add(new Res_PLCADDRESS("投料位反馈", "M41.0", 1, 0));


+ 13
- 0
app/src/main/java/com/bonait/bnframework/common/db/QueryDB.java View File

@@ -425,6 +425,19 @@ public class QueryDB {
return data; return data;
} }


public static BPA_SILOS GetSilosNum(String num) {
LogUtils.d("根据num查询料仓管理 GetSilosNum num="+num);
BPA_SILOS data = null;
String orderby = Desc_Sort_Up + ',' + Desc_Time_Up;//先按排序 创建时间倒序
String where = "isDelete=? and num=?";
String[] args = new String[]{"0", num};
ArrayList<Object> obj = Get(BPA_SILOS.class, where, args, orderby);
for (Object k : obj) {
data = (BPA_SILOS) k;
}
return data;
}

/** /**
* 修改校准值 * 修改校准值
* *


+ 3
- 0
app/src/main/java/com/bonait/bnframework/common/model/mode/MouthFacingEnum.java View File

@@ -4,6 +4,9 @@ public enum MouthFacingEnum {
原点位, 原点位,
炒菜位高, 炒菜位高,
炒菜位低, 炒菜位低,
炒菜位1,
炒菜位2,
炒菜位3,
维护位, 维护位,
抽料位, 抽料位,
倒菜位, 倒菜位,


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

@@ -22,6 +22,8 @@ import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;


import com.apkfuns.logutils.LogUtils; import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.newui.fragment.setting.SceneSetFragment;


/** /**
* 屏幕管理类 * 屏幕管理类
@@ -472,4 +474,11 @@ public class DisplayManager
{ {
scaleView(view,(float) mfDeviceScaleRate); scaleView(view,(float) mfDeviceScaleRate);
} }

public static float scale32(){
if(ConfigName.getInstance().versionSelectionEnum.equals(SceneSetFragment.deviceName4)){
return 21;
}
return 32;
}
} }

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

@@ -82,13 +82,32 @@ public class ProcessValueUtil {
if (wl.length == 2) { if (wl.length == 2) {
String name = wl[0]; String name = wl[0];
String val = wl[1]; String val = wl[1];
if(name.equals("等待时间")){
int time = Integer.parseInt(wl[1]);
val = time/60+"分"+time%60+"秒";
}else if(name.equals("烤箱温度")){
val = val+"°C";
// if(name.equals("等待时间")){
// int time = Integer.parseInt(wl[1]);
// val = time/60+"分"+time%60+"秒";
// }else if(name.equals("烤箱温度")){
// val = val+"°C";
// }else
if(name.equals("重量")){
if(val!=null && !val.isEmpty()){
val = "重量:"+val;
}
}else if(name.equals("温度")){
if(val!=null && !val.isEmpty()){
val = "温度:"+val;
}
}else if(name.equals("功率")){
if(val!=null && !val.isEmpty()){
val = "功率:"+val;
}
}else if(name.contains("描述")){
if(val!=null && !val.isEmpty()){
val = name.replace("主料","").replace("辅料","")+"("+val+")";
}
}
if(val!=null && !val.isEmpty()){
stringBuilder.append(val).append(",");
} }
stringBuilder.append(val).append(",");
} }
} }
} }


+ 2
- 0
app/src/main/java/com/bonait/bnframework/newui/activity/WelcomeActivity.java View File

@@ -11,6 +11,7 @@ import androidx.annotation.NonNull;


import com.apkfuns.logutils.LogUtils; import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.R; import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.business.MainInit; import com.bonait.bnframework.business.MainInit;
import com.bonait.bnframework.common.base.BaseActivity; import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.constant.ConfigName;
@@ -18,6 +19,7 @@ import com.bonait.bnframework.common.constant.Constants;
import com.bonait.bnframework.common.utils.DisplayManager; import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.common.utils.ScreenUtils; import com.bonait.bnframework.common.utils.ScreenUtils;
import com.bonait.bnframework.manager.ActivityLifecycleManager; import com.bonait.bnframework.manager.ActivityLifecycleManager;
import com.bonait.bnframework.newui.fragment.setting.SceneSetFragment;
import com.bonait.bnframework.serial.ComAssistantActivity; import com.bonait.bnframework.serial.ComAssistantActivity;
import com.bonait.bnframework.test.TestActivity; import com.bonait.bnframework.test.TestActivity;
import com.lzy.okgo.OkGo; import com.lzy.okgo.OkGo;


+ 6
- 3
app/src/main/java/com/bonait/bnframework/newui/adapter/classify/ClassifySpinnerAdapter.java View File

@@ -11,7 +11,9 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;


import com.bonait.bnframework.R; import com.bonait.bnframework.R;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.utils.DisplayManager; import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.newui.fragment.setting.SceneSetFragment;


import java.util.List; import java.util.List;


@@ -51,10 +53,11 @@ public class ClassifySpinnerAdapter extends BaseAdapter {
} }
TextView textView = convertView.findViewById(R.id.textViewCustom); TextView textView = convertView.findViewById(R.id.textViewCustom);
textView.setText(getItem(position)); textView.setText(getItem(position));
if(textView.getWidth()==0){
DisplayManager.scaleViewGroup(convertView.findViewById(R.id.root));
if(!ConfigName.getInstance().versionSelectionEnum.equals(SceneSetFragment.deviceName4)){
if(textView.getWidth()==0){
DisplayManager.scaleViewGroup(convertView.findViewById(R.id.root));
}
} }

return convertView; return convertView;
} }
} }

+ 3
- 1
app/src/main/java/com/bonait/bnframework/newui/adapter/goods/CloudGoodsAdapter.java View File

@@ -38,7 +38,9 @@ public abstract class CloudGoodsAdapter extends BaseAdapter<BPA_GOODS,CloudGoods
try { try {
LogUtils.d(" holder.binding.name.getTextSize()="+holder.binding.name.getTextSize()); LogUtils.d(" holder.binding.name.getTextSize()="+holder.binding.name.getTextSize());
if(holder.binding.getRoot().getWidth()==0){ if(holder.binding.getRoot().getWidth()==0){
DisplayManager.scaleViewGroup(holder.binding.getRoot());
if(holder.binding.name.getTextSize()>DisplayManager.scale32()+2 || holder.binding.name.getTextSize()<DisplayManager.scale32()-2){
DisplayManager.scaleViewGroup(holder.binding.getRoot());
}
} }
holder.binding.add.setVisibility(View.GONE); holder.binding.add.setVisibility(View.GONE);




+ 17
- 14
app/src/main/java/com/bonait/bnframework/newui/adapter/goods/HomeGoodsAdapter.java View File

@@ -45,24 +45,27 @@ public abstract class HomeGoodsAdapter extends BaseAdapter<BPA_GOODS, HomeGoodsA
@Override @Override
public void onBindViewHolder(@NonNull GoodsViewHolder holder, @SuppressLint("RecyclerView") int position) { public void onBindViewHolder(@NonNull GoodsViewHolder holder, @SuppressLint("RecyclerView") int position) {
try { try {
LogUtils.d(" ///////// size28="+holder.binding.name.getTextSize());
LogUtils.d(position+" ///////// size32="+holder.binding.name.getTextSize());
if(holder.binding.getRoot().getWidth()==0){ if(holder.binding.getRoot().getWidth()==0){
DisplayManager.scaleViewGroup(holder.binding.getRoot());
}

if(selectPos == position){
if(ConfigName.getInstance().focusPageType == 3){
holder.binding.fbv.setVisibility(View.VISIBLE);
holder.binding.fbv.startAnimation();
}else {
holder.binding.fbv.setVisibility(View.GONE);
holder.binding.fbv.stopAnimation();
if(holder.binding.name.getTextSize()>DisplayManager.scale32()+2 || holder.binding.name.getTextSize()<DisplayManager.scale32()-2){
DisplayManager.scaleViewGroup(holder.binding.getRoot());
LogUtils.d(position+" scaleViewGroup///////// size32="+holder.binding.name.getTextSize());
} }
}else {
holder.binding.fbv.setVisibility(View.GONE);
holder.binding.fbv.stopAnimation();
} }


// if(selectPos == position){
// if(ConfigName.getInstance().focusPageType == 3){
// holder.binding.fbv.setVisibility(View.VISIBLE);
// holder.binding.fbv.startAnimation();
// }else {
// holder.binding.fbv.setVisibility(View.GONE);
// holder.binding.fbv.stopAnimation();
// }
// }else {
// holder.binding.fbv.setVisibility(View.GONE);
// holder.binding.fbv.stopAnimation();
// }

holder.binding.add.setVisibility(View.GONE); holder.binding.add.setVisibility(View.GONE);
LogUtils.d(" ///////// size28="+holder.binding.name.getTextSize()); LogUtils.d(" ///////// size28="+holder.binding.name.getTextSize());




+ 3
- 1
app/src/main/java/com/bonait/bnframework/newui/adapter/goods/LocalGoodsAdapter.java View File

@@ -47,7 +47,9 @@ public abstract class LocalGoodsAdapter extends BaseAdapter<BPA_GOODS,LocalGoods
public void onBindViewHolder(@NonNull GoodsViewHolder holder, @SuppressLint("RecyclerView") int position) { public void onBindViewHolder(@NonNull GoodsViewHolder holder, @SuppressLint("RecyclerView") int position) {
try { try {
if(holder.binding.getRoot().getWidth()==0){ if(holder.binding.getRoot().getWidth()==0){
DisplayManager.scaleViewGroup(holder.binding.getRoot());
if(holder.binding.name.getTextSize()>DisplayManager.scale32()+2 || holder.binding.name.getTextSize()<DisplayManager.scale32()-2){
DisplayManager.scaleViewGroup(holder.binding.getRoot());
}
} }
holder.binding.add.setVisibility(View.GONE); holder.binding.add.setVisibility(View.GONE);
if(isEdit){ if(isEdit){


+ 11
- 6
app/src/main/java/com/bonait/bnframework/newui/adapter/other/TabAdapter.java View File

@@ -9,6 +9,7 @@ import android.view.ViewGroup;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;


import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.utils.DisplayManager; import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.databinding.ItemTabBinding; import com.bonait.bnframework.databinding.ItemTabBinding;
import com.bonait.bnframework.newui.adapter.base.BaseAdapter; import com.bonait.bnframework.newui.adapter.base.BaseAdapter;
@@ -39,13 +40,17 @@ public abstract class TabAdapter extends BaseAdapter<String, TabAdapter.ViewHold
if(holder.binding.getRoot().getWidth()==0){ if(holder.binding.getRoot().getWidth()==0){
DisplayManager.scaleViewGroup(holder.binding.getRoot()); DisplayManager.scaleViewGroup(holder.binding.getRoot());
} }
if(selectPos == position){
holder.binding.fbv.setVisibility(View.VISIBLE);
holder.binding.fbv.startAnimation();
}else {
holder.binding.fbv.setVisibility(View.GONE);
holder.binding.fbv.stopAnimation();

if(ConfigName.SERIAL_TEST){
if(selectPos == position){
holder.binding.fbv.setVisibility(View.VISIBLE);
holder.binding.fbv.startAnimation();
}else {
holder.binding.fbv.setVisibility(View.GONE);
holder.binding.fbv.stopAnimation();
}
} }

holder.binding.name.setText(mData.get(position)+""); holder.binding.name.setText(mData.get(position)+"");
if(mCurrentPosition==position){ if(mCurrentPosition==position){
holder.binding.name.setTextColor(Color.parseColor("#ffffff")); holder.binding.name.setTextColor(Color.parseColor("#ffffff"));


+ 35
- 12
app/src/main/java/com/bonait/bnframework/newui/dialog/check/FoodCheckDialog.java View File

@@ -26,6 +26,7 @@ import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.utils.AdbCommandUtil; import com.bonait.bnframework.common.utils.AdbCommandUtil;
import com.bonait.bnframework.common.utils.DisplayManager; import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.databinding.DialogFoodCheckBinding; import com.bonait.bnframework.databinding.DialogFoodCheckBinding;
import com.bonait.bnframework.newui.fragment.setting.SceneSetFragment;


import java.util.Map; import java.util.Map;


@@ -231,13 +232,24 @@ public class FoodCheckDialog extends DialogFragment {
break; break;


case "出餐盆1": case "出餐盆1":
if(value.exist){
viewBinding.tvChucan1.setText("出餐盘1有盆");
viewBinding.tvChucan1.setSelected(true);
}else {
viewBinding.tvChucan1.setText("出餐盘1无盆");
viewBinding.tvChucan1.setSelected(false);
if(ConfigName.getInstance().versionSelectionEnum.equals(SceneSetFragment.deviceName4)){
if(value.exist){
viewBinding.tvChucan3.setText("出餐盘3有盆");
viewBinding.tvChucan3.setSelected(true);
}else {
viewBinding.tvChucan3.setText("出餐盘3无盆");
viewBinding.tvChucan3.setSelected(false);
}
}else{
if(value.exist){
viewBinding.tvChucan1.setText("出餐盘1有盆");
viewBinding.tvChucan1.setSelected(true);
}else {
viewBinding.tvChucan1.setText("出餐盘1无盆");
viewBinding.tvChucan1.setSelected(false);
}
} }

break; break;
case "出餐盆2": case "出餐盆2":
if(value.exist){ if(value.exist){
@@ -249,13 +261,24 @@ public class FoodCheckDialog extends DialogFragment {
} }
break; break;
case "出餐盆3": case "出餐盆3":
if(value.exist){
viewBinding.tvChucan3.setText("出餐盘1有盆");
viewBinding.tvChucan3.setSelected(true);
}else {
viewBinding.tvChucan3.setText("出餐盘1无盆");
viewBinding.tvChucan3.setSelected(false);
if(ConfigName.getInstance().versionSelectionEnum.equals(SceneSetFragment.deviceName4)){
if(value.exist){
viewBinding.tvChucan1.setText("出餐盘1有盆");
viewBinding.tvChucan1.setSelected(true);
}else {
viewBinding.tvChucan1.setText("出餐盘1无盆");
viewBinding.tvChucan1.setSelected(false);
}
}else{
if(value.exist){
viewBinding.tvChucan3.setText("出餐盘3有盆");
viewBinding.tvChucan3.setSelected(true);
}else {
viewBinding.tvChucan3.setText("出餐盘3无盆");
viewBinding.tvChucan3.setSelected(false);
}
} }

break; break;
} }
} }


+ 32
- 10
app/src/main/java/com/bonait/bnframework/newui/dialog/check/RootTipDialog.java View File

@@ -33,6 +33,7 @@ import com.bonait.bnframework.modbus.RackModbusTcpServer;
import com.bonait.bnframework.modbus.RobotModbusTcpServer; import com.bonait.bnframework.modbus.RobotModbusTcpServer;
import com.bonait.bnframework.modbus.Wok2ModbusTcpServer; import com.bonait.bnframework.modbus.Wok2ModbusTcpServer;
import com.bonait.bnframework.modbus.Wok1ModbusTcpServer; import com.bonait.bnframework.modbus.Wok1ModbusTcpServer;
import com.bonait.bnframework.newui.fragment.setting.SceneSetFragment;


import java.util.Map; import java.util.Map;


@@ -256,13 +257,24 @@ public class RootTipDialog extends DialogFragment {
break; break;


case "出餐盆1": case "出餐盆1":
if(value.exist){
viewBinding.content2.tvChucan1.setText("出餐盆1有盆");
viewBinding.content2.tvChucan1.setSelected(true);
if(ConfigName.getInstance().versionSelectionEnum.equals(SceneSetFragment.deviceName4)){
if(value.exist){
viewBinding.content2.tvChucan3.setText("出餐盆3有盆");
viewBinding.content2.tvChucan3.setSelected(true);
}else {
viewBinding.content2.tvChucan3.setText("出餐盆3无盆");
viewBinding.content2.tvChucan3.setSelected(false);
}
}else { }else {
viewBinding.content2.tvChucan1.setText("出餐盆1无盆");
viewBinding.content2.tvChucan1.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; break;
case "出餐盆2": case "出餐盆2":
if(value.exist){ if(value.exist){
@@ -274,12 +286,22 @@ public class RootTipDialog extends DialogFragment {
} }
break; break;
case "出餐盆3": case "出餐盆3":
if(value.exist){
viewBinding.content2.tvChucan3.setText("出餐盆3有盆");
viewBinding.content2.tvChucan3.setSelected(true);
if(ConfigName.getInstance().versionSelectionEnum.equals(SceneSetFragment.deviceName4)){
if(value.exist){
viewBinding.content2.tvChucan1.setText("出餐盆1有盆");
viewBinding.content2.tvChucan1.setSelected(true);
}else {
viewBinding.content2.tvChucan1.setText("出餐盆1无盆");
viewBinding.content2.tvChucan1.setSelected(false);
}
}else { }else {
viewBinding.content2.tvChucan3.setText("出餐盆3无盆");
viewBinding.content2.tvChucan3.setSelected(false);
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; break;
} }


+ 53
- 11
app/src/main/java/com/bonait/bnframework/newui/dialog/control/RobotControlDialog.java View File

@@ -39,6 +39,7 @@ import com.bonait.bnframework.modbus.Wok1ModbusTcpServer;
import com.bonait.bnframework.newui.widget.NewToastUtil; import com.bonait.bnframework.newui.widget.NewToastUtil;
import com.bonait.bnframework.newui.widget.WaitProcessUtil; import com.bonait.bnframework.newui.widget.WaitProcessUtil;


import java.io.FileDescriptor;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;


@@ -53,6 +54,7 @@ import butterknife.OnClick;
public class RobotControlDialog extends DialogFragment { public class RobotControlDialog extends DialogFragment {
private String TAG = " FoodControlDialog =>"; private String TAG = " FoodControlDialog =>";
private DialogFoodControlBinding viewBinding; private DialogFoodControlBinding viewBinding;
private boolean showTip = true;//是否展示“确认附近有无人员”


@Override @Override
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
@@ -127,11 +129,33 @@ public class RobotControlDialog extends DialogFragment {
window.setAttributes(params); window.setAttributes(params);
} }
AdbCommandUtil.hideStatusBar(true); AdbCommandUtil.hideStatusBar(true);
if(getArguments()!=null &&getArguments().containsKey("showTip")){
showTip = getArguments().getBoolean("showTip");
}


initView(); initView();
} }


private void initView(){ private void initView(){
viewBinding.changeToWok1.setOnClickListener(v->{
if(callBack!=null){
callBack.onChangeToWok(1);
dismiss();
}
});
viewBinding.changeToWok2.setOnClickListener(v->{
if(callBack!=null){
callBack.onChangeToWok(2);
dismiss();
}
});
if(!showTip){
viewBinding.clContent1.setVisibility(View.GONE);
viewBinding.clContent2.setVisibility(View.VISIBLE);
}else {
viewBinding.clContent1.setVisibility(View.VISIBLE);
viewBinding.clContent2.setVisibility(View.GONE);
}
handler.sendEmptyMessageDelayed(1,200); handler.sendEmptyMessageDelayed(1,200);
viewBinding.btnClose1.setOnClickListener(v->{ viewBinding.btnClose1.setOnClickListener(v->{
dismiss(); dismiss();
@@ -280,10 +304,6 @@ public class RobotControlDialog extends DialogFragment {
NewToastUtil.getInstance().showToastError("机器人未连接!"); NewToastUtil.getInstance().showToastError("机器人未连接!");
return; return;
} }
if(!Wok1ModbusTcpServer.get().plcIsConnect&&!ConfigName.TEST){
NewToastUtil.getInstance().showToastError("炒锅未连接!");
return;
}


boolean robotNoWorking = false; boolean robotNoWorking = false;
Object object1 = ModbusCenter.robotReadPlc("主任务读取"); Object object1 = ModbusCenter.robotReadPlc("主任务读取");
@@ -291,6 +311,9 @@ public class RobotControlDialog extends DialogFragment {
if (!ConfigName.TEST && object1 != null && object2!=null) { if (!ConfigName.TEST && object1 != null && object2!=null) {
robotNoWorking = ((short) object1)==0 && (boolean) object2; robotNoWorking = ((short) object1)==0 && (boolean) object2;
} }
if(ConfigName.TEST){
robotNoWorking = true;
}
if(view.getId()!=R.id.btn_weihu_finish){ if(view.getId()!=R.id.btn_weihu_finish){
if(!robotNoWorking){ if(!robotNoWorking){
NewToastUtil.getInstance().showToast("机器人正在工作,请稍等重试..."); NewToastUtil.getInstance().showToast("机器人正在工作,请稍等重试...");
@@ -301,7 +324,7 @@ public class RobotControlDialog extends DialogFragment {
switch (view.getId()){ switch (view.getId()){
case R.id.btn_weihu_finish: case R.id.btn_weihu_finish:
if((Boolean) ModbusCenter.getListingValue("机器人到达维护位")){ if((Boolean) ModbusCenter.getListingValue("机器人到达维护位")){
tipDialog("控制机器人完成维护", new MyClickListener() {
tipDialog("控制机器人完成维护",2, new MyClickListener() {
@Override @Override
public void clickListener(View v, Object s) { public void clickListener(View v, Object s) {
WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在回原点,请等待完成,不要进行其他操作!"); WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在回原点,请等待完成,不要进行其他操作!");
@@ -323,7 +346,7 @@ public class RobotControlDialog extends DialogFragment {


break; break;
case R.id.btn_weihu: case R.id.btn_weihu:
tipDialog("控制机器人去维护位", new MyClickListener() {
tipDialog("控制机器人去维护位",2, new MyClickListener() {
@Override @Override
public void clickListener(View v, Object s) { public void clickListener(View v, Object s) {
WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在去维护位,请等待完成,不要进行其他操作!"); WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在去维护位,请等待完成,不要进行其他操作!");
@@ -442,7 +465,7 @@ public class RobotControlDialog extends DialogFragment {
//左侧 //左侧
case R.id.btn_wok_chucai: case R.id.btn_wok_chucai:
data.put("延迟(秒)","0"); data.put("延迟(秒)","0");
tipDialog("控制机器人给炒锅出菜", new MyClickListener() {
tipDialog("控制机器人给炒锅出菜", 2,new MyClickListener() {
@Override @Override
public void clickListener(View v, Object s) { public void clickListener(View v, Object s) {
WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在给炒锅出菜,请等待完成,不要进行其他操作!"); WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在给炒锅出菜,请等待完成,不要进行其他操作!");
@@ -466,7 +489,7 @@ public class RobotControlDialog extends DialogFragment {
break; break;
case R.id.btn_wok_chucai2: case R.id.btn_wok_chucai2:
data.put("延迟(秒)","0"); data.put("延迟(秒)","0");
tipDialog("控制机器人给炒锅出菜", new MyClickListener() {
tipDialog("控制机器人给炒锅出菜",2, new MyClickListener() {
@Override @Override
public void clickListener(View v, Object s) { public void clickListener(View v, Object s) {
WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在给炒锅出菜,请等待完成,不要进行其他操作!"); WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在给炒锅出菜,请等待完成,不要进行其他操作!");
@@ -492,7 +515,7 @@ public class RobotControlDialog extends DialogFragment {
} }


private void robotPutFood(){ private void robotPutFood(){
tipDialog("控制机器人取主料" + data.get("主料位置") + ",并投放到炒锅", new MyClickListener() {
tipDialog("控制机器人取主料" + data.get("主料位置") + ",并投放到炒锅",1, new MyClickListener() {
@Override @Override
public void clickListener(View v, Object s) { public void clickListener(View v, Object s) {
WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在向炒锅投主料"+data.get("主料位置")+",请等待完成,不要进行其他操作!"); WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在向炒锅投主料"+data.get("主料位置")+",请等待完成,不要进行其他操作!");
@@ -517,7 +540,7 @@ public class RobotControlDialog extends DialogFragment {


} }
private void robotPutFoo2(){ private void robotPutFoo2(){
tipDialog("控制机器人取辅料" + data.get("辅料位置") + ",并投放到炒锅", new MyClickListener() {
tipDialog("控制机器人取辅料" + data.get("辅料位置") + ",并投放到炒锅",1, new MyClickListener() {
@Override @Override
public void clickListener(View v, Object s) { public void clickListener(View v, Object s) {
WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在向炒锅投辅料"+data.get("辅料位置")+",请等待完成,不要进行其他操作!"); WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在向炒锅投辅料"+data.get("辅料位置")+",请等待完成,不要进行其他操作!");
@@ -539,10 +562,14 @@ public class RobotControlDialog extends DialogFragment {


} }


private void tipDialog(String tip, MyClickListener listener){
private void tipDialog(String tip,int type, MyClickListener listener){
AlertDialogUtils.showCancelAndConfirmDialog(getActivity(), R.layout.dialog_wok_tip, (layoutView, xCom) -> { AlertDialogUtils.showCancelAndConfirmDialog(getActivity(), R.layout.dialog_wok_tip, (layoutView, xCom) -> {
DialogWokTipBinding binding = DialogWokTipBinding.bind(layoutView); DialogWokTipBinding binding = DialogWokTipBinding.bind(layoutView);
DisplayManager.scaleViewGroup(binding.getRoot()); DisplayManager.scaleViewGroup(binding.getRoot());
if(type == 2){
binding.submit.setVisibility(View.GONE);
binding.submit2.setText("确认");
}
binding.title.setText("确认机器人指令"); binding.title.setText("确认机器人指令");
binding.message.setText(""+tip); binding.message.setText(""+tip);
binding.close.setOnClickListener(view1->{ binding.close.setOnClickListener(view1->{
@@ -578,5 +605,20 @@ public class RobotControlDialog extends DialogFragment {
handler.removeCallbacksAndMessages(null); handler.removeCallbacksAndMessages(null);
handler = null; handler = null;
} }
callBack = null;
}

public ChangeCallBack callBack;

public ChangeCallBack getCallBack() {
return callBack;
}

public void setCallBack(ChangeCallBack callBack) {
this.callBack = callBack;
}

public interface ChangeCallBack{
void onChangeToWok(int num);
} }
} }

+ 52
- 12
app/src/main/java/com/bonait/bnframework/newui/dialog/control/RobotControlDialog2.java View File

@@ -53,6 +53,7 @@ import butterknife.OnClick;
public class RobotControlDialog2 extends DialogFragment { public class RobotControlDialog2 extends DialogFragment {
private String TAG = " FoodControlDialog =>"; private String TAG = " FoodControlDialog =>";
private DialogFoodControl2Binding viewBinding; private DialogFoodControl2Binding viewBinding;
private boolean showTip = true;//是否展示“确认附近有无人员”


@Override @Override
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
@@ -127,11 +128,32 @@ public class RobotControlDialog2 extends DialogFragment {
window.setAttributes(params); window.setAttributes(params);
} }
AdbCommandUtil.hideStatusBar(true); AdbCommandUtil.hideStatusBar(true);

if(getArguments()!=null &&getArguments().containsKey("showTip")){
showTip = getArguments().getBoolean("showTip");
}
initView(); initView();
} }


private void initView(){ private void initView(){
viewBinding.changeToWok1.setOnClickListener(v->{
if(callBack!=null){
callBack.onChangeToWok(1);
dismiss();
}
});
viewBinding.changeToWok2.setOnClickListener(v->{
if(callBack!=null){
callBack.onChangeToWok(2);
dismiss();
}
});
if(showTip){
viewBinding.clContent1.setVisibility(View.GONE);
viewBinding.clContent2.setVisibility(View.VISIBLE);
}else {
viewBinding.clContent1.setVisibility(View.VISIBLE);
viewBinding.clContent2.setVisibility(View.GONE);
}
handler.sendEmptyMessageDelayed(1,200); handler.sendEmptyMessageDelayed(1,200);
viewBinding.btnClose1.setOnClickListener(v->{ viewBinding.btnClose1.setOnClickListener(v->{
dismiss(); dismiss();
@@ -280,10 +302,6 @@ public class RobotControlDialog2 extends DialogFragment {
NewToastUtil.getInstance().showToastError("机器人未连接!"); NewToastUtil.getInstance().showToastError("机器人未连接!");
return; return;
} }
if(!Wok1ModbusTcpServer.get().plcIsConnect&&!ConfigName.TEST){
NewToastUtil.getInstance().showToastError("炒锅未连接!");
return;
}


boolean robotNoWorking = false; boolean robotNoWorking = false;
Object object1 = ModbusCenter.robotReadPlc("主任务读取"); Object object1 = ModbusCenter.robotReadPlc("主任务读取");
@@ -291,6 +309,9 @@ public class RobotControlDialog2 extends DialogFragment {
if (!ConfigName.TEST && object1 != null && object2!=null) { if (!ConfigName.TEST && object1 != null && object2!=null) {
robotNoWorking = ((short) object1)==0 && (boolean) object2; robotNoWorking = ((short) object1)==0 && (boolean) object2;
} }
if(ConfigName.TEST){
robotNoWorking = true;
}
if(view.getId()!=R.id.btn_weihu_finish){ if(view.getId()!=R.id.btn_weihu_finish){
if(!robotNoWorking){ if(!robotNoWorking){
NewToastUtil.getInstance().showToast("机器人正在工作,请稍等重试..."); NewToastUtil.getInstance().showToast("机器人正在工作,请稍等重试...");
@@ -301,7 +322,7 @@ public class RobotControlDialog2 extends DialogFragment {
switch (view.getId()){ switch (view.getId()){
case R.id.btn_weihu_finish: case R.id.btn_weihu_finish:
if((Boolean) ModbusCenter.getListingValue("机器人到达维护位")){ if((Boolean) ModbusCenter.getListingValue("机器人到达维护位")){
tipDialog("控制机器人完成维护", new MyClickListener() {
tipDialog("控制机器人完成维护",2, new MyClickListener() {
@Override @Override
public void clickListener(View v, Object s) { public void clickListener(View v, Object s) {
WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在回原点,请等待完成,不要进行其他操作!"); WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在回原点,请等待完成,不要进行其他操作!");
@@ -323,7 +344,7 @@ public class RobotControlDialog2 extends DialogFragment {


break; break;
case R.id.btn_weihu: case R.id.btn_weihu:
tipDialog("控制机器人去维护位", new MyClickListener() {
tipDialog("控制机器人去维护位", 2,new MyClickListener() {
@Override @Override
public void clickListener(View v, Object s) { public void clickListener(View v, Object s) {
WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在去维护位,请等待完成,不要进行其他操作!"); WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在去维护位,请等待完成,不要进行其他操作!");
@@ -442,7 +463,7 @@ public class RobotControlDialog2 extends DialogFragment {
//左侧 //左侧
case R.id.btn_wok_chucai: case R.id.btn_wok_chucai:
data.put("延迟(秒)","0"); data.put("延迟(秒)","0");
tipDialog("控制机器人给炒锅出菜", new MyClickListener() {
tipDialog("控制机器人给炒锅出菜",2, new MyClickListener() {
@Override @Override
public void clickListener(View v, Object s) { public void clickListener(View v, Object s) {
WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在给炒锅出菜,请等待完成,不要进行其他操作!"); WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在给炒锅出菜,请等待完成,不要进行其他操作!");
@@ -466,7 +487,7 @@ public class RobotControlDialog2 extends DialogFragment {
break; break;
case R.id.btn_wok_chucai2: case R.id.btn_wok_chucai2:
data.put("延迟(秒)","0"); data.put("延迟(秒)","0");
tipDialog("控制机器人给炒锅出菜", new MyClickListener() {
tipDialog("控制机器人给炒锅出菜",2, new MyClickListener() {
@Override @Override
public void clickListener(View v, Object s) { public void clickListener(View v, Object s) {
WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在给炒锅出菜,请等待完成,不要进行其他操作!"); WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在给炒锅出菜,请等待完成,不要进行其他操作!");
@@ -492,7 +513,7 @@ public class RobotControlDialog2 extends DialogFragment {
} }


private void robotPutFood(){ private void robotPutFood(){
tipDialog("控制机器人取主料" + data.get("主料位置") + ",并投放到炒锅", new MyClickListener() {
tipDialog("控制机器人取主料" + data.get("主料位置") + ",并投放到炒锅", 1,new MyClickListener() {
@Override @Override
public void clickListener(View v, Object s) { public void clickListener(View v, Object s) {
WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在向炒锅投主料"+data.get("主料位置")+",请等待完成,不要进行其他操作!"); WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在向炒锅投主料"+data.get("主料位置")+",请等待完成,不要进行其他操作!");
@@ -514,7 +535,7 @@ public class RobotControlDialog2 extends DialogFragment {


} }
private void robotPutFoo2(){ private void robotPutFoo2(){
tipDialog("控制机器人取辅料" + data.get("辅料位置") + ",并投放到炒锅", new MyClickListener() {
tipDialog("控制机器人取辅料" + data.get("辅料位置") + ",并投放到炒锅",1, new MyClickListener() {
@Override @Override
public void clickListener(View v, Object s) { public void clickListener(View v, Object s) {
WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在向炒锅投辅料"+data.get("辅料位置")+",请等待完成,不要进行其他操作!"); WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在向炒锅投辅料"+data.get("辅料位置")+",请等待完成,不要进行其他操作!");
@@ -536,10 +557,14 @@ public class RobotControlDialog2 extends DialogFragment {


} }


private void tipDialog(String tip, MyClickListener listener){
private void tipDialog(String tip,int type, MyClickListener listener){
AlertDialogUtils.showCancelAndConfirmDialog(getActivity(), R.layout.dialog_wok_tip, (layoutView, xCom) -> { AlertDialogUtils.showCancelAndConfirmDialog(getActivity(), R.layout.dialog_wok_tip, (layoutView, xCom) -> {
DialogWokTipBinding binding = DialogWokTipBinding.bind(layoutView); DialogWokTipBinding binding = DialogWokTipBinding.bind(layoutView);
DisplayManager.scaleViewGroup(binding.getRoot()); DisplayManager.scaleViewGroup(binding.getRoot());
if(type == 2){
binding.submit.setVisibility(View.GONE);
binding.submit2.setText("确认");
}
binding.title.setText("确认机器人指令"); binding.title.setText("确认机器人指令");
binding.message.setText(""+tip); binding.message.setText(""+tip);
binding.close.setOnClickListener(view1->{ binding.close.setOnClickListener(view1->{
@@ -575,5 +600,20 @@ public class RobotControlDialog2 extends DialogFragment {
handler.removeCallbacksAndMessages(null); handler.removeCallbacksAndMessages(null);
handler = null; handler = null;
} }
callBack = null;
}

public ChangeCallBack callBack;

public ChangeCallBack getCallBack() {
return callBack;
}

public void setCallBack(ChangeCallBack callBack) {
this.callBack = callBack;
}

public interface ChangeCallBack{
void onChangeToWok(int num);
} }
} }

+ 54
- 12
app/src/main/java/com/bonait/bnframework/newui/dialog/control/RobotControlDialog3.java View File

@@ -53,6 +53,7 @@ import butterknife.OnClick;
public class RobotControlDialog3 extends DialogFragment { public class RobotControlDialog3 extends DialogFragment {
private String TAG = " FoodControlDialog =>"; private String TAG = " FoodControlDialog =>";
private DialogFoodControl3Binding viewBinding; private DialogFoodControl3Binding viewBinding;
private boolean showTip = true;//是否展示“确认附近有无人员”


@Override @Override
public void onCreate(@Nullable Bundle savedInstanceState) { public void onCreate(@Nullable Bundle savedInstanceState) {
@@ -127,11 +128,32 @@ public class RobotControlDialog3 extends DialogFragment {
window.setAttributes(params); window.setAttributes(params);
} }
AdbCommandUtil.hideStatusBar(true); AdbCommandUtil.hideStatusBar(true);

if(getArguments()!=null &&getArguments().containsKey("showTip")){
showTip = getArguments().getBoolean("showTip");
}
initView(); initView();
} }


private void initView(){ private void initView(){
viewBinding.changeToWok1.setOnClickListener(v->{
if(callBack!=null){
callBack.onChangeToWok(1);
dismiss();
}
});
viewBinding.changeToWok2.setOnClickListener(v->{
if(callBack!=null){
callBack.onChangeToWok(2);
dismiss();
}
});
if(showTip){
viewBinding.clContent1.setVisibility(View.GONE);
viewBinding.clContent2.setVisibility(View.VISIBLE);
}else {
viewBinding.clContent1.setVisibility(View.VISIBLE);
viewBinding.clContent2.setVisibility(View.GONE);
}
handler.sendEmptyMessageDelayed(1,200); handler.sendEmptyMessageDelayed(1,200);
viewBinding.btnClose1.setOnClickListener(v->{ viewBinding.btnClose1.setOnClickListener(v->{
dismiss(); dismiss();
@@ -280,10 +302,7 @@ public class RobotControlDialog3 extends DialogFragment {
NewToastUtil.getInstance().showToastError("机器人未连接!"); NewToastUtil.getInstance().showToastError("机器人未连接!");
return; return;
} }
if(!Wok1ModbusTcpServer.get().plcIsConnect&&!ConfigName.TEST){
NewToastUtil.getInstance().showToastError("炒锅未连接!");
return;
}



boolean robotNoWorking = false; boolean robotNoWorking = false;
Object object1 = ModbusCenter.robotReadPlc("主任务读取"); Object object1 = ModbusCenter.robotReadPlc("主任务读取");
@@ -291,6 +310,9 @@ public class RobotControlDialog3 extends DialogFragment {
if (!ConfigName.TEST && object1 != null && object2!=null) { if (!ConfigName.TEST && object1 != null && object2!=null) {
robotNoWorking = ((short) object1)==0 && (boolean) object2; robotNoWorking = ((short) object1)==0 && (boolean) object2;
} }
if(ConfigName.TEST){
robotNoWorking = true;
}
if(view.getId()!=R.id.btn_weihu_finish){ if(view.getId()!=R.id.btn_weihu_finish){
if(!robotNoWorking){ if(!robotNoWorking){
NewToastUtil.getInstance().showToast("机器人正在工作,请稍等重试..."); NewToastUtil.getInstance().showToast("机器人正在工作,请稍等重试...");
@@ -301,7 +323,7 @@ public class RobotControlDialog3 extends DialogFragment {
switch (view.getId()){ switch (view.getId()){
case R.id.btn_weihu_finish: case R.id.btn_weihu_finish:
if((Boolean) ModbusCenter.getListingValue("机器人到达维护位")){ if((Boolean) ModbusCenter.getListingValue("机器人到达维护位")){
tipDialog("控制机器人完成维护", new MyClickListener() {
tipDialog("控制机器人完成维护",2, new MyClickListener() {
@Override @Override
public void clickListener(View v, Object s) { public void clickListener(View v, Object s) {
WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在回原点,请等待完成,不要进行其他操作!"); WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在回原点,请等待完成,不要进行其他操作!");
@@ -323,7 +345,7 @@ public class RobotControlDialog3 extends DialogFragment {


break; break;
case R.id.btn_weihu: case R.id.btn_weihu:
tipDialog("控制机器人去维护位", new MyClickListener() {
tipDialog("控制机器人去维护位",2, new MyClickListener() {
@Override @Override
public void clickListener(View v, Object s) { public void clickListener(View v, Object s) {
WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在去维护位,请等待完成,不要进行其他操作!"); WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在去维护位,请等待完成,不要进行其他操作!");
@@ -442,7 +464,7 @@ public class RobotControlDialog3 extends DialogFragment {
//左侧 //左侧
case R.id.btn_wok_chucai: case R.id.btn_wok_chucai:
data.put("延迟(秒)","0"); data.put("延迟(秒)","0");
tipDialog("控制机器人给炒锅出菜", new MyClickListener() {
tipDialog("控制机器人给炒锅出菜",2, new MyClickListener() {
@Override @Override
public void clickListener(View v, Object s) { public void clickListener(View v, Object s) {
WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在给炒锅出菜,请等待完成,不要进行其他操作!"); WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在给炒锅出菜,请等待完成,不要进行其他操作!");
@@ -467,7 +489,7 @@ public class RobotControlDialog3 extends DialogFragment {
case R.id.btn_wok_chucai2: case R.id.btn_wok_chucai2:
data.put("延迟(秒)","0"); data.put("延迟(秒)","0");
tipDialog("控制机器人给炒锅出菜", new MyClickListener() {
tipDialog("控制机器人给炒锅出菜",2, new MyClickListener() {
@Override @Override
public void clickListener(View v, Object s) { public void clickListener(View v, Object s) {
WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在给炒锅出菜,请等待完成,不要进行其他操作!"); WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在给炒锅出菜,请等待完成,不要进行其他操作!");
@@ -493,7 +515,7 @@ public class RobotControlDialog3 extends DialogFragment {
} }


private void robotPutFood(){ private void robotPutFood(){
tipDialog("控制机器人取主料" + data.get("主料位置") + ",并投放到炒锅", new MyClickListener() {
tipDialog("控制机器人取主料" + data.get("主料位置") + ",并投放到炒锅",1, new MyClickListener() {
@Override @Override
public void clickListener(View v, Object s) { public void clickListener(View v, Object s) {
WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在向炒锅投主料"+data.get("主料位置")+",请等待完成,不要进行其他操作!"); WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在向炒锅投主料"+data.get("主料位置")+",请等待完成,不要进行其他操作!");
@@ -515,7 +537,7 @@ public class RobotControlDialog3 extends DialogFragment {


} }
private void robotPutFoo2(){ private void robotPutFoo2(){
tipDialog("控制机器人取辅料" + data.get("辅料位置") + ",并投放到炒锅", new MyClickListener() {
tipDialog("控制机器人取辅料" + data.get("辅料位置") + ",并投放到炒锅",1, new MyClickListener() {
@Override @Override
public void clickListener(View v, Object s) { public void clickListener(View v, Object s) {
WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在向炒锅投辅料"+data.get("辅料位置")+",请等待完成,不要进行其他操作!"); WaitProcessUtil.getInstance().show(getContext(),"提示","机器人正在向炒锅投辅料"+data.get("辅料位置")+",请等待完成,不要进行其他操作!");
@@ -537,10 +559,15 @@ public class RobotControlDialog3 extends DialogFragment {


} }


private void tipDialog(String tip, MyClickListener listener){
//type=1 选择 1 2号锅 2 确认
private void tipDialog(String tip,int type, MyClickListener listener){
AlertDialogUtils.showCancelAndConfirmDialog(getActivity(), R.layout.dialog_wok_tip, (layoutView, xCom) -> { AlertDialogUtils.showCancelAndConfirmDialog(getActivity(), R.layout.dialog_wok_tip, (layoutView, xCom) -> {
DialogWokTipBinding binding = DialogWokTipBinding.bind(layoutView); DialogWokTipBinding binding = DialogWokTipBinding.bind(layoutView);
DisplayManager.scaleViewGroup(binding.getRoot()); DisplayManager.scaleViewGroup(binding.getRoot());
if(type == 2){
binding.submit.setVisibility(View.GONE);
binding.submit2.setText("确认");
}
binding.title.setText("确认机器人指令"); binding.title.setText("确认机器人指令");
binding.message.setText(""+tip); binding.message.setText(""+tip);
binding.close.setOnClickListener(view1->{ binding.close.setOnClickListener(view1->{
@@ -576,5 +603,20 @@ public class RobotControlDialog3 extends DialogFragment {
handler.removeCallbacksAndMessages(null); handler.removeCallbacksAndMessages(null);
handler = null; handler = null;
} }
callBack = null;
}

public ChangeCallBack callBack;

public ChangeCallBack getCallBack() {
return callBack;
}

public void setCallBack(ChangeCallBack callBack) {
this.callBack = callBack;
}

public interface ChangeCallBack{
void onChangeToWok(int num);
} }
} }

+ 98
- 11
app/src/main/java/com/bonait/bnframework/newui/dialog/control/WokControlDialog.java View File

@@ -17,6 +17,7 @@ import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
import android.widget.ArrayAdapter;


import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@@ -25,6 +26,7 @@ import androidx.fragment.app.DialogFragment;
import com.apkfuns.logutils.LogUtils; import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.R; import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe; import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.business.RecordManager;
import com.bonait.bnframework.common.constant.ConfigName; import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.db.QueryDB; import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
@@ -44,6 +46,7 @@ import com.bonait.bnframework.newui.widget.NewToastUtil;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog; import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;


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


import butterknife.ButterKnife; import butterknife.ButterKnife;
@@ -155,6 +158,68 @@ public class WokControlDialog extends DialogFragment {


@SuppressLint("ClickableViewAccessibility") @SuppressLint("ClickableViewAccessibility")
private void initView(){ private void initView(){

ArrayList<BPA_SILOS> silosArrayList = QueryDB.GetSilosALL();
List<String> nameList = new ArrayList<>();
if(!silosArrayList.isEmpty()) {
for (BPA_SILOS silos : silosArrayList) {
List<BPA_MATERIAL> materials = QueryDB.GetMaterialBySilosID(silos.id);
if (!materials.isEmpty()) {
nameList.add(silos.num + "料仓:" + materials.get(0).name);
} else {
nameList.add(silos.num + "料仓:未设置");
}
}
ArrayAdapter<String> adapter_kk = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, nameList);
adapter_kk.setDropDownViewResource(R.layout.spinner_dropdown_item);
viewBinding.spinnerSilos.setAdapter(adapter_kk);
}

viewBinding.btnSilosOpen.setOnClickListener(v->{
try {
if(viewBinding.spinnerSilos.getSelectedItem().toString().contains("未设置")){
NewToastUtil.getInstance().showToastError("请先绑定液料!");
return;
}
String[] res = viewBinding.spinnerSilos.getSelectedItem().toString().split("料");
String num = res[0];
String val = viewBinding.editSilosWeight.getText().toString();
if(val.isEmpty()){
NewToastUtil.getInstance().showToastError("请输入重量!");
return;
}
int MaxValue = 0;
int weight = Integer.parseInt(val);
Object jz_z = ExecuteTheRecipe.ReadPLC(deviceNum,"料仓" + num + "校准值");
if (jz_z != null) {
int jzzz = Integer.parseInt(String.valueOf(jz_z));
int jzzz_1 = jzzz == 0 ? 500 : jzzz;
int ztime = (int) (weight / (jzzz_1 / 5.0));
MaxValue = ztime > MaxValue ? ztime : MaxValue;
BPA_SILOS silos = QueryDB.GetSilosNum(num);
if(silos!=null){
ExecuteTheRecipe.Write_PLC_Material(deviceNum,silos, weight);
ExecuteTheRecipe.ThreadWhile_WL(deviceNum,"料仓" + num + "下料完成", MaxValue);
}else {
NewToastUtil.getInstance().showToastError("未找到料仓信息");
RecordManager.getInstance().addLogRecord("角色操作日志","未找到料仓信息");
}
}else {
NewToastUtil.getInstance().showToastError("料仓" +num+ "校准值为空");
RecordManager.getInstance().addLogRecord("角色操作日志","料仓" + num + "校准值为空");
}
}catch (Exception e){
NewToastUtil.getInstance().showToastError("异常 "+e.getMessage());
}

});

viewBinding.changeToRobot.setOnClickListener(v->{
if(callBack!=null){
callBack.onChangeToRobot();
dismiss();
}
});
viewBinding.title1.setText(deviceNum+"号炒锅控制"); viewBinding.title1.setText(deviceNum+"号炒锅控制");
viewBinding.btnClose1.setOnClickListener(v->{ viewBinding.btnClose1.setOnClickListener(v->{
dismiss(); dismiss();
@@ -369,15 +434,20 @@ public class WokControlDialog extends DialogFragment {
viewBinding.guokoucaoxiang.setText("锅口朝向\n原点位"); viewBinding.guokoucaoxiang.setText("锅口朝向\n原点位");
ConfigName.getInstance().guokouChaoxiang = "原点位"; ConfigName.getInstance().guokouChaoxiang = "原点位";
break; break;
case 炒菜位高:
ExecuteTheRecipe.BottomClick(deviceNum,"炒菜位高");
viewBinding.guokoucaoxiang.setText("锅口朝向\n炒菜位高");
ConfigName.getInstance().guokouChaoxiang = "炒菜位高";
case 炒菜位1:
ExecuteTheRecipe.BottomClick(deviceNum,"炒菜位1");
viewBinding.guokoucaoxiang.setText("锅口朝向\n炒菜位1");
ConfigName.getInstance().guokouChaoxiang = "炒菜位1";
break;
case 炒菜位2:
ExecuteTheRecipe.BottomClick(deviceNum,"炒菜位2");
viewBinding.guokoucaoxiang.setText("锅口朝向\n炒菜位2");
ConfigName.getInstance().guokouChaoxiang = "炒菜位2";
break; break;
case 炒菜位低:
ExecuteTheRecipe.BottomClick(deviceNum,"炒菜位低");
viewBinding.guokoucaoxiang.setText("锅口朝向\n炒菜位低");
ConfigName.getInstance().guokouChaoxiang = "炒菜位低";
case 炒菜位3:
ExecuteTheRecipe.BottomClick(deviceNum,"炒菜位3");
viewBinding.guokoucaoxiang.setText("锅口朝向\n炒菜位3");
ConfigName.getInstance().guokouChaoxiang = "炒菜位3";
break; break;
case 维护位: case 维护位:
ExecuteTheRecipe.BottomClick(deviceNum,"维护位"); ExecuteTheRecipe.BottomClick(deviceNum,"维护位");
@@ -457,7 +527,7 @@ public class WokControlDialog extends DialogFragment {


@SuppressLint("NonConstantResourceId") @SuppressLint("NonConstantResourceId")
@OnClick({R.id.btn_chushihua, R.id.xiguoshui, R.id.chushui, R.id.yeliao1, R.id.yeliao2, R.id.yeliao3,R.id.guokoucaoxiang,R.id.btn_speed_kuai, @OnClick({R.id.btn_chushihua, R.id.xiguoshui, R.id.chushui, R.id.yeliao1, R.id.yeliao2, R.id.yeliao3,R.id.guokoucaoxiang,R.id.btn_speed_kuai,
R.id.btn_speed_zhong,R.id.btn_speed_man,R.id.btn_speed_stop,R.id.guokoucaoxiang_yd,R.id.guokoucaoxiang_cc1,R.id.guokoucaoxiang_cc2,
R.id.btn_speed_zhong,R.id.btn_speed_man,R.id.btn_speed_stop,R.id.guokoucaoxiang_yd,R.id.guokoucaoxiang_cc1,R.id.guokoucaoxiang_cc2,R.id.guokoucaoxiang_cc3,
R.id.guokoucaoxiang_wh,R.id.guokoucaoxiang_cl,R.id.guokoucaoxiang_dc,R.id.btn_stop,R.id.btn_fuwei, R.id.guokoucaoxiang_wh,R.id.guokoucaoxiang_cl,R.id.guokoucaoxiang_dc,R.id.btn_stop,R.id.btn_fuwei,
R.id.guokoucaoxiang_qx,R.id.btn_chucai,R.id.btn_shengdu_qingxi,R.id.btn_putong_qingxi}) R.id.guokoucaoxiang_qx,R.id.btn_chucai,R.id.btn_shengdu_qingxi,R.id.btn_putong_qingxi})
public void onViewClicked(View view) { public void onViewClicked(View view) {
@@ -575,10 +645,13 @@ public class WokControlDialog extends DialogFragment {
SetMouthFacing(MouthFacingEnum.原点位); SetMouthFacing(MouthFacingEnum.原点位);
break; break;
case R.id.guokoucaoxiang_cc1: case R.id.guokoucaoxiang_cc1:
SetMouthFacing(MouthFacingEnum.炒菜位);
SetMouthFacing(MouthFacingEnum.炒菜位1);
break; break;
case R.id.guokoucaoxiang_cc2: case R.id.guokoucaoxiang_cc2:
SetMouthFacing(MouthFacingEnum.炒菜位低);
SetMouthFacing(MouthFacingEnum.炒菜位2);
break;
case R.id.guokoucaoxiang_cc3:
SetMouthFacing(MouthFacingEnum.炒菜位3);
break; break;
case R.id.guokoucaoxiang_wh: case R.id.guokoucaoxiang_wh:
SetMouthFacing(MouthFacingEnum.维护位); SetMouthFacing(MouthFacingEnum.维护位);
@@ -606,6 +679,7 @@ public class WokControlDialog extends DialogFragment {
handler.removeCallbacksAndMessages(null); handler.removeCallbacksAndMessages(null);
handler = null; handler = null;
} }
callBack = null;
} }


@Override @Override
@@ -616,4 +690,17 @@ public class WokControlDialog extends DialogFragment {
handler = null; handler = null;
} }
} }
public ChangeCallBack callBack;

public ChangeCallBack getCallBack() {
return callBack;
}

public void setCallBack(ChangeCallBack callBack) {
this.callBack = callBack;
}

public interface ChangeCallBack{
void onChangeToRobot();
}
} }

+ 73
- 100
app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeDevicesFragment.java View File

@@ -30,6 +30,7 @@ import com.bonait.bnframework.newui.dialog.control.RobotControlDialog;
import com.bonait.bnframework.newui.dialog.control.RobotControlDialog2; import com.bonait.bnframework.newui.dialog.control.RobotControlDialog2;
import com.bonait.bnframework.newui.dialog.control.RobotControlDialog3; import com.bonait.bnframework.newui.dialog.control.RobotControlDialog3;
import com.bonait.bnframework.newui.dialog.control.WokControlDialog; import com.bonait.bnframework.newui.dialog.control.WokControlDialog;
import com.bonait.bnframework.newui.fragment.setting.SceneSetFragment;
import com.bonait.bnframework.newui.widget.NewToastUtil; import com.bonait.bnframework.newui.widget.NewToastUtil;
import com.orhanobut.logger.Logger; import com.orhanobut.logger.Logger;


@@ -48,40 +49,6 @@ public class HomeDevicesFragment extends BaseFragment {
@Override @Override
public void handleMessage(@NonNull Message msg) { public void handleMessage(@NonNull Message msg) {
super.handleMessage(msg); super.handleMessage(msg);
// if(msg.what==1){
// if(handler.hasMessages(1)){
// handler.removeMessages(1);
// }
// handler.sendEmptyMessageDelayed(1,500);
// try {
// changeStatus();
// Object object1 = ModbusCenter.getListingValue("出料空盆检测有无");
// Object object2 = ModbusCenter.getListingValue("补盆工位检测有无");
// Object object3 = ModbusCenter.getListingValue("输送线");
// Object object4 = ModbusCenter.getListingValue("出餐工位检测有无");
// if(object1 instanceof Boolean){
// viewBinding.tvChuliaoBox.setText("出料盆位检测:"+(((Boolean)object1)?"有盆":"无盆"));
// }else {
// viewBinding.tvChuliaoBox.setText("出料盆位检测:异常");
// }
// if(object2 instanceof Boolean){
// viewBinding.tvBuliaoBox.setText("补盆位检测:"+(((Boolean)object2)?"有盆":"无盆"));
// }else {
// viewBinding.tvBuliaoBox.setText("补盆位检测:异常");
// }
// if(object3 instanceof Boolean){
// viewBinding.tvShusongxian.setText("输送线状态:"+(((Boolean)object3)?"启动":"停止"));
// }else {
// viewBinding.tvShusongxian.setText("输送线状态:异常");
// }
// if(object4 instanceof Boolean){
// viewBinding.tvChucaiBox.setText("出餐工位检测:"+(((Boolean)object4)?"有盆":"无盆"));
// }else {
// viewBinding.tvChucaiBox.setText("出餐工位检测:异常");
// }
// }catch (Exception ignored){
// }
// }
} }
}; };


@@ -105,63 +72,19 @@ public class HomeDevicesFragment extends BaseFragment {
if(ConfigName.getInstance().isFastClick()){ if(ConfigName.getInstance().isFastClick()){
return; return;
} }
if(!RobotModbusTcpServer.get().plcIsConnect &&!ConfigName.TEST){
NewToastUtil.getInstance().showToastError("机器人未连接!");
return;
}
switch (ConfigName.getInstance().versionSelectionEnum){
case "鸿鹄中江":
RobotControlDialog2 dialog2 = new RobotControlDialog2();
if(getActivity()!=null){
dialog2.show(getActivity().getSupportFragmentManager(),"投料控制1");
}
break;
case "鸿鹄青白江":
RobotControlDialog3 dialog3 = new RobotControlDialog3();
if(getActivity()!=null){
dialog3.show(getActivity().getSupportFragmentManager(),"投料控制3");
}
break;
default:
RobotControlDialog dialog = new RobotControlDialog();
if(getActivity()!=null){
dialog.show(getActivity().getSupportFragmentManager(),"投料控制2");
}
break;
}

showRobotDialog(true);
}); });
viewBinding.btnChaoguo.setOnClickListener(v->{ viewBinding.btnChaoguo.setOnClickListener(v->{
if(ConfigName.getInstance().isFastClick()){ if(ConfigName.getInstance().isFastClick()){
return; return;
} }
if(!Wok1ModbusTcpServer.get().plcIsConnect &&!ConfigName.TEST){
NewToastUtil.getInstance().showToastError("1号炒锅设备未连接!");
return;
}
WokControlDialog dialog = new WokControlDialog();
if(getActivity()!=null){
Bundle bundle = new Bundle();
bundle.putInt("deviceNum",1);
dialog.setArguments(bundle);
dialog.show(getActivity().getSupportFragmentManager(),"炒锅控制");
}
showWokDialog(1);
}); });
viewBinding.btnChaoguo2.setOnClickListener(v->{ viewBinding.btnChaoguo2.setOnClickListener(v->{
if(ConfigName.getInstance().isFastClick()){ if(ConfigName.getInstance().isFastClick()){
return; return;
} }
if(!Wok2ModbusTcpServer.get().plcIsConnect &&!ConfigName.TEST){
NewToastUtil.getInstance().showToastError("2号炒锅设备未连接!");
return;
}
WokControlDialog dialog = new WokControlDialog();
if(getActivity()!=null){
Bundle bundle = new Bundle();
bundle.putInt("deviceNum",2);
dialog.setArguments(bundle);
dialog.show(getActivity().getSupportFragmentManager(),"炒锅控制");
}
showWokDialog(2);
}); });


viewBinding.btnDishCheck.setOnClickListener(v->{ viewBinding.btnDishCheck.setOnClickListener(v->{
@@ -200,6 +123,8 @@ public class HomeDevicesFragment extends BaseFragment {
viewBinding.btnChucanCheck.setVisibility(View.VISIBLE); viewBinding.btnChucanCheck.setVisibility(View.VISIBLE);
break; break;
case "鸿鹄青白江": case "鸿鹄青白江":
// case SceneSetFragment.deviceName4:
case "海科食堂":
viewBinding.imgChucan.setVisibility(View.GONE); viewBinding.imgChucan.setVisibility(View.GONE);
viewBinding.tvChucan.setVisibility(View.GONE); viewBinding.tvChucan.setVisibility(View.GONE);
viewBinding.btnChucanCheck.setVisibility(View.GONE); viewBinding.btnChucanCheck.setVisibility(View.GONE);
@@ -225,26 +150,74 @@ public class HomeDevicesFragment extends BaseFragment {
}); });
} }


private void changeStatus(){
/**
* 机器人控制弹窗
* @param showTip 是否提示确保附近无人
*/
private void showRobotDialog(boolean showTip){
if(!RobotModbusTcpServer.get().plcIsConnect &&!ConfigName.TEST){
NewToastUtil.getInstance().showToastError("机器人未连接!");
return;
}
switch (ConfigName.getInstance().versionSelectionEnum){
case "鸿鹄中江":
RobotControlDialog2 dialog2 = new RobotControlDialog2();
dialog2.setCallBack(num -> showWokDialog(num));
Bundle bundle2 = new Bundle();
bundle2.putBoolean("showTip",showTip);
dialog2.setArguments(bundle2);
if(getActivity()!=null){
dialog2.show(getActivity().getSupportFragmentManager(),"投料控制1");
}
break;
case "鸿鹄青白江":
RobotControlDialog3 dialog3 = new RobotControlDialog3();
dialog3.setCallBack(num -> showWokDialog(num));
Bundle bundle3 = new Bundle();
bundle3.putBoolean("showTip",showTip);
dialog3.setArguments(bundle3);
if(getActivity()!=null){
dialog3.show(getActivity().getSupportFragmentManager(),"投料控制3");
}
break;
default:
RobotControlDialog dialog = new RobotControlDialog();
dialog.setCallBack(num -> showWokDialog(num));
Bundle bundle = new Bundle();
bundle.putBoolean("showTip",showTip);
dialog.setArguments(bundle);
if(getActivity()!=null){
dialog.show(getActivity().getSupportFragmentManager(),"投料控制2");
}
break;
}
}

/**
* 炒锅控制弹窗
* @param num 几号炒锅
*/
private void showWokDialog(int num){
if(num==2){
if(!Wok2ModbusTcpServer.get().plcIsConnect &&!ConfigName.TEST){
NewToastUtil.getInstance().showToastError("2号炒锅设备未连接!");
return;
}
}else {
if(!Wok1ModbusTcpServer.get().plcIsConnect &&!ConfigName.TEST){
NewToastUtil.getInstance().showToastError("2号炒锅设备未连接!");
return;
}
}


// String content = "炒锅连接状态:"+(WokModbusTcpServer.get().plcIsConnect?"已连接":"未连接");
// SpannableStringBuilder spannable = new SpannableStringBuilder(content);
// spannable.setSpan(new ForegroundColorSpan(WokModbusTcpServer.get().plcIsConnect?Color.parseColor("#567722"):Color.parseColor("#DA5A17"))
// , content.length()-3, content.length(),
// Spannable.SPAN_EXCLUSIVE_INCLUSIVE);//SPAN_EXCLUSIVE_INCLUSIVE前面不包括后面包括
// viewBinding.deviceStatusWok.setText(spannable);
//
// String content2 = "烤箱连接状态:"+(OvenModbusTcpServer.get().plcIsConnect?"已连接":"未连接");
// SpannableStringBuilder spannable2 = new SpannableStringBuilder(content2);
// spannable2.setSpan(new ForegroundColorSpan(OvenModbusTcpServer.get().plcIsConnect?Color.parseColor("#567722"):Color.parseColor("#DA5A17")), content2.length()-3, content2.length(),
// Spannable.SPAN_EXCLUSIVE_INCLUSIVE);//SPAN_EXCLUSIVE_INCLUSIVE前面不包括后面包括
// viewBinding.deviceStatusOven.setText(spannable2);
//
// String content3 = "机器人连接状态:"+(RobotModbusTcpServer.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(),
// Spannable.SPAN_EXCLUSIVE_INCLUSIVE);//SPAN_EXCLUSIVE_INCLUSIVE前面不包括后面包括
// viewBinding.deviceStatusRobot.setText(spannable3);
WokControlDialog dialog = new WokControlDialog();
dialog.setCallBack(() -> showRobotDialog(false));
if(getActivity()!=null){
Bundle bundle = new Bundle();
bundle.putInt("deviceNum",num);
dialog.setArguments(bundle);
dialog.show(getActivity().getSupportFragmentManager(),"炒锅控制");
}
} }


@Override @Override


+ 64
- 2
app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeGoodsFragment.java View File

@@ -3,6 +3,10 @@ package com.bonait.bnframework.newui.fragment.main;
import android.annotation.SuppressLint; import android.annotation.SuppressLint;
import android.graphics.Rect; import android.graphics.Rect;
import android.os.Bundle; import android.os.Bundle;
import android.os.Handler;
import android.os.Looper;
import android.text.Editable;
import android.text.TextWatcher;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;


@@ -50,12 +54,15 @@ public class HomeGoodsFragment extends BaseFragment {
private HomeGoodsAdapter goodsAdapter; private HomeGoodsAdapter goodsAdapter;
private GoodsClassifyAdapter classifyAdapter; private GoodsClassifyAdapter classifyAdapter;
private ArrayList<BPA_GOODS> goodsList = new ArrayList<>(); private ArrayList<BPA_GOODS> goodsList = new ArrayList<>();
private ArrayList<BPA_GOODS> goodsListOld = new ArrayList<>();
private ArrayList<BPA_GOODS_CLASSIFY> classifyList = new ArrayList<>(); private ArrayList<BPA_GOODS_CLASSIFY> classifyList = new ArrayList<>();
private AddOrderDialog addOrderDialog; private AddOrderDialog addOrderDialog;
private OrderNameAdapter orderChaoAdapter; private OrderNameAdapter orderChaoAdapter;
private OrderNameAdapter orderKaoAdapter; private OrderNameAdapter orderKaoAdapter;
private List<BPA_ORDER_DETAIL> orderChaoDetails = new ArrayList<>(); private List<BPA_ORDER_DETAIL> orderChaoDetails = new ArrayList<>();


private Handler handler = new Handler(Looper.getMainLooper()){};

@Override @Override
protected View onCreateView() { protected View onCreateView() {
View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_home_goods, null); View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_home_goods, null);
@@ -69,7 +76,12 @@ public class HomeGoodsFragment extends BaseFragment {
super.onViewCreated(view, savedInstanceState); super.onViewCreated(view, savedInstanceState);
initView(); initView();
initOrderView(); initOrderView();
updateData();
handler.postDelayed(new Runnable() {
@Override
public void run() {
updateData();
}
},200);
} }


@Override @Override
@@ -78,7 +90,13 @@ public class HomeGoodsFragment extends BaseFragment {
if(isVisibleToUser){ if(isVisibleToUser){
EventBus.getDefault().register(this); EventBus.getDefault().register(this);
LogUtils.d("HomeGoodsFragment setUserVisibleHint true"); LogUtils.d("HomeGoodsFragment setUserVisibleHint true");
updateData();

handler.postDelayed(new Runnable() {
@Override
public void run() {
updateData();
}
},200);
}else { }else {
EventBus.getDefault().unregister(this); EventBus.getDefault().unregister(this);
LogUtils.d("HomeGoodsFragment setUserVisibleHint false"); LogUtils.d("HomeGoodsFragment setUserVisibleHint false");
@@ -87,6 +105,38 @@ public class HomeGoodsFragment extends BaseFragment {


@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
private void initView(){ private void initView(){
// viewBinding.btnQuery.setOnClickListener(v->{
// String name = viewBinding.edittext.getText().toString();
//
// });
viewBinding.edittext.addTextChangedListener(new TextWatcher() {
@Override
public void beforeTextChanged(CharSequence charSequence, int i, int i1, int i2) {

}

@Override
public void onTextChanged(CharSequence charSequence, int i, int i1, int i2) {

}

@Override
public void afterTextChanged(Editable editable) {
if(editable.toString().isEmpty()){
goodsList.clear();
goodsList.addAll(goodsListOld);
goodsAdapter.notifyDataSetChanged();
}else {
goodsList.clear();
for(BPA_GOODS bean :goodsListOld){
if(bean.name.contains(editable.toString())){
goodsList.add(bean);
}
}
goodsAdapter.notifyDataSetChanged();
}
}
});
goodsList = new ArrayList<>(); goodsList = new ArrayList<>();
classifyList = new ArrayList<>(); classifyList = new ArrayList<>();
orderChaoDetails = new ArrayList<>(); orderChaoDetails = new ArrayList<>();
@@ -128,6 +178,8 @@ public class HomeGoodsFragment extends BaseFragment {
RecordManager.getInstance().addLogRecord("角色操作日志","点击["+mData.get(position).name+"]分类"); RecordManager.getInstance().addLogRecord("角色操作日志","点击["+mData.get(position).name+"]分类");
goodsList.clear(); goodsList.clear();
goodsList.addAll(GoodsDBUtil.getByClassifyId(mData.get(classifyAdapter.getCurrentPosition()).id)); goodsList.addAll(GoodsDBUtil.getByClassifyId(mData.get(classifyAdapter.getCurrentPosition()).id));
goodsListOld.clear();
goodsListOld.addAll(GoodsDBUtil.getByClassifyId(mData.get(classifyAdapter.getCurrentPosition()).id));
goodsAdapter.notifyDataSetChanged(); goodsAdapter.notifyDataSetChanged();
} }
}; };
@@ -177,6 +229,7 @@ public class HomeGoodsFragment extends BaseFragment {
LogUtils.d("updateData"); LogUtils.d("updateData");
if(goodsList!=null){ if(goodsList!=null){
goodsList.clear(); goodsList.clear();
goodsListOld.clear();
} }
if(classifyList!=null){ if(classifyList!=null){
classifyList.clear(); classifyList.clear();
@@ -195,6 +248,7 @@ public class HomeGoodsFragment extends BaseFragment {
classifyAdapter.setNewData(classifies); classifyAdapter.setNewData(classifies);
if(!classifies.isEmpty()){ if(!classifies.isEmpty()){
goodsList.addAll(GoodsDBUtil.getByClassifyId(classifies.get(last2).id)); goodsList.addAll(GoodsDBUtil.getByClassifyId(classifies.get(last2).id));
goodsListOld.addAll(GoodsDBUtil.getByClassifyId(classifies.get(last2).id));
if(goodsAdapter!=null){ if(goodsAdapter!=null){
goodsAdapter.setNewData(goodsList); goodsAdapter.setNewData(goodsList);
} }
@@ -232,10 +286,14 @@ public class HomeGoodsFragment extends BaseFragment {
public void onDestroy() { public void onDestroy() {
super.onDestroy(); super.onDestroy();
LogUtils.d("HomeGoodsFragment onDestroy"); LogUtils.d("HomeGoodsFragment onDestroy");
if(handler!=null){
handler.removeCallbacksAndMessages(null);
}
if(goodsList!=null){ if(goodsList!=null){
goodsList.clear(); goodsList.clear();
classifyList.clear(); classifyList.clear();
orderChaoDetails.clear(); orderChaoDetails.clear();
goodsListOld.clear();
goodsList = null; goodsList = null;
classifyList = null; classifyList = null;
orderChaoDetails = null; orderChaoDetails = null;
@@ -320,6 +378,8 @@ public class HomeGoodsFragment extends BaseFragment {
classifyAdapter.notifyItemChanged(pos+1); classifyAdapter.notifyItemChanged(pos+1);
goodsList.clear(); goodsList.clear();
goodsList.addAll(GoodsDBUtil.getByClassifyId(classifyAdapter.getData().get(classifyAdapter.getCurrentPosition()).id)); goodsList.addAll(GoodsDBUtil.getByClassifyId(classifyAdapter.getData().get(classifyAdapter.getCurrentPosition()).id));
goodsListOld.clear();
goodsListOld.addAll(GoodsDBUtil.getByClassifyId(classifyAdapter.getData().get(classifyAdapter.getCurrentPosition()).id));
goodsAdapter.notifyDataSetChanged(); goodsAdapter.notifyDataSetChanged();
} }
}else if(event.type == 2){ }else if(event.type == 2){
@@ -331,6 +391,8 @@ public class HomeGoodsFragment extends BaseFragment {
classifyAdapter.notifyItemChanged(pos-1); classifyAdapter.notifyItemChanged(pos-1);
goodsList.clear(); goodsList.clear();
goodsList.addAll(GoodsDBUtil.getByClassifyId(classifyAdapter.getData().get(classifyAdapter.getCurrentPosition()).id)); goodsList.addAll(GoodsDBUtil.getByClassifyId(classifyAdapter.getData().get(classifyAdapter.getCurrentPosition()).id));
goodsListOld.clear();
goodsListOld.addAll(GoodsDBUtil.getByClassifyId(classifyAdapter.getData().get(classifyAdapter.getCurrentPosition()).id));
goodsAdapter.notifyDataSetChanged(); goodsAdapter.notifyDataSetChanged();
} }
} }


+ 10
- 0
app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeOrderFragment.java View File

@@ -527,6 +527,11 @@ public class HomeOrderFragment extends BaseFragment {
if(processDetail.processname.equals("主料")){ if(processDetail.processname.equals("主料")){
String[] res = processDetail.processvalue.split("\\|"); String[] res = processDetail.processvalue.split("\\|");
String[] res2= res[1].split(","); String[] res2= res[1].split(",");
for(String s : res){
if(s.contains("主料位置")){
res2 = s.split(",");
}
}
String pos = res2[1].replace("Z",""); String pos = res2[1].replace("Z","");
CheckPositionBean positionBean = ConfigName.getInstance().positionList.get("主料位置"+pos+"号位"); CheckPositionBean positionBean = ConfigName.getInstance().positionList.get("主料位置"+pos+"号位");
if(positionBean!=null){ if(positionBean!=null){
@@ -543,6 +548,11 @@ public class HomeOrderFragment extends BaseFragment {
}else if(processDetail.processname.equals("辅料")){ }else if(processDetail.processname.equals("辅料")){
String[] res = processDetail.processvalue.split("\\|"); String[] res = processDetail.processvalue.split("\\|");
String[] res2= res[1].split(","); String[] res2= res[1].split(",");
for(String s : res){
if(s.contains("辅料位置")){
res2 = s.split(",");
}
}
String pos = res2[1].replace("F",""); String pos = res2[1].replace("F","");
CheckPositionBean positionBean = ConfigName.getInstance().positionList.get("辅料位置"+pos+"号位"); CheckPositionBean positionBean = ConfigName.getInstance().positionList.get("辅料位置"+pos+"号位");
if(positionBean!=null){ if(positionBean!=null){


+ 6
- 0
app/src/main/java/com/bonait/bnframework/newui/fragment/setting/SceneSetFragment.java View File

@@ -187,5 +187,11 @@ public class SceneSetFragment extends BaseFragment {
versionList.add("鸿鹄大邑"); versionList.add("鸿鹄大邑");
versionList.add("鸿鹄中江"); versionList.add("鸿鹄中江");
versionList.add("鸿鹄青白江"); versionList.add("鸿鹄青白江");
versionList.add("海科食堂");
} }

public static final String deviceName4 = "海科食堂";
public static final String deviceName3 = "鸿鹄青白江";
public static final String deviceName2 = "鸿鹄中江";
public static final String deviceName1 = "鸿鹄大邑";
} }

+ 18
- 0
app/src/main/java/com/bonait/bnframework/newui/widget/ProcessValueView.java View File

@@ -1,6 +1,7 @@
package com.bonait.bnframework.newui.widget; package com.bonait.bnframework.newui.widget;


import android.content.Context; import android.content.Context;
import android.graphics.Color;
import android.text.InputType; import android.text.InputType;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@@ -12,12 +13,15 @@ import android.widget.RelativeLayout;
import com.apkfuns.logutils.LogUtils; import com.apkfuns.logutils.LogUtils;
import com.bonait.bnframework.R; import com.bonait.bnframework.R;


import com.bonait.bnframework.common.db.QueryDB;
import com.bonait.bnframework.common.db.mode.BPA_SILOS;
import com.bonait.bnframework.common.utils.DisplayManager; import com.bonait.bnframework.common.utils.DisplayManager;
import com.bonait.bnframework.databinding.ViewProcessValueBinding; import com.bonait.bnframework.databinding.ViewProcessValueBinding;
import com.bonait.bnframework.newui.bean.item_gx; import com.bonait.bnframework.newui.bean.item_gx;


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


import butterknife.ButterKnife; import butterknife.ButterKnife;
@@ -57,6 +61,20 @@ public class ProcessValueView extends RelativeLayout {
public void Init() public void Init()
{ {
viewBinding.name.setText(model.name.trim()); viewBinding.name.setText(model.name.trim());
viewBinding.wlDesc.setVisibility(model.IsWL?VISIBLE:GONE);
if(model.IsWL){
List<BPA_SILOS> bpa_silos = QueryDB.GetSolisByMaterialName(model.name);
if (!bpa_silos.isEmpty() ) {
BPA_SILOS silos = bpa_silos.get(0);
viewBinding.wlDesc.setText("通道:"+silos.num);
viewBinding.wlDesc.setTextColor(Color.parseColor("#9E9E9E"));
}else {
viewBinding.wlDesc.setText("未绑定");
viewBinding.wlDesc.setTextColor(Color.parseColor("#F44336"));
}
}


if(model.name.contains("烤箱温度")){ if(model.name.contains("烤箱温度")){
viewBinding.edit.setHint("温度范围:0,60-300"); viewBinding.edit.setHint("温度范围:0,60-300");
} }


+ 1
- 0
app/src/main/res/layout/fragment_scene_set.xml View File

@@ -147,6 +147,7 @@


<com.suke.widget.SwitchButton <com.suke.widget.SwitchButton
android:id="@+id/zijian_switch" android:id="@+id/zijian_switch"

android:layout_width="200dp" android:layout_width="200dp"
android:layout_height="@dimen/dp_70" android:layout_height="@dimen/dp_70"
android:layout_centerVertical="true" /> android:layout_centerVertical="true" />


+ 20
- 1
app/src/main/res/layout/item/layout/view_process_value.xml View File

@@ -21,13 +21,32 @@
android:paddingLeft="@dimen/dp_5" android:paddingLeft="@dimen/dp_5"
android:paddingRight="@dimen/dp_10" android:paddingRight="@dimen/dp_10"
android:layout_width="@dimen/dp_250" android:layout_width="@dimen/dp_250"
android:layout_height="@dimen/dp_90"
android:layout_height="match_parent"
tools:text="液体料液体料液体料" tools:text="液体料液体料液体料"
android:textSize="@dimen/sp_36" android:textSize="@dimen/sp_36"
android:maxLines="1" android:maxLines="1"
android:maxLength="10" android:maxLength="10"
android:gravity="center_vertical" android:gravity="center_vertical"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_above="@id/wl_desc"
android:layout_toRightOf="@id/check"
android:ellipsize="end"
/>

<TextView
android:id="@+id/wl_desc"
android:paddingLeft="@dimen/dp_5"
android:paddingRight="@dimen/dp_10"
android:layout_width="@dimen/dp_250"
android:layout_height="wrap_content"
tools:text="液体料液体料液体料"
android:textSize="@dimen/sp_20"
android:visibility="gone"
android:maxLines="1"
android:maxLength="10"
android:gravity="bottom"
android:layout_alignParentBottom="true"
android:layout_centerVertical="true"
android:layout_toRightOf="@id/check" android:layout_toRightOf="@id/check"
android:ellipsize="end" android:ellipsize="end"
/> />


+ 87
- 12
app/src/main/res/layout/new/layout/dialog_chaoguo_control.xml View File

@@ -23,6 +23,20 @@
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
/> />



<TextView
android:id="@+id/change_to_robot"
android:layout_width="@dimen/dp_200"
android:layout_height="@dimen/dp_70"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
style="@style/TextView_btn_dialog"
android:layout_marginTop="10dp"
android:layout_marginStart="20dp"
android:background="@drawable/bg_round25_blue_btn"
android:text="机器人调试"
/>

<ImageView <ImageView
android:id="@+id/btn_close1" android:id="@+id/btn_close1"
android:layout_width="@dimen/dp_90" android:layout_width="@dimen/dp_90"
@@ -338,25 +352,41 @@
tools:visibility="visible" tools:visibility="visible"
android:visibility="gone"> android:visibility="gone">


<TextView
android:id="@+id/guokoucaoxiang_cc1"
android:layout_width="@dimen/dp_155"
android:layout_height="wrap_content"
style="@style/TextView_btn_dialog"
android:paddingTop="30dp"
android:paddingBottom="30dp"
android:text="炒菜位高"
/>
<LinearLayout
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<TextView
android:id="@+id/guokoucaoxiang_cc1"
android:layout_width="@dimen/dp_155"
android:layout_height="wrap_content"
style="@style/TextView_btn_dialog"
android:paddingTop="30dp"
android:paddingBottom="30dp"
android:text="炒菜位1"
/>


<TextView
android:id="@+id/guokoucaoxiang_cc2"
android:layout_width="@dimen/dp_155"
android:layout_height="wrap_content"
style="@style/TextView_btn_dialog"
android:paddingTop="30dp"
android:paddingBottom="30dp"
android:layout_marginStart="10dp"
android:text="炒菜位2"
/>

</LinearLayout>
<TextView <TextView
android:id="@+id/guokoucaoxiang_cc2"
android:id="@+id/guokoucaoxiang_cc3"
android:layout_width="@dimen/dp_155" android:layout_width="@dimen/dp_155"
android:layout_height="wrap_content" android:layout_height="wrap_content"
style="@style/TextView_btn_dialog" style="@style/TextView_btn_dialog"
android:paddingTop="30dp" android:paddingTop="30dp"
android:layout_marginTop="10dp" android:layout_marginTop="10dp"
android:paddingBottom="30dp" android:paddingBottom="30dp"
android:text="炒菜位低"
android:text="炒菜位3"
/> />
<TextView <TextView
android:id="@+id/guokoucaoxiang_wh" android:id="@+id/guokoucaoxiang_wh"
@@ -405,7 +435,7 @@
style="@style/TextView_btn_dialog" style="@style/TextView_btn_dialog"
android:paddingStart="30dp" android:paddingStart="30dp"
android:paddingEnd="30dp" android:paddingEnd="30dp"
android:text="液料2-未设置"
android:text="液料2-复合液料 长按出料"
android:background="@drawable/bg_round25_blue_btn" android:background="@drawable/bg_round25_blue_btn"
/> />
<TextView <TextView
@@ -421,6 +451,51 @@
android:text="液料3-未设置" android:text="液料3-未设置"
android:background="@drawable/bg_round25_blue_btn" android:background="@drawable/bg_round25_blue_btn"
/> />

<Spinner
android:id="@+id/spinner_silos"
style="@style/commonSpinnerStyle"
android:layout_width="350dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/edit_silos_weight"
android:layout_marginBottom="10dp"
android:layout_marginEnd="10dp"
android:paddingEnd="13dp"
android:layout_height="90dp" />
<EditText
android:id="@+id/edit_silos_weight"
android:layout_width="@dimen/dp_350"
android:layout_height="90dp"
android:inputType="number"
android:padding="3dp"
android:textColor="@color/text1"
android:background="@drawable/input_bj"
android:layout_marginBottom="10dp"
android:hint="液料重量"
android:textColorHint="@color/gray_light"
android:layout_marginEnd="10dp"
android:maxLines="1"
android:textSize="@dimen/sp_32"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toTopOf="@id/btn_silos_open"
/>
<Button
android:id="@+id/btn_silos_open"
android:layout_width="wrap_content"
android:paddingStart="30dp"
android:paddingEnd="30dp"
android:layout_height="90dp"
android:layout_marginTop="3dp"
android:layout_gravity="center_horizontal"
android:contentDescription="true"
android:layout_marginEnd="80dp"
style="@style/TextView_btn_dialog"
android:text="料仓出料"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:textColor="@color/white"
android:layout_marginBottom="20dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>


</LinearLayout> </LinearLayout>

+ 28
- 1
app/src/main/res/layout/new/layout/dialog_food_control.xml View File

@@ -116,7 +116,7 @@
<TextView <TextView
android:id="@+id/title1" android:id="@+id/title1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_80"
android:layout_height="@dimen/dp_90"
android:background="@drawable/bg_round25_top_yellow" android:background="@drawable/bg_round25_top_yellow"
style="@style/TextView_btn_dialog" style="@style/TextView_btn_dialog"
android:text="机器人控制指令" android:text="机器人控制指令"
@@ -124,6 +124,33 @@
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
/> />


<TextView
android:id="@+id/change_to_wok1"
android:layout_width="@dimen/dp_200"
android:layout_height="@dimen/dp_70"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
style="@style/TextView_btn_dialog"
android:layout_marginTop="10dp"
android:layout_marginStart="20dp"
android:background="@drawable/bg_round25_blue_btn"
android:text="1号炒锅"
/>

<TextView
android:id="@+id/change_to_wok2"
android:layout_width="@dimen/dp_200"
android:layout_height="@dimen/dp_70"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/change_to_wok1"
style="@style/TextView_btn_dialog"
android:layout_marginTop="10dp"
android:layout_marginStart="20dp"
android:background="@drawable/bg_round25_blue_btn"
android:text="2号炒锅"
/>


<ImageView <ImageView
android:id="@+id/btn_close1" android:id="@+id/btn_close1"
android:layout_width="@dimen/dp_80" android:layout_width="@dimen/dp_80"


+ 27
- 1
app/src/main/res/layout/new/layout/dialog_food_control2.xml View File

@@ -115,7 +115,7 @@
<TextView <TextView
android:id="@+id/title1" android:id="@+id/title1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_80"
android:layout_height="@dimen/dp_90"
android:background="@drawable/bg_round25_top_yellow" android:background="@drawable/bg_round25_top_yellow"
style="@style/TextView_btn_dialog" style="@style/TextView_btn_dialog"
android:text="机器人控制指令" android:text="机器人控制指令"
@@ -123,6 +123,32 @@
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
/> />


<TextView
android:id="@+id/change_to_wok1"
android:layout_width="@dimen/dp_200"
android:layout_height="@dimen/dp_70"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
style="@style/TextView_btn_dialog"
android:layout_marginTop="10dp"
android:layout_marginStart="20dp"
android:background="@drawable/bg_round25_blue_btn"
android:text="1号炒锅"
/>

<TextView
android:id="@+id/change_to_wok2"
android:layout_width="@dimen/dp_200"
android:layout_height="@dimen/dp_70"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/change_to_wok1"
style="@style/TextView_btn_dialog"
android:layout_marginTop="10dp"
android:layout_marginStart="20dp"
android:background="@drawable/bg_round25_blue_btn"
android:text="2号炒锅"
/>

<ImageView <ImageView
android:id="@+id/btn_close1" android:id="@+id/btn_close1"
android:layout_width="@dimen/dp_80" android:layout_width="@dimen/dp_80"


+ 27
- 1
app/src/main/res/layout/new/layout/dialog_food_control3.xml View File

@@ -115,7 +115,7 @@
<TextView <TextView
android:id="@+id/title1" android:id="@+id/title1"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/dp_80"
android:layout_height="@dimen/dp_90"
android:background="@drawable/bg_round25_top_yellow" android:background="@drawable/bg_round25_top_yellow"
style="@style/TextView_btn_dialog" style="@style/TextView_btn_dialog"
android:text="机器人控制指令" android:text="机器人控制指令"
@@ -123,6 +123,32 @@
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
/> />


<TextView
android:id="@+id/change_to_wok1"
android:layout_width="@dimen/dp_200"
android:layout_height="@dimen/dp_70"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
style="@style/TextView_btn_dialog"
android:layout_marginTop="10dp"
android:layout_marginStart="20dp"
android:background="@drawable/bg_round25_blue_btn"
android:text="1号炒锅"
/>

<TextView
android:id="@+id/change_to_wok2"
android:layout_width="@dimen/dp_200"
android:layout_height="@dimen/dp_70"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toEndOf="@id/change_to_wok1"
style="@style/TextView_btn_dialog"
android:layout_marginTop="10dp"
android:layout_marginStart="20dp"
android:background="@drawable/bg_round25_blue_btn"
android:text="2号炒锅"
/>

<ImageView <ImageView
android:id="@+id/btn_close1" android:id="@+id/btn_close1"
android:layout_width="@dimen/dp_80" android:layout_width="@dimen/dp_80"


+ 31
- 0
app/src/main/res/layout/new/layout/fragment_home_goods.xml View File

@@ -21,11 +21,42 @@
android:layout_height="match_parent"> android:layout_height="match_parent">
</androidx.recyclerview.widget.RecyclerView> </androidx.recyclerview.widget.RecyclerView>


<EditText
android:id="@+id/edittext"
android:layout_width="@dimen/dp_400"
android:layout_height="60dp"
android:inputType="text"
android:paddingStart="5dp"
android:paddingEnd="5dp"
android:textColor="@color/foreground"
android:background="@drawable/input_bj"
android:hint=" 筛选"
android:layout_marginTop="10dp"
android:maxLines="1"
android:layout_alignParentEnd="true"
android:layout_marginEnd="470dp"
android:textSize="@dimen/sp_26"/>

<!-- <Button-->
<!-- android:id="@+id/btn_query"-->
<!-- android:layout_width="@dimen/dp_130"-->
<!-- android:layout_height="@dimen/dp_60"-->
<!-- android:background="@drawable/bg_round15_yellow_btn"-->
<!-- android:text="查询"-->
<!-- android:textColor="@color/white"-->
<!-- android:gravity="center"-->
<!-- android:layout_marginTop="10dp"-->
<!-- android:textSize="@dimen/sp_32"-->
<!-- android:layout_marginEnd="470dp"-->
<!-- android:layout_alignParentEnd="true"-->
<!-- />-->

<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:layout_marginStart="220dp" android:layout_marginStart="220dp"
android:layout_toStartOf="@id/ll_right" android:layout_toStartOf="@id/ll_right"
android:layout_marginEnd="20dp" android:layout_marginEnd="20dp"
android:paddingTop="20dp" android:paddingTop="20dp"
android:layout_marginTop="80dp"
android:id="@+id/recycler_goods" android:id="@+id/recycler_goods"
android:layout_width="match_parent" android:layout_width="match_parent"
android:orientation="vertical" android:orientation="vertical"


+ 12
- 12
app/src/main/res/layout/new/layout/item_home_goods.xml View File

@@ -62,18 +62,18 @@
/> />
</FrameLayout> </FrameLayout>


<com.bonait.bnframework.newui.widget.FocusBorderView
android:id="@+id/fbv"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
android:layout_gravity="center"
app:solidColor="#00ffffff"
app:roundRadius="@dimen/dp_9"
tools:visibility="visible"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
/>
<!-- <com.bonait.bnframework.newui.widget.FocusBorderView-->
<!-- android:id="@+id/fbv"-->
<!-- android:layout_width="match_parent"-->
<!-- android:layout_height="match_parent"-->
<!-- android:visibility="gone"-->
<!-- android:layout_gravity="center"-->
<!-- app:solidColor="#00ffffff"-->
<!-- app:roundRadius="@dimen/dp_9"-->
<!-- tools:visibility="visible"-->
<!-- app:layout_constraintStart_toStartOf="parent"-->
<!-- app:layout_constraintTop_toTopOf="parent"-->
<!-- />-->
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>


<!-- <TextView--> <!-- <TextView-->


+ 1
- 1
app/src/main/res/values-en/strings.xml View File

@@ -1,5 +1,5 @@
<resources> <resources>
<string name="app_name">菠萝小炒-鸿鹄中学</string>
<string name="app_name">一拖二炒菜机器人</string>
<string name="file_normal">常用文件</string> <string name="file_normal">常用文件</string>
<string name="file_all">全部文件</string> <string name="file_all">全部文件</string>
<string name="empty_data">没有数据</string> <string name="empty_data">没有数据</string>


+ 1
- 1
app/src/main/res/values/strings.xml View File

@@ -1,5 +1,5 @@
<resources> <resources>
<string name="app_name">菠萝小炒-鸿鹄中学</string>
<string name="app_name">一拖二炒菜机器人</string>
<string name="file_normal">常用文件</string> <string name="file_normal">常用文件</string>
<string name="file_all">全部文件</string> <string name="file_all">全部文件</string>
<string name="empty_data">没有数据</string> <string name="empty_data">没有数据</string>


+ 3
- 3
app/src/main/res/values/styles.xml View File

@@ -246,7 +246,7 @@
<style name="TechSpinnerStyle" parent="Widget.AppCompat.Spinner"> <style name="TechSpinnerStyle" parent="Widget.AppCompat.Spinner">
<item name="android:background">#42A5F5</item> <item name="android:background">#42A5F5</item>
<item name="android:popupBackground">@color/borderBrush</item> <item name="android:popupBackground">@color/borderBrush</item>
<item name="android:dropDownVerticalOffset">40dp</item>
<item name="android:dropDownVerticalOffset">50dp</item>
<item name="android:paddingLeft">4dp</item> <item name="android:paddingLeft">4dp</item>
<item name="android:paddingRight">4dp</item> <item name="android:paddingRight">4dp</item>
<item name="android:paddingTop">4dp</item> <item name="android:paddingTop">4dp</item>
@@ -256,12 +256,12 @@
<style name="commonSpinnerStyle" parent="Widget.AppCompat.Spinner"> <style name="commonSpinnerStyle" parent="Widget.AppCompat.Spinner">
<item name="android:background">@drawable/spinner_border</item> <item name="android:background">@drawable/spinner_border</item>
<!-- <item name="android:popupBackground">@color/main_background</item>--> <!-- <item name="android:popupBackground">@color/main_background</item>-->
<item name="android:dropDownVerticalOffset">@dimen/dp_40</item>
<item name="android:dropDownVerticalOffset">@dimen/dp_50</item>
<item name="android:paddingLeft">0dp</item> <item name="android:paddingLeft">0dp</item>
<item name="android:paddingRight">4dp</item> <item name="android:paddingRight">4dp</item>
<item name="android:paddingTop">0dp</item> <item name="android:paddingTop">0dp</item>
<item name="android:paddingBottom">0dp</item> <item name="android:paddingBottom">0dp</item>
<item name="android:layout_height">26dp</item>
<item name="android:layout_height">30dp</item>
<item name="android:layout_marginLeft">5dp</item> <item name="android:layout_marginLeft">5dp</item>
<item name="android:textColor">@color/black</item> <item name="android:textColor">@color/black</item>
</style> </style>


Loading…
Cancel
Save