Przeglądaj źródła

修改识别到钥匙时的loading文字;修正更新钥匙的准备状态的函数逻辑错误;出现钥匙不够分配的弹框时取消loading框

Frankensteinly 7 miesięcy temu
rodzic
commit
0259d759d5

+ 1 - 1
app/src/main/java/com/grkj/iscs/BusinessManager.kt

@@ -240,7 +240,7 @@ object BusinessManager {
                     DOCK_TYPE_KEY -> {
                         dockBean.getKeyList().forEach { keyBean ->
                             if (keyBean.isExist) {
-                                sendLoadingEventMsg(CommonUtils.getStr(R.string.data_is_uploading))
+                                sendLoadingEventMsg(CommonUtils.getStr(R.string.ble_connecting))
                                 // 放回钥匙,读取rfid
                                 ModBusController.readKeyRfid(dockBean.addr, if (keyBean.isLeft) 0 else 1) { isLeft, res ->
                                     if (res.size < 11) {

+ 8 - 2
app/src/main/java/com/grkj/iscs/modbus/ModBusController.kt

@@ -451,8 +451,14 @@ object ModBusController {
      * 更新钥匙的准备状态
      */
     fun updateKeyReadyStatus(mac: String, isReady: Boolean, from: Int) {
-        LogUtil.i("mac : $mac - $from")
-        dockList.find { it.type == DOCK_TYPE_KEY || it.type == DOCK_TYPE_PORTABLE }?.getKeyList()?.find { it.mac == mac }?.isReady = isReady
+        LogUtil.i("updateKeyReadyStatus mac : $mac - $isReady - $from")
+        dockList.forEach {
+            if (it.type == DOCK_TYPE_KEY || it.type == DOCK_TYPE_PORTABLE) {
+                if (it.getKeyList().any { it.mac == mac }) {
+                    it.getKeyList().find { it.mac == mac }?.isReady = isReady
+                }
+            }
+        }
     }
 
     /**

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

@@ -123,9 +123,20 @@ class JobProgressPresenter : BasePresenter<IJobProgressView>() {
                             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 {