+ * 切记!切记!切记!否则会闪退! + *
+ * 当在fragment设置viewPager + BottomNavigation + fragment时,则不会出现这个问题。
+ */
+ @Override
+ protected boolean canDragBack() {
+ return false;
+ }
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_zdqx_fragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_zdqx_fragment.java
index 17a4576b..918922ee 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_zdqx_fragment.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/JiaoYan_zdqx_fragment.java
@@ -5,6 +5,7 @@ import androidx.annotation.Nullable;
import androidx.appcompat.app.AppCompatActivity;
import androidx.fragment.app.FragmentActivity;
import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
import androidx.viewpager.widget.ViewPager;
import android.content.Context;
@@ -17,15 +18,22 @@ import android.widget.Button;
import android.widget.EditText;
import com.bonait.bnframework.R;
+import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.constant.DataBus;
+import com.bonait.bnframework.common.db.QueryDB;
+import com.bonait.bnframework.common.db.mode.BPA_SUGAR;
import com.bonait.bnframework.common.helper.I.IRun;
import com.bonait.bnframework.common.helper.I.IWriteCallBack;
import com.bonait.bnframework.common.helper.WrapContentLinearLayoutManager;
+import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.adapter.wdsz_adapter;
+import com.bonait.bnframework.modules.home.adapter.zdqxchid_adapter;
import com.orhanobut.logger.Logger;
+import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
+import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
import butterknife.BindView;
import butterknife.ButterKnife;
@@ -33,16 +41,13 @@ import butterknife.OnClick;
public class JiaoYan_zdqx_fragment extends BaseFragment {
- @BindView(R.id.edittext_pssj)
- EditText edittext_pssj;//排水阀排水时间
- @BindView(R.id.edittext_xhsj)
- EditText edittext_xhsj;//循环清洗时间
-
- @BindView(R.id.edittext_qxwd)
- EditText edittext_qxwd;//清洗温度
@BindView(R.id.bt_start)
- Button bt_start;//开始时间
+ Button bt_start;//开始清洗
+
+ @BindView(R.id.Recy_zdqx)
+ RecyclerView Recy_zdqx;//自动清洗流程
+
private Context context;
@Override
protected View onCreateView() {
@@ -66,73 +71,78 @@ public class JiaoYan_zdqx_fragment extends BaseFragment {
}
boolean IsStart = false;
- @OnClick({R.id.save_time,R.id.bt_start})
+ @OnClick({R.id.bt_add_zdqx,R.id.bt_start})
public void onViewClicked(View view) {
switch (view.getId()) {
- case R.id.save_time://保存时间
- new Thread(new Runnable() {
- @Override
- public void run() {
- try {
- if (!edittext_pssj.getText().toString().equals("")) {
- int k= (int)Math.round((Double.parseDouble(edittext_pssj.getText().toString()) * 10));
- ExecuteTheRecipe.WritePLC("排水阀排水时间",(short)k,null);
- Thread.sleep(200);
- }
-
- if (!edittext_xhsj.getText().toString().equals("")) {
- int k= (int)Math.round((Double.parseDouble(edittext_xhsj.getText().toString()) * 10));
- ExecuteTheRecipe.WritePLC("循环清洗时间",(short)k,null);
- Thread.sleep(200);
- }
-
- if (!edittext_qxwd.getText().toString().equals("")) {
- int k= Integer.parseInt(edittext_qxwd.getText().toString());
- ExecuteTheRecipe.WritePLC("水池温度设置",k,null);
- Thread.sleep(200);
- }
-
- } catch (InterruptedException e) {
-
- } catch (Exception e) {
-
- }
-
- }
- }).start();
- ToastUtils.info("保存成功!");
+ case R.id.bt_add_zdqx://增加流程
+ BPA_SUGAR sugar=new BPA_SUGAR();
+ sugar.plcvar="0.0|0.0|0";
+ QueryDB.AddSugar(sugar);
+ DataBus.getInstance().GetZDQXChid();
+ ToastUtils.info("增加成功!");
break;
case R.id.bt_start://开始清洗
if (IsStart) {
+
+ String title = "温馨提示!";
+ String message = "客官确定要强制停止清洗吗?";
+ 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);
+ }
+ });
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 {
- ExecuteTheRecipe.WritePLC("清洗模式",true,null);
- ExecuteTheRecipe.WritePLC("自动清洗开始", true, new IWriteCallBack() {
- @Override
- public void onSuccess() {
- //UI线程操作UI控件
- getActivity().runOnUiThread(new Runnable() {
- @Override
- public void run() {
- IsStart=true;
- bt_start.setText("正在清洗");
- bt_start.setBackgroundResource(R.drawable.cp_bj);
- }
- });
- }
-
- @Override
- public void onFailure(String ErrorMsg) {
+ for (BPA_SUGAR item:
+ DataBus.getInstance().zdqx) {
+
+ 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] && IsStart) {
+ if ((System.currentTimeMillis() - a) > 1000 * 500) {
+ break;
+ }
+ Thread.sleep(100);//10 *6
}
- });
+ item.exp="执行完成";
+ DataBus.getInstance().zdqxchidAdapter.refresh();
+ }
+
+ ExecuteTheRecipe.WritePLC("管道自动排水",true,null);
} catch (Exception e) {
@@ -146,23 +156,6 @@ public class JiaoYan_zdqx_fragment extends BaseFragment {
//region 数据加载
- private Handler mHandler = new Handler() {
- public void handleMessage(Message msg) {
- switch (msg.what) {
- case 0:
- bt_start.setText("开始清洗");
- bt_start.setBackgroundResource(R.drawable.sz_bj);
- break;
- case 1:
-
- break;
- case 2:
-
- break;
- }
-
- }
- };
/**
* 初始化数据加载
*/
@@ -172,40 +165,34 @@ public class JiaoYan_zdqx_fragment extends BaseFragment {
@Override
public void run() {
try {
- //填充数据
- Object t1= ExecuteTheRecipe.ReadPLC("排水阀排水时间");
- Object t5= ExecuteTheRecipe.ReadPLC("循环清洗时间");
- Object t7= ExecuteTheRecipe.ReadPLC("水池温度设置");
+ DataBus.getInstance().GetZDQXChid();
getActivity().runOnUiThread(new Runnable() {
@Override
public void run() {
- edittext_pssj.setText(t1==null?"0.0":(String.format ("%.1f", (Double.parseDouble(t1.toString())/10))));
- edittext_xhsj.setText(t5==null?"0.0":(String.format ("%.1f", (Double.parseDouble(t5.toString())/10))));
- edittext_qxwd.setText((t7==null?0:(int)t7) +"");
+ if(isAdded())
+ {
+ Recy_zdqx.setLayoutManager(new WrapContentLinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL,false));
+ DataBus.getInstance().zdqxchidAdapter = new zdqxchid_adapter(getContext(),getActivity());
+ Recy_zdqx.setAdapter(DataBus.getInstance().zdqxchidAdapter);
+ }
}
});
- ExecuteTheRecipe.WritePLC("手自切换",true,null);
+
} catch (Exception e) {
}
}
}).start();
-
- ExecuteTheRecipe.CleaningComplete=new IRun() {
+ ExecuteTheRecipe.AutoPaiShui=new IRun() {
@Override
public void Run() {
- if (IsStart) {
- IsStart = false;
- mHandler.sendEmptyMessage(0);
- ExecuteTheRecipe.WritePLC("清洗模式",false,null);
- ToastUtils.info("清洗完成");
- }
+ IsStart=false;
+ bt_start.setText("开始清洗");
+ bt_start.setBackgroundResource(R.drawable.sz_bj);
}
};
-
-
} catch (Exception e) {
}
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_makegood_control.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_makegood_control.java
index f297e2af..8db96a68 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_makegood_control.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_makegood_control.java
@@ -11,9 +11,11 @@ import android.widget.ListView;
import android.widget.TextView;
import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.bonait.bnframework.R;
+import com.bonait.bnframework.business.ExecuteTheRecipe;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.db.QueryDB;
@@ -50,10 +52,14 @@ public class add_makegood_control extends LinearLayout{
public BPA_GOODS Good = null;
@BindView(R.id.datatab_makesx)
- ListView datatab_makesx;//属性
+ RecyclerView datatab_makesx;//属性
@BindView(R.id.makegoodtitle)
TextView makegoodtitle;//配方名称
+
+ @BindView(R.id.chubeiliang)
+ TextView chubeiliang;
+
/**
* 点击事件
*/
@@ -79,10 +85,15 @@ public class add_makegood_control extends LinearLayout{
private void initData() {
//2.填充规则数据,查询所有属性大类
+ LinearLayoutManager layoutManager=new LinearLayoutManager(getContext());
+ layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
+ datatab_makesx.setLayoutManager(layoutManager);
+
if(DataBus.getInstance().sxadapter==null)
{
- DataBus.getInstance().sxadapter = new pfsx_adapter(contextMian, R.layout.pfsx_item, DataBus.getInstance().bpa_goodproperties);
+ DataBus.getInstance().sxadapter = new pfsx_adapter(contextMian,DataBus.getInstance().bpa_goodproperties);
}
+
datatab_makesx.setAdapter(DataBus.getInstance().sxadapter);
}
@@ -95,6 +106,7 @@ public class add_makegood_control extends LinearLayout{
try {
Good = good;
makegoodtitle.setText(Good.name + "");
+ chubeiliang.setText(ExecuteTheRecipe.MakeGoodCount +"杯");
initData();
} catch (Exception ex) {
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_pf_control.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_pf_control.java
index 8bcbe1fd..7a6a6b36 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_pf_control.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_pf_control.java
@@ -11,6 +11,7 @@ import android.widget.ListView;
import android.widget.TextView;
import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import com.bonait.bnframework.R;
@@ -27,6 +28,7 @@ import com.bonait.bnframework.common.db.res.ResMaterilas;
import com.bonait.bnframework.common.helper.I.MyClickListener;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.common.view.MyLayoutManager;
+import com.bonait.bnframework.modules.home.adapter.loadinggood_adapter;
import com.bonait.bnframework.modules.home.adapter.newmeatrilselect_adapter;
import com.bonait.bnframework.modules.home.adapter.newneatril_adapter;
import com.bonait.bnframework.modules.home.adapter.pfsx_adapter;
@@ -57,17 +59,14 @@ public class add_pf_control extends LinearLayout implements MyClickListener {
EditText edittext;//配方名称
@BindView(R.id.datatab_sx)
- ListView datatab_sx;
+ RecyclerView datatab_sx;
@BindView(R.id.datatab_pf)
ListView datatab_pf;
@BindView(R.id.title)
TextView title;//配方名称
- /**
- * 属性数据
- */
- ArrayList