瀏覽代碼

设备状态功能补充修复优化,代码临时提交

Frankensteinly 1 年之前
父節點
當前提交
1a0f833fbb

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

@@ -42,10 +42,12 @@ import com.grkj.iscs.model.bo.WorkTicketGetBO
 import com.grkj.iscs.model.bo.WorkTicketSendBO
 import com.grkj.iscs.model.bo.WorkTicketSendBO.LockListBO
 import com.grkj.iscs.model.eventmsg.CurrentModeMsg
+import com.grkj.iscs.model.eventmsg.DeviceExceptionMsg
 import com.grkj.iscs.model.eventmsg.DeviceTakeUpdateMsg
 import com.grkj.iscs.model.eventmsg.LoadingMsg
 import com.grkj.iscs.model.eventmsg.MsgEvent
 import com.grkj.iscs.model.eventmsg.MsgEventConstants.MSG_EVENT_CURRENT_MODE
+import com.grkj.iscs.model.eventmsg.MsgEventConstants.MSG_EVENT_DEVICE_EXCEPTION
 import com.grkj.iscs.model.eventmsg.MsgEventConstants.MSG_EVENT_DEVICE_TAKE_UPDATE
 import com.grkj.iscs.model.eventmsg.MsgEventConstants.MSG_EVENT_LOADING
 import com.grkj.iscs.model.eventmsg.MsgEventConstants.MSG_EVENT_SWITCH_MODE
@@ -1109,7 +1111,7 @@ object BusinessManager {
         }
     }
 
-    fun getCurrentStatus(from: Int, bleDevice: BleDevice, retryCount: Int = 3) {
+    fun getCurrentStatus(from: Int, bleDevice: BleDevice, retryCount: Int = 3, timeoutCallBack: ((Boolean) -> Unit)? = null) {
         LogUtil.i("getCurrentStatus - ${bleDevice.mac} - from : $from")
         var isTimeout = true
         // 加1秒防止早于onWriteFailure开始处理导致多次处理
@@ -1118,10 +1120,13 @@ object BusinessManager {
                 LogUtil.e("getCurrentStatus timeout : mac = ${bleDevice.mac}, retryCount = $retryCount")
                 if (retryCount > 0) {
                     Executor.delayOnMain(1000) {
-                        getCurrentStatus(from, bleDevice, retryCount - 1)
+                        getCurrentStatus(from, bleDevice, retryCount - 1, timeoutCallBack)
                     }
                 } else {
-                    addExceptionKey(bleDevice.mac)
+                    ModBusController.getKeyByMac(bleDevice.mac)?.rfid?.let {
+                        addExceptionKey(it)
+                        timeoutCallBack?.invoke(true)
+                    }
                 }
             }
         }
@@ -1129,13 +1134,14 @@ object BusinessManager {
             override fun onWriteSuccess(current: Int, total: Int, justWrite: ByteArray?) {
                 LogUtil.i("getCurrentStatus success : ${bleDevice.mac}")
                 isTimeout = false
+                timeoutCallBack?.invoke(false)
             }
 
             override fun onWriteFailure(exception: BleException?) {
                 LogUtil.i("getCurrentStatus fail : ${bleDevice.mac}")
                 isTimeout = false
                 Executor.delayOnMain(1000) {
-                    getCurrentStatus(from, bleDevice)
+                    getCurrentStatus(from, bleDevice, timeoutCallBack = timeoutCallBack)
                 }
             }
         })
@@ -1283,12 +1289,17 @@ object BusinessManager {
      * 添加待更新取出状态的设备
      */
     fun addDeviceTake(deviceType: Int, ticketId: Long, nfc: String?) {
-        LogUtil.i("$deviceType - $ticketId - $nfc")
+        LogUtil.i("addDeviceTake : $deviceType - $ticketId - $nfc")
         mDeviceTakeList.removeIf { it.deviceType == deviceType && it.nfc == nfc }
         mDeviceTakeList.add(DeviceTakeUpdateBO(deviceType, ticketId, nfc!!))
     }
 
-    private fun handleDeviceTake(deviceTakeUpdateBO: DeviceTakeUpdateMsg) {
+    fun removeDeviceTake(deviceType: Int, nfc: String?) {
+        LogUtil.i("removeDeviceTake : $deviceType - $nfc")
+        mDeviceTakeList.removeIf { it.deviceType == deviceType && it.nfc == nfc }
+    }
+
+    private fun handleDeviceTake(deviceTakeUpdateBO: DeviceTakeUpdateMsg, rfid: String? = null) {
         LogUtil.i("$deviceTakeUpdateBO")
         when (deviceTakeUpdateBO.deviceType) {
             // 钥匙
@@ -1338,7 +1349,7 @@ object BusinessManager {
                             }
                             // 检查有无当前工作票的钥匙
                             mDeviceTakeList.find { it.deviceType == DEVICE_TYPE_KEY && it.ticketId == info.ticketId }?.let { itKey ->
-                                getCurrentStatus(2, getBleDeviceByMac(ModBusController.getKeyByRfid(itKey.nfc)?.mac)!!.bleDevice)
+                                handleGiveKey(itKey)
                             }
                         }
                     }
@@ -1347,6 +1358,31 @@ object BusinessManager {
         }
     }
 
+    private fun handleGiveKey(deviceTakeUpdateBO: DeviceTakeUpdateBO) {
+        getCurrentStatus(2, getBleDeviceByMac(ModBusController.getKeyByRfid(deviceTakeUpdateBO.nfc)?.mac)!!.bleDevice) {
+            if (!it) {
+                return@getCurrentStatus
+            }
+            LogUtil.w("handleGiveKey timeout")
+            removeDeviceTake(DEVICE_TYPE_KEY, deviceTakeUpdateBO.nfc)
+            checkEquipCount(0, true) { keyPair, lockMap ->
+                if (keyPair == null) {
+                    val ctx = MyApplication.instance?.applicationContext!!
+                    val tipDialog = TipDialog(ctx)
+                    tipDialog.setTip(ctx.getString(R.string.key_take_error_tip))
+                    tipDialog.setConfirmListener {
+                        tipDialog.dismiss()
+                        sendEventMsg(MsgEvent(MSG_EVENT_DEVICE_EXCEPTION, DeviceExceptionMsg(DEVICE_TYPE_KEY, deviceTakeUpdateBO.nfc)))
+                    }
+                    tipDialog.show()
+                } else {
+                    addDeviceTake(DEVICE_TYPE_KEY, deviceTakeUpdateBO.ticketId, keyPair.second?.rfid!!)
+                    handleGiveKey(DeviceTakeUpdateBO(DEVICE_TYPE_KEY, deviceTakeUpdateBO.ticketId, keyPair.second?.rfid!!))
+                }
+            }
+        }
+    }
+
     private fun handleCurrentMode(currentModeMsg: CurrentModeMsg) {
         when (currentModeMsg.mode) {
             // 工作模式
@@ -1518,12 +1554,12 @@ object BusinessManager {
         }
     }
 
-    fun addExceptionKey(key: String) {
-        LogUtil.w("addExceptionKey: $key")
-        if (mExceptionKeyList.contains(key)) {
+    fun addExceptionKey(rfid: String) {
+        LogUtil.w("addExceptionKey: $rfid")
+        if (mExceptionKeyList.contains(rfid)) {
             return
         }
-        mExceptionKeyList.add(key)
+        mExceptionKeyList.add(rfid)
     }
 
     fun removeExceptionKey(key: String) {

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

@@ -454,8 +454,7 @@ object ModBusController {
 
     fun isKeyExist(dockAddr: Byte?, isLeft: Boolean): Boolean {
         dockAddr ?: return false
-        return dockList.filter { it.type == DOCK_TYPE_LOCK || it.type == DOCK_TYPE_PORTABLE }
-            .find { it.addr == dockAddr }?.getKeyList()
+        return dockList.find { it.addr == dockAddr }?.getKeyList()
             ?.find { it.isLeft == isLeft && it.isExist } != null
     }
 
@@ -466,28 +465,39 @@ object ModBusController {
      */
     fun getKeyStatus(dockAddr: Byte?, isLeft: Boolean): Int {
         dockAddr ?: return 0
-        val key = dockList.filter { it.type == DOCK_TYPE_LOCK || it.type == DOCK_TYPE_PORTABLE }
-            .find { it.addr == dockAddr }?.getKeyList()
-            ?.find { it.isLeft == isLeft }
+        val key = dockList.find { it.addr == dockAddr }?.getKeyList()?.find { it.isLeft == isLeft }
+        LogUtil.i("getKeyStatus key : $key")
         key ?: return 0
         var status = 0
         if (key.isExist) {
             status = 1
+        } else {
+            return status
         }
         if (key.rfid != null) {
             status = 2
+        } else {
+            return status
         }
         if (key.mac != null) {
             status = 3
+        } else {
+            return status
         }
         if (BleManager.getInstance().isConnected(BusinessManager.getBleDeviceByMac(key.mac)?.bleDevice)) {
             status = 4
+        } else {
+            return status
         }
         if (key.isReady) {
             status = 5
+        } else {
+            return status
         }
         if (key.rfid != null && BusinessManager.mExceptionKeyList.none { it == key.rfid }) {
             status = 6
+        } else {
+            return status
         }
         return status
     }
@@ -610,10 +620,12 @@ object ModBusController {
         keyList.forEach {
             LogUtil.i("keyStatus : ${it.isExist} - ${it.rfid} - ${it.mac} - ${it.isReady} - " +
                     "${BusinessManager.getBleDeviceByMac(it.mac)?.bleDevice != null} - " +
-                    "${BleManager.getInstance().isConnected(BusinessManager.getBleDeviceByMac(it.mac)?.bleDevice)}")
+                    "${BleManager.getInstance().isConnected(BusinessManager.getBleDeviceByMac(it.mac)?.bleDevice)} - " +
+                    "${!BusinessManager.mExceptionKeyList.contains(it.rfid)}")
         }
-        val key = keyList.filter { it.isExist && it.rfid != null && it.mac != null && it.isReady &&
-                BleManager.getInstance().isConnected(BusinessManager.getBleDeviceByMac(it.mac)?.bleDevice) }
+        val key = keyList.filter { it.isExist && it.rfid != null && it.mac != null && it.isReady
+                && BleManager.getInstance().isConnected(BusinessManager.getBleDeviceByMac(it.mac)?.bleDevice)
+                && !BusinessManager.mExceptionKeyList.contains(it.rfid) }
             .shuffled().firstOrNull()
         if (key == null) {
             LogUtil.e("getOneKey : no key match")
@@ -656,4 +668,25 @@ object ModBusController {
         }
         return map
     }
+
+//    fun getLocks(needLockCount: Int): MutableMap<Byte, MutableList<DockBean.LockBean>> {
+//        val map = mutableMapOf<Byte, MutableList<DockBean.LockBean>>()
+//        if (needLockCount == 0) {
+//            return map
+//        }
+//
+//        val lockList =
+//            dockList.filter { it.type == DOCK_TYPE_LOCK || it.type == DOCK_TYPE_PORTABLE }
+//                .flatMap { it.getLockList() }.filter { it.isExist }.shuffled().take(needLockCount)
+//        lockList.forEach loop@{ lock ->
+//            lock.rfid ?: return@loop
+//            val dock = getDockByLockNfc(lock.rfid!!)
+//            dock ?: return@loop
+//            if (map[dock.addr] == null) {
+//                map[dock.addr] = mutableListOf()
+//            }
+//            map[dock.addr]!!.add(lock)
+//        }
+//        return map
+//    }
 }

+ 9 - 0
app/src/main/java/com/grkj/iscs/model/eventmsg/DeviceExceptionMsg.kt

@@ -0,0 +1,9 @@
+package com.grkj.iscs.model.eventmsg
+
+/**
+ * @param type {@link [com.grkj.iscs.model.DeviceConst]<class>#[deviceType]}
+ */
+data class DeviceExceptionMsg(
+    val type: Int,
+    val rfid: String
+)

+ 3 - 0
app/src/main/java/com/grkj/iscs/model/eventmsg/MsgEventConstants.kt

@@ -15,4 +15,7 @@ object MsgEventConstants {
     // ------------------------------ 蓝牙 1-004-000 ------------------------------
     const val MSG_EVENT_CURRENT_MODE = 1_004_000        // 当前模式
     const val MSG_EVENT_SWITCH_MODE = 1_004_001         // 切换模式
+
+    // ------------------------------ 设备异常 1-005-000 ------------------------------
+    const val MSG_EVENT_DEVICE_EXCEPTION = 1_005_000    // 钥匙出现异常
 }

+ 23 - 0
app/src/main/java/com/grkj/iscs/view/activity/HomeActivity.kt

@@ -4,6 +4,7 @@ import android.view.InputDevice
 import android.view.KeyEvent
 import android.widget.ImageView
 import androidx.lifecycle.MutableLiveData
+import androidx.lifecycle.Observer
 import com.grkj.iscs.BusinessManager
 import com.grkj.iscs.R
 import com.grkj.iscs.databinding.ActivityHomeBinding
@@ -15,6 +16,10 @@ import com.grkj.iscs.model.Constants.USER_ROLE_COLOCKER
 import com.grkj.iscs.model.Constants.USER_ROLE_DRAWER
 import com.grkj.iscs.model.Constants.USER_ROLE_GUARD
 import com.grkj.iscs.model.Constants.USER_ROLE_LOCKER
+import com.grkj.iscs.model.DeviceConst
+import com.grkj.iscs.model.eventmsg.DeviceExceptionMsg
+import com.grkj.iscs.model.eventmsg.MsgEvent
+import com.grkj.iscs.model.eventmsg.MsgEventConstants.MSG_EVENT_DEVICE_EXCEPTION
 import com.grkj.iscs.model.vo.user.UserInfoRespVO
 import com.grkj.iscs.util.log.LogUtil
 import com.grkj.iscs.view.adapter.MenuAdapter
@@ -39,6 +44,7 @@ class HomeActivity : BaseMvpActivity<IHomeView, HomePresenter, ActivityHomeBindi
     private var cardNo = ""
     val cardNoLiveData = MutableLiveData("")
     private var mMenuList = mutableListOf<Menu>()
+    private lateinit var observer: Observer<MsgEvent>
 
     override val viewBinding: ActivityHomeBinding
         get() = ActivityHomeBinding.inflate(layoutInflater)
@@ -63,6 +69,9 @@ class HomeActivity : BaseMvpActivity<IHomeView, HomePresenter, ActivityHomeBindi
                 mMenuList.add(Menu(getString(R.string.system_setting), R.mipmap.menu_icon_sys_setting, SystemSettingFragment()))
             }
         }
+//        mMenuList.add(Menu(getString(R.string.test), R.mipmap.menu_icon_test, DockTestFragment()))
+//        mMenuList.add(Menu(getString(R.string.system_setting), R.mipmap.menu_icon_sys_setting, SystemSettingFragment()))
+
         mMenuList.add(Menu(getString(R.string.device_status), R.mipmap.menu_icon_device_status, DeviceStatusFragment()))
         mMenuList.add(Menu(getString(R.string.exception_report), R.mipmap.exception_handle, ExceptionReportFragment()))
         mMenuList.add(Menu(getString(R.string.settings), R.mipmap.settings, SettingFragment()))
@@ -98,6 +107,20 @@ class HomeActivity : BaseMvpActivity<IHomeView, HomePresenter, ActivityHomeBindi
                     else 0)
             }
         }
+
+        observer = Observer { newData ->
+            if (newData.code != MSG_EVENT_DEVICE_EXCEPTION) {
+                return@Observer
+            }
+            LogUtil.w("Device exception occurs : ${newData.data as DeviceExceptionMsg}")
+            if (newData.data.type == DeviceConst.DEVICE_TYPE_KEY) {
+                val index = mMenuList.indexOfFirst { it.title == getString(R.string.device_status) }
+                mBinding?.vp?.currentItem = index
+                mBinding?.rvMenu?.adapter?.notifyDataSetChanged()
+            }
+        }
+
+        BusinessManager.mEventBus.observe(this, observer)
     }
 
     override fun dispatchKeyEvent(event: KeyEvent): Boolean {

+ 13 - 8
app/src/main/java/com/grkj/iscs/view/fragment/DeviceStatusFragment.kt

@@ -9,6 +9,7 @@ import com.grkj.iscs.extentions.setVisibleWithHolder
 import com.grkj.iscs.modbus.ModBusController
 import com.grkj.iscs.model.DeviceConst.DOCK_TYPE_KEY
 import com.grkj.iscs.util.SPUtils
+import com.grkj.iscs.util.log.LogUtil
 import com.grkj.iscs.view.base.BaseMvpFragment
 import com.grkj.iscs.view.fragment.DockTestFragment.DockTestBean
 import com.grkj.iscs.view.iview.IDeviceStatusView
@@ -51,10 +52,10 @@ class DeviceStatusFragment : BaseMvpFragment<IDeviceStatusView, DeviceStatusPres
                 holder.setText(R.id.tv_status_2, status2?.second)
                 holder.setText(R.id.tv_status_3, status3?.second)
                 holder.setText(R.id.tv_status_4, status4?.second)
-                holder.setVisible(R.id.tv_repair_1, status1?.first == false)
-                holder.setVisible(R.id.tv_repair_2, status2?.first == false)
-                holder.setVisible(R.id.tv_repair_3, status3?.first == false)
-                holder.setVisible(R.id.tv_repair_4, status4?.first == false)
+                holder.setVisibleWithHolder(R.id.tv_repair_1, status1?.first == false)
+                holder.setVisibleWithHolder(R.id.tv_repair_2, status2?.first == false)
+                holder.setVisibleWithHolder(R.id.tv_repair_3, status3?.first == false)
+                holder.setVisibleWithHolder(R.id.tv_repair_4, status4?.first == false)
                 holder.setOnClickListener(R.id.tv_repair_1) {
                     presenter?.repairKey(row.dockList.find { it.column == "1" }?.address, true)
                 }
@@ -79,10 +80,14 @@ class DeviceStatusFragment : BaseMvpFragment<IDeviceStatusView, DeviceStatusPres
             if (tempList.isNotEmpty()) {
                 mKeyDockList.addAll(tempList.filter { it.type == DOCK_TYPE_KEY })
                 mKeyDockList.forEach { dock ->
-                    mRowList.find { it.row == dock.row.toInt() }?.let {
-                        it.dockList.add(dock)
-                    } ?: let {
-                        mRowList.add(KeyDockStatusBO(dock.row.toInt(), mutableListOf(dock)))
+                    try {
+                        mRowList.find { it.row == dock.row.toInt() }?.let {
+                            it.dockList.add(dock)
+                        } ?: let {
+                            mRowList.add(KeyDockStatusBO(dock.row.toInt(), mutableListOf(dock)))
+                        }
+                    } catch (e: Exception) {
+                        LogUtil.e("Device status data error : ${e.message}")
                     }
                 }
             }

+ 8 - 5
app/src/main/java/com/grkj/iscs/view/presenter/DeviceStatusPresenter.kt

@@ -17,7 +17,7 @@ import com.grkj.iscs.view.iview.IDeviceStatusView
 class DeviceStatusPresenter : BasePresenter<IDeviceStatusView>() {
     fun getKeyStatus(dockAddr: Byte?, isLeft: Boolean): Pair<Boolean, String> {
         val status = ModBusController.getKeyStatus(dockAddr, isLeft)
-        LogUtil.i("getKeyStatus Key status : $status")
+        LogUtil.i("getKeyStatus Key status : $dockAddr - $isLeft - $status")
         val text = when (status) {
             0 -> mContext!!.getString(R.string.key_does_not_exists)
             1 -> mContext!!.getString(R.string.key_no_rfid)
@@ -43,15 +43,18 @@ class DeviceStatusPresenter : BasePresenter<IDeviceStatusView>() {
             2 -> getKeyInfo(dockAddr, isLeft, ModBusController.getKeyByDock(dockAddr, isLeft)?.rfid)
             3, 4, 5 -> {
                 val mac = ModBusController.getKeyByDock(dockAddr, isLeft)?.mac
+                LogUtil.i("repairKey Key status mac: $mac")
                 mac ?: return
                 BusinessManager.unregisterConnectListener(mac)
                 BusinessManager.getBleDeviceByMac(mac)?.bleDevice?.let {
                     BleManager.getInstance().disconnect(it)
                 }
-                BusinessManager.registerConnectListener(mac) { isDone, bleBean ->
-                    if (isDone && bleBean != null) {
-                        Executor.delayOnMain(300) {
-                            getCurrentStatus(7, bleBean.bleDevice)
+                Executor.delayOnMain(2000) {
+                    BusinessManager.registerConnectListener(mac) { isDone, bleBean ->
+                        if (isDone && bleBean != null) {
+                            Executor.delayOnMain(300) {
+                                getCurrentStatus(7, bleBean.bleDevice)
+                            }
                         }
                     }
                 }

+ 34 - 2
app/src/main/java/com/grkj/iscs/view/presenter/JobProgressPresenter.kt

@@ -11,6 +11,9 @@ import com.grkj.iscs.model.Constants.JOB_STATUS_NOT_STARTED
 import com.grkj.iscs.model.Constants.USER_TYPE_LOCKER
 import com.grkj.iscs.model.DeviceConst.DEVICE_TYPE_KEY
 import com.grkj.iscs.model.DeviceConst.DEVICE_TYPE_LOCK
+import com.grkj.iscs.model.eventmsg.DeviceExceptionMsg
+import com.grkj.iscs.model.eventmsg.MsgEvent
+import com.grkj.iscs.model.eventmsg.MsgEventConstants.MSG_EVENT_DEVICE_EXCEPTION
 import com.grkj.iscs.model.vo.card.CardInfoRespVO
 import com.grkj.iscs.model.vo.lock.LockTakeUpdateReqVO
 import com.grkj.iscs.model.vo.ticket.StepDetailRespVO
@@ -27,6 +30,8 @@ import com.grkj.iscs.view.dialog.TipDialog
 import com.grkj.iscs.view.iview.IJobProgressView
 
 class JobProgressPresenter : BasePresenter<IJobProgressView>() {
+    private var tipDialog: TipDialog? = null
+
     /**
      * 获取作业票详细信息
      */
@@ -179,7 +184,7 @@ class JobProgressPresenter : BasePresenter<IJobProgressView>() {
     /**
      * 上锁人解锁流程
      */
-    fun handleUnlockProcess(ticketId: Long) {
+    fun handleUnlockProcess(ticketId: Long, keyRfid: String? = null) {
         getTicketDetail(ticketId) { ticketDetail ->
             LogUtil.i("getTicketDetail unlock: $ticketDetail")
             val role = ticketDetail?.jobTicketUserList?.find { it.userId == SPUtils.getLoginUser(mContext!!)?.userId && it.userType == USER_TYPE_LOCKER }
@@ -192,12 +197,39 @@ class JobProgressPresenter : BasePresenter<IJobProgressView>() {
                 // null表示锁具数量不够,不给钥匙
                 if (keyPair == null) {
                     BusinessManager.sendLoadingEventMsg(null, false)
+                    keyRfid?.let {
+                        showKeyErrorDialog(it)
+                    }
                 } else {
                     BusinessManager.addDeviceTake(DEVICE_TYPE_KEY, ticketId, keyPair.second?.rfid!!)
 
-                    BusinessManager.getCurrentStatus(5, BusinessManager.getBleDeviceByMac(keyPair.second?.mac)!!.bleDevice)
+                    BusinessManager.getCurrentStatus(5, BusinessManager.getBleDeviceByMac(keyPair.second?.mac)!!.bleDevice) {
+                        if (!it) {
+                            return@getCurrentStatus
+                        }
+                        LogUtil.w("handleUnlockProcess timeout")
+                        BusinessManager.removeDeviceTake(DEVICE_TYPE_KEY, keyPair.second?.rfid!!)
+                        handleUnlockProcess(ticketId, keyPair.second?.rfid!!)
+                    }
                 }
             }
         }
     }
+
+    private fun showKeyErrorDialog(keyRfid: String) {
+        Executor.runOnMain {
+            tipDialog ?: let {
+                tipDialog = TipDialog(mContext!!)
+                tipDialog?.setTip(mContext!!.getString(R.string.key_take_error_tip))
+            }
+            if (tipDialog?.isShowing == true) {
+                return@runOnMain
+            }
+            tipDialog?.setConfirmListener {
+                tipDialog?.dismiss()
+                BusinessManager.sendEventMsg(MsgEvent(MSG_EVENT_DEVICE_EXCEPTION, DeviceExceptionMsg(DEVICE_TYPE_KEY, keyRfid)))
+            }
+            tipDialog?.show()
+        }
+    }
 }

+ 1 - 1
app/src/main/java/com/grkj/iscs/view/presenter/SystemSettingPresenter.kt

@@ -80,7 +80,7 @@ class SystemSettingPresenter : BasePresenter<ISystemSettingView>() {
                 return
             }
         }
-        if (dockList.any { it.row == row && it.column == column }) {
+        if (dockList.any { it.row == row && it.column == column && it.type == type }) {
             ToastUtils.tip(R.string.row_and_column_conflict)
             return
         }

+ 8 - 4
app/src/main/res/layout/item_rv_key_dock_status.xml

@@ -38,7 +38,8 @@
 
                 <TextView
                     android:id="@+id/tv_status_1"
-                    style="@style/CommonTextView" />
+                    style="@style/CommonTextView"
+                    android:textSize="@dimen/common_text_size_small" />
             </RelativeLayout>
 
             <TextView
@@ -71,7 +72,8 @@
 
                 <TextView
                     android:id="@+id/tv_status_2"
-                    style="@style/CommonTextView" />
+                    style="@style/CommonTextView"
+                    android:textSize="@dimen/common_text_size_small" />
             </RelativeLayout>
 
             <TextView
@@ -112,7 +114,8 @@
 
                 <TextView
                     android:id="@+id/tv_status_3"
-                    style="@style/CommonTextView" />
+                    style="@style/CommonTextView"
+                    android:textSize="@dimen/common_text_size_small" />
             </RelativeLayout>
 
             <TextView
@@ -145,7 +148,8 @@
 
                 <TextView
                     android:id="@+id/tv_status_4"
-                    style="@style/CommonTextView" />
+                    style="@style/CommonTextView"
+                    android:textSize="@dimen/common_text_size_small" />
             </RelativeLayout>
 
             <TextView

+ 7 - 3
app/src/main/res/values/strings.xml

@@ -102,7 +102,7 @@
 
     <!--  设计图  -->
     <string name="loto">智能锁控系统</string>
-    <string name="app_title">Mars\n智能锁控</string>
+    <string name="app_title">智能锁控</string>
     <string name="job_management">作业管理</string>
     <string name="settings">设置</string>
     <string name="workshop">车间岗位</string>
@@ -145,7 +145,7 @@
     <string name="colocker">共锁人</string>
     <string name="select">选择</string>
     <string name="select_locker">选择上锁人</string>
-    <string name="select_coloker_mars">选择共锁人(玛氏)</string>
+    <string name="select_coloker_mars">选择共锁人(内部)</string>
     <string name="select_coloker_outside">选择共锁人(外部)</string>
     <string name="isolation_point">隔离点</string>
     <string name="effect">作用</string>
@@ -280,6 +280,9 @@
     <string name="sending_ticket">工作票下发中······</string>
     <string name="send_ticket_fail">作业票下发失败</string>
     <string name="login_method_tip">● 您可以通过指纹或刷卡直接进行登录</string>
+    <string name="use_default_url">将使用默认地址</string>
+    <string name="please_set_url">请输入地址,清空保存将使用默认地址</string>
+    <string name="url_format_error">请以http://或https://开头</string>
     <string name="no_key_available_dialog_tip">暂无可用钥匙,确认继续执行作业票吗?</string>
     <string name="lock_take_report_fail">挂锁取出上报失败</string>
     <string name="board_address_exists">存在相同地址的主板</string>
@@ -287,7 +290,7 @@
     <string name="column">列</string>
     <string name="please_input_row">请输入行号</string>
     <string name="please_input_column">请输入钥匙列号</string>
-    <string name="row_and_column_conflict">存在相同的行列号,请重新输入</string>
+    <string name="row_and_column_conflict">存在相同的行列号的同类型主板,请重新输入</string>
     <string name="column_must_be_1_or_2">钥匙列号只能输入1或者2</string>
     <string name="device_status">设备状态</string>
     <string name="key_does_not_exists">钥匙不存在</string>
@@ -300,4 +303,5 @@
     <string name="key_unknown">未知</string>
     <string name="repair_key">修复</string>
     <string name="no_key_to_repair">钥匙不存在,无法修复</string>
+    <string name="key_take_error_tip">钥匙分配失败,请检查设备状态</string>
 </resources>