#
Junjie
20 小时以前 b6428016edf3de843020bc95fd1708d3bb1961e5
src/main/java/com/zy/core/cache/MessageQueue.java
@@ -1,6 +1,6 @@
package com.zy.core.cache;
import com.zy.core.Slave;
import com.zy.asrs.entity.DeviceConfig;
import com.zy.core.enums.SlaveType;
import com.zy.core.model.Task;
@@ -20,20 +20,25 @@
    private static final Map<Integer, ConcurrentLinkedQueue<Task>> LIFT_EXCHANGE = new ConcurrentHashMap<>();
    //货叉提升机mq交换机
    private static final Map<Integer, ConcurrentLinkedQueue<Task>> FORK_LIFT_EXCHANGE = new ConcurrentHashMap<>();
    //货叉提升机Master mq交换机
    private static final Map<Integer, ConcurrentLinkedQueue<Task>> FORK_LIFT_MASTER_EXCHANGE = new ConcurrentHashMap<>();
    /**
     * mq 交换机初始化
     */
    public static void init(SlaveType type, Slave slave) {
    public static void init(SlaveType type, DeviceConfig deviceConfig) {
        switch (type) {
            case Shuttle:
                SHUTTLE_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
                SHUTTLE_EXCHANGE.put(deviceConfig.getDeviceNo(), new ConcurrentLinkedQueue<>());
                break;
            case ForkLift:
                FORK_LIFT_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
                FORK_LIFT_EXCHANGE.put(deviceConfig.getDeviceNo(), new ConcurrentLinkedQueue<>());
                break;
            case ForkLiftMaster:
                FORK_LIFT_MASTER_EXCHANGE.put(deviceConfig.getDeviceNo(), new ConcurrentLinkedQueue<>());
                break;
            case Lift:
                LIFT_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
                LIFT_EXCHANGE.put(deviceConfig.getDeviceNo(), new ConcurrentLinkedQueue<>());
                break;
            default:
                break;
@@ -50,6 +55,8 @@
                return SHUTTLE_EXCHANGE.get(id).offer(task);
            case ForkLift:
                return FORK_LIFT_EXCHANGE.get(id).offer(task);
            case ForkLiftMaster:
                return FORK_LIFT_MASTER_EXCHANGE.get(id).offer(task);
            case Lift:
                return LIFT_EXCHANGE.get(id).offer(task);
            default:
@@ -67,6 +74,8 @@
                return SHUTTLE_EXCHANGE.get(id).poll();
            case ForkLift:
                return FORK_LIFT_EXCHANGE.get(id).poll();
            case ForkLiftMaster:
                return FORK_LIFT_MASTER_EXCHANGE.get(id).poll();
            case Lift:
                return LIFT_EXCHANGE.get(id).poll();
            default:
@@ -83,6 +92,8 @@
                return SHUTTLE_EXCHANGE.get(id).peek();
            case ForkLift:
                return FORK_LIFT_EXCHANGE.get(id).peek();
            case ForkLiftMaster:
                return FORK_LIFT_MASTER_EXCHANGE.get(id).peek();
            case Lift:
                return LIFT_EXCHANGE.get(id).peek();
            default:
@@ -98,6 +109,9 @@
            case ForkLift:
                FORK_LIFT_EXCHANGE.get(id).clear();
                break;
            case ForkLiftMaster:
                FORK_LIFT_MASTER_EXCHANGE.get(id).clear();
                break;
            case Lift:
                LIFT_EXCHANGE.get(id).clear();
                break;