Эх сурвалжийг харах

1. 优化检测机制,不重复检查设备rfid,只有在仓位被使用且rfid为空的情况下才去检测

bjb 2 сар өмнө
parent
commit
9e0387a089

+ 1 - 1
.idea/deploymentTargetSelector.xml

@@ -4,7 +4,7 @@
     <selectionStates>
       <SelectionState runConfigName="app">
         <option name="selectionMode" value="DROPDOWN" />
-        <DropdownSelection timestamp="2026-02-03T05:12:38.541006400Z">
+        <DropdownSelection timestamp="2026-02-24T06:51:46.497136400Z">
           <Target type="DEFAULT_BOOT">
             <handle>
               <DeviceId pluginId="PhysicalDevice" identifier="serial=9bbbb43d745c4330" />

+ 1 - 1
transport/src/main/java/com/iscs/comm/CommManager.kt

@@ -169,7 +169,7 @@ object CommManager {
             // 设备状态发生变化通知外部
             if (it.isDeviceStatusChanged() && !isInit) deviceChangeListeners.forEach { lis -> lis.onDeviceChanged(it) }
             // 限制轮询的速度
-            delay(50)
+            delay(20)
         }
     }
 

+ 8 - 2
transport/src/main/java/com/iscs/comm/entity/device/DeviceKeySlot.kt

@@ -39,8 +39,14 @@ class DeviceKeySlot(frame: Frame) : Device(frame) {
      */
     override fun ctrlReadSlotRFID(): List<Frame> {
         val frames = ArrayList<Frame>()
-        frames.add(frame.newFrame().apply { cmd = frame.cmd }.buildReadSlotRFID(CAN_KEY_RFID_LEFT, 0x00))
-        frames.add(frame.newFrame().apply { cmd = frame.cmd }.buildReadSlotRFID(CAN_KEY_RFID_RIGHT, 0x00))
+        val slots = (deviceStatus as DeviceStatusKeySlot).slotList.filter { it.isUsed && it.rfid.isEmpty() }
+        for (i in slots) {
+            if (i.ch == 0) {
+                frames.add(frame.newFrame().apply { cmd = frame.cmd }.buildReadSlotRFID(CAN_KEY_RFID_LEFT, 0x00))
+            } else {
+                frames.add(frame.newFrame().apply { cmd = frame.cmd }.buildReadSlotRFID(CAN_KEY_RFID_RIGHT, 0x00))
+            }
+        }
         return frames
     }
 

+ 3 - 2
transport/src/main/java/com/iscs/comm/entity/device/DeviceLockSlot.kt

@@ -37,8 +37,9 @@ class DeviceLockSlot(frame: Frame) : Device(frame) {
      */
     override fun ctrlReadSlotRFID(): List<Frame> {
         val frames = ArrayList<Frame>()
-        for (i in 0..4) {
-            frames.add(frame.newFrame().apply { cmd = frame.cmd }.buildReadSlotRFID(CAN_LOCK_RFID, i))
+        val slots = (deviceStatus as DeviceStatusLockSlot).slotList.filter { it.isUsed && it.rfid.isEmpty() }
+        for (i in slots) {
+            frames.add(frame.newFrame().apply { cmd = frame.cmd }.buildReadSlotRFID(CAN_LOCK_RFID, i.ch))
         }
         return frames
     }