Browse Source

现场修改896

tags/old_version_1
fyf 1 year ago
parent
commit
2648f71415
2 changed files with 30 additions and 26 deletions
  1. +1
    -21
      app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java
  2. +29
    -5
      app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/CpActivity.java

+ 1
- 21
app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java View File

@@ -551,33 +551,13 @@ public class ExecuteTheRecipe {
{
try
{
final boolean[] IsComplete = {false};
long a = System.currentTimeMillis();

WritePLC(name,true,null);
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
ExecuteTheRecipe.WritePLC(name, false, new IWriteCallBack() {
@Override
public void onSuccess() {
IsComplete[0]=true;
}

@Override
public void onFailure(String ErrorMsg) {
IsComplete[0]=true;
}
});
ExecuteTheRecipe.WritePLC(name, false, null);
}
}, 500);

while (!IsComplete[0]) {
if ((System.currentTimeMillis() - a) > 1000 * 3) {
break;
}
Thread.sleep(100);//10 *6
}
}catch (Exception ex)
{



+ 29
- 5
app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/CpActivity.java View File

@@ -23,10 +23,12 @@ import com.bonait.bnframework.common.constant.ConfigName;
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_GOODSRECIPE;
import com.bonait.bnframework.common.db.mode.BPA_PLCADDRESS;
import com.bonait.bnframework.common.message.MessageLooper;
import com.bonait.bnframework.common.message.MessageManager;
import com.bonait.bnframework.common.model.mode.CloudGood;
import com.bonait.bnframework.common.utils.AlertDialogUtils;
import com.bonait.bnframework.common.utils.ScreenUtils;
import com.bonait.bnframework.common.utils.ToastUtils;
import com.bonait.bnframework.modules.home.fragment.mode.QDListSectionAdapter;
@@ -35,6 +37,8 @@ import com.bonait.bnframework.modules.home.fragment.mode.SectionItem;
import com.bonait.bnframework.modules.home.fragment.mode.fragment_plc;
import com.qmuiteam.qmui.widget.QMUITopBar;
import com.qmuiteam.qmui.widget.QMUITopBarLayout;
import com.qmuiteam.qmui.widget.dialog.QMUIDialog;
import com.qmuiteam.qmui.widget.dialog.QMUIDialogAction;
import com.qmuiteam.qmui.widget.section.QMUISection;
import com.qmuiteam.qmui.widget.section.QMUIStickySectionAdapter;
import com.qmuiteam.qmui.widget.section.QMUIStickySectionLayout;
@@ -252,12 +256,32 @@ public class CpActivity extends BaseActivity {
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);
String title = "同步云端菜谱操作提示!";
String message = "请问客官确定要同步菜谱吗?此操作将完全复刻云端菜谱,本地菜谱将清除!请确认本地菜谱已上传云端!!!!";
AlertDialogUtils.showDialog(context, title, message, new QMUIDialogAction.ActionListener() {
@Override
public void onClick(QMUIDialog dialog, int index) {

if(ConfigName.getInstance().cloudGoods!=null && ConfigName.getInstance().cloudGoods.size()>0)
{
ArrayList<BPA_GOODS> goods= QueryDB.GetGoodsALL();
ArrayList<BPA_GOODSRECIPE> rec= QueryDB.GetGoodsSrecipeALL();
for (BPA_GOODS good:goods)
{
QueryDB.DeleteGoods(good);
}
for (BPA_GOODSRECIPE pf:rec)
{
QueryDB.DeleteGoodsSrecipe(pf);
}

for (CloudGood item : ConfigName.getInstance().cloudGoods) {
ConfigData.getInstance().GetGoodProcess(context,item.id,false);
}
}
dialog.dismiss();
}
}
});
}
});



Loading…
Cancel
Save