|
|
@@ -144,16 +144,12 @@ object BusinessManager {
|
|
|
mEventBus.postValue(MsgEvent(MSG_EVENT_LOADING, LoadingMsg(false, "未找到钥匙信息", false)))
|
|
|
ToastUtils.tip(R.string.key_not_exists)
|
|
|
} else {
|
|
|
- mEventBus.postValue(MsgEvent(MSG_EVENT_LOADING, LoadingMsg(false, null, true)))
|
|
|
+ sendLoadingEventMsg(MyApplication.instance?.applicationContext?.getString(R.string.take_out_key_tip))
|
|
|
val dock = ModBusController.getDockByKeyMac(it.data.bleBean.bleDevice.mac)
|
|
|
ModBusController.controlKeyBuckle(true, keyBean.isLeft, dock?.addr)
|
|
|
keyBean.isReady = false
|
|
|
ToastUtils.tip(R.string.take_out_key)
|
|
|
}
|
|
|
- // 强制结束Loading防止有loading仍在显示
|
|
|
- Executor.delayOnMain(500) {
|
|
|
- mEventBus.postValue(MsgEvent(MSG_EVENT_LOADING, LoadingMsg(false, null, true)))
|
|
|
- }
|
|
|
} else {
|
|
|
LogUtil.e("切换工作模式失败 : ${it.data.bleBean.bleDevice.mac}")
|
|
|
Executor.delayOnMain(500) {
|
|
|
@@ -241,6 +237,7 @@ object BusinessManager {
|
|
|
DOCK_TYPE_KEY -> {
|
|
|
dockBean.getKeyList().forEach { keyBean ->
|
|
|
if (keyBean.isExist) {
|
|
|
+ sendLoadingEventMsg(MyApplication.instance?.applicationContext?.getString(R.string.data_is_uploading))
|
|
|
// 放回钥匙,读取rfid
|
|
|
ModBusController.readKeyRfid(dockBean.addr, if (keyBean.isLeft) 0 else 1) { isLeft, res ->
|
|
|
if (res.size < 11) {
|
|
|
@@ -1185,6 +1182,7 @@ object BusinessManager {
|
|
|
// 钥匙
|
|
|
0 -> {
|
|
|
mDeviceTakeList.find { it.deviceType == DEVICE_TYPE_KEY && it.nfc == deviceTakeUpdateBO.nfc }?.let { info ->
|
|
|
+ sendLoadingEventMsg(null, false)
|
|
|
NetApi.updateKeyTake(info.ticketId, info.nfc, MyApplication.instance?.serialNo()!!) { isSuccess ->
|
|
|
if (isSuccess) {
|
|
|
mDeviceTakeList.removeIf { it.deviceType == DEVICE_TYPE_KEY && it.nfc == info.nfc }
|
|
|
@@ -1202,8 +1200,15 @@ object BusinessManager {
|
|
|
// 检查当前工作票是否取完挂锁
|
|
|
if (mDeviceTakeList.any { it.deviceType == DEVICE_TYPE_LOCK && it.ticketId == info.ticketId }) {
|
|
|
LogUtil.i("Waiting all locks to take out")
|
|
|
+ sendLoadingEventMsg(
|
|
|
+ MyApplication.instance?.applicationContext?.getString(
|
|
|
+ R.string.take_out_lock_tip,
|
|
|
+ mDeviceTakeList.count { it.deviceType == DEVICE_TYPE_LOCK && it.ticketId == info.ticketId })
|
|
|
+ )
|
|
|
ToastUtils.tip(R.string.take_out_rest_locks)
|
|
|
return@updateLockTake
|
|
|
+ } else {
|
|
|
+ sendLoadingEventMsg(null, false)
|
|
|
}
|
|
|
// 检查有无当前工作票的钥匙
|
|
|
mDeviceTakeList.find { it.deviceType == DEVICE_TYPE_KEY && it.ticketId == info.ticketId }?.let { itKey ->
|