@@ -241,7 +241,7 @@ public class ExecuteTheRecipe { | |||||
ExecuteTheRecipe.WritePLC("手动控制"+i,false,null); | ExecuteTheRecipe.WritePLC("手动控制"+i,false,null); | ||||
} | } | ||||
} | } | ||||
}); | |||||
}).start(); | |||||
ThreadManager.Get().StartLong("PLC设备数据监听", true, new IThread() { | ThreadManager.Get().StartLong("PLC设备数据监听", true, new IThread() { | ||||
@Override | @Override | ||||
@@ -410,6 +410,10 @@ public class ExecuteTheRecipe { | |||||
//MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, message + "准备下发【" + silos.num + "】号料仓PLC控制命令,需求量:=" + recipe.value); | //MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, message + "准备下发【" + silos.num + "】号料仓PLC控制命令,需求量:=" + recipe.value); | ||||
int _val = (int)Math.round((Double.parseDouble(recipe.value) * 10)); | int _val = (int)Math.round((Double.parseDouble(recipe.value) * 10)); | ||||
WritePLC("需求值" + silos.num, (short) _val, null); | WritePLC("需求值" + silos.num, (short) _val, null); | ||||
//減去料仓数量 | |||||
int otherG=silos.silosmargin-(_val/10); | |||||
QueryDB.UpdateYL(silos.id,otherG>=0?otherG:0); | |||||
} | } | ||||
} | } | ||||
MessageLog.ShowInfo(RecipesNames + "下发成功!"); | MessageLog.ShowInfo(RecipesNames + "下发成功!"); | ||||
@@ -102,6 +102,7 @@ public class SilosNewActivity extends BaseActivity { | |||||
@Override | @Override | ||||
public void clickListenerNew(View v, int k, Object data) { | public void clickListenerNew(View v, int k, Object data) { | ||||
if (k == 0) { | if (k == 0) { | ||||
DataBus.getInstance().RefreshSilos(); | |||||
MessageManager.getInstance().sendMessage(MessageName.RefreshSilos,"RefreshSilos"); | MessageManager.getInstance().sendMessage(MessageName.RefreshSilos,"RefreshSilos"); | ||||
add_yijian.setVisibility(View.GONE); | add_yijian.setVisibility(View.GONE); | ||||
} else if (k == 1) { | } else if (k == 1) { | ||||
@@ -131,6 +132,7 @@ public class SilosNewActivity extends BaseActivity { | |||||
@Override | @Override | ||||
public void clickListenerNew(View v, int k, Object data) { | public void clickListenerNew(View v, int k, Object data) { | ||||
if (k == 0) { | if (k == 0) { | ||||
DataBus.getInstance().RefreshSilos(); | |||||
MessageManager.getInstance().sendMessage(MessageName.RefreshSilos,"RefreshSilos"); | MessageManager.getInstance().sendMessage(MessageName.RefreshSilos,"RefreshSilos"); | ||||
add_silos.setVisibility(View.GONE); | add_silos.setVisibility(View.GONE); | ||||
} else if (k == 1) { | } else if (k == 1) { | ||||
@@ -78,23 +78,21 @@ public class Silos_item_fragment extends BaseFragment { | |||||
*/ | */ | ||||
public void InitViewData() | 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(); | |||||
} | } | ||||
/** | /** | ||||
* 初始化界面 | * 初始化界面 | ||||