From bc5b60663c700b2ee9422adde37425ac929579dc Mon Sep 17 00:00:00 2001 From: fyf <11621@LAPTOP-04QQU0AO> Date: Sat, 10 Jun 2023 16:28:52 +0800 Subject: [PATCH] =?UTF-8?q?=E7=8E=B0=E5=9C=BA=E8=B0=83=E8=AF=95=E6=94=B9?= =?UTF-8?q?=E5=8A=A86222?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/example/bpa/MainActivity.java | 66 ++++++++++++------- .../bpa/view/fragment/HomeFragment.java | 40 ++++++----- 2 files changed, 63 insertions(+), 43 deletions(-) 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