|
@@ -3,6 +3,7 @@ package com.grkj.iscs_mars
|
|
|
import android.bluetooth.BluetoothGattCharacteristic
|
|
import android.bluetooth.BluetoothGattCharacteristic
|
|
|
import android.content.Context
|
|
import android.content.Context
|
|
|
import android.content.Intent
|
|
import android.content.Intent
|
|
|
|
|
+import android.util.Log
|
|
|
import androidx.appcompat.app.AppCompatActivity
|
|
import androidx.appcompat.app.AppCompatActivity
|
|
|
import androidx.lifecycle.MutableLiveData
|
|
import androidx.lifecycle.MutableLiveData
|
|
|
import com.google.gson.Gson
|
|
import com.google.gson.Gson
|
|
@@ -16,9 +17,16 @@ import com.grkj.iscs_mars.ble.BleReturnDispatcher
|
|
|
import com.grkj.iscs_mars.ble.BleSendDispatcher
|
|
import com.grkj.iscs_mars.ble.BleSendDispatcher
|
|
|
import com.grkj.iscs_mars.ble.BleUtil
|
|
import com.grkj.iscs_mars.ble.BleUtil
|
|
|
import com.grkj.iscs_mars.ble.CustomBleWriteCallback
|
|
import com.grkj.iscs_mars.ble.CustomBleWriteCallback
|
|
|
-import com.grkj.iscs_mars.extentions.removeLeadingZeros
|
|
|
|
|
|
|
+import com.grkj.iscs_mars.can.CanCommands
|
|
|
|
|
+import com.grkj.iscs_mars.can.CanDeviceConst
|
|
|
|
|
+import com.grkj.iscs_mars.can.CanHardwareHelper
|
|
|
|
|
+import com.grkj.iscs_mars.can.CanHelper
|
|
|
|
|
+import com.grkj.iscs_mars.can.DeviceModel
|
|
|
|
|
+import com.grkj.iscs_mars.can.HandlerGate
|
|
|
|
|
+import com.grkj.iscs_mars.enums.HardwareMode
|
|
|
import com.grkj.iscs_mars.extentions.serialNo
|
|
import com.grkj.iscs_mars.extentions.serialNo
|
|
|
import com.grkj.iscs_mars.extentions.startsWith
|
|
import com.grkj.iscs_mars.extentions.startsWith
|
|
|
|
|
+import com.grkj.iscs_mars.extentions.toHexFromLe
|
|
|
import com.grkj.iscs_mars.extentions.toHexStrings
|
|
import com.grkj.iscs_mars.extentions.toHexStrings
|
|
|
import com.grkj.iscs_mars.modbus.DockBean
|
|
import com.grkj.iscs_mars.modbus.DockBean
|
|
|
import com.grkj.iscs_mars.modbus.ModBusController
|
|
import com.grkj.iscs_mars.modbus.ModBusController
|
|
@@ -26,11 +34,8 @@ import com.grkj.iscs_mars.modbus.ModBusController.dockList
|
|
|
import com.grkj.iscs_mars.modbus.ModBusController.getOneKey
|
|
import com.grkj.iscs_mars.modbus.ModBusController.getOneKey
|
|
|
import com.grkj.iscs_mars.model.Constants.USER_TYPE_LOCKER
|
|
import com.grkj.iscs_mars.model.Constants.USER_TYPE_LOCKER
|
|
|
import com.grkj.iscs_mars.model.DeviceConst
|
|
import com.grkj.iscs_mars.model.DeviceConst
|
|
|
-import com.grkj.iscs_mars.model.DeviceConst.DEVICE_TYPE_CARD
|
|
|
|
|
-import com.grkj.iscs_mars.model.DeviceConst.DEVICE_TYPE_FINGERPRINT
|
|
|
|
|
import com.grkj.iscs_mars.model.DeviceConst.DEVICE_TYPE_KEY
|
|
import com.grkj.iscs_mars.model.DeviceConst.DEVICE_TYPE_KEY
|
|
|
import com.grkj.iscs_mars.model.DeviceConst.DEVICE_TYPE_LOCK
|
|
import com.grkj.iscs_mars.model.DeviceConst.DEVICE_TYPE_LOCK
|
|
|
-import com.grkj.iscs_mars.model.DeviceConst.DOCK_TYPE_ELEC_LOCK_BOARD
|
|
|
|
|
import com.grkj.iscs_mars.model.DeviceConst.DOCK_TYPE_KEY
|
|
import com.grkj.iscs_mars.model.DeviceConst.DOCK_TYPE_KEY
|
|
|
import com.grkj.iscs_mars.model.DeviceConst.DOCK_TYPE_LOCK
|
|
import com.grkj.iscs_mars.model.DeviceConst.DOCK_TYPE_LOCK
|
|
|
import com.grkj.iscs_mars.model.DeviceConst.DOCK_TYPE_PORTABLE
|
|
import com.grkj.iscs_mars.model.DeviceConst.DOCK_TYPE_PORTABLE
|
|
@@ -64,7 +69,6 @@ import com.grkj.iscs_mars.model.vo.lock.LockPageRespVO
|
|
|
import com.grkj.iscs_mars.model.vo.lock.LockTakeUpdateReqVO
|
|
import com.grkj.iscs_mars.model.vo.lock.LockTakeUpdateReqVO
|
|
|
import com.grkj.iscs_mars.model.vo.ticket.LockPointUpdateReqVO
|
|
import com.grkj.iscs_mars.model.vo.ticket.LockPointUpdateReqVO
|
|
|
import com.grkj.iscs_mars.model.vo.ticket.TicketDetailRespVO
|
|
import com.grkj.iscs_mars.model.vo.ticket.TicketDetailRespVO
|
|
|
-import com.grkj.iscs_mars.service.CheckKeyInfoTask
|
|
|
|
|
import com.grkj.iscs_mars.util.ActivityUtils
|
|
import com.grkj.iscs_mars.util.ActivityUtils
|
|
|
import com.grkj.iscs_mars.util.CommonUtils
|
|
import com.grkj.iscs_mars.util.CommonUtils
|
|
|
import com.grkj.iscs_mars.util.Executor
|
|
import com.grkj.iscs_mars.util.Executor
|
|
@@ -77,7 +81,6 @@ import com.grkj.iscs_mars.view.base.BaseActivity
|
|
|
import com.grkj.iscs_mars.view.dialog.TipDialog
|
|
import com.grkj.iscs_mars.view.dialog.TipDialog
|
|
|
import com.huyuhui.fastble.data.BleDevice
|
|
import com.huyuhui.fastble.data.BleDevice
|
|
|
import com.huyuhui.fastble.exception.BleException
|
|
import com.huyuhui.fastble.exception.BleException
|
|
|
-import com.sik.cronjob.managers.CronJobScanner
|
|
|
|
|
import com.sik.sikandroid.activity.ActivityTracker
|
|
import com.sik.sikandroid.activity.ActivityTracker
|
|
|
import com.sik.sikcore.SIKCore
|
|
import com.sik.sikcore.SIKCore
|
|
|
import com.sik.sikcore.date.TimeUtils
|
|
import com.sik.sikcore.date.TimeUtils
|
|
@@ -102,9 +105,7 @@ object BusinessManager {
|
|
|
var deviceList: MutableList<BleBean> = mutableListOf()
|
|
var deviceList: MutableList<BleBean> = mutableListOf()
|
|
|
|
|
|
|
|
// Modbus数据页面监听
|
|
// Modbus数据页面监听
|
|
|
- class DeviceListener(
|
|
|
|
|
- val key: Any, val callBack: (DockBean) -> Unit
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ class DeviceListener(val key: Any, val callBack: (List<DeviceModel>) -> Unit)
|
|
|
|
|
|
|
|
private val listeners = ArrayList<DeviceListener>()
|
|
private val listeners = ArrayList<DeviceListener>()
|
|
|
|
|
|
|
@@ -135,6 +136,8 @@ object BusinessManager {
|
|
|
*/
|
|
*/
|
|
|
// var checkKeyInfoTask: CheckKeyInfoTask = CheckKeyInfoTask()
|
|
// var checkKeyInfoTask: CheckKeyInfoTask = CheckKeyInfoTask()
|
|
|
|
|
|
|
|
|
|
+ var canManager: CanHardwareHelper? = null
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 初始化消息总线
|
|
* 初始化消息总线
|
|
|
*/
|
|
*/
|
|
@@ -259,18 +262,13 @@ object BusinessManager {
|
|
|
* 检查我的待办
|
|
* 检查我的待办
|
|
|
*/
|
|
*/
|
|
|
suspend fun checkMyTodoForHandleKey(mac: String? = null, delayMillis: Long = 60_0000): Boolean {
|
|
suspend fun checkMyTodoForHandleKey(mac: String? = null, delayMillis: Long = 60_0000): Boolean {
|
|
|
- if (!CAN_RETURN) {
|
|
|
|
|
- return false
|
|
|
|
|
- }
|
|
|
|
|
- val result = suspendCancellableCoroutine<Boolean> { cont ->
|
|
|
|
|
|
|
+ if (!CAN_RETURN) return false
|
|
|
|
|
+ val result = suspendCancellableCoroutine { cont ->
|
|
|
NetApi.getMySelfState {
|
|
NetApi.getMySelfState {
|
|
|
if (it) {
|
|
if (it) {
|
|
|
LogUtil.i("蓝牙连接-存在上锁解锁待办")
|
|
LogUtil.i("蓝牙连接-存在上锁解锁待办")
|
|
|
if (BleSendDispatcher.canConnect()) {
|
|
if (BleSendDispatcher.canConnect()) {
|
|
|
LogUtil.i("蓝牙连接-发送队列可以连接")
|
|
LogUtil.i("蓝牙连接-发送队列可以连接")
|
|
|
- mac?.let {
|
|
|
|
|
-// connectExistsKey(listOf(it))
|
|
|
|
|
- }
|
|
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
LogUtil.i("蓝牙连接-没有待办数据,延迟断开所有发送连接")
|
|
LogUtil.i("蓝牙连接-没有待办数据,延迟断开所有发送连接")
|
|
@@ -284,70 +282,36 @@ object BusinessManager {
|
|
|
return result
|
|
return result
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- /**
|
|
|
|
|
- * 连接一把存在的可连接的钥匙
|
|
|
|
|
- */
|
|
|
|
|
- fun connectExistsKey(exceptKeyMac: List<String> = listOf()) {
|
|
|
|
|
- ThreadUtils.runOnIO {
|
|
|
|
|
- // —— 串行请求1 & 2 ——
|
|
|
|
|
- val slotsPage = getSlotsPage()
|
|
|
|
|
-
|
|
|
|
|
- // —— 并行加载字典(或按需串行也行) ——
|
|
|
|
|
- val slotStatus =
|
|
|
|
|
- async { fetchDict<CommonDictRespVO>(DictAndSystemConstants.KEY_SLOT_STATUS) }
|
|
|
|
|
- val keyStatus =
|
|
|
|
|
- async { fetchDict<CommonDictRespVO>(DictAndSystemConstants.KEY_KEY_STATUS) }
|
|
|
|
|
- val slotType =
|
|
|
|
|
- async { fetchDict<CommonDictRespVO>(DictAndSystemConstants.KEY_SLOT_TYPE) }
|
|
|
|
|
-
|
|
|
|
|
- // 等待字典加载完成
|
|
|
|
|
- val slotStatusList = slotStatus.await()
|
|
|
|
|
- val keyStatusList = keyStatus.await()
|
|
|
|
|
- val slotTypeList = slotType.await()
|
|
|
|
|
- withContext(Dispatchers.Default) {
|
|
|
|
|
- val keyPage = withContext(Dispatchers.IO) { getKeyPage() }
|
|
|
|
|
- getOneKey(
|
|
|
|
|
- slotsPage?.records?.filter {
|
|
|
|
|
- it.slotType == slotTypeList.find { d -> d.dictLabel == "钥匙" }?.dictValue && it.status == slotStatusList.find { d -> d.dictLabel == "异常" }?.dictValue
|
|
|
|
|
- }?.toMutableList() ?: mutableListOf(),
|
|
|
|
|
- (keyPage?.records?.filter { it.exStatus == keyStatusList.find { d -> d.dictLabel == "异常" }?.dictValue }
|
|
|
|
|
- ?.map { it.keyNfc ?: "" }?.toMutableList() ?: mutableListOf()),
|
|
|
|
|
- exceptKeyMac
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- /****************************************** ModBus ******************************************/
|
|
|
|
|
|
|
+ /****************************************** CAN ******************************************/
|
|
|
/**
|
|
/**
|
|
|
* 链接底座
|
|
* 链接底座
|
|
|
*/
|
|
*/
|
|
|
fun connectDock(isNeedInit: Boolean = false) {
|
|
fun connectDock(isNeedInit: Boolean = false) {
|
|
|
val dockData = SPUtils.getDockConfig(SIKCore.getApplication())
|
|
val dockData = SPUtils.getDockConfig(SIKCore.getApplication())
|
|
|
LogUtil.i("基座数据:${dockData}")
|
|
LogUtil.i("基座数据:${dockData}")
|
|
|
- if (dockData?.isEmpty() == true || dockData == "[]") {
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
- ModBusController.interruptReadTrashBinStatus(false)
|
|
|
|
|
- ModBusController.start(MyApplication.instance!!.applicationContext)
|
|
|
|
|
- ModBusController.unregisterListener(MyApplication.instance!!.applicationContext)
|
|
|
|
|
-
|
|
|
|
|
- if (isNeedInit) {
|
|
|
|
|
- ModBusController.initDevicesStatus()
|
|
|
|
|
|
|
+ if (dockData?.isEmpty() == true || dockData == "[]") return
|
|
|
|
|
+ if (canManager == null) {
|
|
|
|
|
+ canManager = CanHardwareHelper()
|
|
|
|
|
+ // CAN总线连接和监听
|
|
|
|
|
+ canManager?.interruptReadTrashBinStatus(true)
|
|
|
|
|
+ canManager?.connectAndAddListener()
|
|
|
|
|
+ CanHelper.addDeviceChangeListener(this) { canDeviceStatusHandle(it) }
|
|
|
}
|
|
}
|
|
|
|
|
+ // 是否需要初始化Dock数据
|
|
|
|
|
+ // if (isNeedInit) initDevicesStatus()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 断开底座链接
|
|
* 断开底座链接
|
|
|
*/
|
|
*/
|
|
|
fun disconnectDock() {
|
|
fun disconnectDock() {
|
|
|
- ModBusController.stop()
|
|
|
|
|
|
|
+ canManager?.disconnect()
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
* 注册状态监听
|
|
* 注册状态监听
|
|
|
*/
|
|
*/
|
|
|
- fun registerStatusListener(key: Any, listener: (DockBean) -> Unit) {
|
|
|
|
|
|
|
+ fun registerStatusListener(key: Any, listener: (List<DeviceModel>) -> Unit) {
|
|
|
listeners.add(DeviceListener(key, listener))
|
|
listeners.add(DeviceListener(key, listener))
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -381,11 +345,12 @@ object BusinessManager {
|
|
|
* 总的监听,做预处理,其余的所有监听均使用本监听处理后的数据,只允许调用一次
|
|
* 总的监听,做预处理,其余的所有监听均使用本监听处理后的数据,只允许调用一次
|
|
|
*/
|
|
*/
|
|
|
fun registerMainListener() {
|
|
fun registerMainListener() {
|
|
|
- ModBusController.registerStatusListener(this) { res ->
|
|
|
|
|
- deviceStatusHandle(res)
|
|
|
|
|
|
|
+ CanHelper.addDeviceChangeListener(this) { res ->
|
|
|
|
|
+ canDeviceStatusHandle(res)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 硬件状态
|
|
* 硬件状态
|
|
|
* 1、检测到有钥匙
|
|
* 1、检测到有钥匙
|
|
@@ -394,118 +359,147 @@ object BusinessManager {
|
|
|
* 4、蓝牙连接
|
|
* 4、蓝牙连接
|
|
|
* 5、蓝牙数据通讯
|
|
* 5、蓝牙数据通讯
|
|
|
*/
|
|
*/
|
|
|
- private fun deviceStatusHandle(res: Any) {
|
|
|
|
|
- LogUtil.d("硬件状态:${(res as List<ByteArray>).map { it.toHexStrings() }}")
|
|
|
|
|
- if (res.isEmpty() || res.any { it.isEmpty() }) {
|
|
|
|
|
- var tipStr = CommonUtils.getStr(R.string.no_response_board_exists) + " : "
|
|
|
|
|
- val addressList = mutableListOf<String>()
|
|
|
|
|
-
|
|
|
|
|
- ModBusController.modBusManager?.mSlaveAddressList?.forEach { itDock ->
|
|
|
|
|
- if (res.none { it.isNotEmpty() && it[0] == itDock }) {
|
|
|
|
|
- addressList.add("0x${String.format("%02X", itDock)}")
|
|
|
|
|
|
|
+ private fun canDeviceStatusHandle(res: List<DeviceModel>) {
|
|
|
|
|
+ if (res.isEmpty()) return
|
|
|
|
|
+ val deviceType = CanHelper.getDeviceTypeByNodeId(res[0].nodeId)
|
|
|
|
|
+ when (deviceType) {
|
|
|
|
|
+ // 钥匙底座
|
|
|
|
|
+ CanDeviceConst.DEVICE_KEY_DOCK -> {
|
|
|
|
|
+ if (!CAN_RETURN) return
|
|
|
|
|
+ res.filterIsInstance<DeviceModel.DeviceKey>().forEach {
|
|
|
|
|
+ canDeviceKeyHandler(it)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- tipStr += addressList
|
|
|
|
|
- ToastUtils.tip(tipStr)
|
|
|
|
|
- }
|
|
|
|
|
- res.forEachIndexed { index, bytes ->
|
|
|
|
|
- val dockBean = ModBusController.updateStatus(bytes) ?: return@forEachIndexed
|
|
|
|
|
- ModBusController.isInitReady = true
|
|
|
|
|
- when (dockBean.type) {
|
|
|
|
|
- DOCK_TYPE_KEY -> {
|
|
|
|
|
- if (!CAN_RETURN) {
|
|
|
|
|
- return@forEachIndexed
|
|
|
|
|
- }
|
|
|
|
|
- dockBean.getKeyList().forEach { keyBean ->
|
|
|
|
|
- deviceKeyHandler(dockBean, keyBean)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ // 锁底座
|
|
|
|
|
+ CanDeviceConst.DEVICE_LOCK_DOCK -> {
|
|
|
|
|
+ if (!CAN_RETURN) return
|
|
|
|
|
+ res.filterIsInstance<DeviceModel.CommonDevice>().forEach {
|
|
|
|
|
+ canDeviceLockHandler(it)
|
|
|
}
|
|
}
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- DOCK_TYPE_LOCK -> {
|
|
|
|
|
- if (!CAN_RETURN) {
|
|
|
|
|
- return@forEachIndexed
|
|
|
|
|
- }
|
|
|
|
|
- dockBean.getLockList().forEach { lockBean ->
|
|
|
|
|
- deviceLockHandler(dockBean, lockBean)
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ CanDeviceConst.DEVICE_KEY_CABINET_CONTROL_BOARD -> {
|
|
|
|
|
+ // TODO 钥匙柜主控板
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- DOCK_TYPE_ELEC_LOCK_BOARD -> {
|
|
|
|
|
- // TODO 占位
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ CanDeviceConst.DEVICE_MATERIAL_CABINET_CONTROL_BOARD -> {
|
|
|
|
|
+ // TODO 物资柜主控板
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ Executor.delayOnMain(200) {
|
|
|
|
|
+ listeners.forEach { it.callBack(res) }
|
|
|
|
|
+ }
|
|
|
|
|
+ Executor.delayOnMain(200) {
|
|
|
|
|
+ if (ISCSDomainData.isDeviceRegistration) {
|
|
|
|
|
+ initListener?.invoke()
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
- DOCK_TYPE_PORTABLE -> {
|
|
|
|
|
- // TODO 便携式待完善
|
|
|
|
|
- dockBean.deviceList.forEach { deviceBean ->
|
|
|
|
|
- if (deviceBean.isExist) {
|
|
|
|
|
- when (deviceBean.type) {
|
|
|
|
|
- DEVICE_TYPE_KEY -> {
|
|
|
|
|
- if (!CAN_RETURN) {
|
|
|
|
|
- return@forEachIndexed
|
|
|
|
|
- }
|
|
|
|
|
- deviceKeyHandler(dockBean, deviceBean as DockBean.KeyBean)
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
- DEVICE_TYPE_LOCK -> {
|
|
|
|
|
- if (!CAN_RETURN) {
|
|
|
|
|
- return@forEachIndexed
|
|
|
|
|
- }
|
|
|
|
|
- deviceLockHandler(dockBean, deviceBean as DockBean.LockBean)
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 钥匙设备处理
|
|
|
|
|
+ * Can设备
|
|
|
|
|
+ */
|
|
|
|
|
+ private fun canDeviceKeyHandler(keyBean: DeviceModel.DeviceKey) {
|
|
|
|
|
+ if (!keyBean.deviceChange) return
|
|
|
|
|
+ Log.i("Manager", "钥匙状态变化canDeviceKeyHandler:$keyBean")
|
|
|
|
|
+ if (keyBean.isExist) {
|
|
|
|
|
+ val req = CanCommands.forDevice(keyBean.nodeId)
|
|
|
|
|
+ .let { if (keyBean.id == 0) it.getLeftRfid() else it.getRightRfid() }
|
|
|
|
|
+ CanHelper.readFrom(req) { res ->
|
|
|
|
|
+ val rfidData = res?.payload ?: byteArrayOf()
|
|
|
|
|
+ if (!ISCSDomainData.isDeviceRegistration) {
|
|
|
|
|
+ CanHelper.writeTo(
|
|
|
|
|
+ CanCommands.forDevice(keyBean.nodeId)
|
|
|
|
|
+ .setCharge(keyBean.id == 0, keyBean.id == 1)
|
|
|
|
|
+ ) {}
|
|
|
|
|
+ }
|
|
|
|
|
+ if (rfidData.size < 4) {
|
|
|
|
|
+ Log.e("Manager", "Key rfid error")
|
|
|
|
|
+ keyBean.deviceChange = false
|
|
|
|
|
+ return@readFrom
|
|
|
|
|
+ }
|
|
|
|
|
+ val rfid = rfidData.toHexFromLe()
|
|
|
|
|
+ Log.i("Manager", "读取到的rfid:$rfid")
|
|
|
|
|
+ keyBean.rfid = rfid
|
|
|
|
|
+ Log.i("Manager", "更新rfid完成:$keyBean")
|
|
|
|
|
|
|
|
- DEVICE_TYPE_CARD -> {
|
|
|
|
|
- ModBusController.readPortalCaseCardRfid(dockBean.addr) { res ->
|
|
|
|
|
- if (res.size < 11) {
|
|
|
|
|
- LogUtil.e("Portal Case card rfid error")
|
|
|
|
|
- return@readPortalCaseCardRfid
|
|
|
|
|
- }
|
|
|
|
|
- val rfid = res.copyOfRange(3, 11).toHexStrings(false)
|
|
|
|
|
- .removeLeadingZeros()
|
|
|
|
|
- LogUtil.i("卡片RFID : $rfid")
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ ThreadUtils.runOnIO {
|
|
|
|
|
+ val slotStatus = async { fetchDict<CommonDictRespVO>(DictAndSystemConstants.KEY_SLOT_STATUS) }
|
|
|
|
|
+ val slotType = async { fetchDict<CommonDictRespVO>(DictAndSystemConstants.KEY_SLOT_TYPE) }
|
|
|
|
|
+ val slotsPageReq = async { getSlotsPage() }
|
|
|
|
|
+ val keyStatusReq =
|
|
|
|
|
+ async { fetchDict<CommonDictRespVO>(DictAndSystemConstants.KEY_KEY_STATUS) }
|
|
|
|
|
+ val keyPageReq = async { getKeyPage() }
|
|
|
|
|
|
|
|
- DEVICE_TYPE_FINGERPRINT -> {
|
|
|
|
|
|
|
+ val keyStatus = keyStatusReq.await()
|
|
|
|
|
+ val keyData = keyPageReq.await()
|
|
|
|
|
+ val slotsPage = slotsPageReq.await()
|
|
|
|
|
+ val slotStatusList = slotStatus.await()
|
|
|
|
|
+ val slotTypeList = slotType.await()
|
|
|
|
|
|
|
|
|
|
+
|
|
|
|
|
+ // 锁钥匙未异常正常请求锁数据,关锁
|
|
|
|
|
+ if (rfid in (keyData?.records?.filter { it.exStatus == keyStatus.find { it.dictLabel == "异常" }?.dictValue }
|
|
|
|
|
+ ?.map { it.keyNfc }?.toMutableList() ?: mutableListOf())) {
|
|
|
|
|
+ ToastUtils.tip(
|
|
|
|
|
+ MyApplication.instance?.applicationContext!!.getString(
|
|
|
|
|
+ R.string.key_exception_tag
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ } else if (slotsPage?.records?.filter {
|
|
|
|
|
+ it.slotType == slotTypeList.find { d -> d.dictLabel == "钥匙" }?.dictValue && it.status == slotStatusList.find { d -> d.dictLabel == "异常" }?.dictValue
|
|
|
|
|
+ }
|
|
|
|
|
+ ?.find { it.row?.toInt() == keyBean.nodeId && it.col?.toInt() == (keyBean.nodeId + (keyBean.id) * 2 + 1) } != null) {
|
|
|
|
|
+ ToastUtils.tip(
|
|
|
|
|
+ MyApplication.instance?.applicationContext!!.getString(
|
|
|
|
|
+ R.string.slot_exception_tag
|
|
|
|
|
+ )
|
|
|
|
|
+ )
|
|
|
|
|
+ } else {
|
|
|
|
|
+ val ctrl = CanCommands.forDevice(keyBean.nodeId).controlLatch(keyBean.id, 1)
|
|
|
|
|
+ CanHelper.writeTo(ctrl) { _ ->
|
|
|
|
|
+ NetApi.getKeyInfo(rfid) {
|
|
|
|
|
+ // TODO QUEST ModBusController.updateKeyNewHardware(dockBean.addr, true, it == null)
|
|
|
|
|
+ if (it != null && !it.macAddress.isNullOrEmpty()) {
|
|
|
|
|
+ keyBean.mac = it.macAddress
|
|
|
|
|
+ } else {
|
|
|
|
|
+ LogUtil.e("Get key info fail : $rfid")
|
|
|
|
|
+ if (!ISCSDomainData.isDeviceRegistration) {
|
|
|
|
|
+ ToastUtils.tip(R.string.get_key_info_fail)
|
|
|
|
|
+ }
|
|
|
|
|
+ val unlock = CanCommands.forDevice(keyBean.nodeId).controlLatch(keyBean.id, 0)
|
|
|
|
|
+ CanHelper.writeTo(unlock) {}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
- DeviceConst.DOCK_TYPE_COLLECT -> {
|
|
|
|
|
- ModBusController.switchStatus(bytes) {}
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- Executor.delayOnMain(200) {
|
|
|
|
|
- if (!ISCSDomainData.isDeviceRegistration) {
|
|
|
|
|
- listeners.forEach { it.callBack(dockBean) }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- Executor.delayOnMain(200) {
|
|
|
|
|
- if (ISCSDomainData.isDeviceRegistration) {
|
|
|
|
|
- initListener?.invoke()
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+ } else if (!keyBean.isCharging) {
|
|
|
|
|
+ unregisterConnectListener(keyBean.mac)
|
|
|
|
|
+ sendEventMsg(MsgEvent(MSG_EVENT_DEVICE_TAKE_UPDATE, DeviceTakeUpdateMsg(DEVICE_TYPE_KEY, keyBean.rfid)))
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
|
- * 挂锁处理
|
|
|
|
|
|
|
+ * 设备挂锁处理
|
|
|
|
|
+ * Can设备
|
|
|
*/
|
|
*/
|
|
|
- private fun deviceLockHandler(
|
|
|
|
|
- dockBean: DockBean, lockBean: DockBean.LockBean
|
|
|
|
|
- ) {
|
|
|
|
|
|
|
+ private fun canDeviceLockHandler(lockBean: DeviceModel.CommonDevice) {
|
|
|
|
|
+ if (!lockBean.deviceChange) return
|
|
|
if (lockBean.isExist) {
|
|
if (lockBean.isExist) {
|
|
|
- ModBusController.readLockRfid(dockBean.addr, lockBean.idx) { res ->
|
|
|
|
|
- if (res.size < 11) {
|
|
|
|
|
- LogUtil.e("Lock rfid error")
|
|
|
|
|
- return@readLockRfid
|
|
|
|
|
- }
|
|
|
|
|
- val rfid = res.copyOfRange(3, 11).toHexStrings(false).removeLeadingZeros()
|
|
|
|
|
- ModBusController.updateLockRfid(
|
|
|
|
|
- dockBean.addr, lockBean.idx, rfid
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ val req = CanCommands.forDevice(lockBean.nodeId).getSlotRfid_1to5(lockBean.id)
|
|
|
|
|
+ CanHelper.readFrom(req) { res ->
|
|
|
|
|
+ val rfidData = res?.payload ?: byteArrayOf()
|
|
|
|
|
+ if (rfidData.size < 4) {
|
|
|
|
|
+ LogUtil.i("Lock rfid error")
|
|
|
|
|
+ lockBean.deviceChange = false
|
|
|
|
|
+ return@readFrom
|
|
|
|
|
+ }
|
|
|
|
|
+ val rfid = rfidData.toHexFromLe()
|
|
|
|
|
+ lockBean.rfid = rfid
|
|
|
ThreadUtils.runOnIO {
|
|
ThreadUtils.runOnIO {
|
|
|
val lockStatusReq =
|
|
val lockStatusReq =
|
|
|
async { fetchDict<CommonDictRespVO>(DictAndSystemConstants.KEY_PAD_LOCK_STATUS) }
|
|
async { fetchDict<CommonDictRespVO>(DictAndSystemConstants.KEY_PAD_LOCK_STATUS) }
|
|
@@ -514,10 +508,12 @@ object BusinessManager {
|
|
|
val slotType =
|
|
val slotType =
|
|
|
async { fetchDict<CommonDictRespVO>(DictAndSystemConstants.KEY_SLOT_TYPE) }
|
|
async { fetchDict<CommonDictRespVO>(DictAndSystemConstants.KEY_SLOT_TYPE) }
|
|
|
val slotsPageReq = async { getSlotsPage() }
|
|
val slotsPageReq = async { getSlotsPage() }
|
|
|
- var lockStatus = lockStatusReq.await()
|
|
|
|
|
|
|
+ val lockStatus = lockStatusReq.await()
|
|
|
val slotsPage = slotsPageReq.await()
|
|
val slotsPage = slotsPageReq.await()
|
|
|
val slotStatusList = slotStatus.await()
|
|
val slotStatusList = slotStatus.await()
|
|
|
val slotTypeList = slotType.await()
|
|
val slotTypeList = slotType.await()
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
NetApi.getIsLockPage { lockData ->
|
|
NetApi.getIsLockPage { lockData ->
|
|
|
//锁rfid未异常正常请求锁数据,关锁
|
|
//锁rfid未异常正常请求锁数据,关锁
|
|
|
if (rfid in (lockData?.records?.filter { it.exStatus == lockStatus.find { it.dictLabel == "异常" }?.dictValue }
|
|
if (rfid in (lockData?.records?.filter { it.exStatus == lockStatus.find { it.dictLabel == "异常" }?.dictValue }
|
|
@@ -530,26 +526,21 @@ object BusinessManager {
|
|
|
} else if (slotsPage?.records?.filter {
|
|
} else if (slotsPage?.records?.filter {
|
|
|
it.slotType == slotTypeList.find { d -> d.dictLabel == "锁" }?.dictValue && it.status == slotStatusList.find { d -> d.dictLabel == "异常" }?.dictValue
|
|
it.slotType == slotTypeList.find { d -> d.dictLabel == "锁" }?.dictValue && it.status == slotStatusList.find { d -> d.dictLabel == "异常" }?.dictValue
|
|
|
}
|
|
}
|
|
|
- ?.find { it.row?.toInt() == dockBean.row && (lockBean.idx + 1) == it.col?.toInt() } != null) {
|
|
|
|
|
|
|
+ ?.find { it.row?.toInt() == lockBean.nodeId && lockBean.id == it.col?.toInt() } != null) {
|
|
|
ToastUtils.tip(
|
|
ToastUtils.tip(
|
|
|
MyApplication.instance?.applicationContext!!.getString(
|
|
MyApplication.instance?.applicationContext!!.getString(
|
|
|
R.string.slot_exception_tag
|
|
R.string.slot_exception_tag
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|
|
|
} else {
|
|
} else {
|
|
|
- NetApi.getLockInfo(rfid) {
|
|
|
|
|
- if (it != null) {
|
|
|
|
|
|
|
+ NetApi.getLockInfo(rfid) { lockInfo ->
|
|
|
|
|
+ if (lockInfo != null) {
|
|
|
NetApi.getLockStateByNfc(rfid) {
|
|
NetApi.getLockStateByNfc(rfid) {
|
|
|
if (it != 1) {
|
|
if (it != 1) {
|
|
|
- ModBusController.controlLockBuckle(
|
|
|
|
|
- false, dockBean.addr, lockBean.idx
|
|
|
|
|
- ) { itRst ->
|
|
|
|
|
- if (itRst.isNotEmpty()) {
|
|
|
|
|
- // 上报锁具信息
|
|
|
|
|
- NetApi.updateLockReturn(
|
|
|
|
|
- rfid, MyApplication.instance!!.serialNo()
|
|
|
|
|
- ) {}
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ val ctrl = CanCommands.forDevice(lockBean.nodeId).controlOne_1to5(lockBean.id, true)
|
|
|
|
|
+ CanHelper.writeTo(ctrl) {
|
|
|
|
|
+ // 上报锁具信息
|
|
|
|
|
+ NetApi.updateLockReturn(rfid, MyApplication.instance!!.serialNo()) {}
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
ToastUtils.tip(CommonUtils.getStr(R.string.ticket_not_finish_can_not_return_lock))
|
|
ToastUtils.tip(CommonUtils.getStr(R.string.ticket_not_finish_can_not_return_lock))
|
|
@@ -563,105 +554,8 @@ object BusinessManager {
|
|
|
}
|
|
}
|
|
|
} else {
|
|
} else {
|
|
|
LogUtil.i("挂锁取出-:${lockBean.rfid}")
|
|
LogUtil.i("挂锁取出-:${lockBean.rfid}")
|
|
|
- sendEventMsg(
|
|
|
|
|
- MsgEvent(
|
|
|
|
|
- MSG_EVENT_DEVICE_TAKE_UPDATE,
|
|
|
|
|
- DeviceTakeUpdateMsg(DEVICE_TYPE_LOCK, lockBean.rfid)
|
|
|
|
|
- )
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- private fun deviceKeyHandler(dockBean: DockBean, keyBean: DockBean.KeyBean) {
|
|
|
|
|
- if (keyBean.isExist) {
|
|
|
|
|
- // 放回钥匙,读取rfid
|
|
|
|
|
- ModBusController.readKeyRfid(
|
|
|
|
|
- dockBean.addr, if (keyBean.isLeft) 0 else 1
|
|
|
|
|
- ) { isLeft, res ->
|
|
|
|
|
- if (!ISCSDomainData.isDeviceRegistration) {
|
|
|
|
|
- ModBusController.controlKeyCharge(
|
|
|
|
|
- true, keyBean.isLeft, dockBean.addr
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
- if (res.size < 11) {
|
|
|
|
|
- LogUtil.e("Key rfid error")
|
|
|
|
|
- return@readKeyRfid
|
|
|
|
|
- }
|
|
|
|
|
- val rfid = res.copyOfRange(3, 11).toHexStrings(false).removeLeadingZeros()
|
|
|
|
|
- ThreadUtils.runOnIO {
|
|
|
|
|
- val slotStatus =
|
|
|
|
|
- async { fetchDict<CommonDictRespVO>(DictAndSystemConstants.KEY_SLOT_STATUS) }
|
|
|
|
|
- val slotType =
|
|
|
|
|
- async { fetchDict<CommonDictRespVO>(DictAndSystemConstants.KEY_SLOT_TYPE) }
|
|
|
|
|
- val slotsPageReq = async { getSlotsPage() }
|
|
|
|
|
- val keyStatusReq =
|
|
|
|
|
- async { fetchDict<CommonDictRespVO>(DictAndSystemConstants.KEY_KEY_STATUS) }
|
|
|
|
|
- val keyPageReq = async { getKeyPage() }
|
|
|
|
|
- var keyStatus = keyStatusReq.await()
|
|
|
|
|
- var keyData = keyPageReq.await()
|
|
|
|
|
- val slotsPage = slotsPageReq.await()
|
|
|
|
|
- val slotStatusList = slotStatus.await()
|
|
|
|
|
- val slotTypeList = slotType.await()
|
|
|
|
|
- //锁钥匙未异常正常请求锁数据,关锁
|
|
|
|
|
- if (rfid in (keyData?.records?.filter { it.exStatus == keyStatus.find { it.dictLabel == "异常" }?.dictValue }
|
|
|
|
|
- ?.map { it.keyNfc }?.toMutableList() ?: mutableListOf())) {
|
|
|
|
|
- ToastUtils.tip(
|
|
|
|
|
- MyApplication.instance?.applicationContext!!.getString(
|
|
|
|
|
- R.string.key_exception_tag
|
|
|
|
|
- )
|
|
|
|
|
- )
|
|
|
|
|
- } else if (slotsPage?.records?.filter {
|
|
|
|
|
- it.slotType == slotTypeList.find { d -> d.dictLabel == "钥匙" }?.dictValue && it.status == slotStatusList.find { d -> d.dictLabel == "异常" }?.dictValue
|
|
|
|
|
- }
|
|
|
|
|
- ?.find { it.row?.toInt() == dockBean.row && it.col?.toInt() == (dockBean.col + (if (keyBean.isLeft) 0 else 1) * 2) } != null) {
|
|
|
|
|
- ToastUtils.tip(
|
|
|
|
|
- MyApplication.instance?.applicationContext!!.getString(
|
|
|
|
|
- R.string.slot_exception_tag
|
|
|
|
|
- )
|
|
|
|
|
- )
|
|
|
|
|
- } else {
|
|
|
|
|
- ModBusController.updateKeyRfid(
|
|
|
|
|
- dockBean.addr, keyBean.isLeft, rfid
|
|
|
|
|
- )
|
|
|
|
|
- // 放回钥匙,上锁
|
|
|
|
|
- ModBusController.controlKeyBuckle(
|
|
|
|
|
- false, keyBean.isLeft, dockBean.addr
|
|
|
|
|
- ) {
|
|
|
|
|
- NetApi.getKeyInfo(rfid) {
|
|
|
|
|
- ModBusController.updateKeyNewHardware(
|
|
|
|
|
- dockBean.addr, true, it == null
|
|
|
|
|
- )
|
|
|
|
|
- if (it != null && !it.macAddress.isNullOrEmpty()) {
|
|
|
|
|
- ModBusController.updateKeyMac(
|
|
|
|
|
- dockBean.addr, keyBean.isLeft, it.macAddress
|
|
|
|
|
- )
|
|
|
|
|
- ModBusController.updateKeyReadyStatus(
|
|
|
|
|
- it.macAddress, false, 5
|
|
|
|
|
- )
|
|
|
|
|
- } else {
|
|
|
|
|
- LogUtil.e("Get key info fail : $rfid")
|
|
|
|
|
- if (!ISCSDomainData.isDeviceRegistration) {
|
|
|
|
|
- ToastUtils.tip(R.string.get_key_info_fail)
|
|
|
|
|
- }
|
|
|
|
|
- ModBusController.controlKeyBuckle(
|
|
|
|
|
- true, keyBean.isLeft, dockBean.addr
|
|
|
|
|
- )
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
- } else if (!keyBean.isCharging) {//增加充电判断,防止无线充电干扰锁仓状态导致判断为取出
|
|
|
|
|
- // 移出待连监听集合,防止connectKey循环失败
|
|
|
|
|
- keyBean.mac?.let {
|
|
|
|
|
- unregisterConnectListener(it)
|
|
|
|
|
- }
|
|
|
|
|
- sendEventMsg(
|
|
|
|
|
- MsgEvent(
|
|
|
|
|
- MSG_EVENT_DEVICE_TAKE_UPDATE, DeviceTakeUpdateMsg(DEVICE_TYPE_KEY, keyBean.rfid)
|
|
|
|
|
- )
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ sendEventMsg(MsgEvent(MSG_EVENT_DEVICE_TAKE_UPDATE, DeviceTakeUpdateMsg(DEVICE_TYPE_LOCK, lockBean.rfid)))
|
|
|
|
|
+ lockBean.deviceChange = false // 取出分支可在同步处理后立即归零
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -1815,11 +1709,14 @@ object BusinessManager {
|
|
|
mDeviceTakeList.removeIf { it.deviceType == deviceType && it.nfc == nfc }
|
|
mDeviceTakeList.removeIf { it.deviceType == deviceType && it.nfc == nfc }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ private fun devKey(nodeId: Int, deviceType: Int, id: Int) =
|
|
|
|
|
+ "$nodeId-$deviceType-$id"
|
|
|
|
|
+
|
|
|
private fun handleDeviceTake(deviceTakeUpdateBO: DeviceTakeUpdateMsg, rfid: String? = null) {
|
|
private fun handleDeviceTake(deviceTakeUpdateBO: DeviceTakeUpdateMsg, rfid: String? = null) {
|
|
|
LogUtil.i("$deviceTakeUpdateBO")
|
|
LogUtil.i("$deviceTakeUpdateBO")
|
|
|
when (deviceTakeUpdateBO.deviceType) {
|
|
when (deviceTakeUpdateBO.deviceType) {
|
|
|
// 钥匙
|
|
// 钥匙
|
|
|
- 0 -> {
|
|
|
|
|
|
|
+ DEVICE_TYPE_KEY -> {
|
|
|
mDeviceTakeList.find { it.deviceType == DEVICE_TYPE_KEY && it.nfc == deviceTakeUpdateBO.nfc }
|
|
mDeviceTakeList.find { it.deviceType == DEVICE_TYPE_KEY && it.nfc == deviceTakeUpdateBO.nfc }
|
|
|
?.let { info ->
|
|
?.let { info ->
|
|
|
if (mDeviceTakeList.any { it.deviceType == DeviceConst.DEVICE_TYPE_LOCK && it.ticketId == info.ticketId }) {
|
|
if (mDeviceTakeList.any { it.deviceType == DeviceConst.DEVICE_TYPE_LOCK && it.ticketId == info.ticketId }) {
|
|
@@ -1841,35 +1738,29 @@ object BusinessManager {
|
|
|
UpdateTicketProgressMsg(info.ticketId)
|
|
UpdateTicketProgressMsg(info.ticketId)
|
|
|
)
|
|
)
|
|
|
)
|
|
)
|
|
|
- //钥匙取出之后重新再连一把钥匙待机
|
|
|
|
|
- ModBusController.getKeyByRfid(
|
|
|
|
|
- info.nfc
|
|
|
|
|
- )?.mac?.let {
|
|
|
|
|
|
|
+ // 钥匙取出之后重新再连一把钥匙待机
|
|
|
|
|
+ HardwareMode.getCurrentHardwareMode().getKeyMacByRfid(info.nfc)?.let {
|
|
|
|
|
+ HardwareMode.getCurrentHardwareMode().getKeyBeanByMac(it)?.let { keyBean ->
|
|
|
|
|
+ HandlerGate.leave(devKey(keyBean.addr, keyBean.type, keyBean.idx))
|
|
|
|
|
+ }
|
|
|
BleSendDispatcher.scheduleDisconnect(it)
|
|
BleSendDispatcher.scheduleDisconnect(it)
|
|
|
}
|
|
}
|
|
|
- //待机数不够就再连一把,但不能是原来那把
|
|
|
|
|
- ModBusController.getKeyByRfid(
|
|
|
|
|
- info.nfc
|
|
|
|
|
- )?.mac?.let {
|
|
|
|
|
- ThreadUtils.runOnIO {
|
|
|
|
|
- checkMyTodoForHandleKey(it)
|
|
|
|
|
|
|
+ // 待机数不够就再连一把,但不能是原来那把
|
|
|
|
|
+ HardwareMode.getCurrentHardwareMode().getKeyMacByRfid(info.nfc)?.let {
|
|
|
|
|
+ HardwareMode.getCurrentHardwareMode().getKeyBeanByMac(it)?.let { keyBean ->
|
|
|
|
|
+ HandlerGate.leave(devKey(keyBean.addr, keyBean.type, keyBean.idx))
|
|
|
}
|
|
}
|
|
|
|
|
+ ThreadUtils.runOnIO { checkMyTodoForHandleKey(it) }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
} ?: sendLoadingEventMsg(null, false)
|
|
} ?: sendLoadingEventMsg(null, false)
|
|
|
}
|
|
}
|
|
|
// 挂锁
|
|
// 挂锁
|
|
|
- 1 -> {
|
|
|
|
|
|
|
+ DEVICE_TYPE_LOCK -> {
|
|
|
mDeviceTakeList.find { it.deviceType == DEVICE_TYPE_LOCK && it.nfc == deviceTakeUpdateBO.nfc }
|
|
mDeviceTakeList.find { it.deviceType == DEVICE_TYPE_LOCK && it.nfc == deviceTakeUpdateBO.nfc }
|
|
|
?.let { info ->
|
|
?.let { info ->
|
|
|
- NetApi.updateLockTake(
|
|
|
|
|
- mutableListOf(
|
|
|
|
|
- LockTakeUpdateReqVO(
|
|
|
|
|
- info.ticketId, info.nfc, MyApplication.instance?.serialNo()!!
|
|
|
|
|
- )
|
|
|
|
|
- )
|
|
|
|
|
- ) { isSuccess ->
|
|
|
|
|
|
|
+ NetApi.updateLockTake(mutableListOf(LockTakeUpdateReqVO(info.ticketId, info.nfc, MyApplication.instance?.serialNo()!!))) { isSuccess ->
|
|
|
Executor.runOnMain {
|
|
Executor.runOnMain {
|
|
|
if (isSuccess == false) {
|
|
if (isSuccess == false) {
|
|
|
LogUtil.e("Lock take report fail")
|
|
LogUtil.e("Lock take report fail")
|
|
@@ -1903,11 +1794,9 @@ object BusinessManager {
|
|
|
// 检查有无当前工作票的钥匙
|
|
// 检查有无当前工作票的钥匙
|
|
|
mDeviceTakeList.find { it.deviceType == DEVICE_TYPE_KEY && it.ticketId == info.ticketId }
|
|
mDeviceTakeList.find { it.deviceType == DEVICE_TYPE_KEY && it.ticketId == info.ticketId }
|
|
|
?.let { itKey ->
|
|
?.let { itKey ->
|
|
|
- sendLoadingEventMsg(
|
|
|
|
|
- MyApplication.instance?.applicationContext!!.getString(
|
|
|
|
|
|
|
+ sendLoadingEventMsg(MyApplication.instance?.applicationContext!!.getString(
|
|
|
R.string.ble_connecting
|
|
R.string.ble_connecting
|
|
|
- )
|
|
|
|
|
- )
|
|
|
|
|
|
|
+ ))
|
|
|
handleGiveKey(itKey)
|
|
handleGiveKey(itKey)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|