| | |
| | | package com.zy.core; |
| | | |
| | | import com.baomidou.mybatisplus.mapper.EntityWrapper; |
| | | import com.core.exception.CoolException; |
| | | import com.zy.asrs.entity.DeviceConfig; |
| | | import com.zy.asrs.service.DeviceConfigService; |
| | | import com.zy.common.utils.RedisUtil; |
| | | import com.zy.core.cache.MessageQueue; |
| | | import com.zy.core.cache.SlaveConnection; |
| | | import com.zy.core.enums.SlaveType; |
| | | import com.zy.core.thread.impl.ZySiemensCrnThread; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.scheduling.annotation.Async; |
| | |
| | | } |
| | | |
| | | private void initThread(){ |
| | | // News.info("初始化堆垛机........................................................"); |
| | | // List<DeviceConfig> crnList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() |
| | | // .eq("device_type", String.valueOf(SlaveType.Crn))); |
| | | // for (DeviceConfig deviceConfig : crnList) { |
| | | // BasLift basLift = basLiftService.selectOne(new EntityWrapper<BasLift>().eq("lift_no", deviceConfig.getDeviceNo())); |
| | | // if (basLift == null) { |
| | | // throw new CoolException("未配置货叉提升机数据"); |
| | | // } |
| | | // |
| | | // ThreadHandler thread = null; |
| | | // if (deviceConfig.getThreadImpl().equals("ZyForkLiftThread")) { |
| | | // thread = new ZyForkLiftThread(deviceConfig, basLift.getStationList$(), redisUtil); |
| | | // } else { |
| | | // throw new CoolException("未知的线程实现"); |
| | | // } |
| | | // |
| | | // new Thread(thread).start(); |
| | | // SlaveConnection.put(SlaveType.ForkLift, deviceConfig.getDeviceNo(), thread); |
| | | // |
| | | // if (deviceConfig.getFake() == 1) { |
| | | // fakeDevices.add(deviceConfig); |
| | | // }else { |
| | | // allDevices.add(deviceConfig); |
| | | // } |
| | | // } |
| | | News.info("初始化堆垛机........................................................"); |
| | | List<DeviceConfig> crnList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() |
| | | .eq("device_type", String.valueOf(SlaveType.Crn))); |
| | | for (DeviceConfig deviceConfig : crnList) { |
| | | ThreadHandler thread = null; |
| | | if (deviceConfig.getThreadImpl().equals("ZySiemensCrnThread")) { |
| | | thread = new ZySiemensCrnThread(deviceConfig, redisUtil); |
| | | } else { |
| | | throw new CoolException("未知的线程实现"); |
| | | } |
| | | |
| | | new Thread(thread).start(); |
| | | SlaveConnection.put(SlaveType.Crn, deviceConfig.getDeviceNo(), thread); |
| | | } |
| | | |
| | | } |
| | | |