@@ -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); | |||
} | |||
/** | |||
@@ -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()); | |||
@@ -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); | |||
} | |||
@@ -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<String, Integer> HeatingGearL = new LinkedHashMap<String, Integer>() {{ | |||
put("二档", 0); | |||
put("三档", 1); | |||
put("四档", 2); | |||
put("五档", 3); | |||
put("六档", 4); | |||
put("七档", 5); | |||
put("八档", 6); | |||
}}; | |||
//region 火力最大级别 | |||
public String HuoLi="八档"; | |||
//endregion | |||
/** | |||
* 炒锅状态上报信息 | |||
*/ | |||
@@ -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<BPA_GOODSRECIPE> 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<BPA_GOODSRECIPE> 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<BPA_GOODSRECIPE> 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<String, String> formulation = new HashMap<>(); | |||
String text=recipe.processvalue; | |||
//region 获取仓号和值 | |||
List<String> 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<String, String> 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<String, String> 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() { | |||
@@ -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<EditText> editTextLists=new ArrayList<>(); | |||
Map<String,Integer> material_map = new LinkedHashMap<>(); | |||
Map<String,Integer> material_map_vis = new LinkedHashMap<>(); | |||
@BindView(R.id.HuoLi) | |||
Spinner HuoLi; | |||
ArrayList<EditText> editTextLists = new ArrayList<>(); | |||
Map<String, Integer> material_map = new LinkedHashMap<>(); | |||
Map<String, Integer> material_map_vis = new LinkedHashMap<>(); | |||
/** | |||
* 系统设置参数 | |||
*/ | |||
ArrayList<BPA_SYSTEMSET> bpa_systemsets=new ArrayList<>(); | |||
ArrayList<BPA_SYSTEMSET> 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左滑返回上一界面。 | |||
* | |||
* <p> | |||
* 切记!切记!切记!否则会闪退! | |||
* | |||
* <p> | |||
* 当在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<ConfigName.getInstance().versionSelectionValues.length;i++) | |||
{ | |||
material_map_vis.put(ConfigName.getInstance().versionSelectionValues[i],i); | |||
for (int i = 0; i < ConfigName.getInstance().versionSelectionValues.length; i++) { | |||
material_map_vis.put(ConfigName.getInstance().versionSelectionValues[i], i); | |||
} | |||
@@ -115,31 +122,37 @@ public class SystemSystemsetFragment extends BaseFragment { | |||
adapter1.setDropDownViewResource(R.layout.spinner_dropdown_item); | |||
versionselection.setAdapter(adapter1); | |||
bpa_systemsets= QueryDB.GetSystemsetALL(); | |||
for (BPA_SYSTEMSET item:bpa_systemsets) { | |||
ArrayAdapter<String> 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 <editTextLists.size();i++){ | |||
BPA_SYSTEMSET set=new BPA_SYSTEMSET(); | |||
set.type=i+1; | |||
set.value=editTextLists.get(i).getText().toString(); | |||
for (int i = 0; i < editTextLists.size(); i++) { | |||
BPA_SYSTEMSET set = new BPA_SYSTEMSET(); | |||
set.type = i + 1; | |||
set.value = editTextLists.get(i).getText().toString(); | |||
set.deviceID = ConfigName.getInstance().DeviceId; | |||
set.userID = ConfigName.getInstance().user.userID; | |||
QueryDB.AddSystemset(set); | |||
} | |||
BPA_SYSTEMSET set=new BPA_SYSTEMSET(); | |||
set.type=-99; | |||
set.value=environment.getSelectedItem().toString(); | |||
BPA_SYSTEMSET set = new BPA_SYSTEMSET(); | |||
set.type = -99; | |||
set.value = environment.getSelectedItem().toString(); | |||
set.deviceID = ConfigName.getInstance().DeviceId; | |||
set.userID = ConfigName.getInstance().user.userID; | |||
QueryDB.AddSystemset(set); | |||
BPA_SYSTEMSET set_vis=new BPA_SYSTEMSET(); | |||
set_vis.type=-100; | |||
set_vis.value=versionselection.getSelectedItem().toString(); | |||
BPA_SYSTEMSET set_vis = new BPA_SYSTEMSET(); | |||
set_vis.type = -100; | |||
set_vis.value = versionselection.getSelectedItem().toString(); | |||
set_vis.deviceID = ConfigName.getInstance().DeviceId; | |||
set_vis.userID = ConfigName.getInstance().user.userID; | |||
QueryDB.AddSystemset(set_vis); | |||
if(isgb) | |||
{ | |||
if (isgb) { | |||
ConfigData.getInstance().RevertPLCProcess(); | |||
} | |||
ToastUtils.info("保存成功"); | |||
@@ -9,8 +9,12 @@ import android.widget.ImageView; | |||
import android.widget.LinearLayout; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.constant.ConfigName; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import java.util.ArrayList; | |||
import java.util.List; | |||
import butterknife.BindView; | |||
import butterknife.ButterKnife; | |||
import butterknife.OnClick; | |||
@@ -34,6 +38,8 @@ public class huoli_control extends LinearLayout { | |||
ImageView hl7; | |||
@BindView(R.id.hl8) | |||
ImageView hl8; | |||
List<ImageView> 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<ImageViews.size(); i++) | |||
{ | |||
if((i)>(k-1)) | |||
{ | |||
ImageViews.get(i).setVisibility(View.GONE); | |||
} | |||
} | |||
} | |||
//设置 关闭 | |||
SetLevel(0); | |||
} | |||
@@ -90,6 +90,7 @@ public class imagebutton_control extends LinearLayout { | |||
{ | |||
mListener.clickListener(root,Status); | |||
} | |||
} | |||
/** | |||
@@ -222,11 +222,12 @@ android:orientation="vertical"> | |||
<RelativeLayout | |||
android:layout_alignParentRight="true" | |||
android:layout_width="180dp" | |||
android:layout_width="190dp" | |||
android:layout_height="match_parent" | |||
android:layout_marginRight="@dimen/dp_10"> | |||
<com.bonait.bnframework.modules.home.fragment.mode.imagebutton_control | |||
android:id="@+id/jiaoban_control" | |||
android:visibility="gone" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_centerVertical="true" | |||
@@ -234,7 +235,19 @@ android:orientation="vertical"> | |||
app:imagesrc_ks="@mipmap/ks_jb" | |||
app:imagesrc_tz="@mipmap/tz_jb" | |||
/> | |||
<ImageView | |||
<Button | |||
android:id="@+id/btn_jiaoban" | |||
android:layout_width="80dp" | |||
android:layout_height="30dp" | |||
android:layout_marginBottom="10dp" | |||
android:layout_centerVertical="true" | |||
android:background="@drawable/bg_btn_login_selected" | |||
android:text="设置" | |||
android:textColor="@color/white" | |||
android:textSize="16dp" | |||
/> | |||
<ImageView | |||
android:layout_width="wrap_content" | |||
android:src="@color/color1" | |||
android:layout_height="wrap_content"> | |||
@@ -297,7 +310,7 @@ android:orientation="vertical"> | |||
</RelativeLayout> | |||
<LinearLayout | |||
android:layout_width="180dp" | |||
android:layout_width="190dp" | |||
android:layout_marginRight="@dimen/dp_10" | |||
android:layout_height="match_parent"> | |||
<RelativeLayout | |||
@@ -310,11 +323,23 @@ 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" | |||
> | |||
</com.bonait.bnframework.modules.home.fragment.mode.imagebutton_control> | |||
<Button | |||
android:id="@+id/btn_zhuandong_control_left" | |||
android:layout_width="80dp" | |||
android:layout_height="30dp" | |||
android:layout_marginBottom="10dp" | |||
android:layout_centerVertical="true" | |||
android:background="@drawable/bg_btn_login_selected" | |||
android:text="正转" | |||
android:textColor="@color/white" | |||
android:textSize="16dp"/> | |||
</RelativeLayout> | |||
<!--边框分割细线--> | |||
@@ -342,9 +367,21 @@ android:orientation="vertical"> | |||
android:layout_height="wrap_content" | |||
android:layout_centerVertical="true" | |||
android:tag="" | |||
android:visibility="gone" | |||
app:imagesrc_ks="@mipmap/ks_fz" | |||
app:imagesrc_tz="@mipmap/tz_fz"> | |||
</com.bonait.bnframework.modules.home.fragment.mode.imagebutton_control> | |||
<Button | |||
android:id="@+id/btn_zhuandong_control_Rift" | |||
android:layout_width="80dp" | |||
android:layout_height="30dp" | |||
android:layout_marginBottom="10dp" | |||
android:layout_centerVertical="true" | |||
android:background="@drawable/bg_btn_login_selected" | |||
android:text="反转" | |||
android:textColor="@color/white" | |||
android:textSize="16dp"/> | |||
</RelativeLayout> | |||
</LinearLayout> | |||
@@ -133,6 +133,25 @@ | |||
android:layout_height="24dp" | |||
android:layout_centerVertical="true" /> | |||
</TableRow> | |||
<!-- Table3--> | |||
<TableRow | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_gravity="left" | |||
android:layout_margin="5dp"> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:gravity="right" | |||
android:text="火力最大级别:" /> | |||
<Spinner | |||
android:id="@+id/HuoLi" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="80dp" | |||
android:layout_height="24dp" | |||
android:layout_centerVertical="true" /> | |||
</TableRow> | |||
</TableLayout> | |||
@@ -10,7 +10,7 @@ | |||
<color name="file_picker_title">#4A4A4A</color> | |||
<color name="file_picker_des">#86848B</color> | |||
<color name="file_bottom_line">#ECECEC</color> | |||
<color name="selebottom">#3604BFEF</color> | |||
<!-- common --> | |||
<color name="dataGridColumnHeaderColor">#00c2f4</color> | |||
<color name="foreground">#a2c2e8</color> | |||