|
|
@@ -73,8 +73,8 @@ class PresentationActivity :
|
|
|
}
|
|
|
|
|
|
(mBinding?.rvLockerTogether?.layoutManager as LinearLayoutManager).orientation = LinearLayoutManager.HORIZONTAL
|
|
|
- mBinding?.rvLockerTogether?.adapter = object : CommonAdapter<PresentationManager.LockerTogetherBean>(this, R.layout.item_rv_locker_together, PresentationManager.mLockerTogetherList) {
|
|
|
- override fun convert(holder: ViewHolder, data: PresentationManager.LockerTogetherBean, position: Int) {
|
|
|
+ mBinding?.rvLockerTogether?.adapter = object : CommonAdapter<PresentationManager.PLockerTogetherBean>(this, R.layout.item_rv_locker_together, PresentationManager.mLockerTogetherList) {
|
|
|
+ override fun convert(holder: ViewHolder, data: PresentationManager.PLockerTogetherBean, position: Int) {
|
|
|
holder.setText(R.id.tv_name, data.name)
|
|
|
holder.setChecked(R.id.cb, data.isChecked)
|
|
|
holder.getView<CheckBox>(R.id.cb).setOnCheckedChangeListener { _, b ->
|
|
|
@@ -85,29 +85,41 @@ class PresentationActivity :
|
|
|
}
|
|
|
|
|
|
private fun confirm() {
|
|
|
- BusinessManager.sendTicket("64:E8:33:47:59:7A", this) { b, s ->
|
|
|
- handleLoading(b, s)
|
|
|
+ // 蓝牙钥匙
|
|
|
+ val keyList = ModBusController.getKeyByDockType(DeviceConst.DOCK_TYPE_KEY)
|
|
|
+ if (keyList.isNullOrEmpty()) {
|
|
|
+ ToastUtils.tip("没有找到钥匙")
|
|
|
+ return
|
|
|
}
|
|
|
- val lockBean0 = ModBusController.getLockByRfid("706BD295")
|
|
|
- val lockBean2 = ModBusController.getLockByRfid("1068D495")
|
|
|
- val lockIdxList = mutableListOf(lockBean0!!.idx, lockBean2!!.idx)
|
|
|
+ val rfid = keyList[0].rfid
|
|
|
+ if (rfid.isNullOrEmpty()) {
|
|
|
+ ToastUtils.tip("没有找到钥匙的RFID")
|
|
|
+ return
|
|
|
+ }
|
|
|
+// BusinessManager.sendTicket(rfid, this) { b, s ->
|
|
|
+// handleLoading(b, s)
|
|
|
+// }
|
|
|
+
|
|
|
+ // 锁
|
|
|
val dockList = ModBusController.getDockByType(DeviceConst.DOCK_TYPE_PORTABLE)
|
|
|
- if (dockList.isNotEmpty()) {
|
|
|
- ToastUtils.tip("地址是 : ${dockList[0].addr.toInt()}")
|
|
|
- ModBusController.controlLockBuckle(true, dockList[0].addr.toInt() - 1, lockIdxList) { res ->
|
|
|
- LogUtil.i("confirm开锁卡扣 : ${res.toHexStrings()}")
|
|
|
- }
|
|
|
+ if (dockList.isEmpty()) {
|
|
|
+ ToastUtils.tip("没有找到移动柜")
|
|
|
+ return
|
|
|
+ }
|
|
|
+ val lockList = dockList[0].getLockList()
|
|
|
+ if (lockList.isEmpty()) {
|
|
|
+ ToastUtils.tip("没有找到移动柜的锁")
|
|
|
+ return
|
|
|
+ }
|
|
|
+
|
|
|
+ val lockIdxList = lockList.filter { it.rfid == rfid }.map { it.idx } as MutableList
|
|
|
+ ToastUtils.tip("地址是 : ${dockList[0].addr.toInt()}")
|
|
|
+ ModBusController.controlLockBuckle(true, dockList[0].addr.toInt() - 1, lockIdxList) { res ->
|
|
|
+ LogUtil.i("confirm开锁卡扣 : ${res.toHexStrings()}")
|
|
|
}
|
|
|
}
|
|
|
|
|
|
override fun initPresenter(): PresentationPresenter {
|
|
|
return PresentationPresenter()
|
|
|
}
|
|
|
-
|
|
|
- override fun onDestroy() {
|
|
|
- super.onDestroy()
|
|
|
- BusinessManager.disconnectDock()
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
}
|