Browse Source

提交

上海闵中
liup 2 months ago
parent
commit
a92f5a8d9b
12 changed files with 126 additions and 77 deletions
  1. +3
    -3
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  2. +4
    -9
      app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java
  3. +1
    -1
      app/src/main/java/com/bonait/bnframework/common/image/utils/LocalCacheUtils.java
  4. +10
    -0
      app/src/main/java/com/bonait/bnframework/modbus/ModbusCenter.java
  5. +3
    -0
      app/src/main/java/com/bonait/bnframework/newui/adapter/warn/WarnInfoAdapter.java
  6. +43
    -9
      app/src/main/java/com/bonait/bnframework/newui/dialog/control/OvenControlDialog.java
  7. +3
    -4
      app/src/main/java/com/bonait/bnframework/newui/fragment/goods/CloudGoodsHFragment.java
  8. +16
    -34
      app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeDevicesFragment.java
  9. +7
    -15
      app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeOrderFragment.java
  10. +2
    -1
      app/src/main/java/com/bonait/bnframework/newui/fragment/main/HomeWarnFragment.java
  11. +22
    -1
      app/src/main/java/com/bonait/bnframework/newui/viewmodel/HomeGoodsViewModel.java
  12. +12
    -0
      app/src/main/res/layout/new/layout/fragment_home_device_debug.xml

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

@@ -1182,7 +1182,7 @@ public class ExecuteTheRecipe {
//<<关门流程
Thread.sleep(100);
ExecuteTheRecipe.WritePLC("烤箱门关闭控制", true, null);
ThreadWhileWithTime("烤箱门关到位检测",15);
ThreadWhileWithTime("烤箱关门成功",15);
boolean isClose2 = (boolean) ModbusCenter.ReadPlc("烤箱门关到位检测");
boolean checkClose = (boolean) ModbusCenter.ReadPlc("机器人允许关门");
if(!isClose2 && checkClose){
@@ -1190,9 +1190,9 @@ public class ExecuteTheRecipe {
ModbusCenter.robotWritePlc(true,"机器人烤箱关门",true,null);
ThreadWhile2("机器人烤箱关门完成");
Thread.sleep(100);
ThreadWhileWithTime("烤箱门关到位检测",120);
ThreadWhileWithTime("烤箱关门成功",120);
}
isClose2 = (boolean) ModbusCenter.ReadPlc("烤箱门关到位检测");
isClose2 = (boolean) ModbusCenter.ReadPlc("烤箱关门成功");
if(!isClose2){
IsForcedEnd2 = true;
NewToastUtil.getInstance().showToastError("烤箱关门超时");


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

@@ -338,16 +338,10 @@ public class ConfigName {
add(new Res_PLCADDRESS("温度定位超时", "M1100.3", 1, 0,3));
add(new Res_PLCADDRESS("补盆动作超时", "M1100.4", 1, 0,3));
add(new Res_PLCADDRESS("机器人允许关门", "M13.0", 1, 0,3));
add(new Res_PLCADDRESS("烤箱门关成功检测", "M126", 1, 0,3));




// add(new Res_PLCADDRESS("温度旋钮在档位0", "M31.0", 1, 0,3));
// add(new Res_PLCADDRESS("温度旋钮在档位1", "M31.1", 1, 0,3));
// add(new Res_PLCADDRESS("温度旋钮在档位2", "M31.2", 1, 0,3));
// add(new Res_PLCADDRESS("温度旋钮在档位3", "M31.3", 1, 0,3));
// add(new Res_PLCADDRESS("温度旋钮在档位4", "M31.4", 1, 0,3));
// add(new Res_PLCADDRESS("烤箱功率判断是否工作", "VD324", 1, 0,3));
add(new Res_PLCADDRESS("烤箱关门成功", "M100.0", 1, 0,3));
add(new Res_PLCADDRESS("烤箱关门故障", "M100.1", 1, 0,3));
}};

/**
@@ -380,6 +374,7 @@ public class ConfigName {
add(new Res_PLCADDRESS("烤箱允许放料", "M510", 0, 1,2));
add(new Res_PLCADDRESS("维护完成确认允许机器人回原位", "M520", 0, 1,2));
add(new Res_PLCADDRESS("允许机器人出餐放盆", "M530", 0, 1,2));
add(new Res_PLCADDRESS("安全门打开", "M654", 1, 1,2));
add(new Res_PLCADDRESS("主任务读取", "GI5", 0, 1,2));
}};



+ 1
- 1
app/src/main/java/com/bonait/bnframework/common/image/utils/LocalCacheUtils.java View File

@@ -62,7 +62,7 @@ public class LocalCacheUtils {
.fitCenter() // 缩放图片以适应ImageView的尺寸
// .override(150, 75) // 设置目标图片的宽度和高度
.placeholder(R.mipmap.loading3)
// .error(R.mipmap.loadingerror)
.error(R.mipmap.loading123)
.skipMemoryCache(true) // 禁用内存缓存
.diskCacheStrategy(DiskCacheStrategy.NONE)
.apply(new RequestOptions().transform(new FitXYRoundRadiusTransform(10)))


+ 10
- 0
app/src/main/java/com/bonait/bnframework/modbus/ModbusCenter.java View File

@@ -199,6 +199,11 @@ public class ModbusCenter {
ModbusCenter.robotWritePlc(false,"烤箱允许放料",(boolean)val,null);
}
}
if(item.name.equals("烤箱关门故障")){
if((Boolean) val){
NewToastUtil.getInstance().showToastError(item.name+",请前往设备报警信息栏目,联系工作人员");
}
}
if(ConfigName.LOG_TEST){
LogUtils.d("烤箱PLC设备数据监听 name="+item.name +" plcaddress.address="+item.address+" ;val="+val);
}
@@ -237,6 +242,11 @@ public class ModbusCenter {
if(ConfigName.LOG_TEST){
LogUtils.d("机器人PLC设备数据监听 ovenReadPlc item="+item.name+" plcaddress.address="+item.address+" val="+val);
}
if(item.name.equals("安全门打开")){
if(!(Boolean) val && (ExecuteTheRecipe.MakeStatus||ExecuteTheRecipe.MakeStatus2)){
NewToastUtil.getInstance().showToastError("安全门已打开,制作已暂停,请关门后再给机器人上电启动");
}
}

listeningValue.put(item.name, val);
}


+ 3
- 0
app/src/main/java/com/bonait/bnframework/newui/adapter/warn/WarnInfoAdapter.java View File

@@ -45,6 +45,9 @@ public abstract class WarnInfoAdapter extends BaseAdapter<String, WarnInfoAdapte
}else {
holder.binding.btnReset.setVisibility(View.GONE);
}
if(holder.binding.name.getText().toString().contains("烤箱关门故障")){
holder.binding.btnReset.setVisibility(View.VISIBLE);
}
}else {
holder.binding.btnReset.setVisibility(View.GONE);
}


+ 43
- 9
app/src/main/java/com/bonait/bnframework/newui/dialog/control/OvenControlDialog.java View File

@@ -58,12 +58,18 @@ public class OvenControlDialog extends DialogFragment {
// }else {
// viewBinding.tvGonglv.setText("烤箱功率:停止");
// }
Object object2 = ModbusCenter.getListingValue("烤箱门关到位检测");
Object object2 = ModbusCenter.getListingValue("烤箱关门成功");
if(object2!=null && (boolean)object2){
viewBinding.tvOpen.setText("烤箱门:已关闭");
}else {
viewBinding.tvOpen.setText("烤箱门:未关闭");
}

Object object3 = ModbusCenter.getListingValue("烤箱关门故障");
if(object3!=null && (boolean)object3){
viewBinding.tvOpen.setText("烤箱门:烤箱关门故障");
}

viewBinding.tvKaoxiang.setText(ConfigName.getInstance().oven_has_food?"烤箱有盆":"烤箱空");
viewBinding.tvKaoxiang.setText(PreferenceUtils.getBoolean(ConfigName.ovenHasPen,false)?"烤箱有盆":"烤箱空");
// Object object3 = ModbusCenter.getListingValue("烤箱门中间位检测");
@@ -145,6 +151,13 @@ public class OvenControlDialog extends DialogFragment {
NewToastUtil.getInstance().showToast("请勿快速点击");
return;
}
Object close = ModbusCenter.getListingValue("烤箱关门故障");
if(close instanceof Boolean){
if((Boolean)close){
NewToastUtil.getInstance().showToastError("烤箱关门故障,请联系工作人员!");
return;
}
}
boolean isOpen = (boolean) ModbusCenter.ReadPlc("烤箱门开到位检测");
if(isOpen){
NewToastUtil.getInstance().showToast("检测到烤箱门已打开");
@@ -211,6 +224,13 @@ public class OvenControlDialog extends DialogFragment {
NewToastUtil.getInstance().showToast("请勿快速点击");
return;
}
Object close = ModbusCenter.getListingValue("烤箱关门故障");
if(close instanceof Boolean){
if((Boolean)close){
NewToastUtil.getInstance().showToastError("烤箱关门故障,请联系工作人员!");
return;
}
}
boolean isOpen = (boolean) ModbusCenter.ReadPlc("烤箱门开到位检测");
if(isOpen){
NewToastUtil.getInstance().showToast("检测到烤箱门已打开");
@@ -265,7 +285,14 @@ public class OvenControlDialog extends DialogFragment {
NewToastUtil.getInstance().showToast("请勿快速点击");
return;
}
boolean isClose = (boolean) ModbusCenter.ReadPlc("烤箱门关到位检测");
Object close = ModbusCenter.getListingValue("烤箱关门故障");
if(close instanceof Boolean){
if((Boolean)close){
NewToastUtil.getInstance().showToastError("烤箱关门故障,请联系工作人员!");
return;
}
}
boolean isClose = (boolean) ModbusCenter.ReadPlc("烤箱关门成功");
if(isClose){
NewToastUtil.getInstance().showToast("检测到烤箱门已关闭");
return;
@@ -288,7 +315,7 @@ public class OvenControlDialog extends DialogFragment {
//<<关门流程
Thread.sleep(100);
ExecuteTheRecipe.WritePLC("烤箱门关闭控制", true, null);
ExecuteTheRecipe.ThreadWhileWithTime("烤箱门关到位检测",10);
ExecuteTheRecipe.ThreadWhileWithTime("烤箱关门成功",10);
boolean isClose2 = (boolean) ModbusCenter.ReadPlc("烤箱门关到位检测");
boolean checkClose = (boolean) ModbusCenter.ReadPlc("机器人允许关门");
if(!isClose2 && checkClose){
@@ -296,9 +323,9 @@ public class OvenControlDialog extends DialogFragment {
ModbusCenter.robotWritePlc(true,"机器人烤箱关门",true,null);
ExecuteTheRecipe.ThreadWhile2("机器人烤箱关门完成");
Thread.sleep(100);
ExecuteTheRecipe.ThreadWhileWithTime("烤箱门关到位检测",120);
ExecuteTheRecipe.ThreadWhileWithTime("烤箱关门成功",120);
}
isClose2 = (boolean) ModbusCenter.ReadPlc("烤箱门关到位检测");
isClose2 = (boolean) ModbusCenter.ReadPlc("烤箱关门成功");
if(!isClose2){
NewToastUtil.getInstance().showToastError("烤箱未关门");
}
@@ -320,7 +347,14 @@ public class OvenControlDialog extends DialogFragment {
NewToastUtil.getInstance().showToast("请勿快速点击");
return;
}
boolean isClose = (boolean) ModbusCenter.ReadPlc("烤箱门关到位检测");
Object close = ModbusCenter.getListingValue("烤箱关门故障");
if(close instanceof Boolean){
if((Boolean)close){
NewToastUtil.getInstance().showToastError("烤箱关门故障,请联系工作人员!");
return;
}
}
boolean isClose = (boolean) ModbusCenter.ReadPlc("烤箱关门成功");
if(isClose){
NewToastUtil.getInstance().showToast("检测到烤箱门已关闭");
return;
@@ -343,7 +377,7 @@ public class OvenControlDialog extends DialogFragment {
//<<关门流程
Thread.sleep(100);
ExecuteTheRecipe.WritePLC("烤箱门关闭控制", true, null);
ExecuteTheRecipe.ThreadWhileWithTime("烤箱门关到位检测",20);
ExecuteTheRecipe.ThreadWhileWithTime("烤箱关门成功",20);
WaitProcessUtil.getInstance().dismiss();
//>>
}catch (Exception e){
@@ -425,7 +459,7 @@ public class OvenControlDialog extends DialogFragment {
NewToastUtil.getInstance().showToast("请勿快速点击");
return;
}
boolean status = (boolean) ModbusCenter.ReadPlc("烤箱门关到位检测");
boolean status = (boolean) ModbusCenter.ReadPlc("烤箱关门成功");
if(!status){
NewToastUtil.getInstance().showToast("请先关闭烤箱门");
return;
@@ -458,7 +492,7 @@ public class OvenControlDialog extends DialogFragment {
NewToastUtil.getInstance().showToast("请勿快速点击");
return;
}
boolean status = (boolean) ModbusCenter.ReadPlc("烤箱门关到位检测");
boolean status = (boolean) ModbusCenter.ReadPlc("烤箱关门成功");
if(!status){
NewToastUtil.getInstance().showToast("请先关闭烤箱门");
return;


+ 3
- 4
app/src/main/java/com/bonait/bnframework/newui/fragment/goods/CloudGoodsHFragment.java View File

@@ -252,11 +252,10 @@ public class CloudGoodsHFragment extends BaseFragment {
return;
}
}
if(position>=0 && !classifyList.isEmpty()){
String goodsId = classifyList.get(position).id;
if(position>=0 ){
String goodsId = type.equals("0")?classifyList.get(position).id:classifyList2.get(position).id;
if(goodsId!=null && viewModel.cloudGoodsList.getValue()!=null&& viewModel.cloudGoodsList.getValue().getGoodsClassifyList()!=null){
String classifyID = classifyList.get(position).id;
LogUtils.d("dealGoodsData classifyID="+classifyID+";classifyList.size="+classifyList.size());
String classifyID = type.equals("0")?classifyList.get(position).id:classifyList2.get(position).id;
if(viewModel.cloudGoodsList.getValue()!=null && viewModel.cloudGoodsList.getValue().getGoodsClassifyList()!=null
&& viewModel.cloudGoodsList.getValue().getGoodsInfoList()!=null){
for (GoodsClassifyBean bean : viewModel.cloudGoodsList.getValue().getGoodsClassifyList()){


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

@@ -47,40 +47,22 @@ public class HomeDevicesFragment extends BaseFragment {
@Override
public void handleMessage(@NonNull Message 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){
// }
// }
if(msg.what==1){
if(handler.hasMessages(1)){
handler.removeMessages(1);
}
handler.sendEmptyMessageDelayed(1,500);
try {
changeStatus();
Object object1 = ModbusCenter.getListingValue("安全门打开");
if(object1 instanceof Boolean){
viewBinding.tvAnquanMeng.setText("安全门:"+(((Boolean)object1)?"已关闭":"已打开"));
}else {
viewBinding.tvAnquanMeng.setText("安全门:检测异常");
}
}catch (Exception ignored){
}
}
}
};



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

@@ -246,21 +246,13 @@ public class HomeOrderFragment extends BaseFragment {

String name = mData.get(position).goodsName +"—"+ (mData.get(position).groupName==null?"":mData.get(position).groupName);
if(mData.get(position).status == 0){
// boolean robotNoWorking = false;
// Object object1 = ModbusCenter.robotReadPlc("主任务读取");
// Object object2 = ModbusCenter.robotReadPlc("机器人在原点");
// Object object3 = ModbusCenter.robotReadPlc("机器人准备就绪");
// if (object1 != null && object2!=null && object3!=null) {
// if(ConfigName.TEST){
// robotNoWorking = true;
// }else {
// robotNoWorking = ((short) object1)==0 && (boolean) object2 &&(boolean) object3;
// }
// }
// if(!robotNoWorking){
// NewToastUtil.getInstance().showToast("机器人正在工作,请稍后重试");
// return;
// }
Object meng = ModbusCenter.getListingValue("安全门打开");
if(meng instanceof Boolean){
if(!(Boolean) meng){
NewToastUtil.getInstance().showToast("请先关闭安全门!");
return;
}
}

for(BPA_ORDER_DETAIL bean : mData){
if(bean.status!=0){


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

@@ -98,6 +98,7 @@ public class HomeWarnFragment extends BaseFragment {
ovenWarnList.add("补盆动作超时");
ovenWarnList.add("烤箱开门动作超时");
ovenWarnList.add("烤箱关门动作超时");
ovenWarnList.add("烤箱关门故障");
viewBinding.titleChaoguo.setSelected(true);

viewBinding.titleChaoguo.setOnClickListener(v->{
@@ -135,7 +136,7 @@ public class HomeWarnFragment extends BaseFragment {
DialogTipBinding binding = DialogTipBinding.bind(layoutView);
DisplayManager.scaleViewGroup(binding.getRoot());
binding.title.setText("确认机器人指令");
if(value.contains("超时")){
if(value.contains("超时")||value.contains("烤箱关门故障")){
binding.message.setText(value+",请检查,是否复位?");
}
binding.close.setOnClickListener(view1->{


+ 22
- 1
app/src/main/java/com/bonait/bnframework/newui/viewmodel/HomeGoodsViewModel.java View File

@@ -67,6 +67,7 @@ public class HomeGoodsViewModel extends ViewModel {
public MutableLiveData<GoodsData> cloudGoodsList = new MutableLiveData<>();
public boolean hasData = false;
public List<GoodsClassifyBean> goodsList = new ArrayList<>();
public GoodsData ovenData = new GoodsData();

public void fetchCloudData(Context context){
if (NetworkUtils.checkNetworkAvailable(context)) {
@@ -94,6 +95,11 @@ public class HomeGoodsViewModel extends ViewModel {
RecordManager.getInstance().addLogRecord("数据接收", "接收商品信息成功");
goodsList.clear();
goodsList.addAll(s.Content.getGoodsClassifyList());
try{
ovenData = s.Content;
}catch (Exception e){

}
ThreadManager.get().execute(new Thread(()->{
GetGoodsInfo2();
}));
@@ -113,7 +119,22 @@ public class HomeGoodsViewModel extends ViewModel {
runOnUiThread(new Runnable() {
@Override
public void run() {
cloudGoodsList.setValue(s.Content);
try{
GoodsData data = s.Content;
if(ovenData!=null){
if(data!=null){
data.getGoodsClassifyList().addAll(ovenData.getGoodsClassifyList());
data.getGoodsInfoList().addAll(ovenData.getGoodsInfoList());
cloudGoodsList.setValue(data);
}else {
cloudGoodsList.setValue(ovenData);
}
}else{
cloudGoodsList.setValue(s.Content);
}
}catch (Exception e){

}
}
});
hasData = true;


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

@@ -18,6 +18,18 @@
android:scaleX="1.1"
android:scaleY="1.1"
/>
<TextView
android:id="@+id/tv_anquan_meng"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="50dp"
android:layout_marginStart="50dp"
android:textStyle="bold"
android:textSize="36sp"
android:textColor="@color/black"
tools:text="安全门:已关闭"
/>
<ImageView
android:layout_width="120dp"
android:layout_height="120dp"


Loading…
Cancel
Save