@@ -85,8 +85,11 @@ public class DialogManager { | |||||
private static Context mContext; | private static Context mContext; | ||||
public static void setContext(Context _ct){ | |||||
mContext = _ct; | |||||
private static Activity mActivity; | |||||
public static void Init(Context context,Activity activity){ | |||||
mContext = context; | |||||
mActivity=activity; | |||||
} | } | ||||
/** | /** | ||||
@@ -153,7 +156,9 @@ public class DialogManager { | |||||
* @param action 执行回调 | * @param action 执行回调 | ||||
*/ | */ | ||||
public static void showInfo(String message, AlertDialogButton btn, IDialogAction action) { | public static void showInfo(String message, AlertDialogButton btn, IDialogAction action) { | ||||
showDialog(message,btn,DialogType.提示,action); | |||||
if(mActivity!=null) | |||||
mActivity.runOnUiThread(()->{showDialog(message,btn,DialogType.提示,action);}); | |||||
else showDialog(message,btn,DialogType.提示,action); | |||||
} | } | ||||
/** | /** | ||||
@@ -163,7 +168,9 @@ public class DialogManager { | |||||
* @param action 执行回调 | * @param action 执行回调 | ||||
*/ | */ | ||||
public static void showWarn(String message, AlertDialogButton btn, IDialogAction action) { | public static void showWarn(String message, AlertDialogButton btn, IDialogAction action) { | ||||
showDialog(message,btn,DialogType.警告,action); | |||||
if(mActivity!=null) | |||||
mActivity.runOnUiThread(()->{showDialog(message,btn,DialogType.警告,action);}); | |||||
else showDialog(message,btn,DialogType.警告,action); | |||||
} | } | ||||
/** | /** | ||||
@@ -173,7 +180,9 @@ public class DialogManager { | |||||
* @param action 执行回调 | * @param action 执行回调 | ||||
*/ | */ | ||||
public static void showError(String message, AlertDialogButton btn, IDialogAction action) { | public static void showError(String message, AlertDialogButton btn, IDialogAction action) { | ||||
showDialog(message,btn,DialogType.错误,action); | |||||
if(mActivity!=null) | |||||
mActivity.runOnUiThread(()->{showDialog(message,btn,DialogType.错误,action);}); | |||||
else showDialog(message,btn,DialogType.错误,action); | |||||
} | } | ||||
} | } | ||||
@@ -7,6 +7,7 @@ import android.util.Log; | |||||
import androidx.annotation.NonNull; | import androidx.annotation.NonNull; | ||||
import com.bonait.bnframework.Dialog.DialogManager; | |||||
import com.bonait.bnframework.common.constant.ConfigName; | import com.bonait.bnframework.common.constant.ConfigName; | ||||
import com.bonait.bnframework.common.db.QueryDB; | import com.bonait.bnframework.common.db.QueryDB; | ||||
import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE; | import com.bonait.bnframework.common.db.mode.BPA_GOODSRECIPE; | ||||
@@ -184,7 +185,7 @@ public class ExecuteTheRecipe { | |||||
public static void FaultDetect(){ | public static void FaultDetect(){ | ||||
if(getDeviceData.IgnitionMalfunction.getValue()&&!IsForcedEnd){ | if(getDeviceData.IgnitionMalfunction.getValue()&&!IsForcedEnd){ | ||||
MessageLog.ShowError("点火异常中,等待重新点火"); | MessageLog.ShowError("点火异常中,等待重新点火"); | ||||
AlertDialogUtils.showDialog("检测到点火异常,是否复位后重新点火?",AlertDialogButton.YesNo ,(s)->{ | |||||
DialogManager.showWarn("检测到点火异常,是否复位后重新点火?",AlertDialogButton.YesNo ,(s)->{ | |||||
if(s){ | if(s){ | ||||
BottomClick("点火复位开关");//复位点火开关 | BottomClick("点火复位开关");//复位点火开关 | ||||
} | } | ||||
@@ -395,29 +396,34 @@ public class ExecuteTheRecipe { | |||||
} | } | ||||
ExecuteTheRecipe.showlog("工序:手动投料," + name); | ExecuteTheRecipe.showlog("工序:手动投料," + name); | ||||
String title = "手动投料-温馨提示!"; | |||||
String message = "客官请投入主料,[" + name + "],投入后点击[确定]继续流程!"; | |||||
// String title = "手动投料-温馨提示!"; | |||||
// String message = "客官请投入主料,[" + name + "],投入后点击[确定]继续流程!"; | |||||
final boolean[] IsComplete = {false}; | final boolean[] IsComplete = {false}; | ||||
Activity activity = findActivity(context); | |||||
if (activity != null) { | |||||
activity.runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
try { | |||||
new QMUIDialog.MessageDialogBuilder(context).setCancelable(false).setCanceledOnTouchOutside(false).setTitle(title).setMessage(message).addAction("确定", new QMUIDialogAction.ActionListener() { | |||||
@Override | |||||
public void onClick(QMUIDialog dialog, int index) { | |||||
IsComplete[0] = true; | |||||
dialog.dismiss(); | |||||
} | |||||
}).create(com.qmuiteam.qmui.R.style.QMUI_Dialog).show(); | |||||
} catch (Exception e) { | |||||
} | |||||
} | |||||
}); | |||||
} | |||||
DialogManager.showInfo("请投入主料:[" + name + "]\r\n投入后点击 [确定] 继续流程!", AlertDialogButton.OK,s->{ | |||||
IsComplete[0] = s; | |||||
}); | |||||
// Activity activity = findActivity(context); | |||||
// if (activity != null) { | |||||
// activity.runOnUiThread(new Runnable() { | |||||
// @Override | |||||
// public void run() { | |||||
// try { | |||||
// new QMUIDialog.MessageDialogBuilder(context).setCancelable(false).setCanceledOnTouchOutside(false).setTitle(title).setMessage(message).addAction("确定", new QMUIDialogAction.ActionListener() { | |||||
// @Override | |||||
// public void onClick(QMUIDialog dialog, int index) { | |||||
// IsComplete[0] = true; | |||||
// dialog.dismiss(); | |||||
// } | |||||
// }).create(com.qmuiteam.qmui.R.style.QMUI_Dialog).show(); | |||||
// } catch (Exception e) { | |||||
// | |||||
// } | |||||
// } | |||||
// }); | |||||
// } | |||||
while (!IsComplete[0]) { | while (!IsComplete[0]) { | ||||
Thread.sleep(100);//10 *6 | Thread.sleep(100);//10 *6 | ||||
@@ -532,13 +538,17 @@ public class ExecuteTheRecipe { | |||||
if(status){ | if(status){ | ||||
MessageLog.ShowInfo("开火中...."); | MessageLog.ShowInfo("开火中...."); | ||||
//确认点火提示 | |||||
mainActivity.runOnUiThread(()->{ | |||||
AlertDialogUtils.showDialog(mainContext, "提示", "是否开始点火?",(s)->{ | |||||
HeatStatus=s?1:2; | |||||
}); | |||||
DialogManager.showWarn("点火之前请检查设备是否准备就绪?\r\n是否继续点火?",AlertDialogButton.YesNo,s->{ | |||||
HeatStatus=s?1:2; | |||||
}); | }); | ||||
//确认点火提示 | |||||
// mainActivity.runOnUiThread(()->{ | |||||
// AlertDialogUtils.showDialog(mainContext, "提示", "是否开始点火?",(s)->{ | |||||
// HeatStatus=s?1:2; | |||||
// }); | |||||
// }); | |||||
//等待弹框关闭 | //等待弹框关闭 | ||||
WaitDialog((s)->{ | WaitDialog((s)->{ | ||||
if(s){ | if(s){ | ||||
@@ -578,11 +588,13 @@ public class ExecuteTheRecipe { | |||||
// }); | // }); | ||||
//点火失败提示 | //点火失败提示 | ||||
mainActivity.runOnUiThread(()->{ | |||||
AlertDialogUtils.showDialog(mainContext, "提示", "点火失败,是否复位后重试?",(s)->{ | |||||
HeatStatus=s?1:2; | |||||
}); | |||||
}); | |||||
DialogManager.showError("点火失败,是否复位后重试?",AlertDialogButton.YesNo,s->{HeatStatus=s?1:2; }); | |||||
// mainActivity.runOnUiThread(()->{ | |||||
// AlertDialogUtils.showDialog(mainContext, "提示", "点火失败,是否复位后重试?",(s)->{ | |||||
// HeatStatus=s?1:2; | |||||
// }); | |||||
// }); | |||||
//等待弹框被关闭 | //等待弹框被关闭 | ||||
WaitDialog((s)->{ | WaitDialog((s)->{ | ||||
@@ -98,7 +98,7 @@ public class HandControlFragment extends BaseFragment { | |||||
ExecuteTheRecipe.mainContext=context; | ExecuteTheRecipe.mainContext=context; | ||||
ExecuteTheRecipe.mainActivity=activity; | ExecuteTheRecipe.mainActivity=activity; | ||||
AlertDialogUtils.getContext=context; | AlertDialogUtils.getContext=context; | ||||
DialogManager.setContext(context); | |||||
DialogManager.Init(context,activity); | |||||
NotifyProp(); | NotifyProp(); | ||||
Init_弹窗(); | Init_弹窗(); | ||||
StatusOrMakeGoodThread(); | StatusOrMakeGoodThread(); | ||||
@@ -344,15 +344,11 @@ public class HandControlFragment extends BaseFragment { | |||||
break; | break; | ||||
case R.id.button_写入参数: | case R.id.button_写入参数: | ||||
boolean temp = ExecuteTheRecipe.getDeviceData.SystemStartStopStatusNotify.getValue(); | |||||
ExecuteTheRecipe.getDeviceData.SystemStartStopStatusNotify.setValue(!temp); | |||||
Convert.TryToFloat(edit_温度修正.getText()).OnSource((s)-> | Convert.TryToFloat(edit_温度修正.getText()).OnSource((s)-> | ||||
{ | { | ||||
ExecuteTheRecipe.showlog("手动设置温度修正值:"+s.Content); | ExecuteTheRecipe.showlog("手动设置温度修正值:"+s.Content); | ||||
ExecuteTheRecipe.WriteAsync("炒锅温度修正",s.Content); | ExecuteTheRecipe.WriteAsync("炒锅温度修正",s.Content); | ||||
}).OnFailed(f->{ | }).OnFailed(f->{ | ||||
// AlertDialogUtils.showDialog(context, "提示", "输入的数据格式不匹配,请重试!"); | |||||
DialogManager.showError("输入的数据格式不匹配,请重试!",AlertDialogButton.OK,null); | DialogManager.showError("输入的数据格式不匹配,请重试!",AlertDialogButton.OK,null); | ||||
edit_温度修正.setText("0.0"); | edit_温度修正.setText("0.0"); | ||||
}); | }); | ||||
@@ -361,7 +357,6 @@ public class HandControlFragment extends BaseFragment { | |||||
ExecuteTheRecipe.showlog("手动设置温度上限值:"+s.Content); | ExecuteTheRecipe.showlog("手动设置温度上限值:"+s.Content); | ||||
ExecuteTheRecipe.WriteAsync("炒锅温度上限设置",s.Content); | ExecuteTheRecipe.WriteAsync("炒锅温度上限设置",s.Content); | ||||
}).OnFailed(p->{ | }).OnFailed(p->{ | ||||
// AlertDialogUtils.showDialog(context, "提示", "输入的数据格式不匹配,请重试!"); | |||||
DialogManager.showError("输入的数据格式不匹配,请重试!",AlertDialogButton.OK,null); | DialogManager.showError("输入的数据格式不匹配,请重试!",AlertDialogButton.OK,null); | ||||
edit_温度上限.setText("0.0"); | edit_温度上限.setText("0.0"); | ||||
}); | }); | ||||
@@ -406,7 +401,6 @@ public class HandControlFragment extends BaseFragment { | |||||
if(!ExecuteTheRecipe.getDeviceData.SystemStartStopStatusNotify.getValue()){ | if(!ExecuteTheRecipe.getDeviceData.SystemStartStopStatusNotify.getValue()){ | ||||
if(motionEvent.getAction() == MotionEvent.ACTION_DOWN){ | if(motionEvent.getAction() == MotionEvent.ACTION_DOWN){ | ||||
// AlertDialogUtils.showDialog("系统未启动,请启动后重试!", AlertDialogButton.OK,(s)->{}); | |||||
DialogManager.showWarn("系统未启动,请启动后重试!",AlertDialogButton.OK,null); | DialogManager.showWarn("系统未启动,请启动后重试!",AlertDialogButton.OK,null); | ||||
} | } | ||||
return false; | return false; | ||||
@@ -587,7 +581,6 @@ public class HandControlFragment extends BaseFragment { | |||||
private void DeviceControl(boolean isChecked,String name){ | private void DeviceControl(boolean isChecked,String name){ | ||||
if(isChecked&&!ExecuteTheRecipe.getDeviceData.SystemStartStopStatusNotify.getValue()){ | if(isChecked&&!ExecuteTheRecipe.getDeviceData.SystemStartStopStatusNotify.getValue()){ | ||||
// AlertDialogUtils.showDialog("系统未启动,请启动后重试!", AlertDialogButton.OK,null); | |||||
DialogManager.showWarn("系统未启动,请启动后重试!",AlertDialogButton.OK,null); | DialogManager.showWarn("系统未启动,请启动后重试!",AlertDialogButton.OK,null); | ||||
} | } | ||||
ExecuteTheRecipe.showlog("手动操作-"+name+",值:"+isChecked); | ExecuteTheRecipe.showlog("手动操作-"+name+",值:"+isChecked); | ||||
@@ -615,7 +608,6 @@ public class HandControlFragment extends BaseFragment { | |||||
boolean temp=!ExecuteTheRecipe.getDeviceData.StirControlStatusNotify.getValue(); | boolean temp=!ExecuteTheRecipe.getDeviceData.StirControlStatusNotify.getValue(); | ||||
if (temp) { | if (temp) { | ||||
if(!ExecuteTheRecipe.getDeviceData.SystemStartStopStatusNotify.getValue()){ | if(!ExecuteTheRecipe.getDeviceData.SystemStartStopStatusNotify.getValue()){ | ||||
// AlertDialogUtils.showDialog("系统未启动,请启动后重试!", AlertDialogButton.OK,null); | |||||
DialogManager.showWarn("系统未启动,请启动后重试!",AlertDialogButton.OK,null); | DialogManager.showWarn("系统未启动,请启动后重试!",AlertDialogButton.OK,null); | ||||
} | } | ||||
ExecuteTheRecipe.showlog("手动启动搅拌"); | ExecuteTheRecipe.showlog("手动启动搅拌"); | ||||
@@ -650,8 +642,6 @@ public class HandControlFragment extends BaseFragment { | |||||
} | } | ||||
/** | /** | ||||
* 初始化弹框中的事件 | * 初始化弹框中的事件 | ||||
*/ | */ | ||||
@@ -168,7 +168,7 @@ public class MakeGoodFragment extends BaseFragment { | |||||
NotifyProp(); | NotifyProp(); | ||||
initTopBar(); | initTopBar(); | ||||
Initdata(); | Initdata(); | ||||
DialogManager.setContext(context); | |||||
DialogManager.Init(context,activity); | |||||
CommHelper.get().ConnectOk = new IRun() { | CommHelper.get().ConnectOk = new IRun() { | ||||
@Override | @Override | ||||
public void Run() { | public void Run() { | ||||
@@ -1033,7 +1033,8 @@ public class MakeGoodFragment extends BaseFragment { | |||||
int ztime = time - ExecuteTheRecipe.HandTime; | int ztime = time - ExecuteTheRecipe.HandTime; | ||||
good.maketime = ztime > 0 ? ztime : time; | good.maketime = ztime > 0 ? ztime : time; | ||||
QueryDB.UpdateGoodsMakeTime(good.id, good.maketime); | QueryDB.UpdateGoodsMakeTime(good.id, good.maketime); | ||||
getActivity().runOnUiThread(()->{AlertDialogUtils.showDialog(context, "提示", "菜谱【"+good.name+"】:已炒制完成,请出料后再继续!");}); | |||||
DialogManager.showInfo("菜谱【"+good.name+"】:已炒制完成,请出料后再继续!",AlertDialogButton.OK,null); | |||||
// getActivity().runOnUiThread(()->{AlertDialogUtils.showDialog(context, "提示", "菜谱【"+good.name+"】:已炒制完成,请出料后再继续!");}); | |||||
} else { | } else { | ||||
ExecuteTheRecipe.showlog("菜谱【" + good.name + "】已强制结束..."); | ExecuteTheRecipe.showlog("菜谱【" + good.name + "】已强制结束..."); | ||||
} | } | ||||
@@ -27,12 +27,6 @@ | |||||
android:text="标题" | android:text="标题" | ||||
android:textSize="30sp"/> | android:textSize="30sp"/> | ||||
<!-- <Button--> | |||||
<!-- android:layout_width="match_parent"--> | |||||
<!-- android:layout_alignParentBottom="true"--> | |||||
<!-- android:background="@color/gray"--> | |||||
<!-- android:enabled="false"--> | |||||
<!-- android:layout_height="1dp"/>--> | |||||
</RelativeLayout> | </RelativeLayout> | ||||
<TextView | <TextView | ||||