@@ -950,6 +950,8 @@ public class ConfigData { | |||
silo.warningValue=50; | |||
silo.silosmargin=0; | |||
silo.siloszl=1000; | |||
silo.exp=item.ShowNum+""; | |||
silo.bValue=5; | |||
BPA_SILOSANDMATERIAL sm = new BPA_SILOSANDMATERIAL(); | |||
sm.silosID = silo.id; | |||
sm.materialID = ""; | |||
@@ -231,20 +231,20 @@ public class ConfigName { | |||
* 奶茶机料仓模型 | |||
*/ | |||
public List<ResSilosModel> Silos_味魔方 = new ArrayList<ResSilosModel>() {{ | |||
add(new ResSilosModel("粉料仓", 1)); | |||
add(new ResSilosModel("粉料仓", 2)); | |||
add(new ResSilosModel("粉料仓", 3)); | |||
add(new ResSilosModel("粉料仓", 4)); | |||
add(new ResSilosModel("粉料仓", 5)); | |||
add(new ResSilosModel("粉料仓", 6)); | |||
add(new ResSilosModel("外置仓", 7)); | |||
add(new ResSilosModel("外置仓", 8)); | |||
add(new ResSilosModel("外置仓", 9)); | |||
add(new ResSilosModel("外置仓", 10)); | |||
add(new ResSilosModel("外置仓", 11)); | |||
add(new ResSilosModel("外置仓", 12)); | |||
add(new ResSilosModel("外置仓", 13)); | |||
add(new ResSilosModel("外置仓", 14)); | |||
add(new ResSilosModel("粉料仓",1 , 1 )); | |||
add(new ResSilosModel("粉料仓",2 , 2 )); | |||
add(new ResSilosModel("粉料仓",3 , 3 )); | |||
add(new ResSilosModel("粉料仓",4 , 4 )); | |||
add(new ResSilosModel("粉料仓",5 , 5 )); | |||
add(new ResSilosModel("粉料仓",6 , 6 )); | |||
add(new ResSilosModel("外置仓",7 , 7 )); | |||
add(new ResSilosModel("外置仓",8 , 8 )); | |||
add(new ResSilosModel("外置仓",9 , 9 )); | |||
add(new ResSilosModel("外置仓",10, 10)); | |||
add(new ResSilosModel("外置仓",11, 11)); | |||
add(new ResSilosModel("外置仓",12, 12)); | |||
add(new ResSilosModel("外置仓",13, 13)); | |||
add(new ResSilosModel("外置仓",14, 14)); | |||
}}; | |||
@@ -500,18 +500,18 @@ public class ConfigName { | |||
* 奶茶机料仓模型 | |||
*/ | |||
public List<ResSilosModel> Silos_奶茶机 = new ArrayList<ResSilosModel>() {{ | |||
add(new ResSilosModel("液体仓", 1)); | |||
add(new ResSilosModel("液体仓", 2)); | |||
add(new ResSilosModel("液体仓", 3)); | |||
add(new ResSilosModel("液体仓", 4)); | |||
add(new ResSilosModel("液体仓", 5)); | |||
add(new ResSilosModel("液体仓", 6)); | |||
add(new ResSilosModel("液体仓", 7)); | |||
add(new ResSilosModel("液体仓", 8)); | |||
add(new ResSilosModel("液体仓", 9)); | |||
add(new ResSilosModel("液体仓", 10)); | |||
add(new ResSilosModel("果糖仓", 11)); | |||
add(new ResSilosModel("果糖仓", 12)); | |||
add(new ResSilosModel("液体仓",1 , 1 )); | |||
add(new ResSilosModel("液体仓",2 , 2 )); | |||
add(new ResSilosModel("液体仓",3 , 3 )); | |||
add(new ResSilosModel("液体仓",4 , 4 )); | |||
add(new ResSilosModel("液体仓",5 , 5 )); | |||
add(new ResSilosModel("液体仓",6 , 6 )); | |||
add(new ResSilosModel("液体仓",7 , 7 )); | |||
add(new ResSilosModel("液体仓",8 , 8 )); | |||
add(new ResSilosModel("液体仓",9 , 9 )); | |||
add(new ResSilosModel("液体仓",10, 10)); | |||
add(new ResSilosModel("果糖仓",11, 11)); | |||
add(new ResSilosModel("果糖仓",12, 12)); | |||
}}; | |||
/** | |||
@@ -792,22 +792,22 @@ public class ConfigName { | |||
* 配料吧台料仓模型 | |||
*/ | |||
public List<ResSilosModel> Silos_配料吧台 = new ArrayList<ResSilosModel>() {{ | |||
add(new ResSilosModel("外置仓", 1)); | |||
add(new ResSilosModel("外置仓", 2)); | |||
add(new ResSilosModel("外置仓", 3)); | |||
add(new ResSilosModel("外置仓", 4)); | |||
add(new ResSilosModel("外置仓", 5)); | |||
add(new ResSilosModel("外置仓", 6)); | |||
add(new ResSilosModel("粉料仓", 7)); | |||
add(new ResSilosModel("粉料仓", 8)); | |||
add(new ResSilosModel("粉料仓", 9)); | |||
add(new ResSilosModel("液料仓", 10)); | |||
add(new ResSilosModel("液料仓", 11)); | |||
add(new ResSilosModel("加热仓", 12)); | |||
add(new ResSilosModel("加热仓", 13)); | |||
add(new ResSilosModel("粉料仓", 14)); | |||
add(new ResSilosModel("粉料仓", 15)); | |||
add(new ResSilosModel("粉料仓", 16)); | |||
add(new ResSilosModel("外置仓",1 , 1 )); | |||
add(new ResSilosModel("外置仓",2 , 2 )); | |||
add(new ResSilosModel("外置仓",3 , 3 )); | |||
add(new ResSilosModel("外置仓",4 , 4 )); | |||
add(new ResSilosModel("外置仓",5 , 5 )); | |||
add(new ResSilosModel("外置仓",6 , 6 )); | |||
add(new ResSilosModel("粉料仓",7 , 7 )); | |||
add(new ResSilosModel("粉料仓",8 , 8 )); | |||
add(new ResSilosModel("粉料仓",9 , 9 )); | |||
add(new ResSilosModel("液料仓",13, 10)); | |||
add(new ResSilosModel("液料仓",14, 11)); | |||
add(new ResSilosModel("加热仓",15, 12)); | |||
add(new ResSilosModel("加热仓",16, 13)); | |||
add(new ResSilosModel("粉料仓",10, 14)); | |||
add(new ResSilosModel("粉料仓",11, 15)); | |||
add(new ResSilosModel("粉料仓",12, 16)); | |||
}}; | |||
/** | |||
@@ -29,6 +29,7 @@ import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.helper.MessageLog; | |||
import com.bonait.bnframework.common.helper.mode.OrderA; | |||
import com.bonait.bnframework.common.helper.mode.ResultA; | |||
import com.bonait.bnframework.common.linktab.LinkMode; | |||
import com.bonait.bnframework.modules.home.adapter.loadinggood_adapter; | |||
import com.bonait.bnframework.modules.home.adapter.pfsx_adapter; | |||
import com.bonait.bnframework.modules.home.adapter.wdsz_adapter; | |||
@@ -38,6 +39,7 @@ import com.bonait.bnframework.modules.home.fragment.mode.tab_control; | |||
import java.util.ArrayList; | |||
import java.util.HashMap; | |||
import java.util.LinkedHashMap; | |||
import java.util.List; | |||
import java.util.Map; | |||
@@ -62,6 +64,39 @@ public class DataBus { | |||
//endregion | |||
//region 数据中心 | |||
/** | |||
* 料仓数据 | |||
*/ | |||
public ArrayList<LinkMode> SilosData = new ArrayList<>(); | |||
/** | |||
* 获取料仓数据 | |||
*/ | |||
public void RefreshSilos() | |||
{ | |||
ArrayList<lcMode> lcModes = DataBus.getInstance().ResGetLc(); | |||
SilosData.clear(); | |||
LinkedHashMap<String, List<Object>> map = new LinkedHashMap<>(); | |||
for (lcMode item : lcModes) { | |||
if (map.containsKey(item.name)) { | |||
map.get(item.name).add(item); | |||
} else { | |||
List<Object> lc = new ArrayList<>(); | |||
lc.add(item); | |||
map.put(item.name, lc); | |||
} | |||
} | |||
/** | |||
* 编例HashMap中所有key跟value的值 | |||
*/ | |||
int i = 0; | |||
for (Object key : map.keySet()) { | |||
List<Object> value = map.get(key); | |||
LinkMode linkMode = new LinkMode(key.toString(), value, i == 0 ? true : false); | |||
SilosData.add(linkMode); | |||
i++; | |||
} | |||
} | |||
/** | |||
* 获取料仓数据 | |||
@@ -32,4 +32,6 @@ public interface MessageName { | |||
String ClickSilos="ClickSilos";//点击料仓 | |||
String RefreshSilos="RefreshSilos";//刷新料仓 | |||
} |
@@ -328,66 +328,6 @@ public class QueryDB { | |||
return data; | |||
} | |||
/** | |||
* 获取料仓数据 | |||
* | |||
* @return | |||
*/ | |||
public static ArrayList<ResSilosMode> GetSilos() { | |||
ArrayList<ResSilosMode> data = new ArrayList<>(); | |||
//1.获取料仓数据 | |||
ArrayList<BPA_SILOS> silos = GetSilosALL(); | |||
//2.获取物料 | |||
ArrayList<BPA_MATERIAL> materials = GetMaterialALL(); | |||
//3.获取返回数据 | |||
for (BPA_SILOS k : silos) { | |||
ResSilosMode par = new ResSilosMode(); | |||
par.id = k.id; | |||
par.createTime = k.createTime; | |||
par.updateTime = k.updateTime; | |||
par.deleteTime = k.deleteTime; | |||
par.deviceID = k.deviceID; | |||
par.userID = k.userID; | |||
par.isDelete = k.isDelete; | |||
par.exp = k.exp; | |||
par.num = k.num; | |||
par.name = k.name; | |||
par.warningValue = k.warningValue; | |||
par.thrsoleValue = k.thrsoleValue; | |||
par.silosmargin = k.silosmargin; | |||
par.siloszl = k.siloszl; | |||
par.plcValue = k.plcValue; | |||
par.bValue = k.bValue; | |||
par.jValue = k.jValue; | |||
par.status = k.status; | |||
par.Sort = k.Sort; | |||
ArrayList<String> gx = GetMaterialList(k.id); | |||
if (!gx.isEmpty() && gx.size() > 0) { | |||
String wlid = gx.get(0); | |||
if (!wlid.isEmpty()) { | |||
BPA_MATERIAL wl = null; | |||
for (BPA_MATERIAL m : materials) { | |||
if (m.id.equals(wlid)) { | |||
wl = m; | |||
break; | |||
} | |||
} | |||
if (wl != null) { | |||
par.materialID = wl.id; | |||
par.materialimgUrl = wl.imgUrl; | |||
par.materialname = wl.name; | |||
} | |||
} | |||
} | |||
par.dvalue = 0; | |||
data.add(par); | |||
} | |||
return data; | |||
} | |||
/** | |||
* 根据ID查询料仓管理 | |||
@@ -15,7 +15,7 @@ public class BPA_SILOS extends ModeBase { | |||
public int thrsoleValue; | |||
//PLC控制信号量 | |||
public String plcValue;// 20s | |||
//满管 需要时间 例如 10s | |||
//满管 需要时间 例如 10s //放大了10位 | |||
public int bValue; | |||
//校准值 实际校准值 | |||
public String jValue; //100 g | |||
@@ -6,9 +6,12 @@ public class ResSilosModel { | |||
public String name; | |||
public int num; | |||
public ResSilosModel(String _name, int _val) | |||
public int ShowNum; | |||
public ResSilosModel(String _name,int _ShowNum, int _val) | |||
{ | |||
this.name=_name; | |||
this.num=_val; | |||
this.ShowNum=_ShowNum; | |||
} | |||
} |
@@ -66,7 +66,7 @@ public class liaochang_adapter extends RecyclerView.Adapter<RecyclerView.ViewHol | |||
lcMode lcMode = (lcMode)liaos.get(position); | |||
MyLCViewHolder1 myViewHolder = (MyLCViewHolder1) holder; | |||
myViewHolder.xuhao.setText(lcMode.num+""); | |||
myViewHolder.xuhao.setText(lcMode.exp+""); | |||
myViewHolder.name.setText(lcMode.materialName.isEmpty()?"未设置":(lcMode.materialName+"")); | |||
if(lcMode.materialName.isEmpty() || lcMode.materialName.equals("未设置")) | |||
@@ -93,9 +93,6 @@ public class liaochang_adapter extends RecyclerView.Adapter<RecyclerView.ViewHol | |||
@Override | |||
public void onClick(View view) { | |||
MessageManager.getInstance().sendMessage(MessageName.ClickSilos,lcMode); | |||
} | |||
}); | |||
} | |||
@@ -135,11 +135,12 @@ public class MakeGoodFragment extends BaseFragment { | |||
} | |||
public Activity activity; | |||
@Override | |||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) { | |||
super.onViewCreated(view, savedInstanceState); | |||
context = getContext(); | |||
activity=getActivity(); | |||
activity = getActivity(); | |||
initTopBar(); | |||
Initdata(); | |||
Run(); | |||
@@ -263,8 +264,7 @@ public class MakeGoodFragment extends BaseFragment { | |||
return; | |||
} | |||
if (ConfigName.getInstance().versionSelectionEnum.equals("奶茶机")) | |||
{ | |||
if (ConfigName.getInstance().versionSelectionEnum.equals("奶茶机")) { | |||
if (!ExecuteTheRecipe.IsCup) { | |||
ToastUtils.warning("出料口没有检测到器皿!"); | |||
return; | |||
@@ -320,13 +320,15 @@ public class MakeGoodFragment extends BaseFragment { | |||
*/ | |||
private void initTopBar() { | |||
mTopBar.setTitle("智慧菠萝点餐系统"); | |||
mTopBar.addRightTextButton("料仓满管", 1).setOnClickListener(new View.OnClickListener() { | |||
mTopBar.addLeftImageButton(R.mipmap.silos1,1).setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View v) { | |||
add_manguan.SetData(); | |||
add_manguan.setVisibility(View.VISIBLE); | |||
} | |||
}); | |||
//打开 | |||
MessageManager.getInstance().registerMessageReceiver(getActivity(), MessageName.ClickMakeGoodNew, new MessageLooper.OnMessageListener() { | |||
@Override | |||
@@ -389,7 +391,7 @@ public class MakeGoodFragment extends BaseFragment { | |||
} | |||
String message=""; | |||
String message = ""; | |||
private Handler mHandler = new Handler() { | |||
public void handleMessage(Message msg) { | |||
switch (msg.what) { | |||
@@ -429,7 +431,7 @@ public class MakeGoodFragment extends BaseFragment { | |||
}).start(); | |||
//接收扫码信息 | |||
ExecuteTheRecipe.OnScanTheCodeInformationT=new IRunT<String>() { | |||
ExecuteTheRecipe.OnScanTheCodeInformationT = new IRunT<String>() { | |||
@Override | |||
public void Run(String msg) { | |||
@@ -448,29 +450,23 @@ public class MakeGoodFragment extends BaseFragment { | |||
String ggid = res[2];//A001,M002,T001 配方ids | |||
String ggids = "";//规格id集合 | |||
String names=""; | |||
String names = ""; | |||
if( QueryDB.GetOrderthirdPartyIDIs(orderid)) | |||
{ | |||
message="已有订单,重复扫码!"; | |||
if (QueryDB.GetOrderthirdPartyIDIs(orderid)) { | |||
message = "已有订单,重复扫码!"; | |||
mHandler.sendEmptyMessage(1); | |||
return; | |||
} | |||
int num = 1; | |||
try { | |||
num = Integer.parseInt(res[3]); | |||
for(String item:ggid.split("[,]")) | |||
{ | |||
for(ResGoodProperty k :DataBus.getInstance().bpa_goodproperties) | |||
{ | |||
if(k.child!=null && k.child.size()>0) | |||
{ | |||
for (ResGoodProperty chd:k.child) | |||
{ | |||
if(chd.foreignKeyRe!=null && !chd.foreignKeyRe.isEmpty() && chd.foreignKeyRe.equals(item)) | |||
{ | |||
for (String item : ggid.split("[,]")) { | |||
for (ResGoodProperty k : DataBus.getInstance().bpa_goodproperties) { | |||
if (k.child != null && k.child.size() > 0) { | |||
for (ResGoodProperty chd : k.child) { | |||
if (chd.foreignKeyRe != null && !chd.foreignKeyRe.isEmpty() && chd.foreignKeyRe.equals(item)) { | |||
ggids += chd.id + ","; | |||
names+="/"+chd.name; | |||
names += "/" + chd.name; | |||
} | |||
} | |||
} | |||
@@ -484,50 +480,47 @@ public class MakeGoodFragment extends BaseFragment { | |||
} catch (Exception ex) { | |||
} | |||
BPA_GOODS good=QueryDB.GetGoodsforeignKeyId(goodid); | |||
if(good==null) | |||
{ | |||
message="没有查询到该商品!"; | |||
BPA_GOODS good = QueryDB.GetGoodsforeignKeyId(goodid); | |||
if (good == null) { | |||
message = "没有查询到该商品!"; | |||
mHandler.sendEmptyMessage(1); | |||
}else | |||
{ | |||
BPA_GOODSRECIPENAME goodsrecipename = QueryDB.GetGoodsRecipeNameDesignId(ggids,good.id); | |||
} else { | |||
BPA_GOODSRECIPENAME goodsrecipename = QueryDB.GetGoodsRecipeNameDesignId(ggids, good.id); | |||
if (goodsrecipename != null) { | |||
BPA_ORDER order = new BPA_ORDER(); | |||
order.thirdPartyID =orderid; | |||
order.thirdPartyID = orderid; | |||
order.status = 0; | |||
order.deviceID = ConfigName.getInstance().DeviceId; | |||
order.userID = ConfigName.getInstance().user.userID; | |||
QueryDB.AddOrder(order); | |||
for (int mm=0;mm<num;mm++) | |||
{ | |||
for (int mm = 0; mm < num; mm++) { | |||
BPA_SUBORDER suborder = new BPA_SUBORDER(); | |||
suborder.deviceID = ConfigName.getInstance().DeviceId; | |||
suborder.userID = ConfigName.getInstance().user.userID; | |||
suborder.orderID = order.id; | |||
suborder.goodsID = good.id; | |||
suborder.recipeID=goodsrecipename.id; | |||
suborder.recipeID = goodsrecipename.id; | |||
suborder.number = 1; | |||
suborder.status = 0; | |||
suborder.exp=names; | |||
suborder.exp = names; | |||
QueryDB.AddSubOrder(suborder); | |||
DataBus.getInstance().AddGoodsMake(suborder); | |||
} | |||
message="加入订单队列成功!"; | |||
message = "加入订单队列成功!"; | |||
mHandler.sendEmptyMessage(2); | |||
} else { | |||
message="没有查询到该商品配方信息!"; | |||
message = "没有查询到该商品配方信息!"; | |||
mHandler.sendEmptyMessage(1); | |||
} | |||
} | |||
} else { | |||
message="没有查询到该商品!"; | |||
message = "没有查询到该商品!"; | |||
mHandler.sendEmptyMessage(1); | |||
} | |||
} else { | |||
message="服务器异常,请稍后重试!"; | |||
message = "服务器异常,请稍后重试!"; | |||
mHandler.sendEmptyMessage(1); | |||
} | |||
} | |||
@@ -46,17 +46,25 @@ public class SilosNewActivity extends BaseActivity { | |||
@BindView(R.id.viewpager_silos) | |||
QMUIViewPager viewpager_silos;//料仓 | |||
/** | |||
* 查看料仓 | |||
*/ | |||
@BindView(R.id.add_silos) | |||
add_silos_ck add_silos; | |||
/** | |||
* 一键设置等 | |||
*/ | |||
@BindView(R.id.add_yijian) | |||
add_yijian_controlextends add_yijian; | |||
/** | |||
* 料仓校验 | |||
*/ | |||
@BindView(R.id.silos_jz) | |||
silos_jiaoyan silos_jz; | |||
private Context context; | |||
ArrayList<lcMode> lcModes = new ArrayList<>(); | |||
Activity activity; | |||
@Override | |||
@@ -89,7 +97,7 @@ public class SilosNewActivity extends BaseActivity { | |||
@Override | |||
public void clickListenerNew(View v, int k, Object data) { | |||
if (k == 0) { | |||
InitData(); | |||
MessageManager.getInstance().sendMessage(MessageName.RefreshSilos,"RefreshSilos"); | |||
add_yijian.setVisibility(View.GONE); | |||
} else if (k == 1) { | |||
} else if (k == 2) { | |||
@@ -118,7 +126,7 @@ public class SilosNewActivity extends BaseActivity { | |||
@Override | |||
public void clickListenerNew(View v, int k, Object data) { | |||
if (k == 0) { | |||
InitData(); | |||
MessageManager.getInstance().sendMessage(MessageName.RefreshSilos,"RefreshSilos"); | |||
add_silos.setVisibility(View.GONE); | |||
} else if (k == 1) { | |||
ToastUtils.info("补充原料成功!!!"); | |||
@@ -147,7 +155,7 @@ public class SilosNewActivity extends BaseActivity { | |||
@Override | |||
public void clickListenerNew(View v, int k, Object data) { | |||
if (k == 0) { | |||
InitData(); | |||
MessageManager.getInstance().sendMessage(MessageName.RefreshSilos,"RefreshSilos"); | |||
silos_jz.setVisibility(View.GONE); | |||
} | |||
} | |||
@@ -155,65 +163,30 @@ public class SilosNewActivity extends BaseActivity { | |||
} | |||
//list 界面 | |||
public List<LinkMode> Fdata = new ArrayList<>(); | |||
/** | |||
* 初始化数据 | |||
*/ | |||
public void InitData() { | |||
lcModes = DataBus.getInstance().ResGetLc(); | |||
Fdata.clear(); | |||
LinkedHashMap<String, List<Object>> map = new LinkedHashMap<>(); | |||
for (lcMode item : lcModes) { | |||
if (map.containsKey(item.name)) { | |||
map.get(item.name).add(item); | |||
} else { | |||
List<Object> lc = new ArrayList<>(); | |||
lc.add(item); | |||
map.put(item.name, lc); | |||
} | |||
} | |||
/** | |||
* 编例HashMap中所有key跟value的值 | |||
*/ | |||
int i = 0; | |||
for (Object key : map.keySet()) { | |||
List<Object> value = map.get(key); | |||
LinkMode linkMode = new LinkMode(key.toString(), value, i == 0 ? true : false); | |||
Fdata.add(linkMode); | |||
i++; | |||
} | |||
//1.刷新料仓 | |||
DataBus.getInstance().RefreshSilos(); | |||
QMUIFragmentPagerAdapter adapter = new QMUIFragmentPagerAdapter(getSupportFragmentManager()) { | |||
@Override | |||
public int getCount() { | |||
return Fdata.size(); | |||
return DataBus.getInstance().SilosData.size(); | |||
} | |||
@Override | |||
public QMUIFragment createFragment(int position) { | |||
//显示数元 | |||
Silos_item_fragment fragment = new Silos_item_fragment(); | |||
fragment.SetData(Fdata.get(position).content); | |||
fragment.SetData(position); | |||
return fragment; | |||
} | |||
@Override | |||
public CharSequence getPageTitle(int position) { | |||
return Fdata.get(position).type.toString(); | |||
return DataBus.getInstance().SilosData.get(position).type.toString(); | |||
} | |||
}; | |||
viewpager_silos.setAdapter(adapter); | |||
tabs.setupWithViewPager(viewpager_silos, true); | |||
// tabs.selectTab(0); | |||
// viewpager_silos.setCurrentItem(0); | |||
adapter.notifyDataSetChanged(); | |||
// for (int l=0;l<Fdata.size();l++) | |||
// { | |||
// View view= viewpager_silos.getChildAt(l); | |||
// } | |||
} | |||
@@ -238,7 +211,6 @@ public class SilosNewActivity extends BaseActivity { | |||
} | |||
} | |||
@Override | |||
public void onDestroy() { | |||
super.onDestroy(); | |||
@@ -0,0 +1,616 @@ | |||
package com.bonait.bnframework.modules.home.fragment.mode; | |||
import android.app.Activity; | |||
import android.app.AlertDialog; | |||
import android.content.Context; | |||
import android.content.DialogInterface; | |||
import android.content.Intent; | |||
import android.text.TextUtils; | |||
import android.util.AttributeSet; | |||
import android.view.LayoutInflater; | |||
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 androidx.annotation.Nullable; | |||
import androidx.recyclerview.widget.RecyclerView; | |||
import com.bonait.bnframework.R; | |||
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_GOODS; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPENAME; | |||
import com.bonait.bnframework.common.db.mode.BPA_GOODSTYPE; | |||
import com.bonait.bnframework.common.db.mode.BPA_MATERIAL; | |||
import com.bonait.bnframework.common.db.res.ResGoodProperty; | |||
import com.bonait.bnframework.common.db.res.ResGoodsRecipe; | |||
import com.bonait.bnframework.common.db.res.ResMaterilas; | |||
import com.bonait.bnframework.common.helper.I.MyClickListener; | |||
import com.bonait.bnframework.common.image.MyBitmapUtils; | |||
import com.bonait.bnframework.common.message.MessageLooper; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.utils.ToastUtils; | |||
import com.bonait.bnframework.common.view.MyLayoutManager; | |||
import com.bonait.bnframework.modules.home.adapter.goodpf_apapter; | |||
import com.bonait.bnframework.modules.home.adapter.newmeatrilselect_adapter; | |||
import com.bonait.bnframework.modules.home.adapter.newneatril_adapter; | |||
import com.bonait.bnframework.modules.home.adapter.xxpf_adapter; | |||
import com.bonait.bnframework.modules.home.fragment.from.ImageChooseActivity; | |||
import java.util.ArrayList; | |||
import java.util.LinkedHashMap; | |||
import java.util.Map; | |||
import butterknife.BindView; | |||
import butterknife.ButterKnife; | |||
/** | |||
* 商品信息展示 | |||
*/ | |||
public class GoodInformation extends LinearLayout implements MyClickListener{ | |||
//region 界面变量 | |||
/** | |||
* 商品类型 | |||
*/ | |||
public ArrayList<BPA_GOODSTYPE> Types = new ArrayList<>(); | |||
/** | |||
* 当前物料数据 | |||
*/ | |||
public ArrayList<ResMaterilas> resMaterilas = new ArrayList<>(); | |||
/** | |||
* 属性数据 | |||
*/ | |||
ArrayList<ResGoodProperty> bpa_goodproperties = new ArrayList<>(); | |||
/** | |||
* 确定文本和取消文本的显示内容 | |||
*/ | |||
private String yesStr; | |||
/** | |||
* 取消按钮 | |||
*/ | |||
public Button close_from, xinjian; | |||
/** | |||
* 图片 | |||
*/ | |||
public ImageView cpfm; | |||
/** | |||
* 文本输入框 | |||
*/ | |||
public EditText edittext, edittext1,edittext_wl; | |||
/** | |||
* 商品分类 | |||
*/ | |||
public Spinner editsp_fl; | |||
/** | |||
* 点击事件 | |||
*/ | |||
public MyClickListener mListener = null; | |||
private View root; | |||
@BindView(R.id.datatab_pf) | |||
ListView datatab_pf; | |||
@BindView(R.id.recycler_view_wl_click) | |||
RecyclerView recycler_view_wl_click; | |||
public BPA_GOODSRECIPENAME bpaGoodsrecipename=null; | |||
@BindView(R.id.edittext_pfmingc) | |||
EditText edittext_pfmingc;//配方名称 | |||
@BindView(R.id.datatab_sx) | |||
RecyclerView datatab_sx; | |||
@BindView(R.id.datatab_xxpf) | |||
ListView datatab_xxpf; | |||
//endregion | |||
//region 私例 | |||
public GoodInformation(Context context, @Nullable AttributeSet attrs) { | |||
super(context, attrs); | |||
root = LayoutInflater.from(context).inflate(R.layout.dialog_gooddetails, this); | |||
ButterKnife.bind(this, root); | |||
} | |||
//endregion | |||
//region 数据校准 | |||
/** | |||
* 数据验证 | |||
* | |||
* @return | |||
*/ | |||
public boolean DataVerification() { | |||
boolean IsSucees = false; | |||
try { | |||
if (edittext.getText().toString().isEmpty()) { | |||
ToastUtils.info("名称不能为空!"); | |||
return false; | |||
} | |||
boolean issc = false; | |||
GetWuLiaoSelect(resMaterilas); | |||
//resMaterilas | |||
if (issc == false) { | |||
ToastUtils.info("必须选择一个物料!"); | |||
return false; | |||
} | |||
return true; | |||
} catch (Exception ex) { | |||
ToastUtils.error("数据验证异常!" + ex.getMessage()); | |||
return IsSucees; | |||
} | |||
} | |||
//endregion | |||
//region 初始化设置数据 | |||
/** | |||
* 数据接口:商品数据 | |||
*/ | |||
public BPA_GOODS Data = null; | |||
/** | |||
* 上一层界面 | |||
*/ | |||
Activity activity_ma=null; | |||
/** | |||
* 图片URL | |||
*/ | |||
public String url = ""; | |||
/** | |||
* 商品类别分类 | |||
*/ | |||
Map<String, String> map_fl = new LinkedHashMap<>(); | |||
/** | |||
* 从外界Activity为Dialog 设置数据 | |||
* | |||
* @param data | |||
*/ | |||
public void setData(String str, BPA_GOODS data, ArrayList<BPA_GOODSTYPE> types, Activity activity,ArrayList<ResGoodProperty> properties) { | |||
if (str != null) { | |||
yesStr = str; | |||
} | |||
Data = data; | |||
Types = types; | |||
activity_ma = activity; | |||
for (ResGoodProperty pro:properties) | |||
{ | |||
if(pro.GoodsTypeId!=null && !pro.GoodsTypeId.isEmpty()) | |||
{ | |||
if(pro.GoodsTypeId.contains(Data.goodtype)) | |||
{ | |||
bpa_goodproperties.add(pro); | |||
} | |||
}else | |||
{ | |||
bpa_goodproperties.add(pro); | |||
} | |||
} | |||
//初始化界面控件 | |||
initView(); | |||
//初始化界面数据 | |||
initData(); | |||
//初始化界面控件的事件 | |||
initEvent(); | |||
//初始化配方 | |||
Initdata_pf(); | |||
} | |||
//endregion | |||
//region 初始化函数 | |||
/** | |||
* 初始化界面控件 | |||
*/ | |||
private void initView() { | |||
close_from = (Button) findViewById(R.id.close_from); | |||
xinjian = (Button) findViewById(R.id.xinjian); | |||
cpfm = findViewById(R.id.cpfm); | |||
edittext = findViewById(R.id.edittext); | |||
edittext1 = findViewById(R.id.edittext1); | |||
editsp_fl = findViewById(R.id.editsp_fl); | |||
edittext_wl = findViewById(R.id.edittext_wl); | |||
} | |||
/** | |||
* 初始化界面控件的显示数据 | |||
*/ | |||
private void initData() { | |||
map_fl.clear(); | |||
for (BPA_GOODSTYPE item : Types) { | |||
map_fl.put(item.name, item.id); | |||
} | |||
SetAdapter(editsp_fl, map_fl); | |||
//如果设置按钮的文字 | |||
if (yesStr != null) { | |||
xinjian.setText(yesStr); | |||
} | |||
//数据不为空 那么就是修改 | |||
if (Data != null) { | |||
edittext.setText(Data.name); | |||
edittext1.setText(Data.foreignKeyRe); | |||
new MyBitmapUtils().disPlay(cpfm, Data.url); | |||
url = Data.url; | |||
int index = 0; | |||
for (Map.Entry<String, String> entry : map_fl.entrySet()) { | |||
String key = entry.getKey(); | |||
String value = entry.getValue(); | |||
if (value.equals(Data.goodtype)) { | |||
editsp_fl.setSelection(index); | |||
} | |||
index++; | |||
} | |||
} else { | |||
edittext.setText(""); | |||
edittext1.setText(""); | |||
new MyBitmapUtils().disPlay(cpfm, ""); | |||
url = ""; | |||
} | |||
//查询物料数据 | |||
ArrayList<BPA_MATERIAL> materials = QueryDB.GetMaterialALL(); | |||
if (materials != null && materials.size() > 0) { | |||
resMaterilas.clear(); | |||
for (BPA_MATERIAL item : materials) { | |||
ResMaterilas mk = new ResMaterilas(); | |||
mk.name = item.name; | |||
mk.id = item.id; | |||
mk.isSelect = false; | |||
if (Data != null && !Data.materialids.isEmpty()) { | |||
if (Data.materialids.contains(item.id)) { | |||
mk.isSelect = true; | |||
} | |||
} | |||
resMaterilas.add(mk); | |||
} | |||
} | |||
GetWuLiaoSelect(resMaterilas); | |||
MyLayoutManager layout = new MyLayoutManager(); | |||
layout.setAutoMeasureEnabled(true); | |||
recycler_view_wl_click.setLayoutManager(layout); | |||
newneatril_adapter adapter = new newneatril_adapter(getContext(), QueryDB.GetMaterialALL(), new MyClickListener() { | |||
@Override | |||
public void clickListener(View v, Object data) { | |||
BPA_MATERIAL m=(BPA_MATERIAL)data; | |||
ResGoodsRecipe cipe=new ResGoodsRecipe(); | |||
cipe.sort=0; | |||
cipe.materialID=m.id; | |||
cipe.materialName=m.name; | |||
cipe.value="0"; | |||
if (DataBus.getInstance().Recipe==null) | |||
{ | |||
DataBus.getInstance().Recipe=new ArrayList<>(); | |||
} | |||
DataBus.getInstance().Recipe.add(cipe); | |||
if(adapter4!=null) | |||
{ | |||
adapter4.notifyDataSetChanged(); | |||
} | |||
} | |||
@Override | |||
public void clickListenerNew(View v, int k, Object data) { | |||
} | |||
}); | |||
recycler_view_wl_click.setAdapter(adapter); | |||
// MyLayoutManager layout = new MyLayoutManager(); | |||
// layout.setAutoMeasureEnabled(true); | |||
// recycler_view_wl.setLayoutManager(layout); | |||
// newmeatrilselect_adapter adapter = new newmeatrilselect_adapter(getContext(), resMaterilas); | |||
// recycler_view_wl.setAdapter(adapter); | |||
} | |||
xxpf_adapter adapter4=null; | |||
public void InitTab() | |||
{ | |||
DataBus.getInstance().Recipe.clear(); | |||
if(bpaGoodsrecipename!=null) | |||
{ | |||
DataBus.getInstance().Recipe = QueryDB.GetGoodsSreciperecipeList(bpaGoodsrecipename.id); | |||
}else | |||
{ | |||
for(BPA_MATERIAL wl:resMaterilas) | |||
{ | |||
if(Data.materialids!=null && !Data.materialids.isEmpty() && Data.materialids.contains(wl.id)) | |||
{ | |||
ResGoodsRecipe cipe=new ResGoodsRecipe(); | |||
cipe.sort=0; | |||
cipe.materialID=wl.id; | |||
cipe.materialName=wl.name; | |||
cipe.value="0"; | |||
cipe.goodsID=Data.id; | |||
DataBus.getInstance().Recipe.add(cipe); | |||
} | |||
} | |||
} | |||
if( DataBus.getInstance().Recipe==null) | |||
{ | |||
DataBus.getInstance().Recipe=new ArrayList<>(); | |||
} | |||
adapter4= new xxpf_adapter(getContext(), R.layout.xxpf_item, DataBus.getInstance().Recipe,this); | |||
datatab_pf.setAdapter(adapter4); | |||
} | |||
/** | |||
* 初始化界面的确定和取消监听器 | |||
*/ | |||
private void initEvent() { | |||
/** | |||
* 设置确定按钮被点击后,向外界提供监听 | |||
*/ | |||
xinjian.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View v) { | |||
if (DataVerification()) { | |||
ArrayList<BPA_GOODS> goods = QueryDB.GetGoodsALL(); | |||
if (Data == null)//新增 | |||
{ | |||
boolean isSucess = QueryDB.GetGoodsIs(edittext.getText().toString()); | |||
if (isSucess) { | |||
ToastUtils.info("菜谱名称已存在!"); | |||
return; | |||
} | |||
Data = new BPA_GOODS(); | |||
Data.name = edittext.getText().toString(); | |||
Data.status = 1; | |||
Data.sort = goods.size() + 1; | |||
Data.maketime = 180; | |||
Data.issc = 1; | |||
Data.url = url; | |||
Data.foreignKeyRe = edittext1.getText().toString(); | |||
Data.goodtype = map_fl.get(editsp_fl.getSelectedItem().toString()); | |||
Data.materialids = ids; | |||
QueryDB.AddGoods(Data); | |||
if (mListener != null) { | |||
mListener.clickListenerNew(v, 1, Data); | |||
} | |||
} else //修改 | |||
{ | |||
Data.name = edittext.getText().toString(); | |||
Data.status = 1; | |||
Data.sort = goods.size() + 1; | |||
Data.maketime = 180; | |||
Data.issc = 1; | |||
Data.url = url; | |||
Data.foreignKeyRe = edittext1.getText().toString(); | |||
Data.goodtype = map_fl.get(editsp_fl.getSelectedItem().toString()); | |||
Data.materialids = ids; | |||
QueryDB.UpdateGoods(Data); | |||
if (mListener != null) { | |||
mListener.clickListenerNew(v, 1, Data); | |||
} | |||
} | |||
} | |||
} | |||
}); | |||
/** | |||
* 关闭窗体 | |||
*/ | |||
close_from.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View v) { | |||
if (mListener != null) { | |||
mListener.clickListenerNew(v, 0, null); | |||
} | |||
} | |||
}); | |||
/** | |||
* 选择图片资源 | |||
*/ | |||
cpfm.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View view) { | |||
Intent intent = new Intent(getContext(), ImageChooseActivity.class); | |||
intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); | |||
activity_ma.startActivity(intent); | |||
} | |||
}); | |||
/** | |||
* 图标选择之后 | |||
*/ | |||
MessageManager.getInstance().registerMessageReceiver(activity_ma, MessageName.ClickImage, new MessageLooper.OnMessageListener() { | |||
@Override | |||
public void onMessage(Object msg) { | |||
if (msg != null) { | |||
url = (String) msg; | |||
new MyBitmapUtils().disPlay(cpfm, url); | |||
} | |||
} | |||
}); | |||
/** | |||
* 下拉框选择之后 | |||
*/ | |||
edittext_wl.setOnClickListener(new View.OnClickListener() { | |||
@Override | |||
public void onClick(View v) { | |||
checkboxEdit(edittext_wl); | |||
} | |||
}); | |||
MessageManager.getInstance().registerMessageReceiver(activity_ma, MessageName.ClickProperty, new MessageLooper.OnMessageListener() { | |||
@Override | |||
public void onMessage(Object msg) { | |||
if (msg != null) { | |||
activity_ma.runOnUiThread(new Runnable() { | |||
@Override | |||
public void run() { | |||
try { | |||
edittext_pfmingc.setText(GetSelectName()); | |||
} catch (Exception e) { | |||
} | |||
} | |||
}); | |||
} | |||
} | |||
}); | |||
} | |||
/** | |||
* 初始化配方 | |||
*/ | |||
public void Initdata_pf() | |||
{ | |||
if(Data!=null) | |||
{ | |||
//根据商品查询配方 | |||
ArrayList<BPA_GOODSRECIPENAME> goodsrecipenames=QueryDB.GetGoodsRecipeNameGoodId(Data.id); | |||
goodpf_apapter adapter = new goodpf_apapter(getContext(), R.layout.wl_item, goodsrecipenames, this); | |||
datatab_pf.setAdapter(adapter); | |||
} | |||
} | |||
//endregion | |||
//region 界面事件 | |||
/** | |||
* 设置下拉框 | |||
* @param spinner | |||
* @param map | |||
*/ | |||
public void SetAdapter(Spinner spinner, Map<String, String> map) { | |||
ArrayAdapter<String> adapter = new ArrayAdapter<>(getContext(), R.layout.spinner_text_item, new ArrayList<>(map.keySet())); | |||
adapter.setDropDownViewResource(R.layout.spinner_dropdown_item); | |||
spinner.setAdapter(adapter); | |||
} | |||
/** | |||
* 多选下拉框 | |||
*/ | |||
private void checkboxEdit(EditText edit) { | |||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext()); | |||
builder.setTitle("物料列表"); | |||
DialogInterface.OnMultiChoiceClickListener multiChoiceClickListener = new DialogInterface.OnMultiChoiceClickListener() { | |||
@Override | |||
public void onClick(DialogInterface dialog, int i, boolean isChecked) { | |||
resMaterilas.get(i).isSelect= isChecked; | |||
} | |||
}; | |||
// 下拉项选中状态 | |||
boolean[] selected = new boolean[resMaterilas.size()]; | |||
// 下拉框数据源 | |||
String[] str = new String[resMaterilas.size()]; | |||
for (int i = 0; i < resMaterilas.size(); i++) { | |||
str[i] = resMaterilas.get(i).name; | |||
selected[i] = resMaterilas.get(i).isSelect; | |||
} | |||
builder.setMultiChoiceItems(str, selected, multiChoiceClickListener); | |||
DialogInterface.OnClickListener clickListener = new DialogInterface.OnClickListener() { | |||
@Override | |||
public void onClick(DialogInterface dialog, int which) { | |||
GetWuLiaoSelect(resMaterilas); | |||
edit.setText(names); | |||
} | |||
}; | |||
builder.setCancelable(false); | |||
builder.setNegativeButton("取消", null); | |||
builder.setPositiveButton("确定", clickListener); | |||
AlertDialog dialog = builder.create(); | |||
dialog.show(); | |||
} | |||
public String ids = ""; | |||
public String names=""; | |||
/** | |||
* 获取物料选择 | |||
*/ | |||
public void GetWuLiaoSelect(ArrayList<ResMaterilas> materilas) | |||
{ | |||
ids = "";names=""; | |||
for (ResMaterilas item:materilas) | |||
{ | |||
if (item.isSelect) { | |||
if (TextUtils.isEmpty(names)) { | |||
names = names + item.name; | |||
ids = ids + item.id; | |||
} else { | |||
names = names + "," + item.name; | |||
ids = ids + "," + item.id; | |||
} | |||
} | |||
} | |||
edittext_wl.setText(names); | |||
} | |||
/** | |||
* 获取选中名称 | |||
* @return | |||
*/ | |||
public String GetSelectName() | |||
{ | |||
String names=Data.name+"_"; | |||
for(ResGoodProperty item:bpa_goodproperties) | |||
{ | |||
for(ResGoodProperty k:item.child) | |||
{ | |||
if(k.isSelect) | |||
{ | |||
names+=k.name+"_"; | |||
} | |||
} | |||
} | |||
return names.substring(0, names.length() - 1); | |||
} | |||
/** | |||
* 点击事件 | |||
* | |||
* @param v | |||
* @param data | |||
*/ | |||
@Override | |||
public void clickListener(View v, Object data) { | |||
switch (v.getId()) { | |||
case R.id.button_update://点击 修改 | |||
bpaGoodsrecipename =(BPA_GOODSRECIPENAME)data; | |||
break; | |||
case R.id.button_item://删除按钮 | |||
ArrayList<ResGoodsRecipe> re= QueryDB.GetGoodsSreciperecipeList(((BPA_GOODSRECIPENAME) data).id); | |||
for(ResGoodsRecipe item:re) | |||
{ | |||
QueryDB.DeleteGoodsSrecipe(item); | |||
} | |||
QueryDB.DeleteGoodsRecipeName((BPA_GOODSRECIPENAME) data); | |||
Initdata_pf(); | |||
ToastUtils.info("删除成功"); | |||
break; | |||
} | |||
} | |||
@Override | |||
public void clickListenerNew(View v, int k, Object data) { | |||
} | |||
//endregion | |||
} |
@@ -14,8 +14,11 @@ import android.view.View; | |||
import com.bonait.bnframework.R; | |||
import com.bonait.bnframework.common.base.BaseFragment; | |||
import com.bonait.bnframework.common.constant.DataBus; | |||
import com.bonait.bnframework.common.constant.MessageName; | |||
import com.bonait.bnframework.common.db.res.lcMode; | |||
import com.bonait.bnframework.common.linktab.LinkMode; | |||
import com.bonait.bnframework.common.message.MessageLooper; | |||
import com.bonait.bnframework.common.message.MessageManager; | |||
import com.bonait.bnframework.common.view.MyLayoutManager; | |||
import com.bonait.bnframework.modules.home.adapter.liaochang_adapter; | |||
import com.orhanobut.logger.Logger; | |||
@@ -46,39 +49,43 @@ public class Silos_item_fragment extends BaseFragment { | |||
super.onViewCreated(view, savedInstanceState); | |||
Logger.d("我的fragment创建"); | |||
InitView(); | |||
InitEvent(); | |||
} | |||
public List<Object> dataA=null; | |||
public void SetData(List<Object> data) | |||
//当前集合数据 | |||
public int index = -1; | |||
public void SetData(int _index) { | |||
index = _index; | |||
} | |||
public void InitEvent() | |||
{ | |||
dataA=data; | |||
MessageManager.getInstance().registerMessageReceiver(getActivity(), MessageName.RefreshSilos, new MessageLooper.OnMessageListener() { | |||
@Override | |||
public void onMessage(Object msg) { | |||
if (msg != null) { | |||
DataBus.getInstance().RefreshSilos(); | |||
InitView(); | |||
} | |||
} | |||
}); | |||
} | |||
/** | |||
* 初始化界面 | |||
*/ | |||
public void InitView() { | |||
if(dataA!=null) | |||
{ | |||
// | |||
// LinearLayoutManager layoutManager = new LinearLayoutManager(context ); | |||
// recycler_view_lll.setLayoutManager(layoutManager); | |||
// 创建一个LinearLayoutManager对象 | |||
// LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity()); | |||
// | |||
// MyLayoutManager layout = new MyLayoutManager(); | |||
// layout.setAutoMeasureEnabled(true); | |||
// | |||
if (index != -1) { | |||
StaggeredGridLayoutManager layout11 = new StaggeredGridLayoutManager | |||
(4,StaggeredGridLayoutManager.VERTICAL); | |||
(4, StaggeredGridLayoutManager.VERTICAL); | |||
recycler_view_lll.setLayoutManager(layout11); | |||
liaochang_adapter adapter = new liaochang_adapter(context,dataA); | |||
liaochang_adapter adapter = new liaochang_adapter(context, DataBus.getInstance().SilosData.get(index).content); | |||
recycler_view_lll.setAdapter(adapter); | |||
adapter.notifyDataSetChanged(); | |||
} | |||
} | |||
@Override | |||
@@ -88,6 +88,9 @@ public class add_silos_ck extends LinearLayout { | |||
@BindView(R.id.control_switch_shoudong) | |||
Button control_switch_shoudong; | |||
@BindView(R.id.control_huishou) | |||
Button control_huishou; | |||
@BindView(R.id.liaochang_sz) | |||
RelativeLayout liaochang_sz; | |||
@@ -359,12 +362,35 @@ public class add_silos_ck extends LinearLayout { | |||
return false; | |||
} | |||
}); | |||
control_huishou.setOnTouchListener(new View.OnTouchListener() { | |||
@Override | |||
public boolean onTouch(View view, MotionEvent motionEvent) { | |||
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) { | |||
Log.e("鼠标", "按下: "); | |||
ExecuteTheRecipe.WritePLC("手自切换", false, new IWriteCallBack() { | |||
@Override | |||
public void onSuccess() { | |||
ExecuteTheRecipe.WritePLC("M_外置仓" + lcMode.num + "反转", true, null); | |||
} | |||
@Override | |||
public void onFailure(String ErrorMsg) { | |||
} | |||
}); | |||
} else if (motionEvent.getAction() == MotionEvent.ACTION_UP) { | |||
Log.e("鼠标", "松开: "); | |||
ExecuteTheRecipe.WritePLC("M_外置仓" + lcMode.num + "反转", false, null); | |||
} | |||
return false; | |||
} | |||
}); | |||
control_switch.setOnCheckedChangeListener(new SwitchButton.OnCheckedChangeListener() { | |||
@Override | |||
public void onCheckedChanged(SwitchButton view, boolean isChecked) { | |||
//设置 | |||
lcMode.status=isChecked?0:1; | |||
QueryDB.UpdateSilosStatus(lcMode.id,isChecked); | |||
lcMode.status = isChecked ? 0 : 1; | |||
QueryDB.UpdateSilosStatus(lcMode.id, isChecked); | |||
} | |||
}); | |||
} | |||
@@ -373,9 +399,16 @@ public class add_silos_ck extends LinearLayout { | |||
public void SetData(lcMode _good) { | |||
lcMode = _good; | |||
control_switch.setChecked(_good.status==0?true:false); | |||
control_switch.setChecked(_good.status == 0 ? true : false); | |||
title.setText("查看料仓-(" + lcMode.name + ")"); | |||
xuhao.setText(lcMode.num + ""); | |||
xuhao.setText(lcMode.exp + ""); | |||
if (lcMode.name.equals("外置仓")) { | |||
control_huishou.setVisibility(View.VISIBLE); | |||
} else { | |||
control_huishou.setVisibility(View.GONE); | |||
} | |||
name.setText(lcMode.materialName.isEmpty() ? "未设置" : (lcMode.materialName + "")); | |||
if (lcMode.materialName.isEmpty() || lcMode.materialName.equals("未设置")) { | |||
wuliaoimage.setImageResource(R.mipmap.newsilos); | |||
@@ -417,7 +450,7 @@ public class add_silos_ck extends LinearLayout { | |||
long elapsedMillis = SystemClock.elapsedRealtime() - runtime.getBase(); | |||
runtime.stop(); | |||
int time=(int) (elapsedMillis / 1000); | |||
return time;//当前点击多少秒 | |||
int time = (int) (elapsedMillis / 1000); | |||
return time;//当前点击多少秒 | |||
} | |||
} |
@@ -2,6 +2,7 @@ package com.bonait.bnframework.modules.home.fragment.mode; | |||
import android.content.Context; | |||
import android.os.Handler; | |||
import android.os.Looper; | |||
import android.os.Message; | |||
import android.os.SystemClock; | |||
import android.util.AttributeSet; | |||
@@ -288,7 +289,7 @@ public class add_yijian_controlextends extends LinearLayout { | |||
{ | |||
int time=item.bValue<=0?5:item.bValue;//默认5秒 | |||
ExecuteTheRecipe.WritePLC("手动控制"+item.num,true,null); | |||
new Handler().postDelayed(new Runnable() { | |||
new Handler(Looper.getMainLooper()).postDelayed(new Runnable() { | |||
@Override | |||
public void run() { | |||
ExecuteTheRecipe.WritePLC("手动控制"+item.num,false,null); | |||
@@ -97,7 +97,6 @@ | |||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager" | |||
android:layout_height="match_parent"/> | |||
<!-- 增加商品 --> | |||
<com.bonait.bnframework.modules.home.fragment.mode.add_good_control | |||
android:id="@+id/add_good" | |||
@@ -67,7 +67,8 @@ | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:textAlignment="center" | |||
android:text="商品封面"/> | |||
android:text="商品封面" | |||
android:textSize="18dp"/> | |||
</LinearLayout> | |||
<LinearLayout | |||
@@ -83,7 +84,8 @@ | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="商品名称:"/> | |||
android:text="商品名称:" | |||
android:textSize="18dp"/> | |||
<!--账号输入框--> | |||
<EditText | |||
android:id="@+id/edittext" | |||
@@ -95,7 +97,7 @@ | |||
android:inputType="text" | |||
android:maxLines="1" | |||
android:padding="3dp" | |||
android:textSize="12dp" /> | |||
android:textSize="18dp" /> | |||
</LinearLayout> | |||
<LinearLayout | |||
@@ -105,7 +107,8 @@ | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="商品外键:"/> | |||
android:text="商品外键:" | |||
android:textSize="18dp"/> | |||
<!--账号输入框--> | |||
<EditText | |||
android:id="@+id/edittext1" | |||
@@ -117,24 +120,26 @@ | |||
android:inputType="text" | |||
android:maxLines="1" | |||
android:padding="3dp" | |||
android:textSize="12dp" /> | |||
android:textSize="18dp" /> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:layout_marginBottom="12dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content"> | |||
android:layout_height="30dp"> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="商品分类:"/> | |||
android:layout_height="30dp" | |||
android:text="商品分类:" | |||
android:textSize="18dp"/> | |||
<!--账号输入框--> | |||
<Spinner | |||
android:id="@+id/editsp_fl" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="match_parent" | |||
android:layout_height="24dp" | |||
android:layout_centerVertical="true"/> | |||
android:layout_centerVertical="true" | |||
android:textSize="18dp"/> | |||
</LinearLayout> | |||
</LinearLayout> | |||
@@ -87,7 +87,7 @@ | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="配方名称:" | |||
android:textSize="16dp"/> | |||
android:textSize="18dp"/> | |||
<!--账号输入框--> | |||
<EditText | |||
android:id="@+id/edittext" | |||
@@ -99,7 +99,7 @@ | |||
android:inputType="text" | |||
android:maxLines="1" | |||
android:padding="3dp" | |||
android:textSize="16dp" /> | |||
android:textSize="18dp" /> | |||
</LinearLayout> | |||
@@ -70,7 +70,7 @@ | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="商品分类" | |||
android:textSize="@dimen/text_size_16"/> | |||
android:textSize="18dp"/> | |||
<TextView | |||
android:id="@+id/type_name" | |||
@@ -78,7 +78,8 @@ | |||
android:layout_height="match_parent" | |||
android:text="明显款" | |||
android:textAlignment="textEnd" | |||
android:textColor="@color/tab_text_normal"/> | |||
android:textColor="@color/tab_text_normal" | |||
android:textSize="18dp"/> | |||
</LinearLayout> | |||
@@ -91,7 +92,7 @@ | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="商品配方" | |||
android:textSize="@dimen/text_size_16"/> | |||
android:textSize="18dp"/> | |||
</LinearLayout> | |||
<!--物料类型--> | |||
@@ -146,6 +146,18 @@ | |||
android:text="出料" | |||
android:textColor="@color/white" | |||
android:textSize="18sp"/> | |||
<Button | |||
android:layout_marginTop="@dimen/dp_10" | |||
android:id="@+id/control_huishou" | |||
android:layout_width="60dp" | |||
android:layout_height="40dp" | |||
android:layout_centerHorizontal="true" | |||
android:background="@drawable/silosbuttonbj" | |||
android:text="回收" | |||
android:textColor="@color/white" | |||
android:textSize="18sp"/> | |||
</LinearLayout> | |||
<LinearLayout | |||
@@ -0,0 +1,360 @@ | |||
<?xml version="1.0" encoding="utf-8"?> | |||
<RelativeLayout | |||
xmlns:android="http://schemas.android.com/apk/res/android" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:background="@color/dialogbj"> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_marginLeft="50dp" | |||
android:layout_marginTop="10dp" | |||
android:layout_marginRight="50dp" | |||
android:layout_marginBottom="10dp" | |||
android:background="@drawable/common_bg_with_radius_and_border"> | |||
<Button | |||
android:id="@+id/close_from" | |||
android:layout_width="32dp" | |||
android:layout_height="32dp" | |||
android:layout_alignParentTop="true" | |||
android:layout_alignParentRight="true" | |||
android:layout_marginTop="@dimen/dp_10" | |||
android:layout_marginRight="@dimen/dp_10" | |||
android:background="@mipmap/close_image" | |||
android:textColor="@color/white" | |||
android:textSize="14dp" /> | |||
<TextView | |||
android:id="@+id/title" | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="商品信息详情" | |||
android:textSize="20dp" | |||
android:layout_marginTop="@dimen/dp_10" | |||
android:layout_centerHorizontal="true"> | |||
</TextView> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_marginTop="46dp" | |||
android:layout_marginBottom="55dp"> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="30dp" | |||
android:layout_marginRight="30dp" | |||
android:orientation="vertical"> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_centerHorizontal="true" | |||
android:text="商品信息" | |||
android:textSize="20dp" /> | |||
<!--菜谱名称行--> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginTop="@dimen/dp_10" | |||
android:layout_marginBottom="@dimen/dp_10"> | |||
<LinearLayout | |||
android:layout_width="0dp" | |||
android:layout_weight="1" | |||
android:layout_height="match_parent" | |||
android:orientation="vertical"> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="0dp" | |||
android:layout_weight="1" | |||
android:background="@color/color1"> | |||
<ImageView | |||
android:id="@+id/cpfm" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_marginStart="3dp" | |||
android:layout_marginTop="3dp" | |||
android:layout_marginEnd="3dp" | |||
android:layout_marginBottom="3dp" | |||
android:src="@mipmap/loading3" /> | |||
</RelativeLayout> | |||
<Button | |||
android:layout_marginTop="@dimen/dp_10" | |||
android:id="@+id/control_huishou" | |||
android:layout_width="match_parent" | |||
android:layout_height="40dp" | |||
android:layout_centerHorizontal="true" | |||
android:background="@drawable/silosbuttonbj" | |||
android:text="保存" | |||
android:textColor="@color/white" | |||
android:textSize="18sp"/> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:layout_width="0dp" | |||
android:layout_weight="1.8" | |||
android:layout_height="wrap_content" | |||
android:layout_marginLeft="30dp" | |||
android:orientation="vertical"> | |||
<LinearLayout | |||
android:layout_width="300dp" | |||
android:layout_height="wrap_content" | |||
android:layout_marginTop="@dimen/dp_10" | |||
android:layout_marginBottom="12dp"> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="商品名称:" | |||
android:textSize="18dp"/> | |||
<!--账号输入框--> | |||
<EditText | |||
android:id="@+id/edittext" | |||
android:layout_width="match_parent" | |||
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="18dp" /> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:layout_width="300dp" | |||
android:layout_height="wrap_content" | |||
android:layout_marginBottom="12dp"> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="商品外键:" | |||
android:textSize="18dp" /> | |||
<!--账号输入框--> | |||
<EditText | |||
android:id="@+id/edittext1" | |||
android:layout_width="match_parent" | |||
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="18dp" /> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:layout_width="300dp" | |||
android:layout_height="30dp" | |||
android:layout_marginBottom="12dp"> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="30dp" | |||
android:text="商品分类:" | |||
android:textSize="18dp"/> | |||
<!--账号输入框--> | |||
<Spinner | |||
android:id="@+id/editsp_fl" | |||
style="@style/commonSpinnerStyle" | |||
android:layout_width="match_parent" | |||
android:layout_height="28dp" | |||
android:layout_centerVertical="true" | |||
android:textSize="18dp"/> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:layout_width="300dp" | |||
android:layout_height="wrap_content" | |||
android:layout_marginBottom="12dp"> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="商品物料:" | |||
android:textSize="18dp" /> | |||
<!--账号输入框--> | |||
<EditText | |||
android:id="@+id/edittext_wl" | |||
android:layout_width="match_parent" | |||
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="18dp" /> | |||
</LinearLayout> | |||
</LinearLayout> | |||
</LinearLayout> | |||
<TextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_centerHorizontal="true" | |||
android:text="配方信息" | |||
android:textSize="20dp" /> | |||
<!--物料类型--> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_marginTop="0dp"> | |||
<RelativeLayout | |||
android:layout_weight="1.5" | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content"> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content"> | |||
<!-- 商品分类 --> | |||
<LinearLayout | |||
android:layout_marginTop="10dp" | |||
android:layout_marginBottom="12dp" | |||
android:layout_marginRight="10dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content"> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:text="配方名称:" | |||
android:textSize="18dp"/> | |||
<!--账号输入框--> | |||
<EditText | |||
android:id="@+id/edittext_pfmingc" | |||
android:layout_width="match_parent" | |||
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="18dp" /> | |||
</LinearLayout> | |||
<LinearLayout | |||
android:layout_marginTop="50dp" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:orientation="vertical"> | |||
<androidx.recyclerview.widget.RecyclerView | |||
android:id="@+id/datatab_sx" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content"/> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content"> | |||
<ListView | |||
android:id="@+id/datatab_xxpf" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_marginTop="3dp" | |||
android:divider="#00000000" | |||
android:dividerHeight="3dp" /> | |||
</RelativeLayout> | |||
</LinearLayout> | |||
</RelativeLayout> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_weight="1" | |||
android:layout_width="0dp" | |||
android:layout_height="match_parent"> | |||
<LinearLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:orientation="vertical"> | |||
<!-- 表头 --> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="26dp" | |||
android:background="@color/app_color_blue"> | |||
<TableLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content" | |||
android:layout_centerVertical="true" | |||
android:layout_gravity="center" | |||
android:gravity="center" | |||
android:stretchColumns="0"> | |||
<TableRow | |||
android:layout_width="fill_parent" | |||
android:layout_height="wrap_content" | |||
android:gravity="center_horizontal"> | |||
<RelativeLayout | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:layout_weight="1"> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="match_parent" | |||
android:textAlignment="center" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentLeft="true" | |||
android:layout_marginLeft="20dp" | |||
android:text="配方名称" | |||
android:textColor="@color/white" /> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_width="0dp" | |||
android:layout_height="wrap_content" | |||
android:layout_weight="1"> | |||
<com.qmuiteam.qmui.widget.textview.QMUILinkTextView | |||
android:layout_width="match_parent" | |||
android:textAlignment="center" android:layout_height="wrap_content" | |||
android:layout_alignParentLeft="true" | |||
android:layout_marginLeft="20dp" | |||
android:text="用户操作" | |||
android:textColor="@color/white"/> | |||
</RelativeLayout> | |||
</TableRow> | |||
</TableLayout> | |||
</RelativeLayout> | |||
<!-- 数据 --> | |||
<RelativeLayout | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent"> | |||
<ListView | |||
android:id="@+id/datatab_pf" | |||
android:layout_width="match_parent" | |||
android:layout_height="match_parent" | |||
android:layout_marginTop="3dp" | |||
android:divider="#00000000" | |||
android:dividerHeight="3dp" /> | |||
</RelativeLayout> | |||
</LinearLayout> | |||
</RelativeLayout> | |||
</LinearLayout> | |||
<androidx.recyclerview.widget.RecyclerView | |||
android:layout_marginTop="@dimen/dp_10" | |||
android:id="@+id/recycler_view_wl_click" | |||
android:layout_width="match_parent" | |||
android:layout_height="wrap_content"/> | |||
</LinearLayout> | |||
</RelativeLayout> | |||
<LinearLayout | |||
android:layout_width="wrap_content" | |||
android:layout_height="wrap_content" | |||
android:layout_alignParentBottom="true" | |||
android:layout_centerHorizontal="true" | |||
android:layout_marginBottom="@dimen/dp_10"> | |||
<Button | |||
android:id="@+id/xinjian" | |||
android:layout_width="200dp" | |||
android:layout_height="40dp" | |||
android:background="@drawable/bg_btn_login_selected" | |||
android:text="保存配方" | |||
android:textColor="@color/white" | |||
android:textSize="18sp" /> | |||
</LinearLayout> | |||
</RelativeLayout> | |||
</RelativeLayout> |
@@ -273,7 +273,7 @@ | |||
android:text="128.0g" | |||
android:textSize="20dp" | |||
android:textStyle="bold|italic" | |||
android:textColor="@color/white"/> | |||
android:textColor="@color/red_primary_dark"/> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_marginTop="10dp" | |||
@@ -586,7 +586,7 @@ | |||
android:text="128.0g" | |||
android:textSize="20dp" | |||
android:textStyle="bold|italic" | |||
android:textColor="@color/white"/> | |||
android:textColor="@color/red_primary_dark"/> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_marginTop="10dp" | |||
@@ -829,9 +829,9 @@ | |||
android:layout_centerInParent="true" | |||
android:fontFamily="sans-serif-medium" | |||
android:text="128.0g" | |||
android:textColor="@color/red_primary_dark" | |||
android:textSize="20dp" | |||
android:textStyle="bold|italic" | |||
android:textColor="@color/white"/> | |||
android:textStyle="bold|italic" /> | |||
</RelativeLayout> | |||
<RelativeLayout | |||
android:layout_marginTop="10dp" | |||