Selaa lähdekoodia

refactor(修改):
- 修复交叉作业覆盖点位无法上锁的问题

周文健 5 kuukautta sitten
vanhempi
sitoutus
a520812fd9

+ 39 - 39
app/src/main/java/com/grkj/iscs/view/presenter/JobProgressPresenter.kt

@@ -147,55 +147,55 @@ class JobProgressPresenter : BasePresenter<IJobProgressView>() {
                                 && BusinessManager.mDeviceTakeList.none { it.deviceType == DEVICE_TYPE_KEY && it.ticketId == ticketId }
                     LogUtil.i("needLockCount = $needLockCount , readyLockCount = $readyLockCount, realCount = $realCount, isNeedKey = $isNeedKey")
                     BusinessManager.checkEquipCount(realCount, isNeedKey) { keyPair, lockMap ->
-                        if (lockMap.isEmpty()) {
-                            Executor.runOnMain {
-                                val dialog = TipDialog(mContext!!)
-                                dialog.setTip(mContext!!.getString(R.string.lock_is_not_enough_stop_issue_ticket))
-                                var state = 0
-                                dialog.setConfirmListener {
-                                    state = 1
-                                    BusinessManager.sendLoadingEventMsg(null, false)
-                                }
-                                dialog.setOnCancelListener {
-                                    state = 2
-                                    BusinessManager.sendLoadingEventMsg(null, false)
-                                }
-                                dialog.setOnDismissListener {
-                                    if (state == 0) {
+                        if (needLockCount == 0) {
+                            ToastUtils.tip(R.string.all_point_already_locked)
+                            (keyPair?.second?.rfid ?: "VIRTUALKEY").let { keyNfc ->
+                                BusinessManager.handleVirtualKeyGive(ticketId, keyNfc) {
+                                    BusinessManager.handleVirtualKeyReturn(ticketId, keyNfc) {
                                         BusinessManager.sendLoadingEventMsg(null, false)
                                     }
                                 }
-                                dialog.show()
                             }
-                        } else if (keyPair == null) {
-                            Executor.runOnMain {
-                                val dialog = TipDialog(mContext!!)
-                                dialog.setTip(mContext!!.getString(R.string.no_key_available_dialog_tip))
-                                var state = 0
-                                dialog.setConfirmListener {
-                                    state = 1
-                                    handleGiveKey(ticketDetail, null, lockMap)
-                                }
-                                dialog.setOnCancelListener {
-                                    state = 2
-                                    BusinessManager.sendLoadingEventMsg(null, false)
-                                }
-                                dialog.setOnDismissListener {
-                                    if (state == 0) {
+                        } else {
+                            if (lockMap.isEmpty()) {
+                                Executor.runOnMain {
+                                    val dialog = TipDialog(mContext!!)
+                                    dialog.setTip(mContext!!.getString(R.string.lock_is_not_enough_stop_issue_ticket))
+                                    var state = 0
+                                    dialog.setConfirmListener {
+                                        state = 1
+                                        BusinessManager.sendLoadingEventMsg(null, false)
+                                    }
+                                    dialog.setOnCancelListener {
+                                        state = 2
                                         BusinessManager.sendLoadingEventMsg(null, false)
                                     }
+                                    dialog.setOnDismissListener {
+                                        if (state == 0) {
+                                            BusinessManager.sendLoadingEventMsg(null, false)
+                                        }
+                                    }
+                                    dialog.show()
                                 }
-                                dialog.show()
-                            }
-                        } else {
-                            if (needLockCount == 0) {
-                                ToastUtils.tip(R.string.all_point_already_locked)
-                                keyPair.second?.rfid?.let { keyNfc ->
-                                    BusinessManager.handleVirtualKeyGive(ticketId, keyNfc) {
-                                        BusinessManager.handleVirtualKeyReturn(ticketId, keyNfc) {
+                            } else if (keyPair == null) {
+                                Executor.runOnMain {
+                                    val dialog = TipDialog(mContext!!)
+                                    dialog.setTip(mContext!!.getString(R.string.no_key_available_dialog_tip))
+                                    var state = 0
+                                    dialog.setConfirmListener {
+                                        state = 1
+                                        handleGiveKey(ticketDetail, null, lockMap)
+                                    }
+                                    dialog.setOnCancelListener {
+                                        state = 2
+                                        BusinessManager.sendLoadingEventMsg(null, false)
+                                    }
+                                    dialog.setOnDismissListener {
+                                        if (state == 0) {
                                             BusinessManager.sendLoadingEventMsg(null, false)
                                         }
                                     }
+                                    dialog.show()
                                 }
                             } else {
                                 handleGiveKey(ticketDetail, keyPair, lockMap)