@@ -1,6 +1,7 @@ | |||||
package com.bonait.bnframework.common.base; | package com.bonait.bnframework.common.base; | ||||
import android.content.Intent; | import android.content.Intent; | ||||
import android.media.MediaPlayer; | |||||
import android.net.Uri; | import android.net.Uri; | ||||
import android.provider.Settings; | import android.provider.Settings; | ||||
import android.view.View; | import android.view.View; | ||||
@@ -98,6 +99,22 @@ public abstract class BaseFragment extends QMUIFragment implements EasyPermissio | |||||
fragmentTransaction.commit(); | fragmentTransaction.commit(); | ||||
} | } | ||||
/** | |||||
* 播放 | |||||
* @param resid | |||||
*/ | |||||
public void Speak(int resid) | |||||
{ | |||||
getActivity().runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
MediaPlayer mediaPlayer = MediaPlayer.create(getContext(), resid); | |||||
mediaPlayer.start(); | |||||
} | |||||
}); | |||||
} | |||||
@Override | @Override | ||||
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) { | ||||
super.onRequestPermissionsResult(requestCode, permissions, grantResults); | super.onRequestPermissionsResult(requestCode, permissions, grantResults); | ||||
@@ -172,7 +172,11 @@ public class DataBus { | |||||
GoodsMake.add(make); | GoodsMake.add(make); | ||||
MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, "[" + make.good.name + "]准备配料!"); | MessageLog.ShowUserMessage(UserLogEnum.订单处理日志, "[" + make.good.name + "]准备配料!"); | ||||
if(loadinggoodAdapter!=null)loadinggoodAdapter.refresh(); | |||||
if(loadinggoodAdapter!=null) | |||||
{ | |||||
loadinggoodAdapter.Speak(R.raw.plks); | |||||
loadinggoodAdapter.refresh(); | |||||
} | |||||
}catch(Exception e){ | }catch(Exception e){ | ||||
MessageLog.ShowInfo( "增加订单异常!"+e.getMessage()); | MessageLog.ShowInfo( "增加订单异常!"+e.getMessage()); | ||||
} | } | ||||
@@ -202,8 +206,10 @@ public class DataBus { | |||||
GoodsMake.get(m).makeMs=makeMs; | GoodsMake.get(m).makeMs=makeMs; | ||||
GoodsMake.get(m).makeProcess=(int)(((count*1.00)/ GoodsMake.get(m).recipes.size())*100); | GoodsMake.get(m).makeProcess=(int)(((count*1.00)/ GoodsMake.get(m).recipes.size())*100); | ||||
if(loadinggoodAdapter!=null)loadinggoodAdapter.refresh(); | |||||
if(loadinggoodAdapter!=null) { | |||||
loadinggoodAdapter.Speak(R.raw.plzqsh); | |||||
loadinggoodAdapter.refresh(); | |||||
} | |||||
return; | return; | ||||
} | } | ||||
} | } | ||||
@@ -236,7 +242,11 @@ public class DataBus { | |||||
GoodsMake.remove(good); | GoodsMake.remove(good); | ||||
} | } | ||||
if(loadinggoodAdapter!=null)loadinggoodAdapter.refresh(); | |||||
if(loadinggoodAdapter!=null) | |||||
{ | |||||
loadinggoodAdapter.Speak(R.raw.plwc); | |||||
loadinggoodAdapter.refresh(); | |||||
} | |||||
}catch(Exception e){ | }catch(Exception e){ | ||||
} | } | ||||
@@ -3,6 +3,7 @@ package com.bonait.bnframework.modules.home.adapter; | |||||
import android.app.Activity; | import android.app.Activity; | ||||
import android.content.Context; | import android.content.Context; | ||||
import android.content.ContextWrapper; | import android.content.ContextWrapper; | ||||
import android.media.MediaPlayer; | |||||
import android.view.LayoutInflater; | import android.view.LayoutInflater; | ||||
import android.view.View; | import android.view.View; | ||||
import android.view.ViewGroup; | import android.view.ViewGroup; | ||||
@@ -136,6 +137,22 @@ public class loadinggood_adapter extends RecyclerView.Adapter<RecyclerView.ViewH | |||||
}); | }); | ||||
} | } | ||||
/** | |||||
* 播放 | |||||
* @param resid | |||||
*/ | |||||
public void Speak(int resid) | |||||
{ | |||||
activity.runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
MediaPlayer mediaPlayer = MediaPlayer.create(conmain, resid); | |||||
mediaPlayer.start(); | |||||
} | |||||
}); | |||||
} | |||||
@Override | @Override | ||||
public int getItemCount() { | public int getItemCount() { | ||||
return datas.size(); | return datas.size(); | ||||
@@ -99,9 +99,7 @@ public class JiaoYanFragment extends BaseFragment { | |||||
menuModes.add(new ResMenuLeft(new JiaoYan_dzcjy_fragment(),"电子秤校验", R.mipmap.dzcjy, R.mipmap.dzcjy_select,true)); | menuModes.add(new ResMenuLeft(new JiaoYan_dzcjy_fragment(),"电子秤校验", R.mipmap.dzcjy, R.mipmap.dzcjy_select,true)); | ||||
menuModes.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"流速校验", R.mipmap.lsjy, R.mipmap.lsjy_select,false)); | menuModes.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"流速校验", R.mipmap.lsjy, R.mipmap.lsjy_select,false)); | ||||
menuModes.add(new ResMenuLeft(new JiaoYan_clsfbc_fragment(),"出料算法补偿", R.mipmap.clsfbc, R.mipmap.clsfbc_selectd,false)); | menuModes.add(new ResMenuLeft(new JiaoYan_clsfbc_fragment(),"出料算法补偿", R.mipmap.clsfbc, R.mipmap.clsfbc_selectd,false)); | ||||
menuModes.add(new ResMenuLeft(new JiaoYan_wdsz_fragment(),"温度设置", R.mipmap.lsjy, R.mipmap.lsjy_select,false)); | menuModes.add(new ResMenuLeft(new JiaoYan_wdsz_fragment(),"温度设置", R.mipmap.lsjy, R.mipmap.lsjy_select,false)); | ||||
menuModes.add(new ResMenuLeft(new JiaoYan_zdqx_fragment(),"自动清洗", R.mipmap.zdqx1, R.mipmap.zdqx1_select,false)); | |||||
menuModes.add(new ResMenuLeft(new JiaoYan_zdbs_fragment(),"自动补水", R.mipmap.zdbs, R.mipmap.zdbs_select,false)); | menuModes.add(new ResMenuLeft(new JiaoYan_zdbs_fragment(),"自动补水", R.mipmap.zdbs, R.mipmap.zdbs_select,false)); | ||||
menuModes.add(new ResMenuLeft(new JiaoYan_sdkz_fragment(),"手动控制", R.mipmap.sdkz, R.mipmap.sdkz_select,false)); | menuModes.add(new ResMenuLeft(new JiaoYan_sdkz_fragment(),"手动控制", R.mipmap.sdkz, R.mipmap.sdkz_select,false)); | ||||
}else | }else | ||||
@@ -109,6 +107,7 @@ public class JiaoYanFragment extends BaseFragment { | |||||
menuModes.add(new ResMenuLeft(new JiaoYan_dzcjy_fragment(),"电子秤校验", R.mipmap.dzcjy, R.mipmap.dzcjy_select,true)); | menuModes.add(new ResMenuLeft(new JiaoYan_dzcjy_fragment(),"电子秤校验", R.mipmap.dzcjy, R.mipmap.dzcjy_select,true)); | ||||
menuModes.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"流速校验", R.mipmap.lsjy, R.mipmap.lsjy_select,false)); | menuModes.add(new ResMenuLeft(new JiaoYan_lsjy_fragment(),"流速校验", R.mipmap.lsjy, R.mipmap.lsjy_select,false)); | ||||
menuModes.add(new ResMenuLeft(new JiaoYan_wdsz_fragment(),"温度设置", R.mipmap.lsjy, R.mipmap.lsjy_select,false)); | menuModes.add(new ResMenuLeft(new JiaoYan_wdsz_fragment(),"温度设置", R.mipmap.lsjy, R.mipmap.lsjy_select,false)); | ||||
menuModes.add(new ResMenuLeft(new JiaoYan_zdqx_fragment(),"自动清洗", R.mipmap.zdqx1, R.mipmap.zdqx1_select,false)); | |||||
menuModes.add(new ResMenuLeft(new JiaoYan_zdbs_fragment(),"自动补水", R.mipmap.zdbs, R.mipmap.zdbs_select,false)); | menuModes.add(new ResMenuLeft(new JiaoYan_zdbs_fragment(),"自动补水", R.mipmap.zdbs, R.mipmap.zdbs_select,false)); | ||||
menuModes.add(new ResMenuLeft(new JiaoYan_sdkz_fragment(),"手动控制", R.mipmap.sdkz, R.mipmap.sdkz_select,false)); | menuModes.add(new ResMenuLeft(new JiaoYan_sdkz_fragment(),"手动控制", R.mipmap.sdkz, R.mipmap.sdkz_select,false)); | ||||
} | } | ||||
@@ -9,6 +9,7 @@ import androidx.recyclerview.widget.RecyclerView; | |||||
import androidx.viewpager.widget.ViewPager; | import androidx.viewpager.widget.ViewPager; | ||||
import android.content.Context; | import android.content.Context; | ||||
import android.media.MediaPlayer; | |||||
import android.os.Bundle; | import android.os.Bundle; | ||||
import android.os.Handler; | import android.os.Handler; | ||||
import android.os.Message; | import android.os.Message; | ||||
@@ -82,6 +83,7 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { | |||||
break; | break; | ||||
case R.id.bt_start://开始清洗 | case R.id.bt_start://开始清洗 | ||||
if (DataBus.getInstance().ZDQX_IsStart) { | if (DataBus.getInstance().ZDQX_IsStart) { | ||||
String title = "温馨提示!"; | String title = "温馨提示!"; | ||||
@@ -93,6 +95,7 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { | |||||
getActivity().runOnUiThread(new Runnable() { | getActivity().runOnUiThread(new Runnable() { | ||||
@Override | @Override | ||||
public void run() { | public void run() { | ||||
Speak(R.raw.qxksqsh); | |||||
ExecuteTheRecipe.WritePLC("清洗模式", false,null); | ExecuteTheRecipe.WritePLC("清洗模式", false,null); | ||||
ExecuteTheRecipe.WritePLC("自动清洗开始", false,null); | ExecuteTheRecipe.WritePLC("自动清洗开始", false,null); | ||||
DataBus.getInstance().ZDQX_IsStart=false; | DataBus.getInstance().ZDQX_IsStart=false; | ||||
@@ -132,7 +135,13 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { | |||||
{ | { | ||||
ExecuteTheRecipe.WritePLC("管道自动排水完成",false,null); | ExecuteTheRecipe.WritePLC("管道自动排水完成",false,null); | ||||
ExecuteTheRecipe.WritePLC("管道自动排水",true,null); | ExecuteTheRecipe.WritePLC("管道自动排水",true,null); | ||||
getActivity().runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
ToastUtils.warning("管道自动排水中,请稍后..."); | |||||
bt_start.setText("管道排水中"); | |||||
} | |||||
}); | |||||
final boolean[] IsStopPS = {false}; | final boolean[] IsStopPS = {false}; | ||||
while (DataBus.getInstance().ZDQX_IsStart && !IsStopPS[0]) | while (DataBus.getInstance().ZDQX_IsStart && !IsStopPS[0]) | ||||
{ | { | ||||
@@ -143,7 +152,12 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { | |||||
} | } | ||||
} | } | ||||
getActivity().runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
bt_start.setText("正在清洗"); | |||||
} | |||||
}); | |||||
for (BPA_SUGAR item: | for (BPA_SUGAR item: | ||||
DataBus.getInstance().zdqx) { | DataBus.getInstance().zdqx) { | ||||
ExecuteTheRecipe.WritePLC("自动清洗完成",false,null); | ExecuteTheRecipe.WritePLC("自动清洗完成",false,null); | ||||
@@ -174,6 +188,13 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { | |||||
ExecuteTheRecipe.WritePLC("管道自动排水完成",false,null); | ExecuteTheRecipe.WritePLC("管道自动排水完成",false,null); | ||||
ExecuteTheRecipe.WritePLC("管道自动排水",true,null); | ExecuteTheRecipe.WritePLC("管道自动排水",true,null); | ||||
getActivity().runOnUiThread(new Runnable() { | |||||
@Override | |||||
public void run() { | |||||
ToastUtils.warning("管道自动排水中,请稍后..."); | |||||
bt_start.setText("管道排水中"); | |||||
} | |||||
}); | |||||
IsStopPS[0] =false; | IsStopPS[0] =false; | ||||
while (DataBus.getInstance().ZDQX_IsStart && !IsStopPS[0]) | while (DataBus.getInstance().ZDQX_IsStart && !IsStopPS[0]) | ||||
{ | { | ||||
@@ -199,6 +220,8 @@ public class JiaoYan_zdqx_fragment extends BaseFragment { | |||||
DataBus.getInstance().zdqxchidAdapter.refresh(); | DataBus.getInstance().zdqxchidAdapter.refresh(); | ||||
} | } | ||||
}); | }); | ||||
Speak(R.raw.qxwc); | |||||
} | } | ||||
} catch (Exception e) { | } catch (Exception e) { | ||||
@@ -22,8 +22,7 @@ | |||||
android:id="@+id/iv_type" | android:id="@+id/iv_type" | ||||
android:layout_width="50dp" | android:layout_width="50dp" | ||||
android:layout_height="50dp" | android:layout_height="50dp" | ||||
android:layout_centerVertical="true" | |||||
android:src="@mipmap/image1"/> | |||||
android:layout_centerVertical="true"/> | |||||
</RelativeLayout> | </RelativeLayout> | ||||