瀏覽代碼

333;

茶饮新(现场)
fyf 1 年之前
父節點
當前提交
8bd02df4fb
共有 2 個檔案被更改,包括 83 行新增57 行删除
  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 查看文件

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

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

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

@Override


+ 81
- 54
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_zdqx_fragment.java 查看文件

@@ -90,66 +90,86 @@ public class JiaoYan_zdqx_fragment extends BaseFragment {
AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() {
@Override
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;
}
ExecuteTheRecipe.WritePLC("清洗模式", true, new IWriteCallBack() {
@Override
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;
}
}
@@ -187,15 +207,22 @@ public class JiaoYan_zdqx_fragment extends BaseFragment {
ExecuteTheRecipe.AutoPaiShui=new IRun() {
@Override
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…
取消
儲存