临时版本
This commit is contained in:
@@ -412,45 +412,54 @@ class LoginByFaceActivity : BaseActivity<ActivityLoginFaceBinding>(),
|
||||
private fun openPlate(userId: String?) {
|
||||
loadLogInfo("collectFace,openPlate: userId=$userId,plateEnable=$plateEnable")
|
||||
if (plateEnable.not()) return
|
||||
// showWaitingDialog("检测餐盘中,请稍候……")
|
||||
PlcHelper.getInstance(this).getStatus(object : PlcCallback<PlcStatus> {
|
||||
override fun onSuccess(result: PlcStatus) {
|
||||
hideWaitingDialog()
|
||||
if (result.isEmptyPlate) {
|
||||
// 无餐盘,播放提示音并返回首页
|
||||
loadLogInfo("collectFace,openPlate: 暂无餐盘,isEmptyPlate=true,isCollectFace=$isCollectFace")
|
||||
SoundPoolUtil.getInstance().play(NO_PLATE_REMIND, 0)
|
||||
goInitActivity()
|
||||
return
|
||||
|
||||
PlcHelper.getInstance(this@LoginByFaceActivity)
|
||||
.outPlate(object : PlcCallback<String> {
|
||||
override fun onSuccess(result: String) {
|
||||
|
||||
if(result.equals("true")){
|
||||
SoundPoolUtil.getInstance().play(RECOGNIZE_SUCCESS, 0)
|
||||
}
|
||||
// 有餐盘,播放识别成功音效并调用出盘
|
||||
loadLogInfo("collectFace,openPlate: 检测到餐盘,开始出盘")
|
||||
SoundPoolUtil.getInstance().play(RECOGNIZE_SUCCESS, 0)
|
||||
plateEnable = false
|
||||
recognizeCountDownUtil.cancelCountDown()
|
||||
PlcHelper.getInstance(this@LoginByFaceActivity)
|
||||
.outPlate(object : PlcCallback<String> {
|
||||
override fun onSuccess(result: String) {
|
||||
loadLogInfo("collectFace,openPlate: 出盘成功,result=$result")
|
||||
goInitActivity()
|
||||
}
|
||||
|
||||
override fun onError(message: String) {
|
||||
ToastUtils.showToast("出盘失败,message=$message")
|
||||
loadLogInfo("collectFace,openPlate: 出盘失败,message=$message")
|
||||
goInitActivity()
|
||||
}
|
||||
})
|
||||
|
||||
loadLogInfo("collectFace,openPlate: 出盘成功,result=$result")
|
||||
goInitActivity()
|
||||
}
|
||||
|
||||
override fun onError(message: String) {
|
||||
hideWaitingDialog()
|
||||
// 状态获取失败,保底播放无盘提示
|
||||
loadLogInfo("collectFace,openPlate: 获取PLC状态失败,message=$message")
|
||||
SoundPoolUtil.getInstance().play(NO_PLATE_REMIND, 0)
|
||||
ToastUtils.showToast("出盘失败,message=$message")
|
||||
loadLogInfo("collectFace,openPlate: 出盘失败,message=$message")
|
||||
goInitActivity()
|
||||
}
|
||||
})
|
||||
|
||||
// showWaitingDialog("检测餐盘中,请稍候……")
|
||||
// PlcHelper.getInstance(this).getStatus(object : PlcCallback<PlcStatus> {
|
||||
// override fun onSuccess(result: PlcStatus) {
|
||||
// hideWaitingDialog()
|
||||
// if (result.isEmptyPlate) {
|
||||
// // 无餐盘,播放提示音并返回首页
|
||||
// loadLogInfo("collectFace,openPlate: 暂无餐盘,isEmptyPlate=true,isCollectFace=$isCollectFace")
|
||||
// SoundPoolUtil.getInstance().play(NO_PLATE_REMIND, 0)
|
||||
// goInitActivity()
|
||||
// return
|
||||
// }
|
||||
// // 有餐盘,播放识别成功音效并调用出盘
|
||||
// loadLogInfo("collectFace,openPlate: 检测到餐盘,开始出盘")
|
||||
//
|
||||
//
|
||||
// }
|
||||
//
|
||||
// override fun onError(message: String) {
|
||||
// hideWaitingDialog()
|
||||
// // 状态获取失败,保底播放无盘提示
|
||||
// loadLogInfo("collectFace,openPlate: 获取PLC状态失败,message=$message")
|
||||
// SoundPoolUtil.getInstance().play(NO_PLATE_REMIND, 0)
|
||||
// goInitActivity()
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
private val openDebouncer by lazy { Debouncer(5000) }
|
||||
@@ -734,15 +743,7 @@ class LoginByFaceActivity : BaseActivity<ActivityLoginFaceBinding>(),
|
||||
goInitActivity()
|
||||
return
|
||||
}
|
||||
// 每次回到识别界面时重新打开串口,防止 PLC SDK 内部连接超时导致出盘失败
|
||||
PlcHelper.getInstance(this).openSerialPort(object : PlcCallback<String> {
|
||||
override fun onSuccess(result: String) {
|
||||
loadLogInfo("onResume openSerialPort 成功: $result")
|
||||
}
|
||||
override fun onError(message: String) {
|
||||
loadLogInfo("onResume openSerialPort 失败: $message")
|
||||
}
|
||||
})
|
||||
|
||||
lifecycleScope.launch {
|
||||
try {
|
||||
val faceDao = FaceDatabase.getInstance(this@LoginByFaceActivity).faceDao()
|
||||
|
||||
Reference in New Issue
Block a user