|
|
@@ -68,6 +68,10 @@ import com.grkj.iscs.view.activity.LoginActivity
|
|
|
import com.grkj.iscs.view.base.BaseActivity
|
|
|
import com.grkj.iscs.view.dialog.TipDialog
|
|
|
import com.sik.sikcore.activity.ActivityTracker
|
|
|
+import com.sik.sikcore.extension.getMMKVData
|
|
|
+import com.sik.sikcore.extension.saveMMKVData
|
|
|
+import com.sik.sikcore.extension.toJson
|
|
|
+import com.tencent.mmkv.MMKV
|
|
|
import pub.devrel.easypermissions.AfterPermissionGranted
|
|
|
|
|
|
/**
|
|
|
@@ -1445,6 +1449,9 @@ object BusinessManager {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取当前钥匙的状态
|
|
|
+ */
|
|
|
fun getCurrentStatus(
|
|
|
from: Int,
|
|
|
bleDevice: BleDevice,
|
|
|
@@ -1781,14 +1788,10 @@ object BusinessManager {
|
|
|
if (isSuccess == false) {
|
|
|
LogUtil.e("Lock take report fail")
|
|
|
ToastUtils.tip(R.string.lock_take_report_fail)
|
|
|
- if (mDeviceTakeList.any { it.deviceType == DEVICE_TYPE_LOCK && it.ticketId == info.ticketId }) {
|
|
|
-// sendLoadingEventMsg(
|
|
|
-// MyApplication.instance?.applicationContext?.getString(
|
|
|
-// R.string.take_out_lock_tip,
|
|
|
-// mDeviceTakeList.count { it.deviceType == DEVICE_TYPE_LOCK && it.ticketId == info.ticketId })
|
|
|
-// )
|
|
|
- sendLoadingEventMsg(null, false)
|
|
|
- }
|
|
|
+ SPUtils.saveTicketTakeLockException(info.ticketId)
|
|
|
+ mDeviceTakeList.removeIf { it.deviceType == DEVICE_TYPE_LOCK && it.nfc == info.nfc }
|
|
|
+ mDeviceTakeList.removeIf { it.deviceType == DEVICE_TYPE_KEY && it.ticketId == info.ticketId }
|
|
|
+ sendLoadingEventMsg(null, false)
|
|
|
return@runOnMain
|
|
|
}
|
|
|
// 检查是不是要发钥匙了
|
|
|
@@ -1807,6 +1810,10 @@ object BusinessManager {
|
|
|
LogUtil.i("All locks are taken")
|
|
|
sendLoadingEventMsg(null, false)
|
|
|
}
|
|
|
+ if (SPUtils.getTicketTakeLockException(info.ticketId)) {
|
|
|
+ ToastUtils.tip(R.string.current_ticket_report_lock_take_exception_tip)
|
|
|
+ return@runOnMain
|
|
|
+ }
|
|
|
// 检查有无当前工作票的钥匙
|
|
|
mDeviceTakeList.find { it.deviceType == DEVICE_TYPE_KEY && it.ticketId == info.ticketId }
|
|
|
?.let { itKey ->
|
|
|
@@ -1819,6 +1826,9 @@ object BusinessManager {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 分配钥匙
|
|
|
+ */
|
|
|
private fun handleGiveKey(deviceTakeUpdateBO: DeviceTakeUpdateBO) {
|
|
|
getCurrentStatus(
|
|
|
2,
|
|
|
@@ -1862,6 +1872,9 @@ object BusinessManager {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 根据当前模式进行处理
|
|
|
+ */
|
|
|
private fun handleCurrentMode(currentModeMsg: CurrentModeMsg) {
|
|
|
when (currentModeMsg.mode) {
|
|
|
// 工作模式
|