feat(plc): 添加餐盘平台复位功能和无餐盘提示界面
- 在PLC设置页面添加餐盘平台复位按钮 - 实现平台复位功能,先执行平台上升再返回营业状态 - 添加无餐盘提示界面,包含图片和文字提示 - 修改启动方法支持显示提示界面参数传递 - 在人脸识别登录页面检测到无餐盘时自动显示提示界面
This commit is contained in:
@@ -453,7 +453,7 @@ class LoginByFaceActivity : BaseActivity<ActivityLoginFaceBinding>(),
|
|||||||
// 餐盘已空,播放无盘提示音
|
// 餐盘已空,播放无盘提示音
|
||||||
SoundPoolUtil.getInstance().play(NO_PLATE_REMIND, 0)
|
SoundPoolUtil.getInstance().play(NO_PLATE_REMIND, 0)
|
||||||
//跳转到餐盘设置页面
|
//跳转到餐盘设置页面
|
||||||
PlcSettingActivity.start(this@LoginByFaceActivity)
|
PlcSettingActivity.start(this@LoginByFaceActivity, showTips = true)
|
||||||
} else {
|
} else {
|
||||||
loadLogInfo("collectFace,checkRemainingPlate: 剩余餐盘,继续使用")
|
loadLogInfo("collectFace,checkRemainingPlate: 剩余餐盘,继续使用")
|
||||||
goInitActivity()
|
goInitActivity()
|
||||||
|
|||||||
@@ -24,11 +24,17 @@ import kotlinx.coroutines.withContext
|
|||||||
class PlcSettingActivity : BaseActivity<ActivityPlcSettingBinding>() {
|
class PlcSettingActivity : BaseActivity<ActivityPlcSettingBinding>() {
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
|
/** Intent Extra 键:是否显示 tips 界面 */
|
||||||
|
private const val EXTRA_SHOW_TIPS = "extra_show_tips"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 启动 PlcSettingActivity
|
* 启动 PlcSettingActivity
|
||||||
|
* @param showTips 是否显示 tips 界面(暂无餐盘提示)
|
||||||
*/
|
*/
|
||||||
fun start(context: Context) {
|
fun start(context: Context, showTips: Boolean = false) {
|
||||||
context.startActivity(Intent(context, PlcSettingActivity::class.java))
|
val intent = Intent(context, PlcSettingActivity::class.java)
|
||||||
|
intent.putExtra(EXTRA_SHOW_TIPS, showTips)
|
||||||
|
context.startActivity(intent)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -42,9 +48,15 @@ class PlcSettingActivity : BaseActivity<ActivityPlcSettingBinding>() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
override fun initialize() {
|
override fun initialize() {
|
||||||
|
// 根据传入参数控制 tips 界面显示
|
||||||
|
val showTips = intent.getBooleanExtra(EXTRA_SHOW_TIPS, false)
|
||||||
|
binding.layoutTips.visibility =
|
||||||
|
if (showTips) android.view.View.VISIBLE else android.view.View.GONE
|
||||||
|
|
||||||
initConnectButtons()
|
initConnectButtons()
|
||||||
initOutPlateButton()
|
initOutPlateButton()
|
||||||
initPlatformButtons()
|
initPlatformButtons()
|
||||||
|
initPlatformResetButton()
|
||||||
initAlarmButton()
|
initAlarmButton()
|
||||||
initParamButtons()
|
initParamButtons()
|
||||||
initStatusButton()
|
initStatusButton()
|
||||||
@@ -183,6 +195,37 @@ class PlcSettingActivity : BaseActivity<ActivityPlcSettingBinding>() {
|
|||||||
|
|
||||||
// ==================== 故障处理 ====================
|
// ==================== 故障处理 ====================
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 初始化平台复位按钮:先执行平台上升,成功后自动执行返回营业
|
||||||
|
*/
|
||||||
|
private fun initPlatformResetButton() {
|
||||||
|
binding.btnPlatformReset.clickWithDebounce {
|
||||||
|
showWaitingDialog("正在复位平台……")
|
||||||
|
PlcHelper.getInstance(this).platformUp(object : PlcCallback<String> {
|
||||||
|
override fun onSuccess(result: String) {
|
||||||
|
// 平台上升完成,继续执行返回营业
|
||||||
|
PlcHelper.getInstance(this@PlcSettingActivity).backToBusiness(object : PlcCallback<String> {
|
||||||
|
override fun onSuccess(result: String) {
|
||||||
|
hideWaitingDialog()
|
||||||
|
ToastUtils.showToast("平台复位成功")
|
||||||
|
finish()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(message: String) {
|
||||||
|
hideWaitingDialog()
|
||||||
|
ToastUtils.showToast("返回营业失败:$message")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(message: String) {
|
||||||
|
hideWaitingDialog()
|
||||||
|
ToastUtils.showToast("平台上升失败:$message")
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 初始化故障复位按钮
|
* 初始化故障复位按钮
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -11,6 +11,29 @@
|
|||||||
android:id="@+id/includeHeader"
|
android:id="@+id/includeHeader"
|
||||||
layout="@layout/item_title_time" />
|
layout="@layout/item_title_time" />
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:id="@+id/layout_tips"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="match_parent">
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:src="@mipmap/img_error_tips"
|
||||||
|
tools:ignore="ContentDescription" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_alignParentBottom="true"
|
||||||
|
android:layout_centerHorizontal="true"
|
||||||
|
android:layout_marginBottom="144dp"
|
||||||
|
android:text="暂无餐盘 请联系管理人员"
|
||||||
|
android:textColor="#fff0c8b4"
|
||||||
|
android:textSize="20sp" />
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
<ScrollView
|
<ScrollView
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
@@ -143,6 +166,17 @@
|
|||||||
android:textColor="#FFCC99"
|
android:textColor="#FFCC99"
|
||||||
android:textSize="22sp" />
|
android:textSize="22sp" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/btnPlatformReset"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="60dp"
|
||||||
|
android:layout_marginTop="12dp"
|
||||||
|
android:background="@drawable/btn_outline"
|
||||||
|
android:gravity="center"
|
||||||
|
android:text="餐盘平台复位"
|
||||||
|
android:textColor="#FFCC99"
|
||||||
|
android:textSize="22sp" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|||||||
Binary file not shown.
|
After Width: | Height: | Size: 179 KiB |
Reference in New Issue
Block a user