Forráskód Böngészése

补充上锁人解锁流程

Frankensteinly 9 hónapja
szülő
commit
477cfdc3e6

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

@@ -123,5 +123,25 @@ class JobProgressPresenter : BasePresenter<IJobProgressVIew>() {
      */
     fun handleUnlockProcess(ticketId: Long) {
         // TODO 上锁人解锁流程
+        getTicketDetail(ticketId) { ticketDetail ->
+            val role = ticketDetail?.jobTicketUserList?.find { it.userId == SPUtils.getLoginUser(mContext!!)?.userId && it.userType == USER_TYPE_LOCKER }
+            if (role == null) {
+                return@getTicketDetail
+            }
+            BusinessManager.checkEquipCount(0) { keyPair, _ ->
+                // null表示锁具数量不够,不给钥匙
+                if (keyPair != null) {
+                    // 更新钥匙信息
+                    NetApi.updateKeyTake(ticketDetail.ticketId!!, keyPair.second?.rfid!!, mContext!!.serialNo()) {
+                        if (it) {
+                            // 下发工作票
+                            BusinessManager.sendTicketBusiness(keyPair.second?.mac!!, ticketDetail, mvpView as TicketDetailActivity) { b, s, rst ->
+                                (mvpView as TicketDetailActivity).handleLoading(b, s)
+                            }
+                        }
+                    }
+                }
+            }
+        }
     }
 }