diff --git a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java index d84698a7..b3256780 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java +++ b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java @@ -239,6 +239,8 @@ public class ConfigData { ConfigName.getInstance().user.pass = ConfigUtil.read(ConfigName.getInstance().dishesCon, "password", ConfigName.getInstance().user.pass); ConfigName.getInstance().IsUserDownOrder = ConfigUtil.read(ConfigName.getInstance().dishesCon, "IsUserDownOrder", ConfigName.getInstance().IsUserDownOrder); ConfigName.getInstance().Version = ConfigUtil.read(ConfigName.getInstance().dishesCon, "Version", ConfigName.getInstance().Version); + ConfigName.getInstance().HuoLi = ConfigUtil.read(ConfigName.getInstance().dishesCon, "HuoLi", ConfigName.getInstance().HuoLi); + } /** @@ -252,8 +254,8 @@ public class ConfigData { ConfigUtil.write(ConfigName.getInstance().dishesCon, "username", ConfigName.getInstance().user.account); ConfigUtil.write(ConfigName.getInstance().dishesCon, "password", ConfigName.getInstance().user.pass); ConfigUtil.write(ConfigName.getInstance().dishesCon, "IsUserDownOrder", ConfigName.getInstance().IsUserDownOrder); - ConfigUtil.write(ConfigName.getInstance().dishesCon, "IsUserDownOrder", ConfigName.getInstance().IsUserDownOrder); ConfigUtil.write(ConfigName.getInstance().dishesCon, "Version", ConfigName.getInstance().Version); + ConfigUtil.write(ConfigName.getInstance().dishesCon, "HuoLi", ConfigName.getInstance().HuoLi); } /** diff --git a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java index d89ac571..9f84d78c 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java +++ b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java @@ -603,7 +603,7 @@ public class ExecuteTheRecipe { final boolean[] IsComplete = {false}; long a = System.currentTimeMillis(); while (!IsComplete[0]) { - if ((System.currentTimeMillis() - a) > 1000 * whileTime) { + if ((System.currentTimeMillis() - a) > 1000 * 120) { break; } else { Object sb =ReadPLC(name);//ListeningValue.get(name); @@ -646,7 +646,7 @@ public class ExecuteTheRecipe { */ public static void Write_PLC_HuoLI(int data) { try { - WritePLC("加热功率", data * 2, new IWriteCallBack() { + WritePLC("加热功率", data, new IWriteCallBack() { @Override public void onSuccess() { if (data == 0) { @@ -876,6 +876,11 @@ public class ExecuteTheRecipe { ReturnsVariable[0] = ConfigName.getInstance().StirringSpeed.get(value); } else if (name.contains("功率")) { ReturnsVariable[0] = ConfigName.getInstance().HeatingGear.get(value); + int max= ConfigName.getInstance().HeatingGear.get( ConfigName.getInstance().HuoLi); + if(ReturnsVariable[0]>max) + { + ReturnsVariable[0]=max; + } } } catch (Exception ex) { ToastUtils.error("异常信息:" + ex.getMessage()); diff --git a/app/src/main/java/com/bonait/bnframework/common/base/BaseActivity.java b/app/src/main/java/com/bonait/bnframework/common/base/BaseActivity.java index 66e33097..f01c26a0 100644 --- a/app/src/main/java/com/bonait/bnframework/common/base/BaseActivity.java +++ b/app/src/main/java/com/bonait/bnframework/common/base/BaseActivity.java @@ -15,6 +15,7 @@ import com.bonait.bnframework.common.utils.AlertDialogUtils; import com.bonait.bnframework.common.utils.ToastUtils; import com.qmuiteam.qmui.arch.QMUIActivity; import com.qmuiteam.qmui.util.QMUIDisplayHelper; +import com.qmuiteam.qmui.util.QMUIStatusBarHelper; import com.qmuiteam.qmui.widget.dialog.QMUIDialog; import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction; @@ -31,7 +32,9 @@ public class BaseActivity extends QMUIActivity implements EasyPermissions.Permi @Override protected void onCreate(@Nullable Bundle savedInstanceState) { - //ActiveMax.MaxFrom(this); +// ActiveMax.MaxFrom(this); +// QMUIStatusBarHelper.translucent(this); + // super.onCreate(savedInstanceState); } diff --git a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java index 425ac39f..f5fedd3a 100644 --- a/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java +++ b/app/src/main/java/com/bonait/bnframework/common/constant/ConfigName.java @@ -21,6 +21,7 @@ import java.util.Arrays; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; +import java.util.Map; import java.util.concurrent.ConcurrentHashMap; @@ -138,6 +139,7 @@ public class ConfigName { public String Version = "1.0"; //endregion + //region 是否手动下单 /** * 是否手动下单 @@ -769,6 +771,21 @@ public class ConfigName { put("七档", 7); put("八档", 8); }}; + + public Map HeatingGearL = new LinkedHashMap() {{ + put("二档", 0); + put("三档", 1); + put("四档", 2); + put("五档", 3); + put("六档", 4); + put("七档", 5); + put("八档", 6); + }}; + + + //region 火力最大级别 + public String HuoLi="八档"; + //endregion /** * 炒锅状态上报信息 */ diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home1Fragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home1Fragment.java index 1685c041..3e59b64e 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home1Fragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/Home1Fragment.java @@ -18,8 +18,11 @@ import androidx.recyclerview.widget.RecyclerView; import android.os.CountDownTimer; import android.os.Handler; +import android.util.Log; import android.view.LayoutInflater; +import android.view.MotionEvent; import android.view.View; +import android.widget.Button; import android.widget.ImageView; import android.widget.RelativeLayout; import android.widget.SeekBar; @@ -65,6 +68,7 @@ import com.qmuiteam.qmui.widget.textview.QMUILinkTextView; import com.suke.widget.SwitchButton; import java.util.ArrayList; +import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; @@ -114,6 +118,15 @@ public class Home1Fragment extends BaseFragment { @BindView(R.id.nifty_slider3) NiftySlider nifty_slider3;// + + + @BindView(R.id.btn_jiaoban) + Button btn_jiaoban;// + @BindView(R.id.btn_zhuandong_control_left) + Button btn_zhuandong_control_left;// + @BindView(R.id.btn_zhuandong_control_Rift) + Button btn_zhuandong_control_Rift;// + /** * 商品是否开始制作 */ @@ -235,33 +248,118 @@ public class Home1Fragment extends BaseFragment { * Image Button 按钮点击事件 */ public void ControlClicked() { - //搅拌挡位 - jiaoban_control.mListener = new MyClickListener() { +// //搅拌挡位 +// jiaoban_control.mListener = new MyClickListener() { +// @Override +// public void clickListener(View v, Object data) { +// boolean status = !(boolean) data; +// if (!IsMake(false)) +// { +// return; +// } +// jiaoban_control.SetStatus(status); +// int jd = (int) nifty_slider2.getValue(); +// ToastUtils.info("点击按钮:搅拌" + status + ".搅拌频率:" + jd); +// ExecuteTheRecipe.WritePLC("搅拌速度", jd, new IWriteCallBack() { +// @Override +// public void onSuccess() { +// if (jd == 0) { +// ExecuteTheRecipe.WritePLC("搅拌", false, null); +// } else { +// ExecuteTheRecipe.WritePLC("搅拌", status, null); +// } +// } +// +// @Override +// public void onFailure(String ErrorMsg) { +// } +// }); +// +// } +// +// @Override +// public void clickListenerNew(View v, int k, Object data) { +// +// } +// }; +// //转动 左 +// zhuandong_control_left.mListener = new MyClickListener() { +// @Override +// public void clickListener(View v, Object data) { +// boolean status = !(boolean) data; +// if (!IsMake(true)) +// { +// return; +// } +// zhuandong_control_left.SetStatus(status); +// int jd = (int) nifty_slider3.getValue(); +// ToastUtils.info("点击按钮:转动" + status + ".转动频率:" + jd); +// ExecuteTheRecipe.WritePLC("转动速度", jd, new IWriteCallBack() { +// @Override +// public void onSuccess() { +// if (jd == 0) { +// ExecuteTheRecipe.WritePLC("翻转正转", false, null); +// } else { +// ExecuteTheRecipe.WritePLC("翻转正转", status, null); +// } +// } +// +// @Override +// public void onFailure(String ErrorMsg) { +// } +// }); +// } +// +// @Override +// public void clickListenerNew(View v, int k, Object data) { +// +// } +// }; +// //转动 右 +// zhuandong_control_Rift.mListener = new MyClickListener() { +// @Override +// public void clickListener(View v, Object data) { +// boolean status = !(boolean) data; +// if (!IsMake(true)) +// { +// return; +// } +// zhuandong_control_Rift.SetStatus(status); +// int jd = (int) nifty_slider3.getValue(); +// ToastUtils.info("点击按钮:搅拌" + status + ".转动频率:" + jd); +// ExecuteTheRecipe.WritePLC("转动速度", jd, new IWriteCallBack() { +// @Override +// public void onSuccess() { +// if (jd == 0) { +// ExecuteTheRecipe.WritePLC("翻转反转", false, null); +// } else { +// ExecuteTheRecipe.WritePLC("翻转反转", status, null); +// } +// } +// +// @Override +// public void onFailure(String ErrorMsg) { +// } +// }); +// } +// +// @Override +// public void clickListenerNew(View v, int k, Object data) { +// +// } +// }; + //抽水启动 + choushui_control.mListener = new MyClickListener() { @Override public void clickListener(View v, Object data) { boolean status = !(boolean) data; - if (!IsMake(false)) + if (!IsMake(true)) { return; } - jiaoban_control.SetStatus(status); - int jd = (int) nifty_slider2.getValue(); - ToastUtils.info("点击按钮:搅拌" + status + ".搅拌频率:" + jd); - ExecuteTheRecipe.WritePLC("搅拌速度", jd, new IWriteCallBack() { - @Override - public void onSuccess() { - if (jd == 0) { - ExecuteTheRecipe.WritePLC("搅拌", false, null); - } else { - ExecuteTheRecipe.WritePLC("搅拌", status, null); - } - } - - @Override - public void onFailure(String ErrorMsg) { - } - }); - + choushui_control.SetStatus(status); + ToastUtils.info("点击按钮:炒锅抽水" + status); + ExecuteTheRecipe.WritePLC("炒锅抽水", status, null); } @Override @@ -269,8 +367,8 @@ public class Home1Fragment extends BaseFragment { } }; - //转动 左 - zhuandong_control_left.mListener = new MyClickListener() { + //放水启动 + fangshui_control.mListener = new MyClickListener() { @Override public void clickListener(View v, Object data) { boolean status = !(boolean) data; @@ -278,23 +376,9 @@ public class Home1Fragment extends BaseFragment { { return; } - zhuandong_control_left.SetStatus(status); - int jd = (int) nifty_slider3.getValue(); - ToastUtils.info("点击按钮:转动" + status + ".转动频率:" + jd); - ExecuteTheRecipe.WritePLC("转动速度", jd, new IWriteCallBack() { - @Override - public void onSuccess() { - if (jd == 0) { - ExecuteTheRecipe.WritePLC("翻转正转", false, null); - } else { - ExecuteTheRecipe.WritePLC("翻转正转", status, null); - } - } - - @Override - public void onFailure(String ErrorMsg) { - } - }); + fangshui_control.SetStatus(status); + ToastUtils.info("点击按钮:炒锅放水" + status); + ExecuteTheRecipe.WritePLC("炒锅放水", status, null); } @Override @@ -302,25 +386,23 @@ public class Home1Fragment extends BaseFragment { } }; - //转动 右 - zhuandong_control_Rift.mListener = new MyClickListener() { + + //搅拌 + btn_jiaoban.setOnClickListener(new View.OnClickListener() { @Override - public void clickListener(View v, Object data) { - boolean status = !(boolean) data; - if (!IsMake(true)) + public void onClick(View view) { + if (!IsMake(false)) { return; } - zhuandong_control_Rift.SetStatus(status); - int jd = (int) nifty_slider3.getValue(); - ToastUtils.info("点击按钮:搅拌" + status + ".转动频率:" + jd); - ExecuteTheRecipe.WritePLC("转动速度", jd, new IWriteCallBack() { + int jd = (int) nifty_slider2.getValue(); + ExecuteTheRecipe.WritePLC("搅拌速度", jd, new IWriteCallBack() { @Override public void onSuccess() { if (jd == 0) { - ExecuteTheRecipe.WritePLC("翻转反转", false, null); + ExecuteTheRecipe.WritePLC("搅拌", false, null); } else { - ExecuteTheRecipe.WritePLC("翻转反转", status, null); + ExecuteTheRecipe.WritePLC("搅拌", true, null); } } @@ -329,58 +411,91 @@ public class Home1Fragment extends BaseFragment { } }); } + }); + //正转 + btn_zhuandong_control_left.setOnTouchListener(new View.OnTouchListener() { @Override - public void clickListenerNew(View v, int k, Object data) { + public boolean onTouch(View view, MotionEvent motionEvent) { + if(motionEvent.getAction()==MotionEvent.ACTION_DOWN) + { + Log.e("鼠标", "按下: "); + if (!IsMake(false)) + { + return false; + } + int jd = (int) nifty_slider3.getValue(); + ExecuteTheRecipe.WritePLC("转动速度", jd, new IWriteCallBack() { + @Override + public void onSuccess() { + if (jd == 0) { + ExecuteTheRecipe.WritePLC("翻转正转", false, null); + } else { + ExecuteTheRecipe.WritePLC("翻转正转", true, null); + } + } - } - }; - //抽水启动 - choushui_control.mListener = new MyClickListener() { - @Override - public void clickListener(View v, Object data) { - boolean status = !(boolean) data; - if (!IsMake(true)) + @Override + public void onFailure(String ErrorMsg) { + } + }); + }else if(motionEvent.getAction()==MotionEvent.ACTION_UP) { - return; + Log.e("鼠标", "松开: "); + ExecuteTheRecipe.WritePLC("翻转正转", false, null); } - choushui_control.SetStatus(status); - ToastUtils.info("点击按钮:炒锅抽水" + status); - ExecuteTheRecipe.WritePLC("炒锅抽水", status, null); + return false; } + }); + //反转 + btn_zhuandong_control_Rift.setOnTouchListener(new View.OnTouchListener() { @Override - public void clickListenerNew(View v, int k, Object data) { + public boolean onTouch(View view, MotionEvent motionEvent) { + if(motionEvent.getAction()==MotionEvent.ACTION_DOWN) + { + Log.e("鼠标", "按下: "); + if (!IsMake(false)) + { + return false; + } + int jd = (int) nifty_slider3.getValue(); + ExecuteTheRecipe.WritePLC("转动速度", jd, new IWriteCallBack() { + @Override + public void onSuccess() { + if (jd == 0) { + ExecuteTheRecipe.WritePLC("翻转反转", false, null); + } else { + ExecuteTheRecipe.WritePLC("翻转反转", true, null); + } + } - } - }; - //放水启动 - fangshui_control.mListener = new MyClickListener() { - @Override - public void clickListener(View v, Object data) { - boolean status = !(boolean) data; - if (!IsMake(true)) + @Override + public void onFailure(String ErrorMsg) { + } + }); + }else if(motionEvent.getAction()==MotionEvent.ACTION_UP) { - return; + Log.e("鼠标", "松开: "); + ExecuteTheRecipe.WritePLC("翻转反转", false, null); } - fangshui_control.SetStatus(status); - ToastUtils.info("点击按钮:炒锅放水" + status); - ExecuteTheRecipe.WritePLC("炒锅放水", status, null); + return false; } + }); - @Override - public void clickListenerNew(View v, int k, Object data) { - - } - }; } + int gongxuIndex=10000; + ArrayList goodsrecipesL=null; + + BPA_GOODSRECIPE MakeCipe=null; /** * 商品制作线程 */ public void MakeThread() { ExecuteTheRecipe.context = context; + new Thread(new Runnable() { @Override public void run() { @@ -391,7 +506,11 @@ public class Home1Fragment extends BaseFragment { try { //获取工艺 ArrayList goodsrecipes = QueryDB.GetGoodsSrecipeID(good.id); + goodsrecipesL=goodsrecipes; + gongxuIndex=1; for (BPA_GOODSRECIPE item : goodsrecipes) { + MakeCipe=item; + gongxuIndex++; boolean status= ExecuteTheRecipe.Execute(item); } @@ -403,6 +522,9 @@ public class Home1Fragment extends BaseFragment { ExecuteTheRecipe.WritePLC("搅拌", false, null); ExecuteTheRecipe.WritePLC("加热", false, null); ExecuteTheRecipe.BottomClick("平移-去1号位"); + gongxuIndex=10000; + MakeCipe=null; + goodsrecipesL=null; Activity activity = getActivity(); if (activity != null) { activity.runOnUiThread(new Runnable() { @@ -428,6 +550,113 @@ public class Home1Fragment extends BaseFragment { } }).start(); + new Thread(new Runnable() { + @Override + public void run() { + while (true) { + try { + + if (Status && good != null && gongxuIndex!=10000 && goodsrecipesL!=null && MakeCipe!=null) { + try { + //获取工艺 + int k=1; + ArrayList goodsrecipes = goodsrecipesL; + BPA_GOODSRECIPE recipe=null; + for (BPA_GOODSRECIPE item : goodsrecipes) { + k++; + if(k>gongxuIndex) + { + if(item.processname.contains("主料") && !MakeCipe.processname.equals("主料") && recipe==null) + { + recipe=item; + } + } + } + + + if(recipe!=null) + { + HashMap formulation = new HashMap<>(); + String text=recipe.processvalue; + //region 获取仓号和值 + List data = new ArrayList<>(); + if (text.contains("|")) { + String[] res = text.split("[|]"); + for (int i = 0; i < res.length; i++) { + data.add(res[i]); + } + } else { + data.add(text); + } + for (String item : data) { + if (!item.isEmpty() && item.contains(",")) { + String[] wl = item.split("[,]"); + if (wl != null && wl.length == 2) { + String name = wl[0]; + String val = wl[1]; + formulation.put(name, val); + } + } + } + //endregion + boolean ishand=true; + + //region 判断是否手动 + if(ConfigName.getInstance().versionSelectionEnum.equals("大炒版本")) + { + ishand=true; + }else + { + for (HashMap.Entry entry : formulation.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if (key.contains("投料动作")) { + if(value.contains("手动投料")) + { + ishand=true; + }else + { + ishand=false; + } + } + } + } + //endregion + + if(!ishand) + { + if(ConfigName.getInstance().versionSelectionEnum.equals("大炒自动投料版本") || ConfigName.getInstance().versionSelectionEnum.equals("小炒版本")) + { + String writeValue = "1号位"; + for (HashMap.Entry entry : formulation.entrySet()) { + String key = entry.getKey(); + String value = entry.getValue(); + if (key.contains("主料位置")) { + writeValue=value; + } + } + ExecuteTheRecipe.BottomClick("平移-去"+writeValue); + } + } + }else + { + if(!MakeCipe.processname.equals("主料")) + { + ExecuteTheRecipe.BottomClick("平移-去1号位"); + } + } + } catch (Exception ex) { + ToastUtils.error("异常信息:" + ex.getMessage()); + } + } + Thread.sleep(3000); + } catch (InterruptedException e) { + ToastUtils.info("异常信息:" + e.getMessage()); + } + } + } + }).start(); + new Thread(new Runnable() { @Override public void run() { diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSystemsetFragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSystemsetFragment.java index 1cdbcfba..d5d663ec 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSystemsetFragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/fragment/SystemSystemsetFragment.java @@ -1,12 +1,15 @@ package com.bonait.bnframework.modules.home.fragment.from.fragment; import android.content.Context; + import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.appcompat.app.AppCompatActivity; + import android.os.Bundle; import android.view.LayoutInflater; import android.view.View; +import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.EditText; import android.widget.Spinner; @@ -46,15 +49,20 @@ public class SystemSystemsetFragment extends BaseFragment { @BindView(R.id.versionselection) Spinner versionselection; - ArrayList editTextLists=new ArrayList<>(); - Map material_map = new LinkedHashMap<>(); - Map material_map_vis = new LinkedHashMap<>(); + @BindView(R.id.HuoLi) + Spinner HuoLi; + + + ArrayList editTextLists = new ArrayList<>(); + Map material_map = new LinkedHashMap<>(); + Map material_map_vis = new LinkedHashMap<>(); /** * 系统设置参数 */ - ArrayList bpa_systemsets=new ArrayList<>(); + ArrayList bpa_systemsets = new ArrayList<>(); private Context context; + @Override protected View onCreateView() { View root = LayoutInflater.from(getActivity()).inflate(R.layout.fragment_system_systemset, null); @@ -68,6 +76,7 @@ public class SystemSystemsetFragment extends BaseFragment { Logger.d("我的fragment创建"); context = getContext(); initData(); + initSelect(); } @Override @@ -80,9 +89,9 @@ public class SystemSystemsetFragment extends BaseFragment { * 当在activity设置viewPager + BottomNavigation + fragment时, * 为防止viewPager左滑动切换界面,与fragment左滑返回上一界面冲突引起闪退问题, * 必须加上此方法,禁止fragment左滑返回上一界面。 - * + *

* 切记!切记!切记!否则会闪退! - * + *

* 当在fragment设置viewPager + BottomNavigation + fragment时,则不会出现这个问题。 */ @Override @@ -90,20 +99,18 @@ public class SystemSystemsetFragment extends BaseFragment { return false; } - private void initData() - { + private void initData() { editTextLists.add(edittext1); editTextLists.add(edittext2); editTextLists.add(edittext3); editTextLists.add(edittext4); - material_map.put("开发环境",0); - material_map.put("测试环境",1); - material_map.put("正式环境",2); + material_map.put("开发环境", 0); + material_map.put("测试环境", 1); + material_map.put("正式环境", 2); - for (int i=0;i adapter2 = new ArrayAdapter<>(context, R.layout.spinner_text_item, new ArrayList<>(ConfigName.getInstance().HeatingGearL.keySet())); + adapter2.setDropDownViewResource(R.layout.spinner_dropdown_item); + HuoLi.setAdapter(adapter2); + HuoLi.setSelection(ConfigName.getInstance().HeatingGearL.get(ConfigName.getInstance().HuoLi)); + + bpa_systemsets = QueryDB.GetSystemsetALL(); + for (BPA_SYSTEMSET item : bpa_systemsets) { switch (item.type) { case -100: - ConfigName.getInstance().versionSelectionEnum=item.value; + ConfigName.getInstance().versionSelectionEnum = item.value; versionselection.setSelection(material_map_vis.get(item.value)); break; case -99: - ConfigName.getInstance().Environment=item.value; + ConfigName.getInstance().Environment = item.value; environment.setSelection(material_map.get(item.value)); break; case 1: - ConfigName.getInstance().Address=item.value; + ConfigName.getInstance().Address = item.value; edittext1.setText(item.value); break; case 2: - ConfigName.getInstance().Post=Integer.parseInt(item.value); + ConfigName.getInstance().Post = Integer.parseInt(item.value); edittext2.setText(item.value); break; case 3: - ConfigName.getInstance().ClientAutoKey=item.value; + ConfigName.getInstance().ClientAutoKey = item.value; edittext3.setText(item.value); break; case 4: - ConfigName.getInstance().DeviceAutoKey=item.value; + ConfigName.getInstance().DeviceAutoKey = item.value; edittext4.setText(item.value); break; @@ -147,52 +160,71 @@ public class SystemSystemsetFragment extends BaseFragment { } } + /** + * 初始化选中 + */ + public void initSelect() { + HuoLi.setOnItemSelectedListener(new Spinner.OnItemSelectedListener() { + @Override + /*public void onItemSelected(AdapterView parent, View view, int position, long id) { + + }*/ + public void onItemSelected(AdapterView arg0, View arg1, int arg2, long arg3) { + ConfigName.getInstance().HuoLi=HuoLi.getSelectedItem().toString(); + ConfigData.getInstance().SavePZ(); + } + + @Override + public void onNothingSelected(AdapterView parent) { + + } + }); + + } + @OnClick({R.id.StartButton}) public void onViewClicked(View view) { switch (view.getId()) { case R.id.StartButton://保存按钮 - ConfigName.getInstance().Address=edittext1.getText().toString(); - ConfigName.getInstance().Post=Integer.parseInt(edittext2.getText().toString()); - ConfigName.getInstance().ClientAutoKey=edittext3.getText().toString(); - ConfigName.getInstance().DeviceAutoKey=edittext4.getText().toString(); - - ConfigName.getInstance().Environment=environment.getSelectedItem().toString(); - - boolean isgb=false; - if(!ConfigName.getInstance().versionSelectionEnum.equals(versionselection.getSelectedItem().toString())) - { - ConfigName.getInstance().versionSelectionEnum=versionselection.getSelectedItem().toString(); - isgb=true; + ConfigName.getInstance().Address = edittext1.getText().toString(); + ConfigName.getInstance().Post = Integer.parseInt(edittext2.getText().toString()); + ConfigName.getInstance().ClientAutoKey = edittext3.getText().toString(); + ConfigName.getInstance().DeviceAutoKey = edittext4.getText().toString(); + + ConfigName.getInstance().Environment = environment.getSelectedItem().toString(); + + boolean isgb = false; + if (!ConfigName.getInstance().versionSelectionEnum.equals(versionselection.getSelectedItem().toString())) { + ConfigName.getInstance().versionSelectionEnum = versionselection.getSelectedItem().toString(); + isgb = true; } - for (BPA_SYSTEMSET item:bpa_systemsets) - { + for (BPA_SYSTEMSET item : bpa_systemsets) { QueryDB.DeleteSystemset(item.id); } - for (int i = 0; i ImageViews=new ArrayList<>(); /** * 当前状态 */ @@ -57,6 +63,26 @@ public class huoli_control extends LinearLayout { public void Init() { + ImageViews.add(hl1); + ImageViews.add(hl2); + ImageViews.add(hl3); + ImageViews.add(hl4); + ImageViews.add(hl5); + ImageViews.add(hl6); + ImageViews.add(hl7); + ImageViews.add(hl8); + if(ConfigName.getInstance().HeatingGear.get(ConfigName.getInstance().HuoLi)!=null) + { + int k= ConfigName.getInstance().HeatingGear.get(ConfigName.getInstance().HuoLi); + for (int i = 0; i(k-1)) + { + ImageViews.get(i).setVisibility(View.GONE); + } + } + } + //设置 关闭 SetLevel(0); } diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/imagebutton_control.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/imagebutton_control.java index e102cd55..d124cd7b 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/imagebutton_control.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/imagebutton_control.java @@ -90,6 +90,7 @@ public class imagebutton_control extends LinearLayout { { mListener.clickListener(root,Status); } + } /** diff --git a/app/src/main/res/layout/fragment_home1.xml b/app/src/main/res/layout/fragment_home1.xml index a0d816ac..edf83471 100644 --- a/app/src/main/res/layout/fragment_home1.xml +++ b/app/src/main/res/layout/fragment_home1.xml @@ -222,11 +222,12 @@ android:orientation="vertical"> app:imagesrc_ks="@mipmap/ks_jb" app:imagesrc_tz="@mipmap/tz_jb" /> - + + @@ -297,7 +310,7 @@ android:orientation="vertical"> android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" + android:visibility="gone" + android:tag="" app:imagesrc_ks="@mipmap/ks_zz" app:imagesrc_tz="@mipmap/tz_zz" > +