|
|
@@ -104,16 +104,36 @@ public class HandControlFragment extends BaseFragment { |
|
|
|
StatusOrMakeGoodThread(); |
|
|
|
} |
|
|
|
|
|
|
|
// /** |
|
|
|
// * 更新按钮背景和文本 |
|
|
|
// * @param id |
|
|
|
// * @param value |
|
|
|
// * @param trueText |
|
|
|
// * @param falseText |
|
|
|
// */ |
|
|
|
// private synchronized void RefreshButton(int id,boolean value,String trueText,String falseText){ |
|
|
|
// activity.runOnUiThread(()->{ |
|
|
|
// Button button = (Button)activity.findViewById(id); |
|
|
|
// if(!value){ |
|
|
|
// button.setText(trueText); |
|
|
|
// button.setBackgroundResource(R.drawable.bg_btn_false_color); |
|
|
|
// }else{ |
|
|
|
// button.setText(falseText); |
|
|
|
// button.setBackgroundResource(R.drawable.bg_btn_login_selected); |
|
|
|
// } |
|
|
|
// }); |
|
|
|
// } |
|
|
|
|
|
|
|
/** |
|
|
|
* 更新按钮背景和文本 |
|
|
|
* @param id |
|
|
|
* @param value |
|
|
|
* @param trueText |
|
|
|
* @param falseText |
|
|
|
* @param button 需要更新的按钮 |
|
|
|
* @param value 状态值 |
|
|
|
* @param trueText 状态为 true 时显示的文本 |
|
|
|
* @param falseText 状态为 false 时显示的文本 |
|
|
|
*/ |
|
|
|
private synchronized void RefreshButton(int id,boolean value,String trueText,String falseText){ |
|
|
|
private synchronized void RefreshButton(Button button,boolean value,String trueText,String falseText){ |
|
|
|
if(button==null) return; |
|
|
|
activity.runOnUiThread(()->{ |
|
|
|
Button button = activity.findViewById(id); |
|
|
|
if(!value){ |
|
|
|
button.setText(trueText); |
|
|
|
button.setBackgroundResource(R.drawable.bg_btn_false_color); |
|
|
@@ -131,14 +151,14 @@ public class HandControlFragment extends BaseFragment { |
|
|
|
|
|
|
|
//系统启停状态更新 |
|
|
|
ExecuteTheRecipe.getDeviceData.SystemStartStopStatusNotify.ChangeNotify=(s)->{getActivity().runOnUiThread(()->{ |
|
|
|
RefreshButton(R.id.switch_系统启停,s,"启动","停止"); |
|
|
|
RefreshButton(switch_系统启停,s,"启动","停止"); |
|
|
|
switch_系统启停.setEnabled(true); |
|
|
|
MessageLog.ShowInfo("更新开关状态:"+(s?"true":"false")); |
|
|
|
});}; |
|
|
|
|
|
|
|
//超温停气状态更新 |
|
|
|
ExecuteTheRecipe.getDeviceData.OverTemperatureShutdownNotify.ChangeNotify=(s)->{getActivity().runOnUiThread(()->{ |
|
|
|
RefreshButton(R.id.switch_超温停气,s,"启用","禁用"); |
|
|
|
RefreshButton(switch_超温停气,s,"启用","禁用"); |
|
|
|
switch_超温停气.setEnabled(true); |
|
|
|
});}; |
|
|
|
|
|
|
@@ -175,31 +195,31 @@ public class HandControlFragment extends BaseFragment { |
|
|
|
|
|
|
|
//小火控制状态更新 |
|
|
|
ExecuteTheRecipe.getDeviceData.SmallFireStatusNotify.ChangeNotify=(s)->{getActivity().runOnUiThread(()->{ |
|
|
|
RefreshButton(R.id.switch_小火,s,"打开","关闭"); |
|
|
|
RefreshButton(switch_小火,s,"打开","关闭"); |
|
|
|
switch_小火.setEnabled(true); |
|
|
|
});}; |
|
|
|
|
|
|
|
//中火控制状态更新 |
|
|
|
ExecuteTheRecipe.getDeviceData.MediumFireStatusNotify.ChangeNotify=(s)->{getActivity().runOnUiThread(()->{ |
|
|
|
RefreshButton(R.id.switch_中火,s,"打开","关闭"); |
|
|
|
RefreshButton(switch_中火,s,"打开","关闭"); |
|
|
|
switch_中火.setEnabled(true); |
|
|
|
});}; |
|
|
|
|
|
|
|
//大火控制状态更新 |
|
|
|
ExecuteTheRecipe.getDeviceData.HighFireStatusNotify.ChangeNotify=(s)->{getActivity().runOnUiThread(()->{ |
|
|
|
RefreshButton(R.id.switch_大火,s,"打开","关闭"); |
|
|
|
RefreshButton(switch_大火,s,"打开","关闭"); |
|
|
|
switch_大火.setEnabled(true); |
|
|
|
});}; |
|
|
|
|
|
|
|
//强火控制状态更新 |
|
|
|
ExecuteTheRecipe.getDeviceData.StrongFireStatusNotify.ChangeNotify=(s)->{getActivity().runOnUiThread(()->{ |
|
|
|
RefreshButton(R.id.switch_强火,s,"打开","关闭"); |
|
|
|
RefreshButton(switch_强火,s,"打开","关闭"); |
|
|
|
switch_强火.setEnabled(true); |
|
|
|
});}; |
|
|
|
|
|
|
|
//点火控制状态更新 |
|
|
|
ExecuteTheRecipe.getDeviceData.IgnitionStatusNotify.ChangeNotify=(s)->{getActivity().runOnUiThread(()->{ |
|
|
|
RefreshButton(R.id.switch_点火控制,s,"点火","关火"); |
|
|
|
RefreshButton(switch_点火控制,s,"点火","关火"); |
|
|
|
switch_点火控制.setEnabled(true); |
|
|
|
});}; |
|
|
|
|
|
|
@@ -215,19 +235,19 @@ public class HandControlFragment extends BaseFragment { |
|
|
|
|
|
|
|
//搅拌控制状态更新 |
|
|
|
ExecuteTheRecipe.getDeviceData.StirControlStatusNotify.ChangeNotify=(s)->{getActivity().runOnUiThread(()->{ |
|
|
|
RefreshButton(R.id.switch_搅拌控制,s,"启动搅拌","停止搅拌"); |
|
|
|
RefreshButton(switch_搅拌控制,s,"启动搅拌","停止搅拌"); |
|
|
|
switch_搅拌控制.setEnabled(true); |
|
|
|
});}; |
|
|
|
|
|
|
|
//抽油启停状态更新 |
|
|
|
ExecuteTheRecipe.getDeviceData.OilPumpingStatusNotify.ChangeNotify=(s)->{getActivity().runOnUiThread(()->{ |
|
|
|
RefreshButton(R.id.switch_抽油启停,s,"启动抽油","停止抽油"); |
|
|
|
RefreshButton(switch_抽油启停,s,"启动抽油","停止抽油"); |
|
|
|
switch_抽油启停.setEnabled(true); |
|
|
|
});}; |
|
|
|
|
|
|
|
//备用气缸起停状态更新 |
|
|
|
ExecuteTheRecipe.getDeviceData.StandbyCylinderStatusNotify.ChangeNotify=(s)->{getActivity().runOnUiThread(()->{ |
|
|
|
RefreshButton(R.id.switch_备用气缸,s,"启动","停止"); |
|
|
|
RefreshButton(switch_备用气缸,s,"启动","停止"); |
|
|
|
switch_备用气缸.setEnabled(true); |
|
|
|
});}; |
|
|
|
|
|
|
@@ -290,34 +310,43 @@ public class HandControlFragment extends BaseFragment { |
|
|
|
switch (view.getId()) { |
|
|
|
case R.id.button_出料: |
|
|
|
if (!ExecuteTheRecipe.getDeviceData.SystemStartStopStatusNotify.getValue()) { |
|
|
|
// AlertDialogUtils.showDialog(context, "提示", "系统未启动,请启动后重试!"); |
|
|
|
DialogManager.showWarn("系统未启动,请启动后重试!",AlertDialogButton.OK,null); |
|
|
|
return ; |
|
|
|
} |
|
|
|
Convert.TryToFloat(edit_设定重量.getText()).OnSource((s)-> |
|
|
|
{ |
|
|
|
ExecuteTheRecipe.showlog("手动设定出料重量:"+s.Content); |
|
|
|
Convert.TryToFloat(edit_提前量.getText()).OnSource((t)-> |
|
|
|
{ |
|
|
|
ExecuteTheRecipe.showlog("手动设定提前量:"+t.Content); |
|
|
|
ExecuteTheRecipe.DischargeControlAsync(s.Content,t.Content); |
|
|
|
}).OnFailed(p->{ |
|
|
|
// AlertDialogUtils.showDialog(context, "提示", "输入的数据格式不匹配,请重试!"); |
|
|
|
DialogManager.showError("输入的数据格式不匹配,请重试!",AlertDialogButton.OK,null); |
|
|
|
edit_提前量.setText("0.0"); |
|
|
|
}); |
|
|
|
|
|
|
|
}).OnFailed(f->{ |
|
|
|
// AlertDialogUtils.showDialog(context, "提示", "输入的数据格式不匹配,请重试!"); |
|
|
|
DialogManager.showError("输入的数据格式不匹配,请重试!",AlertDialogButton.OK,null); |
|
|
|
edit_设定重量.setText("0.0"); |
|
|
|
DialogManager.showWarn("手动出料前请确认周边环境是否安全?\r\n请问是否继续?",AlertDialogButton.YesNo,(res)->{ |
|
|
|
if(res){ |
|
|
|
Convert.TryToFloat(edit_设定重量.getText()).OnSource((s)-> |
|
|
|
{ |
|
|
|
ExecuteTheRecipe.showlog("手动设定出料重量:"+s.Content); |
|
|
|
Convert.TryToFloat(edit_提前量.getText()).OnSource((t)-> |
|
|
|
{ |
|
|
|
ExecuteTheRecipe.showlog("手动设定提前量:"+t.Content); |
|
|
|
ExecuteTheRecipe.DischargeControlAsync(s.Content,t.Content); |
|
|
|
}).OnFailed(p->{ |
|
|
|
// AlertDialogUtils.showDialog(context, "提示", "输入的数据格式不匹配,请重试!"); |
|
|
|
DialogManager.showError("输入的数据格式不匹配,请重试!",AlertDialogButton.OK,null); |
|
|
|
edit_提前量.setText("0.0"); |
|
|
|
}); |
|
|
|
|
|
|
|
}).OnFailed(f->{ |
|
|
|
DialogManager.showError("输入的数据格式不匹配,请重试!",AlertDialogButton.OK,null); |
|
|
|
edit_设定重量.setText("0.0"); |
|
|
|
}); |
|
|
|
} |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
break; |
|
|
|
case R.id.button_点火复位: |
|
|
|
ExecuteTheRecipe.showlog("手动操作点火复位开关"); |
|
|
|
ExecuteTheRecipe.BottomClickAsync("点火复位开关"); |
|
|
|
break; |
|
|
|
case R.id.button_写入参数: |
|
|
|
|
|
|
|
boolean temp = ExecuteTheRecipe.getDeviceData.SystemStartStopStatusNotify.getValue(); |
|
|
|
ExecuteTheRecipe.getDeviceData.SystemStartStopStatusNotify.setValue(!temp); |
|
|
|
|
|
|
|
Convert.TryToFloat(edit_温度修正.getText()).OnSource((s)-> |
|
|
|
{ |
|
|
|
ExecuteTheRecipe.showlog("手动设置温度修正值:"+s.Content); |
|
|
|