Browse Source

333;

茶饮新(现场)
fyf 1 year ago
parent
commit
8bd02df4fb
2 changed files with 83 additions and 57 deletions
  1. +2
    -3
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  2. +81
    -54
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_zdqx_fragment.java

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

@@ -243,9 +243,8 @@ public class ExecuteTheRecipe {
// ListeningValue.put(key, val); // ListeningValue.put(key, val);
// } // }
// } // }

ReadCode(); ReadCode();
//ReadPLCStatus();
ReadPLCStatus();


} catch (Exception ex) { } catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage()); ToastUtils.error("异常信息:" + ex.getMessage());
@@ -267,7 +266,7 @@ public class ExecuteTheRecipe {
} catch (Exception ex) { } catch (Exception ex) {
ToastUtils.error("异常信息:" + ex.getMessage()); ToastUtils.error("异常信息:" + ex.getMessage());
} }
Thread.sleep(3000);
Thread.sleep(5000);
} }


@Override @Override


+ 81
- 54
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_zdqx_fragment.java View File

@@ -90,66 +90,86 @@ public class JiaoYan_zdqx_fragment extends BaseFragment {
AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() { AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() {
@Override @Override
public void onClick(QMUIDialog dialog, int index) { public void onClick(QMUIDialog dialog, int index) {
IsStart=false;
bt_start.setText("开始清洗");
bt_start.setBackgroundResource(R.drawable.sz_bj);

getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
IsStart=false;
bt_start.setText("开始清洗");
bt_start.setBackgroundResource(R.drawable.sz_bj);

for (BPA_SUGAR item:
DataBus.getInstance().zdqx) {
item.exp="";
}
DataBus.getInstance().zdqxchidAdapter.refresh();
}
});
dialog.dismiss();
} }
}); });
ToastUtils.warning("正在清洗中,请勿重复点击!");
return; return;
} }
ExecuteTheRecipe.WritePLC("清洗模式", true, new IWriteCallBack() { ExecuteTheRecipe.WritePLC("清洗模式", true, new IWriteCallBack() {
@Override @Override
public void onSuccess() { public void onSuccess() {
IsStart=true;
bt_start.setText("正在清洗");
bt_start.setBackgroundResource(R.drawable.cp_bj);
}
@Override
public void onFailure(String ErrorMsg) {

}
});


new Thread(new Runnable() {
@Override
public void run() {
try {

for (BPA_SUGAR item:
DataBus.getInstance().zdqx) {

item.exp="执行中";
DataBus.getInstance().zdqxchidAdapter.refresh();
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
IsStart=true;
bt_start.setText("正在清洗");
bt_start.setBackgroundResource(R.drawable.cp_bj);
}
});


final boolean[] IsStop = {false};
ExecuteTheRecipe.CleaningComplete=new IRun() {
@Override
public void Run() {
IsStop[0] =true;
new Thread(new Runnable() {
@Override
public void run() {
try {
ExecuteTheRecipe.WritePLC("管道自动排水完成",false,null);

for (BPA_SUGAR item:
DataBus.getInstance().zdqx) {
ExecuteTheRecipe.WritePLC("自动清洗完成",false,null);
Thread.sleep(100);//10 *6
item.exp="执行中";
DataBus.getInstance().zdqxchidAdapter.refresh();

final boolean[] IsStop = {false};
ExecuteTheRecipe.CleaningComplete=new IRun() {
@Override
public void Run() {
IsStop[0] =true;
}
};

long a = System.currentTimeMillis();
while (IsStart && !IsStop[0]) {
if ((System.currentTimeMillis() - a) > 1000 * 500) {
break;
}
Thread.sleep(100);//10 *6
}
item.exp="执行完成";
DataBus.getInstance().zdqxchidAdapter.refresh();
} }
};


long a = System.currentTimeMillis();
while (IsStart && !IsStop[0] && IsStart) {
if ((System.currentTimeMillis() - a) > 1000 * 500) {
break;
if(IsStart)
{
ExecuteTheRecipe.WritePLC("管道自动排水",true,null);
} }
Thread.sleep(100);//10 *6
}
item.exp="执行完成";
DataBus.getInstance().zdqxchidAdapter.refresh();
}

ExecuteTheRecipe.WritePLC("管道自动排水",true,null);

} catch (Exception e) {


}
} catch (Exception e) {
}


}
}).start();
}
@Override
public void onFailure(String ErrorMsg) {
ToastUtils.error("启动失败!");
} }
}).start();
});
break; break;
} }
} }
@@ -187,15 +207,22 @@ public class JiaoYan_zdqx_fragment extends BaseFragment {
ExecuteTheRecipe.AutoPaiShui=new IRun() { ExecuteTheRecipe.AutoPaiShui=new IRun() {
@Override @Override
public void Run() { public void Run() {
IsStart=false;
bt_start.setText("开始清洗");
bt_start.setBackgroundResource(R.drawable.sz_bj);
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
ToastUtils.warning("清洗完成!");
IsStart=false;
bt_start.setText("开始清洗");
bt_start.setBackgroundResource(R.drawable.sz_bj);

for (BPA_SUGAR item:
DataBus.getInstance().zdqx) {
item.exp="";
}
DataBus.getInstance().zdqxchidAdapter.refresh();
}
});


for (BPA_SUGAR item:
DataBus.getInstance().zdqx) {
item.exp="";
}
DataBus.getInstance().zdqxchidAdapter.refresh();
} }
}; };




Loading…
Cancel
Save