自动化立体仓库 - WCS系统
Junjie
2023-07-19 c605b435cb4be68de70c822162a96e9a78f45a88
src/main/java/com/zy/core/cache/MessageQueue.java
@@ -15,8 +15,6 @@
 */
public class MessageQueue {
    // 堆垛机mq交换机
    private static final Map<Integer, ConcurrentLinkedQueue<Task>> CRN_EXCHANGE = new ConcurrentHashMap<>();
    // 输送线mq交换机
    private static final Map<Integer, ConcurrentLinkedQueue<Task>> DEVP_EXCHANGE = new ConcurrentHashMap<>();
    // 条码扫描仪mq交换机
@@ -27,15 +25,16 @@
    private static final Map<Integer, ConcurrentLinkedQueue<Task>> SCALE_EXCHANGE = new ConcurrentHashMap<>();
    // 台车mq交换机
    private static final Map<Integer, ConcurrentLinkedQueue<Task>> CAR_EXCHANGE = new ConcurrentHashMap<>();
    //四向穿梭车mq交换机
    private static final Map<Integer, ConcurrentLinkedQueue<Task>> SHUTTLE_EXCHANGE = new ConcurrentHashMap<>();
    //提升机mq交换机
    private static final Map<Integer, ConcurrentLinkedQueue<Task>> LIFT_EXCHANGE = new ConcurrentHashMap<>();
    /**
     * mq 交换机初始化
     */
    public static void init(SlaveType type, Slave slave) {
        switch (type) {
            case Crn:
                CRN_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
                break;
            case Devp:
                DEVP_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
                break;
@@ -51,6 +50,12 @@
            case Car:
                CAR_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
                break;
            case Shuttle:
                SHUTTLE_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
                break;
            case Lift:
                LIFT_EXCHANGE.put(slave.getId(), new ConcurrentLinkedQueue<>());
                break;
            default:
                break;
        }
@@ -62,8 +67,6 @@
     */
    public static boolean offer(SlaveType type, Integer id, Task task) {
        switch (type) {
            case Crn:
                return CRN_EXCHANGE.get(id).offer(task);
            case Devp:
                return DEVP_EXCHANGE.get(id).offer(task);
            case Barcode:
@@ -74,6 +77,10 @@
                return SCALE_EXCHANGE.get(id).offer(task);
            case Car:
                return CAR_EXCHANGE.get(id).offer(task);
            case Shuttle:
                return SHUTTLE_EXCHANGE.get(id).offer(task);
            case Lift:
                return LIFT_EXCHANGE.get(id).offer(task);
            default:
                return false;
        }
@@ -85,8 +92,6 @@
     */
    public static Task poll(SlaveType type, Integer id) {
        switch (type) {
            case Crn:
                return CRN_EXCHANGE.get(id).poll();
            case Devp:
                return DEVP_EXCHANGE.get(id).poll();
            case Barcode:
@@ -97,6 +102,10 @@
                return SCALE_EXCHANGE.get(id).poll();
            case Car:
                return CAR_EXCHANGE.get(id).poll();
            case Shuttle:
                return SHUTTLE_EXCHANGE.get(id).poll();
            case Lift:
                return LIFT_EXCHANGE.get(id).poll();
            default:
                return null;
        }
@@ -107,8 +116,6 @@
     */
    public static Task peek(SlaveType type, Integer id) {
        switch (type) {
            case Crn:
                return CRN_EXCHANGE.get(id).peek();
            case Devp:
                return DEVP_EXCHANGE.get(id).peek();
            case Barcode:
@@ -119,6 +126,10 @@
                return SCALE_EXCHANGE.get(id).peek();
            case Car:
                return CAR_EXCHANGE.get(id).peek();
            case Shuttle:
                return SHUTTLE_EXCHANGE.get(id).peek();
            case Lift:
                return LIFT_EXCHANGE.get(id).peek();
            default:
                return null;
        }
@@ -126,9 +137,6 @@
    public static void clear(SlaveType type, Integer id){
        switch (type) {
            case Crn:
                CRN_EXCHANGE.get(id).clear();
                break;
            case Devp:
                DEVP_EXCHANGE.get(id).clear();
                break;
@@ -144,6 +152,12 @@
            case Car:
                CAR_EXCHANGE.get(id).clear();
                break;
            case Shuttle:
                SHUTTLE_EXCHANGE.get(id).clear();
                break;
            case Lift:
                LIFT_EXCHANGE.get(id).clear();
                break;
            default:
                break;
        }