@@ -6,6 +6,10 @@ android { | |||
namespace 'com.example.bpa' | |||
compileSdk 33 | |||
dataBinding { | |||
enabled = true | |||
} | |||
defaultConfig { | |||
applicationId "com.example.bpa" | |||
minSdk 23 | |||
@@ -61,4 +65,8 @@ dependencies { | |||
implementation files('libs\\sdkapi.jar') | |||
compileOnly files('libs/sdkapi.jar') | |||
implementation files('libs/modbus4Android-1.2.jar') | |||
// implementation 'androidx.databinding:databinding-runtime:4.1.4' | |||
// implementation 'androidx.appcompat:appcompat:1.3.1' | |||
// implementation 'androidx.core:core-ktx:1.6.0' | |||
// implementation 'androidx.databinding:databinding-runtime:4.3.1' | |||
} |
@@ -9,6 +9,7 @@ import com.example.bpa.db.QueryDB; | |||
import com.example.bpa.db.mode.BPA_MATERIAL; | |||
import com.example.bpa.db.mode.BPA_SILOS; | |||
import com.example.bpa.db.mode.BPA_SILOSANDMATERIAL; | |||
import com.example.bpa.db.mode.BPA_SUGAR; | |||
import com.example.bpa.db.mode.BPA_USER; | |||
import com.example.bpa.helper.Json; | |||
import com.example.bpa.helper.SdCart; | |||
@@ -52,7 +53,7 @@ public class ICSApp extends Application { | |||
user.userID = "20230415-fyf"; | |||
user.exp = "管理员"; | |||
QueryDB.AddUser(user); | |||
//10个料仓 | |||
if(QueryDB.GetSilosALL().size() == 0) | |||
{ | |||
for(int i=0;i<10;i++){ | |||
@@ -66,6 +67,42 @@ public class ICSApp extends Application { | |||
QueryDB.AddSilosAndMaterial(sm); | |||
} | |||
} | |||
if(QueryDB.GetSugarALL().size() == 0){ | |||
BPA_SUGAR sugar_A_1 = new BPA_SUGAR(); | |||
BPA_SUGAR sugar_A_5 = new BPA_SUGAR(); | |||
BPA_SUGAR sugar_A_9 = new BPA_SUGAR(); | |||
BPA_SUGAR sugar_A_2 = new BPA_SUGAR(); | |||
BPA_SUGAR sugar_B_1 = new BPA_SUGAR(); | |||
BPA_SUGAR sugar_B_5 = new BPA_SUGAR(); | |||
BPA_SUGAR sugar_B_9 = new BPA_SUGAR(); | |||
BPA_SUGAR sugar_B_2 = new BPA_SUGAR(); | |||
sugar_A_1.sugarName = "果糖A_1"; | |||
sugar_A_5.sugarName = "果糖A_5"; | |||
sugar_A_9.sugarName = "果糖A_9"; | |||
sugar_A_2.sugarName = "果糖A_2"; | |||
sugar_B_1.sugarName = "果糖B_1"; | |||
sugar_B_5.sugarName = "果糖B_5"; | |||
sugar_B_9.sugarName = "果糖B_9"; | |||
sugar_B_2.sugarName = "果糖B_2"; | |||
sugar_A_1.plcvar = "M9.0"; | |||
sugar_A_5.plcvar = "M9.1"; | |||
sugar_A_9.plcvar = "M9.2"; | |||
sugar_A_2.plcvar = "M9.3"; | |||
sugar_B_1.plcvar = "M9.4"; | |||
sugar_B_5.plcvar = "M9.5"; | |||
sugar_B_9.plcvar = "M9.6"; | |||
sugar_B_2.plcvar = "M9.7"; | |||
sugar_A_1.plcvar = "M9.8"; | |||
QueryDB.AddSugar(sugar_A_1); | |||
QueryDB.AddSugar(sugar_A_5); | |||
QueryDB.AddSugar(sugar_A_9); | |||
QueryDB.AddSugar(sugar_A_2); | |||
QueryDB.AddSugar(sugar_B_1); | |||
QueryDB.AddSugar(sugar_B_5); | |||
QueryDB.AddSugar(sugar_B_9); | |||
QueryDB.AddSugar(sugar_B_2); | |||
} | |||
} | |||
} | |||
@@ -17,6 +17,7 @@ import com.example.bpa.db.mode.BPA_ORDERLOGDESC; | |||
import com.example.bpa.db.mode.BPA_SILOS; | |||
import com.example.bpa.db.mode.BPA_SILOSANDMATERIAL; | |||
import com.example.bpa.db.mode.BPA_SUBORDER; | |||
import com.example.bpa.db.mode.BPA_SUGAR; | |||
import com.example.bpa.db.mode.BPA_SYSTEMSET; | |||
import com.example.bpa.db.mode.BPA_USER; | |||
import com.example.bpa.db.mode.ModeBase; | |||
@@ -660,10 +661,20 @@ public class QueryDB { | |||
ArrayList<Object> obj = Get(BPA_GOODSRECIPE.class, where, args, orderby); | |||
for (Object item : obj) { | |||
BPA_GOODSRECIPE k = (BPA_GOODSRECIPE) item; | |||
BPA_MATERIAL ma = GetMaterialID(k.materialID); | |||
if (ma != null) { | |||
String name = ""; | |||
if (k.materialType ==1){ | |||
BPA_MATERIAL res = GetMaterialID(k.materialID); | |||
if (res!= null) { name = GetMaterialID(k.materialID).name;} | |||
}else if (k.materialType ==2){ | |||
BPA_SUGAR res = GetsugarId(k.materialID); | |||
if (res!= null) { name = GetsugarId(k.materialID).sugarName;} | |||
} | |||
if (name != "") { | |||
ResGoodsRecipe par = new ResGoodsRecipe(); | |||
par.id = k.id; | |||
par.materialType = k.materialType; | |||
par.createTime = k.createTime; | |||
par.updateTime = k.updateTime; | |||
par.deleteTime = k.deleteTime; | |||
@@ -671,7 +682,7 @@ public class QueryDB { | |||
par.userID = k.userID; | |||
par.isDelete = k.isDelete; | |||
par.exp = k.exp; | |||
par.materialName = ma.name; | |||
par.materialName = name; | |||
par.goodsID = k.goodsID; | |||
par.materialID = k.materialID; | |||
@@ -1332,6 +1343,68 @@ public class QueryDB { | |||
} | |||
//endregion | |||
//region BPA_SUGAR 果糖辅料表 | |||
/** | |||
* 新增果糖 | |||
* | |||
* @param data | |||
* @return 是否成功 | |||
*/ | |||
public static boolean AddSugar(BPA_SUGAR data) { | |||
return Add(BPA_SUGAR.class, data); | |||
} | |||
/** | |||
* 修改果糖表 | |||
* | |||
* @param data | |||
*/ | |||
public static void UpdateSugar(BPA_SUGAR data) { | |||
Update(BPA_SUGAR.class, data); | |||
} | |||
/** | |||
* 删除菜单用户关联表 | |||
* add fengyoufu 20230413 | |||
* | |||
* @param data | |||
* @return 是否成功 | |||
*/ | |||
public static boolean DeleteSugar(BPA_SUGAR data) { | |||
return Delete(BPA_SUGAR.class, data.id); | |||
} | |||
/** | |||
* 获取菜单用户关联表 | |||
* | |||
* @return | |||
*/ | |||
public static ArrayList<BPA_SUGAR> GetSugarALL() { | |||
String orderby = Desc_Time_Up;//先按排序 创建时间倒序 | |||
String where = "isDelete=?"; | |||
String[] args = new String[]{"0"}; | |||
ArrayList<BPA_SUGAR> data = new ArrayList<>(); | |||
ArrayList<Object> obj = Get(BPA_SUGAR.class, where, args, orderby); | |||
for (Object k : obj) { | |||
data.add((BPA_SUGAR) k); | |||
} | |||
return data; | |||
} | |||
public static BPA_SUGAR GetsugarId(String id) { | |||
String orderby = Desc_Time_Up;//先按排序 创建时间倒序 | |||
String where = "isDelete=? and id=?"; | |||
String[] args = new String[]{"0",id}; | |||
BPA_SUGAR data = new BPA_SUGAR(); | |||
ArrayList<Object> obj = Get(BPA_SUGAR.class, where, args, orderby); | |||
for (Object k : obj) { | |||
data =(BPA_SUGAR) k; | |||
} | |||
return data; | |||
} | |||
//endregion | |||
//region 私有 | |||
/** | |||
@@ -1541,6 +1614,7 @@ public class QueryDB { | |||
((BPA_GOODSRECIPE) data).materialID = cursor.getString((int) cursor.getColumnIndex("materialID")); | |||
((BPA_GOODSRECIPE) data).value = cursor.getInt((int) cursor.getColumnIndex("value")); | |||
((BPA_GOODSRECIPE) data).sort = cursor.getInt((int) cursor.getColumnIndex("sort")); | |||
((BPA_GOODSRECIPE) data).materialType = cursor.getInt((int) cursor.getColumnIndex("materialType")); | |||
break; | |||
case "BPA_ORDER": | |||
data = new BPA_ORDER(); | |||
@@ -1604,6 +1678,11 @@ public class QueryDB { | |||
//私有 | |||
((BPA_MENUANDUSER) data).menuID = cursor.getString((int) cursor.getColumnIndex("menuID")); | |||
break; | |||
case "BPA_SUGAR": | |||
data = new BPA_SUGAR(); | |||
//私有 | |||
((BPA_SUGAR)data).sugarName = cursor.getString((int) cursor.getColumnIndex("sugarName")); | |||
((BPA_SUGAR)data).plcvar = cursor.getString((int) cursor.getColumnIndex("plcvar")); | |||
} | |||
((ModeBase) data).id = cursor.getString((int) cursor.getColumnIndex("id")); | |||
((ModeBase) data).createTime = cursor.getString((int) cursor.getColumnIndex("createTime")); | |||
@@ -16,6 +16,7 @@ import com.example.bpa.db.mode.BPA_ORDERLOGDESC; | |||
import com.example.bpa.db.mode.BPA_SILOS; | |||
import com.example.bpa.db.mode.BPA_SILOSANDMATERIAL; | |||
import com.example.bpa.db.mode.BPA_SUBORDER; | |||
import com.example.bpa.db.mode.BPA_SUGAR; | |||
import com.example.bpa.db.mode.BPA_SYSTEMSET; | |||
import com.example.bpa.db.mode.BPA_USER; | |||
import java.lang.reflect.Field; | |||
@@ -103,6 +104,9 @@ public class DBHelper extends SQLiteOpenHelper { | |||
CreateTablesAll(BPA_USER.class,null);//账户表 | |||
CreateTablesAll(BPA_MENU.class,null);//菜单表 | |||
CreateTablesAll(BPA_MENUANDUSER.class,null);//菜单用户关联表 | |||
CreateTablesAll(BPA_SUGAR.class,null);//果糖表 | |||
ForeignKeys(); | |||
@@ -13,4 +13,6 @@ public class BPA_GOODSRECIPE extends ModeBase { | |||
public int value; | |||
//排序 | |||
public int sort; | |||
public int materialType; | |||
} |
@@ -0,0 +1,7 @@ | |||
package com.example.bpa.db.mode; | |||
public class BPA_SUGAR extends ModeBase{ | |||
public String sugarName; | |||
public String plcvar; | |||
} |
@@ -60,31 +60,32 @@ public class pf_adapter extends ArrayAdapter<ResGoodsRecipe> { | |||
//为每一个子项加载设定的布局 | |||
View view = LayoutInflater.from(getContext()).inflate(R.layout.pf_item, parent, false); | |||
//分别获取 image view 和 textview 的实例 | |||
Spinner name = view.findViewById(R.id.name); | |||
TextView name = view.findViewById(R.id.materialname); | |||
EditText sort = view.findViewById(R.id.sort); | |||
EditText value = view.findViewById(R.id.value); | |||
Button button = view.findViewById(R.id.button_item); | |||
// 设置要显示的图片和文字 | |||
ArrayAdapter mAdapter = new ArrayAdapter<String>(view.getContext(), | |||
R.layout.my_text_view,wuliao); | |||
//mAdapter.addAll(wuliao); | |||
name.setAdapter(mAdapter); | |||
if(resGoodsRecipe.materialName!=null && !resGoodsRecipe.materialName.isEmpty()) | |||
{ | |||
SpinnerAdapter apsAdapter= name.getAdapter(); | |||
int k= apsAdapter.getCount(); | |||
for(int i=0;i<k;i++){ | |||
if(resGoodsRecipe.materialName.equals(apsAdapter.getItem(i).toString())){ | |||
name.setSelection(i,true); | |||
break; | |||
} | |||
} | |||
} | |||
// ArrayAdapter mAdapter = new ArrayAdapter<String>(view.getContext(), | |||
// R.layout.my_text_view,wuliao); | |||
// //mAdapter.addAll(wuliao); | |||
// name.setAdapter(mAdapter); | |||
// if(resGoodsRecipe.materialName!=null && !resGoodsRecipe.materialName.isEmpty()) | |||
// { | |||
// SpinnerAdapter apsAdapter= name.getAdapter(); | |||
// int k= apsAdapter.getCount(); | |||
// for(int i=0;i<k;i++){ | |||
// if(resGoodsRecipe.materialName.equals(apsAdapter.getItem(i).toString())){ | |||
// name.setSelection(i,true); | |||
// break; | |||
// } | |||
// } | |||
// } | |||
name.setText(resGoodsRecipe.materialName); | |||
value.setText(resGoodsRecipe.value+""); | |||
sort.setText(resGoodsRecipe.sort+""); | |||
sort.setTag(resGoodsRecipe.id); | |||
button.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
@@ -143,42 +144,42 @@ public class pf_adapter extends ArrayAdapter<ResGoodsRecipe> { | |||
} | |||
}); | |||
name.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { | |||
@Override | |||
public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { | |||
int index=name.getSelectedItemPosition(); | |||
if(index>=0) | |||
{ | |||
BPA_MATERIAL wljh= wllist.get(name.getSelectedItemPosition()); | |||
resGoodsRecipe.materialName=wljh.name; | |||
resGoodsRecipe.materialID=wljh.id; | |||
datas.set(position,resGoodsRecipe); | |||
}else | |||
{ | |||
T.show(view.getContext(), "不能为空!"); | |||
return; | |||
} | |||
} | |||
@Override | |||
public void onNothingSelected(AdapterView<?> adapterView) { | |||
int index=name.getSelectedItemPosition(); | |||
if(index>=0) | |||
{ | |||
BPA_MATERIAL wljh= wllist.get(name.getSelectedItemPosition()); | |||
resGoodsRecipe.materialName=wljh.name; | |||
resGoodsRecipe.materialID=wljh.id; | |||
datas.set(position,resGoodsRecipe); | |||
}else | |||
{ | |||
resGoodsRecipe.materialName=""; | |||
resGoodsRecipe.materialID=""; | |||
datas.set(position,resGoodsRecipe); | |||
T.show(view.getContext(), "不能为空!"); | |||
return; | |||
} | |||
} | |||
}); | |||
// name.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() { | |||
// @Override | |||
// public void onItemSelected(AdapterView<?> adapterView, View view, int i, long l) { | |||
// int index=name.getSelectedItemPosition(); | |||
// if(index>=0) | |||
// { | |||
// BPA_MATERIAL wljh= wllist.get(name.getSelectedItemPosition()); | |||
// resGoodsRecipe.materialName=wljh.name; | |||
// resGoodsRecipe.materialID=wljh.id; | |||
// datas.set(position,resGoodsRecipe); | |||
// }else | |||
// { | |||
// T.show(view.getContext(), "不能为空!"); | |||
// return; | |||
// } | |||
// } | |||
// | |||
// @Override | |||
// public void onNothingSelected(AdapterView<?> adapterView) { | |||
// int index=name.getSelectedItemPosition(); | |||
// if(index>=0) | |||
// { | |||
// BPA_MATERIAL wljh= wllist.get(name.getSelectedItemPosition()); | |||
// resGoodsRecipe.materialName=wljh.name; | |||
// resGoodsRecipe.materialID=wljh.id; | |||
// datas.set(position,resGoodsRecipe); | |||
// }else | |||
// { | |||
// resGoodsRecipe.materialName=""; | |||
// resGoodsRecipe.materialID=""; | |||
// datas.set(position,resGoodsRecipe); | |||
// T.show(view.getContext(), "不能为空!"); | |||
// return; | |||
// } | |||
// } | |||
// }); | |||
return view; | |||
} | |||
@@ -3,12 +3,10 @@ package com.example.bpa.view.from; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import android.os.Bundle; | |||
import android.util.Log; | |||
import android.view.View; | |||
import android.widget.ArrayAdapter; | |||
import android.widget.Button; | |||
import android.widget.EditText; | |||
import android.widget.ImageView; | |||
import android.widget.LinearLayout; | |||
import android.widget.ListView; | |||
import android.widget.Spinner; | |||
import android.widget.TextView; | |||
@@ -16,20 +14,23 @@ import android.widget.TextView; | |||
import com.example.bpa.R; | |||
import com.example.bpa.config.ConfigName; | |||
import com.example.bpa.config.MessageName; | |||
import com.example.bpa.databinding.ActivityMainBinding; | |||
import com.example.bpa.db.QueryDB; | |||
import com.example.bpa.db.mode.BPA_GOODS; | |||
import com.example.bpa.db.mode.BPA_GOODSRECIPE; | |||
import com.example.bpa.db.mode.BPA_MATERIAL; | |||
import com.example.bpa.db.mode.BPA_SUGAR; | |||
import com.example.bpa.helper.Json; | |||
import com.example.bpa.helper.T; | |||
import com.example.bpa.message.MessageManager; | |||
import com.example.bpa.view.adapter.pf_adapter; | |||
import com.example.bpa.view.adapter.sp_adapter; | |||
import com.example.bpa.view.inteface.MyClickListener; | |||
import com.example.bpa.view.mode.ResGoodsRecipe; | |||
import java.util.ArrayList; | |||
import java.util.LinkedHashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
public class add_pf_activity extends AppCompatActivity implements View.OnClickListener, MyClickListener { | |||
//region 变量 | |||
@@ -51,7 +52,9 @@ public class add_pf_activity extends AppCompatActivity implements View.OnClickLi | |||
/** | |||
* 增加按钮 | |||
*/ | |||
Button buttonsave, buttonaddwuliao; | |||
Button buttonsave,btn_addwuliao,btn_addguotang; | |||
Spinner wuliaolist_spinner,guotanglist_spinner; | |||
/** | |||
* 表格显示 | |||
*/ | |||
@@ -60,6 +63,12 @@ public class add_pf_activity extends AppCompatActivity implements View.OnClickLi | |||
* 配方数据 | |||
*/ | |||
ArrayList<ResGoodsRecipe> bpa_pf = new ArrayList<>(); | |||
/** | |||
* 物料和果糖map | |||
*/ | |||
Map<String,String> material_map = new LinkedHashMap<>(); | |||
Map<String,String> sugar_map = new LinkedHashMap<>(); | |||
/** | |||
* 当前传入的商品数据 | |||
*/ | |||
@@ -96,7 +105,12 @@ public class add_pf_activity extends AppCompatActivity implements View.OnClickLi | |||
gongneng_title = this.findViewById(R.id.gongneng_title); | |||
edittext = this.findViewById(R.id.edittext); | |||
buttonsave = this.findViewById(R.id.buttonsave); | |||
buttonaddwuliao = this.findViewById(R.id.buttonaddwuliao); | |||
btn_addwuliao = this.findViewById(R.id.btn_addwuliao); | |||
btn_addguotang = this.findViewById(R.id.btn_addguotang); | |||
wuliaolist_spinner = this.findViewById(R.id.wuliaolist_spinner); | |||
guotanglist_spinner = this.findViewById(R.id.guotanglist_spinner); | |||
datatab = this.findViewById(R.id.datatab); | |||
//通过Activity.getIntent()获取当前页面接收到的Intent。 getXxxExtra方法获取Intent传递过来的数据 | |||
String msg = getIntent().getStringExtra("title"); | |||
@@ -119,7 +133,8 @@ public class add_pf_activity extends AppCompatActivity implements View.OnClickLi | |||
private void initEvents() { | |||
gongneng_fanhui.setOnClickListener(this); | |||
buttonsave.setOnClickListener(this); | |||
buttonaddwuliao.setOnClickListener(this); | |||
btn_addwuliao.setOnClickListener(this); | |||
btn_addguotang.setOnClickListener(this); | |||
} | |||
/** | |||
@@ -134,9 +149,34 @@ public class add_pf_activity extends AppCompatActivity implements View.OnClickLi | |||
bpa_pf= QueryDB.GetGoodsSrecipeList(good.id); | |||
DataTab(); | |||
} | |||
} catch (Exception e) { | |||
} | |||
try { | |||
//获取全部物料绑定物料spinner | |||
List<BPA_MATERIAL> resMaterials = QueryDB.GetMaterialALL(); | |||
for (BPA_MATERIAL material:resMaterials){ | |||
material_map.put(material.name,material.id); | |||
} | |||
ArrayAdapter<String> adapter = new ArrayAdapter<>(this, R.layout.spinner_text_item, new ArrayList<>(material_map.keySet())); | |||
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item); | |||
wuliaolist_spinner.setAdapter(adapter); | |||
List<BPA_SUGAR> resSugars = QueryDB.GetSugarALL(); | |||
for (BPA_SUGAR sugar:resSugars){ | |||
sugar_map.put(sugar.sugarName,sugar.id); | |||
} | |||
ArrayAdapter<String> adapter2 = new ArrayAdapter<>(this, R.layout.spinner_text_item, new ArrayList<>(sugar_map.keySet())); | |||
adapter2.setDropDownViewResource(R.layout.spinner_dropdown_item); | |||
guotanglist_spinner.setAdapter(adapter2); | |||
} | |||
catch (Exception e) { | |||
} | |||
} | |||
/** | |||
@@ -162,13 +202,7 @@ public class add_pf_activity extends AppCompatActivity implements View.OnClickLi | |||
case R.id.gongneng_fanhui://返回按钮 | |||
this.finish(); | |||
break; | |||
case R.id.buttonaddwuliao://新增空白行 | |||
ResGoodsRecipe recipe=new ResGoodsRecipe();//new 一个空对象 | |||
if(adapter!=null) bpa_pf=adapter.GetDatas(); | |||
recipe.sort=bpa_pf.size()+1; | |||
bpa_pf.add(recipe); | |||
DataTab(); | |||
break; | |||
case R.id.buttonsave://保存按钮点击 | |||
if(adapter==null || bpa_pf.size()<=0) | |||
{ | |||
@@ -220,6 +254,7 @@ public class add_pf_activity extends AppCompatActivity implements View.OnClickLi | |||
BPA_GOODSRECIPE da=new BPA_GOODSRECIPE(); | |||
da.goodsID = good.id; | |||
da.materialID = item.materialID; | |||
da.materialType = item.materialType; | |||
da.value = item.value; | |||
da.sort =item.sort; | |||
da.deviceID = ConfigName.getInstance().DeviceId; | |||
@@ -230,6 +265,26 @@ public class add_pf_activity extends AppCompatActivity implements View.OnClickLi | |||
MessageManager.getInstance().sendMessage(MessageName.PF_From_Close.name(),"Close"); | |||
this.finish(); | |||
break; | |||
case R.id.btn_addwuliao: | |||
ResGoodsRecipe recipe1=new ResGoodsRecipe();//new 一个空对象 | |||
if(adapter!=null) bpa_pf=adapter.GetDatas(); | |||
recipe1.materialType = 1;//物料类型 | |||
recipe1.sort=bpa_pf.size()+1; | |||
recipe1.materialName = wuliaolist_spinner.getSelectedItem().toString(); | |||
recipe1.materialID = material_map.get(recipe1.materialName); | |||
bpa_pf.add(recipe1); | |||
DataTab(); | |||
break; | |||
case R.id.btn_addguotang: | |||
ResGoodsRecipe recipe=new ResGoodsRecipe();//new 一个空对象 | |||
if(adapter!=null) bpa_pf=adapter.GetDatas(); | |||
recipe.sort=bpa_pf.size()+1; | |||
recipe.materialType = 2; | |||
recipe.materialName = guotanglist_spinner.getSelectedItem().toString(); | |||
recipe.materialID = sugar_map.get(recipe.materialName); | |||
bpa_pf.add(recipe); | |||
DataTab(); | |||
break; | |||
} | |||
} | |||
@@ -1,6 +1,7 @@ | |||
package com.example.bpa.view.from; | |||
import androidx.appcompat.app.AppCompatActivity; | |||
import androidx.databinding.DataBindingUtil; | |||
import androidx.fragment.app.Fragment; | |||
import androidx.fragment.app.FragmentManager; | |||
import androidx.fragment.app.FragmentTransaction; | |||
@@ -53,7 +54,6 @@ public class ddyjrz_activity extends AppCompatActivity implements View.OnClickLi | |||
//通过Activity.getIntent()获取当前页面接收到的Intent。 getXxxExtra方法获取Intent传递过来的数据 | |||
String msg=getIntent().getStringExtra("data"); | |||
gongneng_title.setText(msg); | |||
((TextView)this.findViewById(R.id.test_view)).setText(msg); | |||
} | |||
@@ -6,6 +6,9 @@ import com.example.bpa.db.mode.BPA_GOODSRECIPE; | |||
* 界面显示商品配方结构 | |||
*/ | |||
public class ResGoodsRecipe extends BPA_GOODSRECIPE { | |||
public String id; | |||
//物料名称 | |||
public String materialName; | |||
public int materialType; | |||
} |
@@ -19,20 +19,33 @@ | |||
android:layout_width="0dp" | |||
android:layout_height="match_parent" | |||
android:layout_weight="1"> | |||
<Spinner | |||
android:id="@+id/name" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
<TextView | |||
android:id="@+id/materialname" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_centerVertical="true" | |||
android:layout_marginLeft="20dp" | |||
android:layout_alignParentLeft="true" | |||
android:inputType="text" | |||
android:padding="3dp" | |||
android:theme="@style/MyEditText1" | |||
android:spinnerMode="dropdown" | |||
android:background="@drawable/round_corners_bg" | |||
android:textColor="@color/foreground" | |||
android:textSize="@dimen/textSize"/> | |||
android:textSize="@dimen/textSize" | |||
android:text="11111"/> | |||
<!-- <Spinner--> | |||
<!-- android:id="@+id/name"--> | |||
<!-- android:layout_width="match_parent"--> | |||
<!-- android:layout_height="match_parent"--> | |||
<!-- android:layout_centerVertical="true"--> | |||
<!-- android:layout_marginLeft="20dp"--> | |||
<!-- android:layout_alignParentLeft="true"--> | |||
<!-- android:inputType="text"--> | |||
<!-- android:padding="3dp"--> | |||
<!-- android:theme="@style/MyEditText1"--> | |||
<!-- android:spinnerMode="dropdown"--> | |||
<!-- android:background="@drawable/round_corners_bg"--> | |||
<!-- android:textColor="@color/foreground"--> | |||
<!-- android:textSize="@dimen/textSize"/>--> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="0dp" | |||
@@ -1,124 +1,160 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:app="http://schemas.android.com/apk/res-auto" | |||
<layout | |||
xmlns:android="http://schemas.android.com/apk/res/android" | |||
xmlns:tools="http://schemas.android.com/tools" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:orientation="vertical" | |||
android:background="@mipmap/dpbj" | |||
tools:context=".view.from.add_pf_activity"> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="30dp" | |||
android:background="@color/test"> | |||
<ImageView | |||
android:id="@+id/gongneng_fanhui" | |||
android:layout_width="26dp" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentLeft="true" | |||
android:layout_centerVertical="true" | |||
android:layout_marginLeft="20dp" | |||
android:textSize="@dimen/TitleSize" | |||
android:textColor="@color/titleforeground" | |||
android:src="@mipmap/zj" | |||
/> | |||
<LinearLayout | |||
android:layout_width="wrap_content" | |||
android:layout_height="match_parent" | |||
android:orientation="vertical" | |||
android:background="@mipmap/dpbj"> | |||
<RelativeLayout | |||
android:layout_centerInParent="true" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content"> | |||
<TextView | |||
android:id="@+id/gongneng_title" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_centerInParent="true" | |||
android:textColor="@color/white" | |||
android:textSize="@dimen/textTitleSize" | |||
android:textStyle="bold" /> | |||
android:layout_width="match_parent" | |||
android:layout_height="30dp" | |||
android:background="@color/test"> | |||
<ImageView | |||
android:layout_width="400dp" | |||
android:layout_height="22dp" | |||
android:layout_alignParentBottom="true" | |||
android:src="@mipmap/tittle" | |||
android:layout_marginLeft="5dp" | |||
android:id="@+id/gongneng_fanhui" | |||
android:layout_width="26dp" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentLeft="true" | |||
android:layout_centerVertical="true" | |||
android:layout_marginLeft="20dp" | |||
android:textSize="@dimen/TitleSize" | |||
android:textColor="@color/titleforeground" | |||
android:src="@mipmap/zj" | |||
/> | |||
<RelativeLayout | |||
android:layout_centerInParent="true" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content"> | |||
<TextView | |||
android:id="@+id/gongneng_title" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_centerInParent="true" | |||
android:textColor="@color/white" | |||
android:textSize="@dimen/textTitleSize" | |||
android:textStyle="bold" /> | |||
<ImageView | |||
android:layout_width="400dp" | |||
android:layout_height="22dp" | |||
android:layout_alignParentBottom="true" | |||
android:src="@mipmap/tittle" | |||
android:layout_marginLeft="5dp" | |||
/> | |||
</RelativeLayout> | |||
</RelativeLayout> | |||
</RelativeLayout> | |||
<View | |||
android:layout_width="match_parent" | |||
android:layout_height="1dp" | |||
android:background="#FF03668F" /> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_margin="5dp"> | |||
<ImageView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentLeft="true" | |||
android:layout_alignParentTop="true" | |||
android:src="@mipmap/zs"/> | |||
<ImageView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentLeft="true" | |||
android:layout_alignParentBottom="true" | |||
android:src="@mipmap/zx"/> | |||
<ImageView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentRight="true" | |||
android:layout_alignParentTop="true" | |||
android:src="@mipmap/ys"/> | |||
<ImageView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentRight="true" | |||
android:layout_alignParentBottom="true" | |||
android:src="@mipmap/yx"/> | |||
<View | |||
android:layout_width="match_parent" | |||
android:layout_height="1dp" | |||
android:background="#FF03668F" /> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_margin="10dp"> | |||
<LinearLayout | |||
android:layout_margin="5dp"> | |||
<ImageView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentLeft="true" | |||
android:layout_alignParentTop="true" | |||
android:src="@mipmap/zs"/> | |||
<ImageView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentLeft="true" | |||
android:layout_alignParentBottom="true" | |||
android:src="@mipmap/zx"/> | |||
<ImageView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentRight="true" | |||
android:layout_alignParentTop="true" | |||
android:src="@mipmap/ys"/> | |||
<ImageView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentRight="true" | |||
android:layout_alignParentBottom="true" | |||
android:src="@mipmap/yx"/> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:orientation="vertical"> | |||
<RelativeLayout | |||
android:layout_margin="10dp"> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="50dp"> | |||
<LinearLayout | |||
android:layout_height="match_parent" | |||
android:orientation="vertical"> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentBottom="true"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="50dp"> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:text="饮料名称:" | |||
android:textSize="@dimen/textSize" | |||
android:textColor="@color/foreground"/> | |||
<EditText | |||
android:id="@+id/edittext" | |||
android:layout_width="200dp" | |||
android:layout_alignParentBottom="true"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="饮料名称:" | |||
android:textSize="@dimen/textSize" | |||
android:textColor="@color/foreground"/> | |||
<EditText | |||
android:id="@+id/edittext" | |||
android:layout_width="200dp" | |||
android:layout_height="wrap_content" | |||
android:inputType="text" | |||
android:padding="3dp" | |||
android:textColor="@color/foreground" | |||
android:theme="@style/MyEditText1" | |||
android:background="@drawable/round_corners_bg" | |||
android:layout_marginLeft="5dp" | |||
android:hint="请输入饮料名称" | |||
android:maxLines="1" | |||
android:textSize="@dimen/textSize" /> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:inputType="text" | |||
android:padding="3dp" | |||
android:textColor="@color/foreground" | |||
android:theme="@style/MyEditText1" | |||
android:background="@drawable/round_corners_bg" | |||
android:layout_marginLeft="5dp" | |||
android:hint="请输入饮料名称" | |||
android:maxLines="1" | |||
android:textSize="@dimen/textSize"/> | |||
</LinearLayout> | |||
android:layout_alignParentRight="true" | |||
android:layout_marginRight="20dp" | |||
android:layout_alignParentBottom="true"> | |||
<Button | |||
android:id="@+id/buttonaddwuliao" | |||
android:text="添加新行" | |||
android:background="@drawable/btn_button" | |||
android:textSize="@dimen/textSize" | |||
android:textColor="@color/foreground" | |||
android:layout_marginLeft="5dp" | |||
android:layout_gravity="center" | |||
android:layout_width="80dp" | |||
android:layout_height="26dp" | |||
/> | |||
<Button | |||
android:id="@+id/buttonsave" | |||
android:text="保存饮品" | |||
android:background="@drawable/btn_button" | |||
android:textSize="@dimen/textSize" | |||
android:textColor="@color/foreground" | |||
android:layout_marginLeft="5dp" | |||
android:layout_gravity="center" | |||
android:layout_width="80dp" | |||
android:layout_height="26dp" | |||
/> | |||
</LinearLayout> | |||
</RelativeLayout> | |||
<LinearLayout | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentRight="true" | |||
android:layout_marginRight="20dp" | |||
android:layout_alignParentBottom="true"> | |||
android:layout_height="wrap_content"> | |||
<Spinner | |||
android:id="@+id/wuliaolist_spinner" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
style="@style/commonSpinnerStyle"/> | |||
<Button | |||
android:id="@+id/buttonaddwuliao" | |||
android:text="添加新行" | |||
android:id="@+id/btn_addwuliao" | |||
android:background="@drawable/btn_button" | |||
android:textSize="@dimen/textSize" | |||
android:textColor="@color/foreground" | |||
@@ -126,10 +162,16 @@ | |||
android:layout_gravity="center" | |||
android:layout_width="80dp" | |||
android:layout_height="26dp" | |||
android:text="添加物料" | |||
/> | |||
<Spinner | |||
android:id="@+id/guotanglist_spinner" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
style="@style/commonSpinnerStyle"/> | |||
<Button | |||
android:id="@+id/buttonsave" | |||
android:text="保存饮品" | |||
android:id="@+id/btn_addguotang" | |||
android:background="@drawable/btn_button" | |||
android:textSize="@dimen/textSize" | |||
android:textColor="@color/foreground" | |||
@@ -137,114 +179,114 @@ | |||
android:layout_gravity="center" | |||
android:layout_width="80dp" | |||
android:layout_height="26dp" | |||
/> | |||
android:text="添加果糖"/> | |||
</LinearLayout> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
<LinearLayout | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_marginTop="10dp" | |||
android:orientation="vertical"> | |||
<RelativeLayout | |||
android:layout_height="match_parent"> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:background="@mipmap/bgbtbj" | |||
android:layout_height="26dp"> | |||
<View | |||
android:layout_height="match_parent" | |||
android:layout_marginTop="10dp" | |||
android:orientation="vertical"> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="1dp" | |||
android:background="#FF03668F" /> | |||
<View | |||
android:layout_width="match_parent" | |||
android:layout_height="1dp" | |||
android:layout_alignParentBottom="true" | |||
android:background="#FF03668F" /> | |||
<TableLayout | |||
android:layout_centerVertical="true" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:gravity="center" | |||
android:layout_gravity="center" | |||
android:stretchColumns="0"> | |||
<TableRow | |||
android:layout_width="fill_parent" | |||
android:background="@mipmap/bgbtbj" | |||
android:layout_height="26dp"> | |||
<View | |||
android:layout_width="match_parent" | |||
android:layout_height="1dp" | |||
android:background="#FF03668F" /> | |||
<View | |||
android:layout_width="match_parent" | |||
android:layout_height="1dp" | |||
android:layout_alignParentBottom="true" | |||
android:background="#FF03668F" /> | |||
<TableLayout | |||
android:layout_centerVertical="true" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:gravity="center_horizontal"> | |||
<RelativeLayout | |||
android:layout_width="0dp" | |||
android:gravity="center" | |||
android:layout_gravity="center" | |||
android:stretchColumns="0"> | |||
<TableRow | |||
android:layout_width="fill_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_weight="1"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:gravity="center_horizontal"> | |||
<RelativeLayout | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="20dp" | |||
android:layout_alignParentLeft="true" | |||
android:text="物料名称" | |||
android:textColor="@color/dataGridColumnHeaderColor" | |||
android:textSize="@dimen/textSize" /> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:layout_weight="1"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_weight="1"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="20dp" | |||
android:layout_alignParentLeft="true" | |||
android:text="物料名称" | |||
android:textColor="@color/dataGridColumnHeaderColor" | |||
android:textSize="@dimen/textSize" /> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="20dp" | |||
android:layout_alignParentLeft="true" | |||
android:text="出料顺序" | |||
android:textColor="@color/dataGridColumnHeaderColor" | |||
android:textSize="@dimen/textSize" /> | |||
</RelativeLayout> | |||
android:layout_weight="1"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="20dp" | |||
android:layout_alignParentLeft="true" | |||
android:text="出料顺序" | |||
android:textColor="@color/dataGridColumnHeaderColor" | |||
android:textSize="@dimen/textSize" /> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:layout_weight="1"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
<RelativeLayout | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="20dp" | |||
android:layout_alignParentLeft="true" | |||
android:text="微调数值" | |||
android:textColor="@color/dataGridColumnHeaderColor" | |||
android:textSize="@dimen/textSize" /> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:layout_weight="2"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_weight="1"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="20dp" | |||
android:layout_alignParentLeft="true" | |||
android:text="微调数值" | |||
android:textColor="@color/dataGridColumnHeaderColor" | |||
android:textSize="@dimen/textSize" /> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="20dp" | |||
android:layout_alignParentLeft="true" | |||
android:text="操作" | |||
android:textColor="@color/dataGridColumnHeaderColor" | |||
android:textSize="@dimen/textSize" /> | |||
</RelativeLayout> | |||
</TableRow> | |||
</TableLayout> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
<ListView | |||
android:id="@+id/datatab" | |||
android:layout_weight="2"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="20dp" | |||
android:layout_alignParentLeft="true" | |||
android:text="操作" | |||
android:textColor="@color/dataGridColumnHeaderColor" | |||
android:textSize="@dimen/textSize" /> | |||
</RelativeLayout> | |||
</TableRow> | |||
</TableLayout> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:divider="#00000000" | |||
android:dividerHeight="3dp" | |||
android:layout_marginTop="3dp" | |||
/> | |||
</RelativeLayout> | |||
</LinearLayout> | |||
</RelativeLayout> | |||
</LinearLayout> | |||
android:layout_height="match_parent"> | |||
<ListView | |||
android:id="@+id/datatab" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:divider="#00000000" | |||
android:dividerHeight="3dp" | |||
android:layout_marginTop="3dp" | |||
/> | |||
</RelativeLayout> | |||
</LinearLayout> | |||
</RelativeLayout> | |||
</LinearLayout> | |||
</RelativeLayout> | |||
</RelativeLayout> | |||
</RelativeLayout> | |||
</LinearLayout> | |||
</LinearLayout> | |||
</layout> | |||