自动化立体仓库 - WCS系统
#
lsh
2024-07-12 ab43a814da847a9e533732191b4ed54c01b95d09
src/main/java/com/zy/core/cache/MessageQueue.java
@@ -16,7 +16,9 @@
public class MessageQueue {
    // 堆垛机mq交换机
    private static final Map<Integer, ConcurrentLinkedQueue<Task>> CRN_EXCHANGE = new ConcurrentHashMap<>();
    private static final Map<Integer, LinkedBlockingQueue<Task>> CRN_EXCHANGE = new ConcurrentHashMap<>();
    // RGV mq交换机
    private static final Map<Integer, LinkedBlockingQueue<Task>> RGV_EXCHANGE = new ConcurrentHashMap<>();
    // 输送线mq交换机
    private static final Map<Integer, ConcurrentLinkedQueue<Task>> DEVP_EXCHANGE = new ConcurrentHashMap<>();
    // 条码扫描仪mq交换机
@@ -25,6 +27,12 @@
    private static final Map<Integer, LinkedBlockingQueue<Task>> LED_EXCHANGE = new ConcurrentHashMap<>();
    // 磅称mq交换机
    private static final Map<Integer, ConcurrentLinkedQueue<Task>> SCALE_EXCHANGE = new ConcurrentHashMap<>();
    // 台车mq交换机
    private static final Map<Integer, ConcurrentLinkedQueue<Task>> CAR_EXCHANGE = new ConcurrentHashMap<>();
    private static final Map<Integer, ConcurrentLinkedQueue<Task>> JAR_EXCHANGE = new ConcurrentHashMap<>();
    private static final Map<Integer, ConcurrentLinkedQueue<Task>> STE_EXCHANGE = new ConcurrentHashMap<>();
    /**
     * mq 交换机初始化
@@ -32,7 +40,10 @@
    public static void init(SlaveType type, Slave slave) {
        switch (type) {
            case Crn:
                CRN_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
                CRN_EXCHANGE.put(slave.getId(), new LinkedBlockingQueue<>(1));
                break;
            case Rgv:
                RGV_EXCHANGE.put(slave.getId(), new LinkedBlockingQueue<>(1));
                break;
            case Devp:
                DEVP_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
@@ -45,6 +56,15 @@
                break;
            case Scale:
                SCALE_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
                break;
            case Car:
                CAR_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
                break;
            case Jar:
                JAR_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
                break;
            case Ste:
                STE_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
                break;
            default:
                break;
@@ -59,6 +79,8 @@
        switch (type) {
            case Crn:
                return CRN_EXCHANGE.get(id).offer(task);
            case Rgv:
                return RGV_EXCHANGE.get(id).offer(task);
            case Devp:
                return DEVP_EXCHANGE.get(id).offer(task);
            case Barcode:
@@ -67,6 +89,12 @@
                return LED_EXCHANGE.get(id).offer(task);
            case Scale:
                return SCALE_EXCHANGE.get(id).offer(task);
            case Car:
                return CAR_EXCHANGE.get(id).offer(task);
            case Jar:
                return JAR_EXCHANGE.get(id).offer(task);
            case Ste:
                return STE_EXCHANGE.get(id).offer(task);
            default:
                return false;
        }
@@ -80,6 +108,8 @@
        switch (type) {
            case Crn:
                return CRN_EXCHANGE.get(id).poll();
            case Rgv:
                return RGV_EXCHANGE.get(id).poll();
            case Devp:
                return DEVP_EXCHANGE.get(id).poll();
            case Barcode:
@@ -88,6 +118,12 @@
                return LED_EXCHANGE.get(id).poll();
            case Scale:
                return SCALE_EXCHANGE.get(id).poll();
            case Car:
                return CAR_EXCHANGE.get(id).poll();
            case Jar:
                return JAR_EXCHANGE.get(id).poll();
            case Ste:
                return STE_EXCHANGE.get(id).poll();
            default:
                return null;
        }
@@ -100,6 +136,8 @@
        switch (type) {
            case Crn:
                return CRN_EXCHANGE.get(id).peek();
            case Rgv:
                return RGV_EXCHANGE.get(id).peek();
            case Devp:
                return DEVP_EXCHANGE.get(id).peek();
            case Barcode:
@@ -108,6 +146,12 @@
                return LED_EXCHANGE.get(id).peek();
            case Scale:
                return SCALE_EXCHANGE.get(id).peek();
            case Car:
                return CAR_EXCHANGE.get(id).peek();
            case Jar:
                return JAR_EXCHANGE.get(id).peek();
            case Ste:
                return STE_EXCHANGE.get(id).peek();
            default:
                return null;
        }
@@ -117,6 +161,9 @@
        switch (type) {
            case Crn:
                CRN_EXCHANGE.get(id).clear();
                break;
            case Rgv:
                RGV_EXCHANGE.get(id).clear();
                break;
            case Devp:
                DEVP_EXCHANGE.get(id).clear();
@@ -130,6 +177,15 @@
            case Scale:
                SCALE_EXCHANGE.get(id).clear();
                break;
            case Car:
                CAR_EXCHANGE.get(id).clear();
                break;
            case Jar:
                JAR_EXCHANGE.get(id).clear();
                break;
            case Ste:
                STE_EXCHANGE.get(id).clear();
                break;
            default:
                break;
        }