自动化立体仓库 - WCS系统
#
luxiaotao1123
2022-09-27 d66490d4dfbc811bca51a98c08dbbc444e258a30
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<>();
    // 穿梭车mq交换机
    private static final Map<Integer, LinkedBlockingQueue<Task>> STE_EXCHANGE = new ConcurrentHashMap<>();
    // 输送线mq交换机
    private static final Map<Integer, ConcurrentLinkedQueue<Task>> DEVP_EXCHANGE = new ConcurrentHashMap<>();
    // 条码扫描仪mq交换机
@@ -34,7 +36,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 Ste:
                STE_EXCHANGE.put(slave.getId(), new LinkedBlockingQueue<>(1));
                break;
            case Devp:
                DEVP_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
@@ -64,6 +69,8 @@
        switch (type) {
            case Crn:
                return CRN_EXCHANGE.get(id).offer(task);
            case Ste:
                return STE_EXCHANGE.get(id).offer(task);
            case Devp:
                return DEVP_EXCHANGE.get(id).offer(task);
            case Barcode:
@@ -87,6 +94,8 @@
        switch (type) {
            case Crn:
                return CRN_EXCHANGE.get(id).poll();
            case Ste:
                return STE_EXCHANGE.get(id).poll();
            case Devp:
                return DEVP_EXCHANGE.get(id).poll();
            case Barcode:
@@ -109,6 +118,8 @@
        switch (type) {
            case Crn:
                return CRN_EXCHANGE.get(id).peek();
            case Ste:
                return STE_EXCHANGE.get(id).peek();
            case Devp:
                return DEVP_EXCHANGE.get(id).peek();
            case Barcode:
@@ -129,6 +140,9 @@
            case Crn:
                CRN_EXCHANGE.get(id).clear();
                break;
            case Ste:
                STE_EXCHANGE.get(id).clear();
                break;
            case Devp:
                DEVP_EXCHANGE.get(id).clear();
                break;