|
|
@@ -15,13 +15,11 @@ import com.grkj.iscs.model.vo.lock.LockTakeUpdateReqVO
|
|
|
import com.grkj.iscs.model.vo.ticket.StepDetailRespVO
|
|
|
import com.grkj.iscs.model.vo.ticket.TicketDetailMonitorRespVO
|
|
|
import com.grkj.iscs.model.vo.ticket.TicketDetailRespVO
|
|
|
-import com.grkj.iscs.util.ActivityUtils
|
|
|
import com.grkj.iscs.util.Executor
|
|
|
import com.grkj.iscs.util.NetApi
|
|
|
import com.grkj.iscs.util.SPUtils
|
|
|
import com.grkj.iscs.util.ToastUtils
|
|
|
import com.grkj.iscs.util.log.LogUtil
|
|
|
-import com.grkj.iscs.view.base.BaseActivity
|
|
|
import com.grkj.iscs.view.base.BasePresenter
|
|
|
import com.grkj.iscs.view.iview.IJobProgressView
|
|
|
|
|
|
@@ -100,9 +98,15 @@ class JobProgressPresenter : BasePresenter<IJobProgressView>() {
|
|
|
NetApi.getTicketEquipDetail(ticketId) { equipDetail ->
|
|
|
println("EquipDetail : $equipDetail")
|
|
|
// 取锁具、取钥匙
|
|
|
- val needLockCount = equipDetail?.ticketLockVOList?.filter { it.lockId == null }?.size ?: 0
|
|
|
+ val needLockCount = equipDetail?.ticketLockVOList?.count { it.lockId == null } ?: 0
|
|
|
+ val readyLockCount = BusinessManager.mDeviceTakeList.count { it.deviceType == DEVICE_TYPE_LOCK && it.ticketId == ticketId }
|
|
|
+ val realCount = (needLockCount - readyLockCount).coerceAtLeast(0)
|
|
|
+ if (readyLockCount > 0) {
|
|
|
+ ToastUtils.tip(R.string.please_take_out_ready_device_first)
|
|
|
+ }
|
|
|
val isNeedKey = equipDetail?.ticketKeyVOList?.filter { it.keyId == null }?.size != 1
|
|
|
- BusinessManager.checkEquipCount(needLockCount, isNeedKey) { keyPair, lockMap ->
|
|
|
+ && BusinessManager.mDeviceTakeList.none { it.deviceType == DEVICE_TYPE_KEY && it.ticketId == ticketId }
|
|
|
+ BusinessManager.checkEquipCount(realCount, isNeedKey) { keyPair, lockMap ->
|
|
|
val lockList = mutableListOf<LockTakeUpdateReqVO>()
|
|
|
lockMap.forEach { (addr, mLockList) ->
|
|
|
lockList.addAll(mLockList.map { LockTakeUpdateReqVO(ticketDetail.ticketId, it.rfid, mContext!!.serialNo()) })
|
|
|
@@ -115,16 +119,6 @@ class JobProgressPresenter : BasePresenter<IJobProgressView>() {
|
|
|
// null表示锁具数量不够,不给钥匙
|
|
|
if (keyPair != null) {
|
|
|
BusinessManager.addDeviceTake(DEVICE_TYPE_KEY, ticketId, keyPair.second?.rfid!!)
|
|
|
- LogUtil.i("工作票挂锁list : $lockList")
|
|
|
-
|
|
|
-// // 下发工作票
|
|
|
-// BusinessManager.sendTicketBusiness(
|
|
|
-// keyPair.second?.mac!!,
|
|
|
-// ticketDetail,
|
|
|
-// lockList.map { it.lockNfc }.toMutableList(),
|
|
|
-// ActivityUtils.currentActivity() as BaseActivity<*>,
|
|
|
-// true
|
|
|
-// )
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -149,15 +143,6 @@ class JobProgressPresenter : BasePresenter<IJobProgressView>() {
|
|
|
BusinessManager.addDeviceTake(DEVICE_TYPE_KEY, ticketId, keyPair.second?.rfid!!)
|
|
|
|
|
|
BusinessManager.getCurrentStatus(BusinessManager.getBleDeviceByMac(keyPair.second?.mac)!!.bleDevice)
|
|
|
-
|
|
|
- // 下发工作票
|
|
|
-// BusinessManager.sendTicketBusiness(
|
|
|
-// keyPair.second?.mac!!,
|
|
|
-// ticketDetail,
|
|
|
-// null,
|
|
|
-// ActivityUtils.currentActivity() as BaseActivity<*>,
|
|
|
-// true
|
|
|
-// )
|
|
|
}
|
|
|
}
|
|
|
}
|