From 1bede9eda0299ab581bc8548a373ff94fa8040a1 Mon Sep 17 00:00:00 2001 From: fyf Date: Wed, 5 Jul 2023 13:53:02 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=8C=E5=96=84=E7=B3=BB=E7=BB=9F=E8=AE=BE?= =?UTF-8?q?=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../bnframework/business/ConfigData.java | 18 ++++++++----- .../common/constant/ConfigName.java | 6 ++--- .../bnframework/common/constant/DataBus.java | 3 ++- .../common/db/mode/BPA_SYSTEMSET.java | 9 ++++--- .../home/adapter/gongxubuzhou_adapter.java | 3 +++ .../modules/home/adapter/lc_adapter.java | 9 ++++++- .../home/fragment/from/DiyActivity.java | 19 +++++++++++++- .../home/fragment/from/DiyUpdateActivity.java | 18 +++++++++++++ .../fragment/SystemSystemsetFragment.java | 26 +++++++++++++------ app/src/main/res/layout/activity_diy.xml | 1 - .../main/res/layout/activity_diy_update.xml | 1 - .../res/layout/datatab/layout/gx_item.xml | 2 +- .../res/layout/datatab/layout/lcsz_item.xml | 6 ++--- .../res/layout/datatab/layout/wl_item.xml | 4 +-- .../layout/fragment_system_seasoningset.xml | 2 +- .../res/layout/fragment_system_systemset.xml | 25 ++++++++++++++++++ 16 files changed, 118 insertions(+), 34 deletions(-) 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 aa22bba3..f783867d 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java +++ b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java @@ -62,12 +62,15 @@ public class ConfigData { // { // QueryDB.DeleteSystemset(item.id); // } - for (int i = 0; i <4;i++){ - int ty=i+1; + for (int i = 0; i <5;i++){ + int ty=i; BPA_SYSTEMSET set=new BPA_SYSTEMSET(); set.type=ty; switch (ty) { + case 0: + set.value=ConfigName.getInstance().Environment; + break; case 1: set.value=ConfigName.getInstance().Address; break; @@ -75,10 +78,10 @@ public class ConfigData { set.value=String.valueOf(ConfigName.getInstance().Post); break; case 3: - set.value=ConfigName.getInstance().AutKey; + set.value=ConfigName.getInstance().ClientId; break; case 4: - set.value=ConfigName.getInstance().Environment; + set.value=ConfigName.getInstance().DeviceId; break; } set.deviceID = ConfigName.getInstance().DeviceId; @@ -102,6 +105,9 @@ public class ConfigData { { switch (item.type) { + case 0: + ConfigName.getInstance().Environment=item.value; + break; case 1: ConfigName.getInstance().Address=item.value; break; @@ -109,10 +115,10 @@ public class ConfigData { ConfigName.getInstance().Post=Integer.parseInt(item.value); break; case 3: - ConfigName.getInstance().AutKey=item.value; + ConfigName.getInstance().ClientId=item.value; break; case 4: - ConfigName.getInstance().Environment=item.value; + ConfigName.getInstance().DeviceId=item.value; break; } 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 b7b73494..ff4a9803 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 @@ -49,15 +49,13 @@ public class ConfigName { */ public String Shop_Name="黑菠萝奶茶机"; /** - * 店铺设备号 + * 门店Id */ - public String AutKey="152.146"; public String ClientId="152"; - public String DevId="146"; /** * 店铺设备号 */ - public String DeviceId="20020415-test"; + public String DeviceId="146"; //endregion //region MQTT配置中心 diff --git a/app/src/main/java/com/bonait/bnframework/common/constant/DataBus.java b/app/src/main/java/com/bonait/bnframework/common/constant/DataBus.java index dbec12f0..00ecb725 100644 --- a/app/src/main/java/com/bonait/bnframework/common/constant/DataBus.java +++ b/app/src/main/java/com/bonait/bnframework/common/constant/DataBus.java @@ -122,7 +122,8 @@ public class DataBus { { if(index>=0 && lcModes.size()>=0) { - lcModes.get(index).silosmargin=10000; + int zl= lcModes.get(index).siloszl; + lcModes.get(index).silosmargin=zl<=0?10000:zl; QueryDB.UpdateYL(lcModes.get(index).id,lcModes.get(index).silosmargin); if (lcadapter!=null) { diff --git a/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_SYSTEMSET.java b/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_SYSTEMSET.java index d1a32ec3..78ed5d73 100644 --- a/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_SYSTEMSET.java +++ b/app/src/main/java/com/bonait/bnframework/common/db/mode/BPA_SYSTEMSET.java @@ -7,10 +7,11 @@ package com.bonait.bnframework.common.db.mode; public class BPA_SYSTEMSET extends ModeBase{ /** * 类型: - * 1 设备id 店铺Autkey - * 2 PLC地址 - * 3 PLC端口 - * 4 链接环境 + * 0 链接环境 + * 1 PLC地址 + * 2 PLC端口 + * 3 门店id + * 4 设备id */ public int type; //值 diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/gongxubuzhou_adapter.java b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/gongxubuzhou_adapter.java index 28c3e305..8fea4e08 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/gongxubuzhou_adapter.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/gongxubuzhou_adapter.java @@ -58,9 +58,12 @@ public class gongxubuzhou_adapter extends ArrayAdapter { if (selectedPosition == position) { text.setSelected(true); text.setTextColor(Color.WHITE); + text.setBackground(getContext().getResources().getDrawable(R.color.green_primary_dark)); } else { text.setSelected(false); text.setTextColor(Color.BLACK); + text.setBackground(getContext().getResources().getDrawable(R.color.white)); + } return view; } diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/lc_adapter.java b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/lc_adapter.java index de138364..3871486c 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/adapter/lc_adapter.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/adapter/lc_adapter.java @@ -50,7 +50,14 @@ public class lc_adapter extends RecyclerView.Adapter { myViewHolder.name.setText(lcModes.get(position).materialName); int bfb=0; int yl=lcModes.get(position).silosmargin; - bfb= (yl*100)/10000; + int zl=lcModes.get(position).siloszl; + if(zl==0) + { + bfb=0; + }else + { + bfb=((yl*100)/zl)>=100?100:((yl*100)/zl); + } myViewHolder.bfb.setText(bfb+"%"); myViewHolder.type.setText((lcModes.get(position).materiallx==0?"液料":"酱料")); myViewHolder.add.setOnClickListener(new View.OnClickListener() { diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyActivity.java index a99c6281..56ca4027 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyActivity.java @@ -297,6 +297,12 @@ public class DiyActivity extends BaseActivity implements MyClickListener { 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 { @@ -311,6 +317,9 @@ public class DiyActivity extends BaseActivity implements MyClickListener { bpa_goodsrecipes.remove(obj_up); bpa_goodsrecipes.add(index_up-1,obj_up); gxbz_adapter.notifyDataSetChanged(); + + //移动光标 + SetSelectPos(index_up-1); }else { ToastUtils.info("已经最顶部!"); @@ -324,6 +333,9 @@ public class DiyActivity extends BaseActivity implements MyClickListener { bpa_goodsrecipes.remove(obj_down); bpa_goodsrecipes.add(index_down+1,obj_down); gxbz_adapter.notifyDataSetChanged(); + + //移动光标 + SetSelectPos(index_down+1); }else { ToastUtils.info("已经最底部!"); @@ -377,7 +389,12 @@ public class DiyActivity extends BaseActivity implements MyClickListener { break; } } - + public void SetSelectPos(int index) + { + //移动光标 + gxbz_adapter.setSelectedPosition(index); + gxbz_adapter.notifyDataSetInvalidated(); + } @Override public void onDestroy() { super.onDestroy(); diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdateActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdateActivity.java index e24a022f..da685985 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdateActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/DiyUpdateActivity.java @@ -325,6 +325,11 @@ public class DiyUpdateActivity extends BaseActivity { 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 { @@ -339,6 +344,9 @@ public class DiyUpdateActivity extends BaseActivity { bpa_goodsrecipes.remove(obj_up); bpa_goodsrecipes.add(index_up-1,obj_up); gxbz_adapter.notifyDataSetChanged(); + + //移动光标 + SetSelectPos(index_up-1); }else { ToastUtils.info("已经最顶部!"); @@ -352,6 +360,9 @@ public class DiyUpdateActivity extends BaseActivity { bpa_goodsrecipes.remove(obj_down); bpa_goodsrecipes.add(index_down+1,obj_down); gxbz_adapter.notifyDataSetChanged(); + + //移动光标 + SetSelectPos(index_down+1); }else { ToastUtils.info("已经最底部!"); @@ -401,6 +412,13 @@ public class DiyUpdateActivity extends BaseActivity { } } + public void SetSelectPos(int index) + { + //移动光标 + gxbz_adapter.setSelectedPosition(index); + gxbz_adapter.notifyDataSetInvalidated(); + } + @Override public void onDestroy() { super.onDestroy(); 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 e5e67d39..edb914de 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 @@ -36,6 +36,8 @@ public class SystemSystemsetFragment extends BaseFragment { EditText edittext2; @BindView(R.id.edittext3) EditText edittext3; + @BindView(R.id.edittext4) + EditText edittext4; @BindView(R.id.environment) Spinner environment; @@ -86,6 +88,7 @@ public class SystemSystemsetFragment extends BaseFragment { editTextLists.add(edittext1); editTextLists.add(edittext2); editTextLists.add(edittext3); + editTextLists.add(edittext4); material_map.put("开发环境",0); material_map.put("测试环境",1); @@ -97,6 +100,10 @@ public class SystemSystemsetFragment extends BaseFragment { bpa_systemsets= QueryDB.GetSystemsetALL(); for (BPA_SYSTEMSET item:bpa_systemsets) { switch (item.type) { + case 0: + ConfigName.getInstance().Environment=item.value; + environment.setSelection(material_map.get(item.value)); + break; case 1: ConfigName.getInstance().Address=item.value; edittext1.setText(item.value); @@ -106,12 +113,12 @@ public class SystemSystemsetFragment extends BaseFragment { edittext2.setText(item.value); break; case 3: - ConfigName.getInstance().AutKey=item.value; + ConfigName.getInstance().ClientId=item.value; edittext3.setText(item.value); break; case 4: - ConfigName.getInstance().Environment=item.value; - environment.setSelection(material_map.get(item.value)); + ConfigName.getInstance().DeviceId=item.value; + edittext4.setText(item.value); break; } } @@ -121,14 +128,17 @@ public class SystemSystemsetFragment extends BaseFragment { public void onViewClicked(View view) { switch (view.getId()) { case R.id.StartButton://保存按钮 - ConfigName.getInstance().AutKey=edittext1.getText().toString(); - ConfigName.getInstance().Address=edittext2.getText().toString(); - ConfigName.getInstance().Post=Integer.parseInt(edittext3.getText().toString()); + ConfigName.getInstance().Address=edittext1.getText().toString(); + ConfigName.getInstance().Post=Integer.parseInt(edittext2.getText().toString()); + ConfigName.getInstance().ClientId=edittext3.getText().toString(); + ConfigName.getInstance().DeviceId=edittext4.getText().toString(); + ConfigName.getInstance().Environment=environment.getSelectedItem().toString(); for (BPA_SYSTEMSET item:bpa_systemsets) { QueryDB.DeleteSystemset(item.id); } + for (int i = 0; i + + + + + + +