From 877b2519157cea762b1e63e9c57c09614216d684 Mon Sep 17 00:00:00 2001 From: Junjie <fallin.jie@qq.com> Date: 星期四, 24 七月 2025 19:27:46 +0800 Subject: [PATCH] # --- src/main/java/com/zy/core/cache/MessageQueue.java | 25 +++++++++++++++++++------ 1 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/main/java/com/zy/core/cache/MessageQueue.java b/src/main/java/com/zy/core/cache/MessageQueue.java index 4037c4a..9788407 100644 --- a/src/main/java/com/zy/core/cache/MessageQueue.java +++ b/src/main/java/com/zy/core/cache/MessageQueue.java @@ -1,6 +1,5 @@ package com.zy.core.cache; -import com.zy.asrs.entity.DeviceConfig; import com.zy.core.enums.SlaveType; import com.zy.core.model.Task; @@ -22,23 +21,28 @@ private static final Map<Integer, ConcurrentLinkedQueue<Task>> FORK_LIFT_EXCHANGE = new ConcurrentHashMap<>(); //璐у弶鎻愬崌鏈篗aster mq浜ゆ崲鏈� private static final Map<Integer, ConcurrentLinkedQueue<Task>> FORK_LIFT_MASTER_EXCHANGE = new ConcurrentHashMap<>(); + //Traffic Control mq浜ゆ崲鏈� + private static final Map<Integer, ConcurrentLinkedQueue<Task>> TRAFFIC_CONTROL_EXCHANGE = new ConcurrentHashMap<>(); /** * mq 浜ゆ崲鏈哄垵濮嬪寲 */ - public static void init(SlaveType type, DeviceConfig deviceConfig) { + public static void init(SlaveType type, Integer id) { switch (type) { case Shuttle: - SHUTTLE_EXCHANGE.put(deviceConfig.getDeviceNo(), new ConcurrentLinkedQueue<>()); + SHUTTLE_EXCHANGE.put(id, new ConcurrentLinkedQueue<>()); break; case ForkLift: - FORK_LIFT_EXCHANGE.put(deviceConfig.getDeviceNo(), new ConcurrentLinkedQueue<>()); + FORK_LIFT_EXCHANGE.put(id, new ConcurrentLinkedQueue<>()); break; case ForkLiftMaster: - FORK_LIFT_MASTER_EXCHANGE.put(deviceConfig.getDeviceNo(), new ConcurrentLinkedQueue<>()); + FORK_LIFT_MASTER_EXCHANGE.put(id, new ConcurrentLinkedQueue<>()); break; case Lift: - LIFT_EXCHANGE.put(deviceConfig.getDeviceNo(), new ConcurrentLinkedQueue<>()); + LIFT_EXCHANGE.put(id, new ConcurrentLinkedQueue<>()); + break; + case TrafficControl: + TRAFFIC_CONTROL_EXCHANGE.put(id, new ConcurrentLinkedQueue<>()); break; default: break; @@ -59,6 +63,8 @@ return FORK_LIFT_MASTER_EXCHANGE.get(id).offer(task); case Lift: return LIFT_EXCHANGE.get(id).offer(task); + case TrafficControl: + return TRAFFIC_CONTROL_EXCHANGE.get(id).offer(task); default: return false; } @@ -78,6 +84,8 @@ return FORK_LIFT_MASTER_EXCHANGE.get(id).poll(); case Lift: return LIFT_EXCHANGE.get(id).poll(); + case TrafficControl: + return TRAFFIC_CONTROL_EXCHANGE.get(id).poll(); default: return null; } @@ -96,6 +104,8 @@ return FORK_LIFT_MASTER_EXCHANGE.get(id).peek(); case Lift: return LIFT_EXCHANGE.get(id).peek(); + case TrafficControl: + return TRAFFIC_CONTROL_EXCHANGE.get(id).peek(); default: return null; } @@ -115,6 +125,9 @@ case Lift: LIFT_EXCHANGE.get(id).clear(); break; + case TrafficControl: + TRAFFIC_CONTROL_EXCHANGE.get(id).clear(); + break; default: break; } -- Gitblit v1.9.1