@@ -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; | |||
} | |||
@@ -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配置中心 | |||
@@ -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) | |||
{ | |||
@@ -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; | |||
//值 | |||
@@ -58,9 +58,12 @@ public class gongxubuzhou_adapter extends ArrayAdapter<BPA_GOODSRECIPE> { | |||
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; | |||
} |
@@ -50,7 +50,14 @@ public class lc_adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> { | |||
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() { | |||
@@ -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(); | |||
@@ -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(); | |||
@@ -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 <editTextLists.size();i++){ | |||
BPA_SYSTEMSET set=new BPA_SYSTEMSET(); | |||
set.type=i+1; | |||
@@ -137,13 +147,13 @@ public class SystemSystemsetFragment extends BaseFragment { | |||
set.userID = ConfigName.getInstance().user.userID; | |||
QueryDB.AddSystemset(set); | |||
} | |||
BPA_SYSTEMSET set=new BPA_SYSTEMSET(); | |||
set.type=4; | |||
set.type=0; | |||
set.value=environment.getSelectedItem().toString(); | |||
set.deviceID = ConfigName.getInstance().DeviceId; | |||
set.userID = ConfigName.getInstance().user.userID; | |||
QueryDB.AddSystemset(set); | |||
ToastUtils.info("保存成功"); | |||
break; | |||
@@ -104,7 +104,6 @@ | |||
</LinearLayout> | |||
<ListView | |||
android:id="@+id/datatab_gxbz" | |||
android:listSelector="@color/green_primary_dark" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:divider="#00000000" | |||
@@ -103,7 +103,6 @@ | |||
</LinearLayout> | |||
<ListView | |||
android:id="@+id/datatab_gxbz" | |||
android:listSelector="@color/green_primary_dark" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:divider="#00000000" | |||
@@ -7,7 +7,7 @@ | |||
xsi:schemaLocation="http://schemas.android.com/apk/res/android "> | |||
<TextView | |||
android:id="@+id/text" | |||
android:layout_width="wrap_content" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_centerVertical="true" | |||
android:layout_alignParentLeft="true" | |||
@@ -42,7 +42,7 @@ | |||
<TextView | |||
android:id="@+id/name" | |||
android:layout_width="wrap_content" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_centerVertical="true" | |||
android:layout_marginLeft="20dp" | |||
@@ -58,7 +58,7 @@ | |||
<TextView | |||
android:id="@+id/bjz" | |||
android:layout_width="wrap_content" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_centerVertical="true" | |||
android:layout_marginLeft="20dp" | |||
@@ -74,7 +74,7 @@ | |||
<TextView | |||
android:id="@+id/zlz" | |||
android:layout_width="wrap_content" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_centerVertical="true" | |||
android:layout_marginLeft="20dp" | |||
@@ -26,7 +26,7 @@ | |||
<TextView | |||
android:id="@+id/name" | |||
android:layout_width="wrap_content" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_centerVertical="true" | |||
android:layout_marginLeft="20dp" | |||
@@ -42,7 +42,7 @@ | |||
<TextView | |||
android:id="@+id/lx" | |||
android:layout_width="wrap_content" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_centerVertical="true" | |||
android:layout_marginLeft="20dp" | |||
@@ -324,7 +324,7 @@ | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="工序模型管理" | |||
android:text="工序模型" | |||
android:textSize="19dp" /> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
@@ -96,6 +96,31 @@ | |||
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="商家设备号:" /> | |||
<EditText | |||
android:id="@+id/edittext4" | |||
android:layout_width="120dp" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="5dp" | |||
android:background="@drawable/input_bj" | |||
android:hint="请输入商家设备号" | |||
android:inputType="text" | |||
android:maxLines="1" | |||
android:padding="3dp" | |||
android:textSize="12dp" /> | |||
</TableRow> | |||
</TableLayout> | |||