diff --git a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java index 1641116a..eadd7a0e 100644 --- a/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java +++ b/app/src/main/java/com/bonait/bnframework/business/ExecuteTheRecipe.java @@ -241,7 +241,7 @@ public class ExecuteTheRecipe { ExecuteTheRecipe.WritePLC("手动控制"+i,false,null); } } - }); + }).start(); ThreadManager.Get().StartLong("PLC设备数据监听", true, new IThread() { @Override @@ -410,6 +410,10 @@ public class ExecuteTheRecipe { //MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, message + "准备下发【" + silos.num + "】号料仓PLC控制命令,需求量:=" + recipe.value); int _val = (int)Math.round((Double.parseDouble(recipe.value) * 10)); WritePLC("需求值" + silos.num, (short) _val, null); + + //減去料仓数量 + int otherG=silos.silosmargin-(_val/10); + QueryDB.UpdateYL(silos.id,otherG>=0?otherG:0); } } MessageLog.ShowInfo(RecipesNames + "下发成功!"); diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosNewActivity.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosNewActivity.java index 129e187b..f534b920 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosNewActivity.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/from/SilosNewActivity.java @@ -102,6 +102,7 @@ public class SilosNewActivity extends BaseActivity { @Override public void clickListenerNew(View v, int k, Object data) { if (k == 0) { + DataBus.getInstance().RefreshSilos(); MessageManager.getInstance().sendMessage(MessageName.RefreshSilos,"RefreshSilos"); add_yijian.setVisibility(View.GONE); } else if (k == 1) { @@ -131,6 +132,7 @@ public class SilosNewActivity extends BaseActivity { @Override public void clickListenerNew(View v, int k, Object data) { if (k == 0) { + DataBus.getInstance().RefreshSilos(); MessageManager.getInstance().sendMessage(MessageName.RefreshSilos,"RefreshSilos"); add_silos.setVisibility(View.GONE); } else if (k == 1) { diff --git a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/Silos_item_fragment.java b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/Silos_item_fragment.java index e3ac84a6..c62f99d1 100644 --- a/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/Silos_item_fragment.java +++ b/app/src/main/java/com/bonait/bnframework/modules/home/fragment/mode/Silos_item_fragment.java @@ -78,23 +78,21 @@ public class Silos_item_fragment extends BaseFragment { */ public void InitViewData() { -// new Thread(new Runnable() { -// @Override -// public void run() { -// if(activity!=null) -// { -// activity.runOnUiThread(new Runnable() { -// @Override -// public void run() { -// -// } -// }); -// } -// } -// }); - - DataBus.getInstance().RefreshSilos(); - InitView(); + new Thread(new Runnable() { + @Override + public void run() { + if(activity!=null) + { + activity.runOnUiThread(new Runnable() { + @Override + public void run() { + + InitView(); + } + }); + } + } + }).start(); } /** * 初始化界面