| | |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.thread.TrafficControlThread; |
| | | import com.zy.core.thread.impl.NyShuttleThread; |
| | | import com.zy.core.thread.impl.TrafficControlImplThread; |
| | | import com.zy.core.thread.impl.ZyForkLiftThread; |
| | | import com.zy.core.utils.DeviceMsgUtils; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | List<DeviceConfig> forkLiftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() |
| | | .eq("device_type", String.valueOf(SlaveType.ForkLift))); |
| | | for (DeviceConfig forkLift : forkLiftList) { |
| | | MessageQueue.init(SlaveType.ForkLift, forkLift); |
| | | MessageQueue.init(SlaveType.ForkLift, forkLift.getDeviceNo()); |
| | | } |
| | | // 初始化四向穿梭车mq |
| | | List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() |
| | | .eq("device_type", String.valueOf(SlaveType.Shuttle))); |
| | | for (DeviceConfig shuttle : shuttleList) { |
| | | MessageQueue.init(SlaveType.Shuttle, shuttle); |
| | | MessageQueue.init(SlaveType.Shuttle, shuttle.getDeviceNo()); |
| | | } |
| | | |
| | | MessageQueue.init(SlaveType.TrafficControl, 1); |
| | | } |
| | | |
| | | private void initThread(){ |
| | |
| | | //设备初始化完毕 |
| | | deviceMsgUtils.sendDeviceConfig(JSON.toJSONString(allDevices)); |
| | | deviceMsgUtils.sendFakeDeviceConfig(JSON.toJSONString(fakeDevices)); |
| | | |
| | | TrafficControlThread trafficControlThread = new TrafficControlImplThread(redisUtil); |
| | | new Thread(trafficControlThread).start(); |
| | | SlaveConnection.put(SlaveType.TrafficControl, 1, trafficControlThread); |
| | | } |
| | | |
| | | |