setPLCNotify(ControlAdress.当前压力,(s)->{
+ activity.runOnUiThread(()->{tv_pressure.setText("压力:"+ String.format("%.2f",s/10f) +" kpa");});
+ });
+
+ ModbusHelper.get().IsRunning.ChangeNotify=(s)->{
+ activity.runOnUiThread(()->{
+ BtnEnable(!s);
+ });
+ };
+
+ btn_PotLid_Up.setOnTouchListener(touchListener);
+ btn_PotLid_Down.setOnTouchListener(touchListener);
+ btn_PotLid_Open.setOnTouchListener(touchListener);
+ btn_PotLid_Close.setOnTouchListener(touchListener);
+ btn_PotBody_Forward.setOnTouchListener(touchListener);
+ btn_PotBody_Reversal.setOnTouchListener(touchListener);
+ btn_PressureReliefValve.setOnTouchListener(touchListener);
+ }
+
+ private void BtnEnable(boolean value){
+ btn_PotLid_Up.setEnabled(value);
+ btn_PotLid_Down.setEnabled(value);
+ btn_PotLid_Open.setEnabled(value);
+ btn_PotLid_Close.setEnabled(value);
+ btn_PotBody_Forward.setEnabled(value);
+ btn_PotBody_Reversal.setEnabled(value);
+ btn_PressureReliefValve.setEnabled(value);
+ btn_OneKey_Up.setEnabled(value);
+ btn_OneKey_Down.setEnabled(value);
+ btn_OneKey_Home.setEnabled(value);
+
+ btn_PotLid_Up.setTextColor(value?Color.WHITE: Color.GRAY);
+ btn_PotLid_Down.setTextColor(value?Color.WHITE: Color.GRAY);
+ btn_PotLid_Open.setTextColor(value?Color.WHITE: Color.GRAY);
+ btn_PotLid_Close.setTextColor(value?Color.WHITE: Color.GRAY);
+ btn_PotBody_Forward.setTextColor(value?Color.WHITE: Color.GRAY);
+ btn_PotBody_Reversal.setTextColor(value?Color.WHITE: Color.GRAY);
+ btn_PressureReliefValve.setTextColor(value?Color.WHITE: Color.GRAY);
+ btn_OneKey_Up.setTextColor(value?Color.WHITE: Color.GRAY);
+ btn_OneKey_Down.setTextColor(value?Color.WHITE: Color.GRAY);
+ btn_OneKey_Home.setTextColor(value?Color.WHITE: Color.GRAY);
+ }
+
+ @OnClick({R.id.btn_OneKey_Up, R.id.btn_OneKey_Down, R.id.btn_OneKey_Home, R.id.btn_Stop})
+ public void onViewClicked(View view) {
+ if(!ModbusHelper.get().getConnected()){
+ DialogManager.showWarn(activity,"设备未连接,请连接后重试!", AlertDialogButton.OK,null);
+ return ;
+ }
+ switch (view.getId()) {
+ case R.id.btn_OneKey_Up:
+ ModbusHelper.get().PulseSignal(ControlAdress.一键上升);
+ break;
+ case R.id.btn_OneKey_Down:
+ ModbusHelper.get().PulseSignal(ControlAdress.一键下降);
+ break;
+ case R.id.btn_OneKey_Home:
+ ModbusHelper.get().PulseSignal(ControlAdress.一键回位);
+ break;
+ case R.id.btn_Stop:
+ DialogManager.showWarn(activity,"请问是否停止当前正在焖制的任务?",AlertDialogButton.OKCancel,(s)->{
+ if(s){
+ ModbusHelper.get().PulseSignal(ControlAdress.停止);
+ ModbusHelper.get().IsRunning.setValue(false);
+ }
+ });
+ break;
+ }
+ }
+
+ public View.OnTouchListener touchListener = new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View view, MotionEvent motionEvent) {
+
+ if(!ModbusHelper.get().getConnected()){
+ if(motionEvent.getAction() == MotionEvent.ACTION_DOWN){
+ DialogManager.showWarn(activity,"设备未连接,请连接后重试!", AlertDialogButton.OK,null);
+ }
+ return false;
+ }
+
+ if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
+ InchingControl(view,true);//手指按下
+ } else if (motionEvent.getAction() == MotionEvent.ACTION_UP) {
+ InchingControl(view,false);//手指松开
+ }
+ return false;
+ }
+ };
+
+ public void InchingControl(View view,Boolean IsChick)
+ {
+ switch (view.getId()) {
+ case R.id.btn_PotLid_Up:
+ ModbusHelper.get().WriteBoolSingle(ControlAdress.锅盖上升,IsChick);
+ break;
+ case R.id.btn_PotLid_Down:
+ ModbusHelper.get().WriteBoolSingle(ControlAdress.锅盖下降,IsChick);
+ break;
+ case R.id.btn_PotLid_Open:
+ ModbusHelper.get().WriteBoolSingle(ControlAdress.锅盖开启,IsChick);
+ break;
+ case R.id.btn_PotLid_Close:
+ ModbusHelper.get().WriteBoolSingle(ControlAdress.锅盖关闭,IsChick);
+ break;
+ case R.id.btn_PotBody_Forward:
+ ModbusHelper.get().WriteBoolSingle(ControlAdress.锅体正转,IsChick);
+ break;
+ case R.id.btn_PotBody_Reversal:
+ ModbusHelper.get().WriteBoolSingle(ControlAdress.锅体反转,IsChick);
+ break;
+ case R.id.btn_PressureReliefValve:
+ ModbusHelper.get().WriteBoolSingle(ControlAdress.泄压阀启停,IsChick);
+ break;
+ }
+ }
+
+ /**
+ * 当在activity设置viewPager + BottomNavigation + fragment时,
+ * 为防止viewPager左滑动切换界面,与fragment左滑返回上一界面冲突引起闪退问题,
+ * 必须加上此方法,禁止fragment左滑返回上一界面。
+ *
+ * 切记!切记!切记!否则会闪退!
+ *
+ * 当在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/HomeFragmentPR.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/HomeFragmentPR.java
index 9bdd5366..b89033fb 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/HomeFragmentPR.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/HomeFragmentPR.java
@@ -23,9 +23,16 @@ import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;
+import com.bonait.bnframework.HBL.Dialog.AlertDialogButton;
+import com.bonait.bnframework.HBL.Dialog.DialogManager;
+import com.bonait.bnframework.HBL.Executor;
+import com.bonait.bnframework.HBL.Logs.MessageLog;
+import com.bonait.bnframework.HBL.NotifyEvent;
+import com.bonait.bnframework.MainApplication;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ConfigData;
import com.bonait.bnframework.business.ExecuteTheRecipe;
+import com.bonait.bnframework.business.ModbusHelper;
import com.bonait.bnframework.common.base.BaseFragment;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
@@ -102,7 +109,7 @@ public class HomeFragmentPR extends BaseFragment {
activity = getActivity();
initTopBar();
SelectTab(1);
-
+ NotifyEvent.get().Register("商品信息刷新",()->{initData();});
}
@SuppressLint("HandlerLeak")
@@ -122,57 +129,6 @@ public class HomeFragmentPR extends BaseFragment {
mTopBar.setBackgroundColor(ContextCompat.getColor(requireContext(), R.color.topbj1));
mTopBar.setTitle("菜谱");
mTopBar.addRightTextButton("设备状态:"+(ConfigName.getInstance().PlcIsConnect ? "已连接" : "未连接"),R.id.status_image);
-
- new Thread(new Runnable() {
- @Override
- public void run() {
- while (true)
- {
- try {
- activity.runOnUiThread(new Runnable() {
- @Override
- public void run() {
- mTopBar.removeAllRightViews();
- mTopBar.addRightTextButton("设备状态:"+(ConfigName.getInstance().PlcIsConnect ? "已连接" : "未连接"),R.id.status_image);
- }
- });
- Thread.sleep(1000);
- } catch (InterruptedException e) {
- }
- }
- }
- }).start();
- /**
- * 刷新菜品
- */
- MessageManager.getInstance().registerMessageReceiver(activity, MessageName.GetOrganize, new MessageLooper.OnMessageListener() {
- @Override
- public void onMessage(Object msg) {
- if (msg != null && isAdded()) {
- ConfigData.getInstance().GetGevGood(context, mHandler);
- }
- }
- });
- /**
- * 刷新菜品
- */
- MessageManager.getInstance().registerMessageReceiver(activity, MessageName.ScGood, new MessageLooper.OnMessageListener() {
- @Override
- public void onMessage(Object msg) {
- if (msg != null && isAdded()) {
- String str = (String) msg;
- if (str.equals("Good")) {
- initData();
- if (qupenren.getVisibility() == View.VISIBLE) {
- qupenren.RefreshData();
- }
- } else {
- ConfigData.getInstance().GetGevGood(context, mHandler);
- }
- }
- }
- });
-
search_view.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
@Override
public boolean onQueryTextSubmit(String s) {
@@ -187,44 +143,29 @@ public class HomeFragmentPR extends BaseFragment {
});
}
+
+
/**
* 初始化显示数据
*/
private void initData() {
- StaggeredGridLayoutManager layout = new StaggeredGridLayoutManager
- (3, StaggeredGridLayoutManager.VERTICAL);
+ StaggeredGridLayoutManager layout = new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL);
recycler_view.setLayoutManager(layout);
- ArrayList good = new ArrayList<>();
- String name = search_view.getQuery().toString();
- if (name.isEmpty()) {
- good = QueryDB.GetGoodsALL();
- } else {
- good = QueryDB.GetGoodsLike(name);
- }
-
- List Bendi_id = new ArrayList<>();
- ArrayList contents_bdcp = new ArrayList<>();
- ArrayList contents_ydcp = new ArrayList<>();
- for (BPA_GOODS item : good) {
- if (item.url == null) {
- item.url = "未知";
+ QueryDB.getFormulaAll().OnFinally(s->{
+ if(s.isSuccess){
+ ArrayList contents_bdcp = new ArrayList<>();
+ s.Content.forEach(item->{
+ if (item.Url == null) {item.Url = "未知"; }
+ contents_bdcp.add(new SectionItem(item.Name, "", item.id, item.Url, false, false, true));
+ });
+ good_adapter adapter = new good_adapter(context, contents_bdcp, myClickListener);
+ recycler_view.setAdapter(adapter);
+ }else{
+ MessageLog.ShowError(s.message);
}
- contents_bdcp.add(new SectionItem(item.name, String.valueOf(item.maketime), item.id, item.url, item.issc == 1, false, true));
- Bendi_id.add(item.id);
- }
-
- for (CloudGood item : ConfigName.getInstance().cloudGoods) {
- contents_ydcp.add(new SectionItem(item.goods_Name, "180", item.id, item.goods_ImgUrl, false, true, Bendi_id.contains(item.id) ? true : false));
- }
+ });
- if (SelectIndex == 1) {
- good_adapter adapter = new good_adapter(context, contents_bdcp, myClickListener);
- recycler_view.setAdapter(adapter);
- } else {
- good_adapter adapter = new good_adapter(context, contents_ydcp, myClickListener);
- recycler_view.setAdapter(adapter);
- }
}
public MyClickListener myClickListener = new MyClickListener() {
@@ -240,8 +181,7 @@ public class HomeFragmentPR extends BaseFragment {
switch (k) {
case 1:
- QueryDB.DeleteGoodsid(goodid);
- QueryDB.DeleteGoodsSrecipeList(goodid);
+ QueryDB.ReamoveFormula(goodid);
initData();
break;
case 2:
@@ -252,6 +192,7 @@ public class HomeFragmentPR extends BaseFragment {
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
intent.putExtra("id", goodid);
startActivity(intent);
+ qupenren.setVisibility(View.GONE);
break;
case 99:
Intent intent1 = new Intent(getContext(), CookingSimulatedActivity.class);
@@ -262,14 +203,29 @@ public class HomeFragmentPR extends BaseFragment {
case 4: //打开查看窗体
qupenren.SetData(item, myClickListener);
qupenren.setVisibility(View.VISIBLE);
+ DiyUpdate1Activity.SelectId=goodid;
break;
case 5: //打开制作窗体
//判断是否正在制作
- if (ExecuteTheRecipe.IsStart) {
- ToastUtils.warning("请耐心等待商品制作结束!!!");
- } else {
- MessageManager.getInstance().sendMessage(MessageName.OpenMakeGoodFrom, goodid);
- qupenren.setVisibility(View.GONE);
+
+ if(ModbusHelper.get().IsRunning.getValue()){
+ DialogManager.showWarn(context,"制作中,请稍后后再试!", AlertDialogButton.OK,null);
+ }else{
+ if(ModbusHelper.get().getConnected()){
+ DialogManager.showInfo(context,"是否开始制作商品?", AlertDialogButton.YesNo,(s)->{
+ if(s){
+ QueryDB.getFormula(goodid).OnSource(order->{
+ Executor.get().runThread(()->{
+ ModbusHelper.get().WriteOrder(order.Content);
+ getActivity().runOnUiThread( ()->{qupenren.setVisibility(View.GONE);});
+ NotifyEvent.get().Notify(MessageName.OpenDeviceFrom);
+ });
+ });
+ }
+ });
+ }else{
+ DialogManager.showWarn(context,"设备未连接,请连接后重试!", AlertDialogButton.OK,null);
+ }
}
break;
case 0://关闭窗体
@@ -285,8 +241,7 @@ public class HomeFragmentPR extends BaseFragment {
*
* @param view
*/
- @OnClick({R.id.quanbucaipu, R.id.yunduancaipu
- })
+ @OnClick({R.id.quanbucaipu, R.id.yunduancaipu})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.quanbucaipu:
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdate1Activity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdate1Activity.java
index 892fb99f..177f9963 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdate1Activity.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdate1Activity.java
@@ -13,6 +13,7 @@ import android.view.View;
import android.view.WindowManager;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
+import android.widget.Button;
import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.ImageView;
@@ -20,11 +21,17 @@ import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Spinner;
+import com.bonait.bnframework.HBL.Dialog.AlertDialogButton;
+import com.bonait.bnframework.HBL.Dialog.DialogManager;
+import com.bonait.bnframework.HBL.NotifyEvent;
+import com.bonait.bnframework.HBL.Result.OperateResult;
+import com.bonait.bnframework.HBL.Result.OperateResultT;
import com.bonait.bnframework.R;
import com.bonait.bnframework.common.base.BaseActivity;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.constant.MessageName;
import com.bonait.bnframework.common.db.QueryDB;
+import com.bonait.bnframework.common.db.mode.BPA_FORMULA;
import com.bonait.bnframework.common.db.mode.BPA_GOODS;
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE;
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL;
@@ -66,13 +73,35 @@ public class DiyUpdate1Activity extends BaseActivity {
@BindView(R.id.check)
CheckBox check;//默认收藏
@BindView(R.id.hrgx)
- Spinner hrgx;//工序
+ Spinner hrgx;//档位
+
+ @BindView(R.id.shengchengnewcaipu)
+ Button shengchengnewcaipu;
+
+ /**
+ * 加热计时温度
+ */
+ @BindView(R.id.Timing_Temperature)
+ EditText et_Timing_Temperature;
+
+ /**
+ * 泄压压力
+ */
+ @BindView(R.id.Relief_Pressure)
+ EditText et_Relief_Pressure;
+
+ /**
+ * 烹饪时间
+ */
+ @BindView(R.id.Cooking_Time)
+ EditText et_Cooking_Time;
+
Map hrgx_map = new LinkedHashMap<>();
Map hrgx_map_index = new LinkedHashMap<>();
- @BindView(R.id.gxchid)
- LinearLayout gxchid;//工序子集
- @BindView(R.id.datatab_gxbz)
- ListView datatab_gxbz;//工序步骤
+// @BindView(R.id.gxchid)
+// LinearLayout gxchid;//工序子集
+// @BindView(R.id.datatab_gxbz)
+// ListView datatab_gxbz;//工序步骤
public gongxubuzhou_adapter gxbz_adapter = null;
/**
* 工序步骤
@@ -86,7 +115,10 @@ public class DiyUpdate1Activity extends BaseActivity {
/**
* 当前商品
*/
- public BPA_GOODS good = null;
+ public BPA_FORMULA good = null;
+
+ public String ImageUrl;
+ public static String SelectId;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -96,71 +128,67 @@ public class DiyUpdate1Activity extends BaseActivity {
initTopBar();
initData();
SetGood();
+
+
+
+
}
private void initData() {
- //1.初始化轮播图
- //Drawable_Get(Banner_list);
- //2.初始化工序
- ArrayList data = QueryDB.GetProcessALL();
- int i = 0;
- String id = "";
- for (BPA_PROCESS item : data) {
- hrgx_map.put(item.name, item.id);
- hrgx_map_index.put(item.name, i);
- if (i == 0) {
- id = item.id;
- }
- i++;
+
+ List spinners = new ArrayList();
+ for (int i =1;i<=8;i++){
+ spinners.add(i);
}
- ArrayAdapter adapter_kk = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, new ArrayList<>(hrgx_map.keySet()));
+ ArrayAdapter adapter_kk = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, spinners);
adapter_kk.setDropDownViewResource(R.layout.spinner_dropdown_item);
hrgx.setAdapter(adapter_kk);
- hrgx.setOnTouchListener(new View.OnTouchListener() {
- @Override
- public boolean onTouch(View view, MotionEvent motionEvent) {
- isUserClicked = true;
- view.performClick();
- return false;
- }
- });
- hrgx.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
- @Override
- public void onItemSelected(AdapterView> adapterView, View view, int i, long l) {
- if (isUserClicked)//不是用户点击返回
- {
- String id = hrgx_map.get(hrgx.getSelectedItem().toString());
- SelectItemFrom(id);
- isUserClicked = false;
- }
- }
-
- @Override
- public void onNothingSelected(AdapterView> adapterView) {
- }
- });
- SelectItemFrom(id);
+// hrgx.setOnTouchListener(new View.OnTouchListener() {
+// @Override
+// public boolean onTouch(View view, MotionEvent motionEvent) {
+// isUserClicked = true;
+// view.performClick();
+// return false;
+// }
+// });
+// hrgx.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
+// @Override
+// public void onItemSelected(AdapterView> adapterView, View view, int i, long l) {
+// if (isUserClicked)//不是用户点击返回
+// {
+// String id = hrgx_map.get(hrgx.getSelectedItem().toString());
+// SelectItemFrom(id);
+// isUserClicked = false;
+// }
+// }
+//
+// @Override
+// public void onNothingSelected(AdapterView> adapterView) {
+// }
+// });
+// SelectItemFrom(1);
//3.工序步骤
- gxbz_adapter = new gongxubuzhou_adapter(getContext(), R.layout.gx_item1, (List) bpa_goodsrecipes, null);
- datatab_gxbz.setAdapter(gxbz_adapter);
- datatab_gxbz.setOnItemClickListener(new AdapterView.OnItemClickListener() {
- @Override
- public void onItemClick(AdapterView> parent, View view, int position, long l) {
- // TODO Auto-generated method stub
- gxbz_adapter.setSelectedPosition(position);
- gxbz_adapter.notifyDataSetInvalidated();
-
- SetSelectGX(bpa_goodsrecipes.get(position));//单击工序行,显示变量
- }
- });
+// gxbz_adapter = new gongxubuzhou_adapter(getContext(), R.layout.gx_item1, (List) bpa_goodsrecipes, null);
+// datatab_gxbz.setAdapter(gxbz_adapter);
+// datatab_gxbz.setOnItemClickListener(new AdapterView.OnItemClickListener() {
+// @Override
+// public void onItemClick(AdapterView> parent, View view, int position, long l) {
+// // TODO Auto-generated method stub
+// gxbz_adapter.setSelectedPosition(position);
+// gxbz_adapter.notifyDataSetInvalidated();
+//
+// SetSelectGX(bpa_goodsrecipes.get(position));//单击工序行,显示变量
+// }
+// });
//图标选择
MessageManager.getInstance().registerMessageReceiver(this, MessageName.ClickImage, new MessageLooper.OnMessageListener() {
@Override
public void onMessage(Object msg) {
if (msg != null) {
- good.url = (String) msg;
- new MyBitmapUtils().disPlay(cpfm, good.url);
+ good.Url = (String) msg;
+ ImageUrl=(String) msg;
+ new MyBitmapUtils().disPlay(cpfm, good.Url);
}
}
});
@@ -181,60 +209,60 @@ public class DiyUpdate1Activity extends BaseActivity {
});
}
- /**
- * 根据选中步骤显示变量
- *
- * @param goodsrecipe
- */
- public void SetSelectGX(BPA_GOODSRECIPE goodsrecipe) {
- try {
- //1.根据工序名称显示工序集合
- hrgx.setSelection(hrgx_map_index.get(goodsrecipe.processname));
- String id = hrgx_map.get(hrgx.getSelectedItem().toString());
- SelectItemFrom(id);
-
- //2.根据工序变量集合-获取变量名称和值
- final HashMap formulation = new HashMap<>();
- //region 获取变量名称和值
- String text = goodsrecipe.processvalue;
- 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
-
- //3.查询子集-填充变量
- for (Map.Entry entry : formulation.entrySet()) {
- String key = entry.getKey();
- String value = entry.getValue();
- String STR = formulation.get(key);
- }
-
- for (int i = 0; i < gxchid.getChildCount(); i++) {
- fragment_gx gongxu = (fragment_gx) gxchid.getChildAt(i);
- String res = formulation.get(gongxu.model.name);
- if (res != null) {
- gongxu.SetValues(res);
- }
- }
- } catch (Exception ex) {
- }
- }
+// /**
+// * 根据选中步骤显示变量
+// *
+// * @param goodsrecipe
+// */
+// public void SetSelectGX(BPA_GOODSRECIPE goodsrecipe) {
+// try {
+// //1.根据工序名称显示工序集合
+// hrgx.setSelection(hrgx_map_index.get(goodsrecipe.processname));
+// String id = hrgx_map.get(hrgx.getSelectedItem().toString());
+// SelectItemFrom(id);
+//
+// //2.根据工序变量集合-获取变量名称和值
+// final HashMap formulation = new HashMap<>();
+// //region 获取变量名称和值
+// String text = goodsrecipe.processvalue;
+// 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
+//
+// //3.查询子集-填充变量
+// for (Map.Entry entry : formulation.entrySet()) {
+// String key = entry.getKey();
+// String value = entry.getValue();
+// String STR = formulation.get(key);
+// }
+//
+//// for (int i = 0; i < gxchid.getChildCount(); i++) {
+//// fragment_gx gongxu = (fragment_gx) gxchid.getChildAt(i);
+//// String res = formulation.get(gongxu.model.name);
+//// if (res != null) {
+//// gongxu.SetValues(res);
+//// }
+//// }
+// } catch (Exception ex) {
+// }
+// }
/**
* 设置当前商品
@@ -243,121 +271,139 @@ public class DiyUpdate1Activity extends BaseActivity {
*/
public void SetGood() {
try {
- Intent intent = getIntent();
- String id = intent.getStringExtra("id");
- if (!id.isEmpty()) {
- good = QueryDB.GetGoodsId(id);
- if (good != null) {
- bpa_goodsrecipes.clear();
- ArrayList goodsrecipes = QueryDB.GetGoodsSrecipeID(good.id);
- for (BPA_GOODSRECIPE item : goodsrecipes) {
- bpa_goodsrecipes.add(item);
+ if(SelectId!=null&&!SelectId.isEmpty()) {
+ QueryDB.getFormula(SelectId).OnSource(s->{
+ good=s.Content;
+ ArrayAdapter adapter = (ArrayAdapter) hrgx.getAdapter();
+ for (int i = 0; i < adapter.getCount(); i++) {
+ if (String.valueOf(good.HeatingGear).equals(adapter.getItem(i).toString())) {
+ hrgx.setSelection(i);
+ break;
+ }
}
- edittext.setText(good.name);
- check.setChecked(good.issc == 1);
- zzsc.setText(good.maketime + "");
- gxbz_adapter.notifyDataSetChanged();//刷新商品配方
- new MyBitmapUtils().disPlay(cpfm, good.url);
- }
+ edittext.setText(good.Name);
+ et_Timing_Temperature.setText(String.valueOf(good.TimingTemperature));
+ et_Cooking_Time.setText(String.valueOf(good.CookingTime));
+ et_Relief_Pressure.setText(String.valueOf(good.ReliefPressure));
+ });
}
- getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
- } catch (Exception ex) {
- }
- }
-
- /**
- * 根据选中工序id显示集合
- *
- * @param id
- */
- public void SelectItemFrom(String id) {
- try {
- gxchid.removeAllViews();
- ArrayList mode = QueryDB.GetProcessModelProcessID(id);
- if (mode.size() > 0)//工序
- {
- for (BPA_PROCESSModel item : mode) {
- item_gx gx = new item_gx();
- gx.datatype = item.datatype;
- gx.name = item.name;
- gx.data = item.data;
- gx.IsWL = false;
- fragment_gx gongxu = new fragment_gx(this, null, gx);
- gxchid.addView(gongxu);
- }
- } else //物料
- {
- ArrayList materials = QueryDB.GetMaterialALL();
- for (BPA_MATERIAL item2 : materials) {
- item_gx gx = new item_gx();
- gx.datatype = 0;//液体料都是数字
- gx.name = item2.name;
- gx.IsWL = true;
- fragment_gx gongxu = new fragment_gx(this, null, gx);
- gxchid.addView(gongxu);
- }
- }
+//
+// Intent intent = getIntent();
+// String id = intent.getStringExtra("id");
+// if (!id.isEmpty()) {
+// good = QueryDB.GetGoodsId(id);
+// if (good != null) {
+// bpa_goodsrecipes.clear();
+// ArrayList goodsrecipes = QueryDB.GetGoodsSrecipeID(good.id);
+// for (BPA_GOODSRECIPE item : goodsrecipes) {
+// bpa_goodsrecipes.add(item);
+// }
+// edittext.setText(good.name);
+// check.setChecked(good.issc == 1);
+// zzsc.setText(good.maketime + "");
+// gxbz_adapter.notifyDataSetChanged();//刷新商品配方
+// new MyBitmapUtils().disPlay(cpfm, good.url);
+// }
+// }
+// getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_HIDDEN);
} catch (Exception ex) {
- }
- }
- /**
- * 获取选中行的变量
- *
- * @return
- */
- public BPA_GOODSRECIPE GetSelectItemFromValue() {
- BPA_GOODSRECIPE pf = new BPA_GOODSRECIPE();
- try {
- String name = hrgx.getSelectedItem().toString();
- boolean IsVerify = true;
- String description = "";
- // 延迟,100|延迟,100|延迟,100|延迟,100|
- String data = "";
- String desc = "";
- if (name.contains("液体料")) {
- pf.materialType = 0;
- for (int i = 0; i < gxchid.getChildCount(); i++) {
- fragment_gx gongxu = (fragment_gx) gxchid.getChildAt(i);
- String values = gongxu.GetValues();
- if (!values.isEmpty()) {
- data += gongxu.model.name + "," + values + "|";
- desc += values + ",";
- }
- }
-
- if (data.isEmpty()) {
- IsVerify = false;
- description += "物料-不能为空,请勾选一个物料\n";
- }
- } else {
- pf.materialType = 1;
- for (int i = 0; i < gxchid.getChildCount(); i++) {
- fragment_gx gongxu = (fragment_gx) gxchid.getChildAt(i);
- String values = gongxu.GetValues();
- if (values.isEmpty()) {
- IsVerify = false;
- description += gongxu.model.name + "-不能为空\n";
- } else {
- data += gongxu.model.name + "," + values + "|";
- desc += values + ",";
- }
- }
- }
- if (IsVerify) {
- pf.processname = name;
- pf.processms = name + "(" + desc.substring(0, desc.length() - 1) + ")";
- pf.processvalue = data.substring(0, data.length() - 1);
- return pf;
- } else {
- ToastUtils.info("数据验证失败,原因:" + description);
- return null;
- }
- } catch (Exception ex) {
- return null;
}
}
+
+// /**
+// * 根据选中工序id显示集合
+// *
+// * @param id
+// */
+// public void SelectItemFrom(String id) {
+// try {
+//// gxchid.removeAllViews();
+//// ArrayList mode = QueryDB.GetProcessModelProcessID(id);
+//// if (mode.size() > 0)//工序
+//// {
+//// for (BPA_PROCESSModel item : mode) {
+//// item_gx gx = new item_gx();
+//// gx.datatype = item.datatype;
+//// gx.name = item.name;
+//// gx.data = item.data;
+//// gx.IsWL = false;
+//// fragment_gx gongxu = new fragment_gx(this, null, gx);
+//// gxchid.addView(gongxu);
+//// }
+//// } else //物料
+//// {
+//// ArrayList materials = QueryDB.GetMaterialALL();
+//// for (BPA_MATERIAL item2 : materials) {
+//// item_gx gx = new item_gx();
+//// gx.datatype = 0;//液体料都是数字
+//// gx.name = item2.name;
+//// gx.IsWL = true;
+//// fragment_gx gongxu = new fragment_gx(this, null, gx);
+//// gxchid.addView(gongxu);
+//// }
+//// }
+// } catch (Exception ex) {
+// }
+// }
+
+// /**
+// * 获取选中行的变量
+// *
+// * @return
+// */
+// public BPA_GOODSRECIPE GetSelectItemFromValue() {
+// BPA_GOODSRECIPE pf = new BPA_GOODSRECIPE();
+// try {
+// String name = hrgx.getSelectedItem().toString();
+// boolean IsVerify = true;
+// String description = "";
+// // 延迟,100|延迟,100|延迟,100|延迟,100|
+// String data = "";
+// String desc = "";
+// if (name.contains("液体料")) {
+// pf.materialType = 0;
+//// for (int i = 0; i < gxchid.getChildCount(); i++) {
+//// fragment_gx gongxu = (fragment_gx) gxchid.getChildAt(i);
+//// String values = gongxu.GetValues();
+//// if (!values.isEmpty()) {
+//// data += gongxu.model.name + "," + values + "|";
+//// desc += values + ",";
+//// }
+//// }
+//
+// if (data.isEmpty()) {
+// IsVerify = false;
+// description += "物料-不能为空,请勾选一个物料\n";
+// }
+// } else {
+// pf.materialType = 1;
+//// for (int i = 0; i < gxchid.getChildCount(); i++) {
+//// fragment_gx gongxu = (fragment_gx) gxchid.getChildAt(i);
+//// String values = gongxu.GetValues();
+//// if (values.isEmpty()) {
+//// IsVerify = false;
+//// description += gongxu.model.name + "-不能为空\n";
+//// } else {
+//// data += gongxu.model.name + "," + values + "|";
+//// desc += values + ",";
+//// }
+//// }
+// }
+// if (IsVerify) {
+// pf.processname = name;
+// pf.processms = name + "(" + desc.substring(0, desc.length() - 1) + ")";
+// pf.processvalue = data.substring(0, data.length() - 1);
+// return pf;
+// } else {
+// ToastUtils.info("数据验证失败,原因:" + description);
+// return null;
+// }
+// } catch (Exception ex) {
+// return null;
+// }
+// }
private void initTopBar() {
mTopBar.setBackgroundColor(ContextCompat.getColor(getContext(), R.color.topbj1));
mTopBar.setTitle("编辑菜谱");
@@ -374,7 +420,7 @@ public class DiyUpdate1Activity extends BaseActivity {
*
* @param view
*/
- @OnClick({R.id.add_hrgx, R.id.update_gx, R.id.delete_gx, R.id.shangyi, R.id.xiayi, R.id.caozuomoshi, R.id.shengchengcaipu, R.id.shengchengnewcaipu, R.id.cpfm})
+ @OnClick({ R.id.shengchengcaipu, R.id.shengchengnewcaipu, R.id.cpfm})
public void onViewClicked(View view) {
switch (view.getId()) {
case R.id.cpfm://菜谱封面
@@ -383,169 +429,203 @@ public class DiyUpdate1Activity extends BaseActivity {
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
break;
- case R.id.add_hrgx://添加工序
- BPA_GOODSRECIPE goodsrecipe = GetSelectItemFromValue();
- if (goodsrecipe != null) {
- bpa_goodsrecipes.add(GetSelectItemFromValue());
- gxbz_adapter.notifyDataSetChanged();
- }
- break;
- case R.id.update_gx://修改工序
- int index_update = gxbz_adapter.getSelectedPosition();
- if (index_update >= 0 && index_update < bpa_goodsrecipes.size()) {
- BPA_GOODSRECIPE obj_update = (BPA_GOODSRECIPE) bpa_goodsrecipes.get(index_update);
- String selectname = hrgx.getSelectedItem().toString();
- if (!obj_update.processname.equals(selectname)) {
- ToastUtils.info("请先选择工序!");
- return;
- }
- bpa_goodsrecipes.set(index_update, GetSelectItemFromValue());
- gxbz_adapter.notifyDataSetChanged();
- ToastUtils.info("修改步骤" + (index_update + 1) + ":" + obj_update.processname + "成功!");
- } else {
- ToastUtils.info("请先选择工序!");
- }
- break;
- case R.id.delete_gx://删除工序
- int index_delete = gxbz_adapter.getSelectedPosition();
- if (index_delete >= 0 && index_delete < bpa_goodsrecipes.size()) {
- BPA_GOODSRECIPE obj_delete = (BPA_GOODSRECIPE) bpa_goodsrecipes.get(index_delete);
- bpa_goodsrecipes.remove(obj_delete);
- gxbz_adapter.notifyDataSetChanged();
-
- //移动光标
- if (index_delete - 1 >= 0) {
- SetSelectPos(index_delete - 1);
- }
- ToastUtils.info("删除工序" + obj_delete.processname + "成功!");
- } else {
- ToastUtils.info("请先选择工序!");
- }
- break;
- case R.id.shangyi://上移
- int index_up = gxbz_adapter.getSelectedPosition();
- ;
- if (index_up > 0) {
- BPA_GOODSRECIPE obj_up = (BPA_GOODSRECIPE) bpa_goodsrecipes.get(index_up);
- bpa_goodsrecipes.remove(obj_up);
- bpa_goodsrecipes.add(index_up - 1, obj_up);
- gxbz_adapter.notifyDataSetChanged();
-
- //移动光标
- SetSelectPos(index_up - 1);
- } else {
- ToastUtils.info("已经最顶部!");
- }
- break;
- case R.id.xiayi://下移
- int index_down = gxbz_adapter.getSelectedPosition();
- if (index_down < bpa_goodsrecipes.size() - 1 && index_down >= 0) {
- BPA_GOODSRECIPE obj_down = (BPA_GOODSRECIPE) bpa_goodsrecipes.get(index_down);
- bpa_goodsrecipes.remove(obj_down);
- bpa_goodsrecipes.add(index_down + 1, obj_down);
- gxbz_adapter.notifyDataSetChanged();
-
- //移动光标
- SetSelectPos(index_down + 1);
- } else {
- ToastUtils.info("已经最底部!");
- }
- break;
- case R.id.caozuomoshi://操作模式
- Intent intent1 = new Intent(getContext(), DiyMemoryActivity.class);
- intent1.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- startActivity(intent1);
- break;
+// case R.id.add_hrgx://添加工序
+// BPA_GOODSRECIPE goodsrecipe = GetSelectItemFromValue();
+// if (goodsrecipe != null) {
+// bpa_goodsrecipes.add(GetSelectItemFromValue());
+// gxbz_adapter.notifyDataSetChanged();
+// }
+// break;
+// case R.id.update_gx://修改工序
+// int index_update = gxbz_adapter.getSelectedPosition();
+// if (index_update >= 0 && index_update < bpa_goodsrecipes.size()) {
+// BPA_GOODSRECIPE obj_update = (BPA_GOODSRECIPE) bpa_goodsrecipes.get(index_update);
+// String selectname = hrgx.getSelectedItem().toString();
+// if (!obj_update.processname.equals(selectname)) {
+// ToastUtils.info("请先选择工序!");
+// return;
+// }
+// bpa_goodsrecipes.set(index_update, GetSelectItemFromValue());
+// gxbz_adapter.notifyDataSetChanged();
+// ToastUtils.info("修改步骤" + (index_update + 1) + ":" + obj_update.processname + "成功!");
+// } else {
+// ToastUtils.info("请先选择工序!");
+// }
+// break;
+// case R.id.delete_gx://删除工序
+// int index_delete = gxbz_adapter.getSelectedPosition();
+// if (index_delete >= 0 && index_delete < bpa_goodsrecipes.size()) {
+// BPA_GOODSRECIPE obj_delete = (BPA_GOODSRECIPE) bpa_goodsrecipes.get(index_delete);
+// bpa_goodsrecipes.remove(obj_delete);
+// gxbz_adapter.notifyDataSetChanged();
+//
+// //移动光标
+// if (index_delete - 1 >= 0) {
+// SetSelectPos(index_delete - 1);
+// }
+// ToastUtils.info("删除工序" + obj_delete.processname + "成功!");
+// } else {
+// ToastUtils.info("请先选择工序!");
+// }
+// break;
+// case R.id.shangyi://上移
+// int index_up = gxbz_adapter.getSelectedPosition();
+// ;
+// if (index_up > 0) {
+// BPA_GOODSRECIPE obj_up = (BPA_GOODSRECIPE) bpa_goodsrecipes.get(index_up);
+// bpa_goodsrecipes.remove(obj_up);
+// bpa_goodsrecipes.add(index_up - 1, obj_up);
+// gxbz_adapter.notifyDataSetChanged();
+//
+// //移动光标
+// SetSelectPos(index_up - 1);
+// } else {
+// ToastUtils.info("已经最顶部!");
+// }
+// break;
+// case R.id.xiayi://下移
+// int index_down = gxbz_adapter.getSelectedPosition();
+// if (index_down < bpa_goodsrecipes.size() - 1 && index_down >= 0) {
+// BPA_GOODSRECIPE obj_down = (BPA_GOODSRECIPE) bpa_goodsrecipes.get(index_down);
+// bpa_goodsrecipes.remove(obj_down);
+// bpa_goodsrecipes.add(index_down + 1, obj_down);
+// gxbz_adapter.notifyDataSetChanged();
+//
+// //移动光标
+// SetSelectPos(index_down + 1);
+// } else {
+// ToastUtils.info("已经最底部!");
+// }
+// break;
+// case R.id.caozuomoshi://操作模式
+// Intent intent1 = new Intent(getContext(), DiyMemoryActivity.class);
+// intent1.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+// startActivity(intent1);
+// break;
case R.id.shengchengnewcaipu:
String name1 = edittext.getText().toString();
- if (name1.isEmpty()) {
- ToastUtils.info("菜谱名称不能为空!");
+ if(name1.isEmpty()){
+ DialogManager.showWarn(this,"菜谱名称不能为空!", AlertDialogButton.OK,null);
return;
- } else {
- boolean isSucess = QueryDB.GetGoodsIs(name1);
- if (isSucess) {
- ToastUtils.info("菜谱名称已存在!");
- return;
- }
- //按钮点击
- String title = "生成菜谱操作提示!";
- String message = "请问客官确定要生成[" + name1 + "]菜谱吗?";
- AlertDialogUtils.showDialog(view.getContext(), title, message, new QMUIDialogAction.ActionListener() {
- @Override
- public void onClick(QMUIDialog dialog, int index) {
- int sc = 60 * 3;
- if (!zzsc.getText().toString().isEmpty() && !zzsc.getText().toString().equals("0")) {
- sc = Integer.parseInt(zzsc.getText().toString());
- }
+ }
+ if(QueryDB.checkName(name1)){
+ DialogManager.showWarn(this,"菜谱名称已存在!", AlertDialogButton.OK,null);
+ return;
+ }
- ArrayList goods = QueryDB.GetGoodsALL();
- BPA_GOODS good1 = new BPA_GOODS();
- good1.name = name1;
- good1.status = 1;
- good1.sort = goods.size() + 1;
- good1.maketime = sc;
- good1.issc = check.isChecked() ? 1 : 0;
- good1.url = good.url;
- QueryDB.AddGoods(good1);
- for (int k = 0; k < bpa_goodsrecipes.size(); k++) {
- BPA_GOODSRECIPE item = bpa_goodsrecipes.get(k);
- item.id = java.util.UUID.randomUUID().toString();
- item.goodsID = good1.id;
- item.sort = k + 1;
- QueryDB.AddGoodsSrecipe(item);
+ DialogManager.showInfo(this,"请问是否生成 ["+name1+"] 菜谱?", AlertDialogButton.YesNo,(s)->{
+ if(s){
+ try{
+ int heatingGear = Integer.parseInt(hrgx.getSelectedItem().toString());
+ int timingsTemperature = Integer.parseInt(et_Timing_Temperature.getText().toString());
+ int cookingTime = Integer.parseInt(et_Cooking_Time.getText().toString());
+ int reliefPressure = Integer.parseInt(et_Relief_Pressure.getText().toString());
+ OperateResult result = QueryDB.addFormula(new BPA_FORMULA(name1,ImageUrl,heatingGear,timingsTemperature,cookingTime,reliefPressure));
+ if(result.isSuccess)
+ {
+ ToastUtils.info("菜谱添加成功!");
+ NotifyEvent.get().Notify("商品信息刷新");
}
- ToastUtils.info("菜谱复刻成功!");
- dialog.dismiss();
- MessageManager.getInstance().sendMessage(MessageName.ScGood, "Good");
+ else DialogManager.showError(this,"添加菜谱失败,"+result.message,AlertDialogButton.OK,null);
finish();
+ }catch(Exception e){
+ DialogManager.showError(this,"添加菜谱失败,"+e.getMessage(),AlertDialogButton.OK,null);
}
- });
-
- }
+ }
+ });
+
+
+
+//
+// if (name1.isEmpty()) {
+//// ToastUtils.info("菜谱名称不能为空!");
+// DialogManager.showWarn(this,"菜谱名称不能为空!", AlertDialogButton.OK,null);
+// return;
+// } else {
+// boolean isSucess = QueryDB.checkName(name1);
+// if (isSucess) {
+// ToastUtils.info("菜谱名称已存在!");
+// return;
+// }
+// //按钮点击
+// String title = "生成菜谱操作提示!";
+// String message = "请问客官确定要生成[" + name1 + "]菜谱吗?";
+// AlertDialogUtils.showDialog(view.getContext(), title, message, new QMUIDialogAction.ActionListener() {
+// @Override
+// public void onClick(QMUIDialog dialog, int index) {
+// int sc = 60 * 3;
+// if (!zzsc.getText().toString().isEmpty() && !zzsc.getText().toString().equals("0")) {
+// sc = Integer.parseInt(zzsc.getText().toString());
+// }
+//
+// ArrayList goods = QueryDB.GetGoodsALL();
+// BPA_GOODS good1 = new BPA_GOODS();
+// good1.name = name1;
+// good1.status = 1;
+// good1.sort = goods.size() + 1;
+// good1.maketime = sc;
+// good1.issc = check.isChecked() ? 1 : 0;
+// if(good!=null) good1.url = good.url;
+// QueryDB.AddGoods(good1);
+// for (int k = 0; k < bpa_goodsrecipes.size(); k++) {
+// BPA_GOODSRECIPE item = bpa_goodsrecipes.get(k);
+// item.id = java.util.UUID.randomUUID().toString();
+// item.goodsID = good1.id;
+// item.sort = k + 1;
+// QueryDB.AddGoodsSrecipe(item);
+// }
+// ToastUtils.info("菜谱复刻成功!");
+// dialog.dismiss();
+// MessageManager.getInstance().sendMessage(MessageName.ScGood, "Good");
+// finish();
+// }
+// });
+//
+// }
break;
case R.id.shengchengcaipu://修改菜谱
- String name = edittext.getText().toString();
- if (name.isEmpty()) {
- ToastUtils.info("菜谱名称不能为空!");
- return;
- } else {
- boolean isSucess = QueryDB.GetGoodsIs(name, good.id);
- if (isSucess) {
- ToastUtils.info("菜谱名称已存在!");
- return;
- }
- //按钮点击
- String title = "保存菜谱操作提示!";
- String message = "请问客官确定要保存[" + name + "]菜谱吗?";
- AlertDialogUtils.showDialog(view.getContext(), title, message, new QMUIDialogAction.ActionListener() {
- @Override
- public void onClick(QMUIDialog dialog, int index) {
- int sc = 60 * 3;
- if (!zzsc.getText().toString().isEmpty() && !zzsc.getText().toString().equals("0")) {
- sc = Integer.parseInt(zzsc.getText().toString());
- }
- good.maketime = sc;
- good.issc = check.isChecked() ? 1 : 0;
- good.name = name;
- QueryDB.UpdateGoods(good);
- ArrayList pe = QueryDB.GetGoodsSrecipeID(good.id);
- for (BPA_GOODSRECIPE item : pe) {
- QueryDB.DeleteGoodsSrecipe(item);
- }
- for (int k = 0; k < bpa_goodsrecipes.size(); k++) {
- BPA_GOODSRECIPE item = bpa_goodsrecipes.get(k);
- item.goodsID = good.id;
- item.sort = k + 1;
- QueryDB.AddGoodsSrecipe(item);
- }
- ToastUtils.info("菜谱修改成功!");
- dialog.dismiss();
- MessageManager.getInstance().sendMessage(MessageName.ScGood, "Good");
- finish();
- }
- });
-
- }
+// String name = edittext.getText().toString();
+// if (name.isEmpty()) {
+// ToastUtils.info("菜谱名称不能为空!");
+// return;
+// } else {
+// boolean isSucess = QueryDB.GetGoodsIs(name, good.id);
+// if (isSucess) {
+// ToastUtils.info("菜谱名称已存在!");
+// return;
+// }
+// //按钮点击
+// String title = "保存菜谱操作提示!";
+// String message = "请问客官确定要保存[" + name + "]菜谱吗?";
+// AlertDialogUtils.showDialog(view.getContext(), title, message, new QMUIDialogAction.ActionListener() {
+// @Override
+// public void onClick(QMUIDialog dialog, int index) {
+// int sc = 60 * 3;
+// if (!zzsc.getText().toString().isEmpty() && !zzsc.getText().toString().equals("0")) {
+// sc = Integer.parseInt(zzsc.getText().toString());
+// }
+// good.maketime = sc;
+// good.issc = check.isChecked() ? 1 : 0;
+// good.name = name;
+// QueryDB.UpdateGoods(good);
+// ArrayList pe = QueryDB.GetGoodsSrecipeID(good.id);
+// for (BPA_GOODSRECIPE item : pe) {
+// QueryDB.DeleteGoodsSrecipe(item);
+// }
+// for (int k = 0; k < bpa_goodsrecipes.size(); k++) {
+// BPA_GOODSRECIPE item = bpa_goodsrecipes.get(k);
+// item.goodsID = good.id;
+// item.sort = k + 1;
+// QueryDB.AddGoodsSrecipe(item);
+// }
+// ToastUtils.info("菜谱修改成功!");
+// dialog.dismiss();
+// MessageManager.getInstance().sendMessage(MessageName.ScGood, "Good");
+// finish();
+// }
+// });
+//
+// }
break;
}
}
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParSetActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParSetActivity.java
new file mode 100644
index 00000000..2f511881
--- /dev/null
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SystemParSetActivity.java
@@ -0,0 +1,171 @@
+package com.bonait.bnframework.modules.home.fragment.from;
+
+import android.app.Activity;
+import android.content.Context;
+import android.os.Bundle;
+import android.view.View;
+import android.widget.EditText;
+
+import androidx.core.content.ContextCompat;
+
+import com.bonait.bnframework.HBL.Executor;
+import com.bonait.bnframework.HBL.Logs.MessageLog;
+import com.bonait.bnframework.R;
+import com.bonait.bnframework.business.ControlAdress;
+import com.bonait.bnframework.business.ModbusHelper;
+import com.bonait.bnframework.common.base.BaseActivity;
+import com.bonait.bnframework.common.constant.ConfigName;
+import com.bonait.bnframework.common.constant.DataBus;
+import com.bonait.bnframework.common.db.QueryDB;
+import com.bonait.bnframework.common.db.res.lcMode;
+import com.bonait.bnframework.common.helper.ConfigUtil;
+import com.bonait.bnframework.common.helper.I.MyClickListener;
+import com.bonait.bnframework.common.utils.ToastUtils;
+import com.bonait.bnframework.modules.home.fragment.mode.add_silos_message;
+import com.bonait.bnframework.modules.home.fragment.mode.imagebuttom;
+import com.bonait.bnframework.modules.home.fragment.mode.jingdutiao1;
+import com.qmuiteam.qmui.widget.QMUITopBarLayout;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+import butterknife.OnClick;
+
+public class SystemParSetActivity extends BaseActivity {
+
+ //region 变量
+ @BindView(R.id.topbar)
+ QMUITopBarLayout mTopBar;
+
+ /**
+ * 温度上限
+ */
+ @BindView(R.id.et_Temperature_Upper_Limit)
+ EditText et_Temperature_Upper_Limit;
+
+ /**
+ * 温度下限
+ */
+ @BindView(R.id.et_Temperature_Lower_Limit)
+ EditText et_Temperature_Lower_Limit;
+
+ /**
+ * 压力上限
+ */
+ @BindView(R.id.et_Pressure_Upper_Limit)
+ EditText et_Pressure_Upper_Limit;
+
+ /**
+ * 压力下限
+ */
+ @BindView(R.id.et_Pressure_Lower_Limit)
+ EditText et_Pressure_Lower_Limit;
+
+ /**
+ * 允许开盖压力
+ */
+ @BindView(R.id.et_OpenLid_pressure)
+ EditText et_OpenLid_pressure;
+
+ /**
+ * 排冷气温度
+ */
+ @BindView(R.id.et_Exhaust_Air_Temperature)
+ EditText et_Exhaust_Air_Temperature;
+
+ public Context context;
+ public Activity activity=null;
+ //endregion
+
+ //region 界面实例
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_system_par_set);
+ ButterKnife.bind(this);
+ context = this;
+ activity=this;
+ initTopBar();
+ InitData();
+ }
+ //endregion
+
+ //region 私有方法
+
+ /**
+ * 初始化顶部弹框
+ */
+ private void initTopBar() {
+ mTopBar.setBackgroundColor(ContextCompat.getColor(context, R.color.topbj1));
+ mTopBar.setTitle("系统参数设置");
+ mTopBar.addLeftImageButton(R.mipmap.fanhui, R.id.topbar).setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ finish();
+ }
+ });
+
+
+ }
+
+ private String getConfig(String key){
+ Context dishesCon = ConfigName.getInstance().dishesCon;
+ return String.valueOf(ConfigUtil.read(dishesCon, key,0 ));
+ }
+
+ /**
+ * 初始化数据
+ */
+ public void InitData() {
+ try{
+ et_Temperature_Upper_Limit.setText(getConfig("Temperature_Upper_Limit"));
+ et_Temperature_Lower_Limit.setText(getConfig("Temperature_Lower_Limit"));
+ et_Pressure_Upper_Limit.setText(getConfig("Pressure_Upper_Limit"));
+ et_Pressure_Lower_Limit.setText(getConfig("Pressure_Lower_Limit"));
+ et_OpenLid_pressure.setText(getConfig("OpenLid_pressure"));
+ et_Exhaust_Air_Temperature.setText(getConfig("Exhaust_Air_Temperature"));
+ }catch(Exception e){
+ MessageLog.ShowError(e);
+ }
+ }
+
+
+ /**
+ * 点击事件
+ *
+ * @param view
+ */
+ @OnClick({R.id.btn_save})
+ public void onViewClicked(View view) {
+ switch (view.getId()) {
+ case R.id.btn_save:
+ try{
+ short Temperature_Upper_Limit = Short.parseShort(et_Temperature_Upper_Limit.getText().toString());
+ short Temperature_Lower_Limit = Short.parseShort(et_Temperature_Lower_Limit.getText().toString());
+ short Pressure_Upper_Limit = Short.parseShort(et_Pressure_Upper_Limit.getText().toString());
+ short Pressure_Lower_Limit = Short.parseShort(et_Pressure_Lower_Limit.getText().toString());
+ short OpenLid_pressure = Short.parseShort(et_OpenLid_pressure.getText().toString());
+ short Exhaust_Air_Temperature = Short.parseShort(et_Exhaust_Air_Temperature.getText().toString());
+ Context dishesCon = ConfigName.getInstance().dishesCon;
+ ConfigUtil.write(dishesCon, "Temperature_Upper_Limit",Temperature_Upper_Limit );
+ ConfigUtil.write(dishesCon, "Temperature_Lower_Limit",Temperature_Lower_Limit);
+ ConfigUtil.write(dishesCon, "Pressure_Upper_Limit",Pressure_Upper_Limit );
+ ConfigUtil.write(dishesCon, "Pressure_Lower_Limit",Pressure_Lower_Limit );
+ ConfigUtil.write(dishesCon, "OpenLid_pressure",OpenLid_pressure );
+ ConfigUtil.write(dishesCon, "Exhaust_Air_Temperature", Exhaust_Air_Temperature);
+ Executor.get().runThread(()->{
+ ModbusHelper.get().WritePar(ControlAdress.温度上限,Temperature_Upper_Limit);
+ ModbusHelper.get().WritePar(ControlAdress.温度下限,Temperature_Lower_Limit);
+ ModbusHelper.get().WritePar(ControlAdress.压力上限,Pressure_Upper_Limit);
+ ModbusHelper.get().WritePar(ControlAdress.压力下限,Pressure_Lower_Limit);
+ ModbusHelper.get().WritePar(ControlAdress.允许开盖压力,OpenLid_pressure);
+ ModbusHelper.get().WritePar(ControlAdress.排冷气温度,Exhaust_Air_Temperature);
+ this.runOnUiThread(()->{ ToastUtils.info("保存成功!");});
+ });
+ }catch (Exception e){
+ MessageLog.ShowError(e);
+ }
+ break;
+ }
+ }
+ //endregion
+}
\ No newline at end of file
diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_qupenren.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_qupenren.java
index e3d0dabd..f3e2e887 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_qupenren.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/add_qupenren.java
@@ -14,8 +14,13 @@ import android.widget.TextView;
import androidx.annotation.Nullable;
+import com.bonait.bnframework.HBL.Dialog.AlertDialogButton;
+import com.bonait.bnframework.HBL.Dialog.DialogManager;
+import com.bonait.bnframework.HBL.Executor;
+import com.bonait.bnframework.MainApplication;
import com.bonait.bnframework.R;
import com.bonait.bnframework.business.ExecuteTheRecipe;
+import com.bonait.bnframework.business.ModbusHelper;
import com.bonait.bnframework.common.constant.ConfigName;
import com.bonait.bnframework.common.constant.DataBus;
import com.bonait.bnframework.common.db.QueryDB;
@@ -38,30 +43,33 @@ public class add_qupenren extends LinearLayout {
@BindView(R.id.quzhizuo)
Button quzhizuo;
+ @BindView(R.id.edit_func)
+ Button edit_func;
+
@BindView(R.id.quzhizuo_ms)
TextView quzhizuo_ms;
- @BindView(R.id.bianji)
- RelativeLayout bianji;
+// @BindView(R.id.bianji)
+// RelativeLayout bianji;
- @BindView(R.id.chaozhi)
- RelativeLayout chaozhi;
+// @BindView(R.id.chaozhi)
+// RelativeLayout chaozhi;
@BindView(R.id.close_from)
Button close_from;
@BindView(R.id.good_name)
TextView good_name;//商品名称
- @BindView(R.id.yihao_text)
- TextView yihao_text;//1号
-
- @BindView(R.id.erhao_text)
- TextView erhao_text;//1号
-
- @BindView(R.id.sanhao_text)
- TextView sanhao_text;//1号
-
- @BindView(R.id.sihao_text)
- TextView sihao_text;//1号
+// @BindView(R.id.yihao_text)
+// TextView yihao_text;//1号
+//
+// @BindView(R.id.erhao_text)
+// TextView erhao_text;//1号
+//
+// @BindView(R.id.sanhao_text)
+// TextView sanhao_text;//1号
+//
+// @BindView(R.id.sihao_text)
+// TextView sihao_text;//1号
/**
* 点击事件
*/
@@ -93,11 +101,6 @@ public class add_qupenren extends LinearLayout {
ConcurrentHashMap resultData= DataBus.getInstance().GetMainDisplayText(id);
- yihao_text.setText(resultData.get(1)+"");
- erhao_text.setText(resultData.get(2)+"");
- sanhao_text.setText(resultData.get(3)+"");
- sihao_text.setText(resultData.get(4)+"");
-
if(ExecuteTheRecipe.IsStart)
{
quzhizuo.setVisibility(View.GONE);
@@ -138,25 +141,14 @@ public class add_qupenren extends LinearLayout {
private void initEvent() {
if (ConfigName.getInstance().user.userID.equals("研发用户")) {
- bianji.setVisibility(View.VISIBLE);
+ edit_func.setVisibility(View.VISIBLE);
} else {
- bianji.setVisibility(View.GONE);
+ edit_func.setVisibility(View.GONE);
}
quzhizuo.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
- if (!ConfigName.getInstance().PlcIsConnect) {
- ToastUtils.warning("PLC未准备就绪!!!");
- return;
- }
-
- Object chushiover = ExecuteTheRecipe.getListingValue("初始化完成");
- //Object jiting = ExecuteTheRecipe.getListingValue("设备急停");
- if (chushiover == null || !(boolean) chushiover) {
- ToastUtils.warning("设备未初始化,请先手动初始化设备!!!");
- return;
- }
if (mListener != null) {
mListener.clickListenerNew(view, 5, mode);
}
@@ -171,7 +163,7 @@ public class add_qupenren extends LinearLayout {
}
});
- bianji.setOnClickListener(new OnClickListener() {
+ edit_func.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View view) {
if (mListener != null) {
@@ -180,13 +172,5 @@ public class add_qupenren extends LinearLayout {
}
});
- chaozhi.setOnClickListener(new OnClickListener() {
- @Override
- public void onClick(View view) {
- if (mListener != null) {
- mListener.clickListenerNew(view, 99, mode);
- }
- }
- });
}
}
\ No newline at end of file
diff --git a/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java b/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java
index a59a9599..6ac3b7a9 100644
--- a/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java
+++ b/app/src/main/java/com/bonait/bnframework/modules/welcome/activity/LoginActivity.java
@@ -348,17 +348,17 @@ public class LoginActivity extends BaseActivity implements Validator.ValidationL
QMUIStatusBarHelper.setStatusBarDarkMode(LoginActivity.this);
- if(ConfigName.getInstance().user.name.equals("admin") || ConfigName.getInstance().user.account.equals("admin") || ConfigName.getInstance().user.userID.equals("超级管理员"))
- {
- Intent intent = new Intent(LoginActivity.this, BottomNavigation2Activity.class);
- intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
- startActivity(intent);
- }else
- {
+// if(ConfigName.getInstance().user.name.equals("admin") || ConfigName.getInstance().user.account.equals("admin") || ConfigName.getInstance().user.userID.equals("超级管理员"))
+// {
+// Intent intent = new Intent(LoginActivity.this, BottomNavigation2Activity.class);
+// intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
+// startActivity(intent);
+// }else
+// {
Intent intent = new Intent(LoginActivity.this, BottomNavigationNewActivity.class);
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
startActivity(intent);
- }
+// }
ToastUtils.info("登录成功!");
// 结束所有Activity
ActivityLifecycleManager.get().finishAllActivity();
diff --git a/app/src/main/res/drawable-xxhdpi/ylg.png b/app/src/main/res/drawable-xxhdpi/ylg.png
new file mode 100644
index 00000000..c42155f7
Binary files /dev/null and b/app/src/main/res/drawable-xxhdpi/ylg.png differ
diff --git a/app/src/main/res/drawable/bg_btn_dialog_qupenren.xml b/app/src/main/res/drawable/bg_btn_dialog_qupenren.xml
new file mode 100644
index 00000000..8b29f758
--- /dev/null
+++ b/app/src/main/res/drawable/bg_btn_dialog_qupenren.xml
@@ -0,0 +1,27 @@
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/control_but_back.xml b/app/src/main/res/drawable/control_but_back.xml
new file mode 100644
index 00000000..01636a3e
--- /dev/null
+++ b/app/src/main/res/drawable/control_but_back.xml
@@ -0,0 +1,35 @@
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/edit_border.xml b/app/src/main/res/drawable/edit_border.xml
new file mode 100644
index 00000000..56b538d5
--- /dev/null
+++ b/app/src/main/res/drawable/edit_border.xml
@@ -0,0 +1,31 @@
+
+
+
+ -
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/drawable/shadow_backcolor.xml b/app/src/main/res/drawable/shadow_backcolor.xml
new file mode 100644
index 00000000..4c511842
--- /dev/null
+++ b/app/src/main/res/drawable/shadow_backcolor.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/activity_diy_update1.xml b/app/src/main/res/layout/activity_diy_update1.xml
index bc0e2cc0..61dafb1b 100644
--- a/app/src/main/res/layout/activity_diy_update1.xml
+++ b/app/src/main/res/layout/activity_diy_update1.xml
@@ -143,161 +143,118 @@
android:layout_marginBottom="@dimen/dp_10"
android:background="@color/color3" />
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_home_device.xml b/app/src/main/res/layout/fragment_home_device.xml
new file mode 100644
index 00000000..a94bf8e6
--- /dev/null
+++ b/app/src/main/res/layout/fragment_home_device.xml
@@ -0,0 +1,281 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/fragment_home_sbkz.xml b/app/src/main/res/layout/fragment_home_sbkz.xml
index 81aa144e..9d0a5cf7 100644
--- a/app/src/main/res/layout/fragment_home_sbkz.xml
+++ b/app/src/main/res/layout/fragment_home_sbkz.xml
@@ -48,13 +48,16 @@
android:layout_weight="4">
+ android:src="@drawable/ylg" />
\ No newline at end of file
diff --git a/app/src/main/res/layout/item/layout/spinner_text_item.xml b/app/src/main/res/layout/item/layout/spinner_text_item.xml
index cf3f6428..3627566b 100644
--- a/app/src/main/res/layout/item/layout/spinner_text_item.xml
+++ b/app/src/main/res/layout/item/layout/spinner_text_item.xml
@@ -9,7 +9,7 @@
android:textAlignment="inherit"
android:gravity="center_vertical"
android:text="请选择"
- android:textSize="12dp"
+ android:textSize="20sp"
android:textColor="@color/black">
diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml
index 78c0cbf1..4dfd4d9e 100644
--- a/app/src/main/res/values/dimens.xml
+++ b/app/src/main/res/values/dimens.xml
@@ -50,4 +50,7 @@
10sp
16sp
60dp
+
+ 20dp
+ 5dp