diff --git a/app/src/main/java/com/example/bpa/MainActivity.java b/app/src/main/java/com/example/bpa/MainActivity.java index ee0f51b..62e8f26 100644 --- a/app/src/main/java/com/example/bpa/MainActivity.java +++ b/app/src/main/java/com/example/bpa/MainActivity.java @@ -30,6 +30,7 @@ import com.example.bpa.config.ConfigName; import com.example.bpa.config.DataBus; import com.example.bpa.config.MessageName; import com.example.bpa.db.QueryDB; +import com.example.bpa.db.mode.BPA_GOODS; import com.example.bpa.db.mode.BPA_ORDER; import com.example.bpa.db.mode.BPA_SUBORDER; import com.example.bpa.helper.Json; @@ -186,13 +187,14 @@ public class MainActivity extends FragmentActivity implements View.OnClickListen ShowFragment(systemSetFragment, "系统设置"); break; case R.id.SystemHelp://系统帮助按钮 - if(OrderID.isEmpty()) - { - T.show(MainActivity.this, "无制作中饮品!"); - }else - { - ShowDialog(OrderID); - } + Main.getInstance().GetOrder("455283032140681216"); +// if(OrderID.isEmpty()) +// { +// T.show(MainActivity.this, "无制作中饮品!"); +// }else +// { +// ShowDialog(OrderID); +// } //ShowFragment(heplerFragment, "系统帮助"); break; case R.id.HomeMain://主页 @@ -317,27 +319,41 @@ public class MainActivity extends FragmentActivity implements View.OnClickListen for (BPA_SUBORDER k : sub) { ResGoodsMake make = new ResGoodsMake(); make.recipes = QueryDB.GetGoodsSrecipeList(k.goodsID); - make.good = QueryDB.GetGoodsId(k.goodsID); - make.subOrder = k; - - make.makeMs = ""; - make.makeProcess = 0; - if (k.status == 0) { - make.makeStatus = MakeStatus.等待制作; - } else if (k.status == 1) { - make.makeStatus = MakeStatus.制作中; - } else { - make.makeStatus = MakeStatus.制作完成; + BPA_GOODS good= QueryDB.GetGoodsId(k.goodsID); + if(good.name!=null) + { + make.good = QueryDB.GetGoodsId(k.goodsID); + make.subOrder = k; + make.makeMs = ""; - make.makeProcess = 100; - for (ResGoodsRecipe recipe : make.recipes) { - recipe.makeProcess = 100; + make.makeProcess = 0; + if (k.status == 0) { + make.makeStatus = MakeStatus.等待制作; + } else if (k.status == 1) { + make.makeStatus = MakeStatus.制作中; + } else { + make.makeStatus = MakeStatus.制作完成; + make.makeMs = ""; + make.makeProcess = 100; + for (ResGoodsRecipe recipe : make.recipes) { + recipe.makeProcess = 100; + } + } + // if(!make.makeStatus.equals(MakeStatus.制作完成)) + { + DataBus.getInstance().GoodsSMMake.add(make); } } - // if(!make.makeStatus.equals(MakeStatus.制作完成)) - { - DataBus.getInstance().GoodsSMMake.add(make); - } + } + if(DataBus.getInstance().GoodsSMMake.size()<=0) + { + runOnUiThread(new Runnable() { + @Override + public void run() { + T.show(MainActivity.this, "无可制作的订单!"); + } + }); + return; } if (alg == null) { diff --git a/app/src/main/java/com/example/bpa/view/fragment/HomeFragment.java b/app/src/main/java/com/example/bpa/view/fragment/HomeFragment.java index 0783a01..2bda62d 100644 --- a/app/src/main/java/com/example/bpa/view/fragment/HomeFragment.java +++ b/app/src/main/java/com/example/bpa/view/fragment/HomeFragment.java @@ -103,13 +103,17 @@ public class HomeFragment extends Fragment implements View.OnClickListener, MyCl public void Initdata() { try{ - MyLayoutManager layout = new MyLayoutManager(); - layout.setAutoMeasureEnabled(true); - good_recyclerView.setLayoutManager(layout); + if( ConfigName.getInstance().IsUserDownOrder) + { + MyLayoutManager layout = new MyLayoutManager(); + layout.setAutoMeasureEnabled(true); + good_recyclerView.setLayoutManager(layout); + + goodadapter = new maingoods_adapter( getContext()); + good_recyclerView.setAdapter(goodadapter); + DataBus.getInstance().UpdateMainGoods();//更新商品 + } - goodadapter = new maingoods_adapter( getContext()); - good_recyclerView.setAdapter(goodadapter); - DataBus.getInstance().UpdateMainGoods();//更新商品 // MakeGood.setLayoutManager(new WrapContentLinearLayoutManager(view.getContext(), LinearLayoutManager.HORIZONTAL,false)); @@ -155,18 +159,18 @@ public class HomeFragment extends Fragment implements View.OnClickListener, MyCl Activity activity=null; public void RegisterMessage() { - MessageManager.getInstance().registerMessageReceiver(this, MessageName.Common.name(), new MessageLooper.OnMessageListener() { - @Override - public void onMessage(Object msg) { - activity.runOnUiThread(new Runnable() { - @Override - public void run() { - DataBus.getInstance().UpdateMainGoods();//更新商品 - goodadapter.notifyDataSetChanged(); - } - }); - } - }); +// MessageManager.getInstance().registerMessageReceiver(this, MessageName.Common.name(), new MessageLooper.OnMessageListener() { +// @Override +// public void onMessage(Object msg) { +// activity.runOnUiThread(new Runnable() { +// @Override +// public void run() { +// DataBus.getInstance().UpdateMainGoods();//更新商品 +// goodadapter.notifyDataSetChanged(); +// } +// }); +// } +// }); } //endregion } \ No newline at end of file