diff --git a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java index a05b84ef..88a50481 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ConfigData.java +++ b/app/src/main/java/com/bonait/bnframework/business/ConfigData.java @@ -525,7 +525,7 @@ public class ConfigData { * * @param context */ - public void GetGoodProcess(Context context, String goodid) { + public void GetGoodProcess(Context context, String goodid,Boolean isSX) { Boolean IsXZ = QueryDB.GetGoodsIDIs(goodid); if (IsXZ) { ToastUtils.warning("请勿重复下载,本地商品已存在!!!"); @@ -630,7 +630,11 @@ public class ConfigData { } } ToastUtils.info("下载菜品成功!!!"); - MessageManager.getInstance().sendMessage(MessageName.ScGood, "Good"); + + if(isSX) + { + MessageManager.getInstance().sendMessage(MessageName.ScGood, "Good"); + } } } } diff --git a/app/src/main/java/com/bonait/bnframework/business/MainInit.java b/app/src/main/java/com/bonait/bnframework/business/MainInit.java index 56f88d16..da31c2e5 100644 --- a/app/src/main/java/com/bonait/bnframework/business/MainInit.java +++ b/app/src/main/java/com/bonait/bnframework/business/MainInit.java @@ -12,6 +12,8 @@ import com.bonait.bnframework.common.db.QueryDB; import com.bonait.bnframework.common.db.file.DBHelper; import com.bonait.bnframework.common.db.mode.BPA_ALERTLOG; import com.bonait.bnframework.common.db.mode.BPA_CLOUDDATA; +import com.bonait.bnframework.common.db.mode.BPA_GOODS; +import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE; import com.bonait.bnframework.common.db.mode.BPA_LOG; import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS; import com.bonait.bnframework.common.db.mode.BPA_SILOS; @@ -42,6 +44,7 @@ import com.qmuiteam.qmui.arch.QMUISwipeBackActivityManager; import org.litepal.LitePal; +import java.util.ArrayList; import java.util.concurrent.TimeUnit; import java.util.logging.Level; @@ -99,9 +102,31 @@ public class MainInit { //设置连接到有线网络 // NetworkUtils.connetEnternet(app); + + //text(); } + //========================================================================// + public static void text() + { + String id="38f0a737-2476-40d8-a7d8-28ff7796e9d2"; + BPA_GOODS gd=QueryDB.GetGoodsId(id); + ArrayList PF=QueryDB.GetGoodsSrecipeID(id); + ArrayList goods= QueryDB.GetGoodsALL(); + for (BPA_GOODS good:goods) + { + if(!good.id.equals(id)) + { + for (BPA_GOODSRECIPE m:PF) + { + m.id=java.util.UUID.randomUUID().toString(); + m.goodsID=good.id; + QueryDB.AddGoodsSrecipe(m); + } + } + } + } /** * 初始化数据库数据(默认数据) */ diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/CpActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/CpActivity.java index 9c3a6dca..3e45c177 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/CpActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/CpActivity.java @@ -245,6 +245,22 @@ public class CpActivity extends BaseActivity { finish(); } }); + + /** + * 下载云端菜谱 + */ + mTopBar.addRightImageButton(R.mipmap.clouddownload,R.id.cLeftImageViewId).setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + if(ConfigName.getInstance().cloudGoods!=null && ConfigName.getInstance().cloudGoods.size()>0) + { + for (CloudGood item : ConfigName.getInstance().cloudGoods) { + ConfigData.getInstance().GetGoodProcess(context,item.id,false); + } + } + } + }); + /** * 新建商品 */ @@ -254,6 +270,8 @@ public class CpActivity extends BaseActivity { skipToActivity(DiyActivity.class); } }); + + } /** diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/QDListSectionAdapter.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/QDListSectionAdapter.java index ffa071c7..7513016d 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/QDListSectionAdapter.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/QDListSectionAdapter.java @@ -110,7 +110,7 @@ public class QDListSectionAdapter extends QMUIDefaultStickySectionAdapter { public void onClick(View view) { if(isCloud) { - ConfigData.getInstance().GetGoodProcess(holder.itemView.getContext(),id); + ConfigData.getInstance().GetGoodProcess(holder.itemView.getContext(),id,true); }else { ConfigData.getInstance().UploadGoods(holder.itemView.getContext(),id); diff --git a/app/src/main/res/mipmap-hdpi/clouddownload.png b/app/src/main/res/mipmap-hdpi/clouddownload.png new file mode 100644 index 00000000..a8dce87f Binary files /dev/null and b/app/src/main/res/mipmap-hdpi/clouddownload.png differ