|  |  | 
 |  |  | import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol; | 
 |  |  | import com.zy.asrs.wcs.rcs.service.DeviceService; | 
 |  |  | import com.zy.asrs.wcs.rcs.service.DeviceTypeService; | 
 |  |  | import com.zy.asrs.wcs.rcs.service.ShuttleService; | 
 |  |  | import com.zy.asrs.wcs.rcs.thread.ShuttleThread; | 
 |  |  | import com.zy.asrs.wcs.system.controller.BaseController; | 
 |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
 |  |  | 
 |  |  |     private DeviceService deviceService; | 
 |  |  |     @Autowired | 
 |  |  |     private DeviceTypeService deviceTypeService; | 
 |  |  |     @Autowired | 
 |  |  |     private ShuttleService shuttleService; | 
 |  |  |  | 
 |  |  |     @GetMapping("/shuttle/status/list") | 
 |  |  |     public R getShuttleStatusList() { | 
 |  |  |         DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>() | 
 |  |  |                 .eq(DeviceType::getHostId, getHostId()) | 
 |  |  |                 .eq(DeviceType::getStatus, 1) | 
 |  |  |                 .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle))); | 
 |  |  |         if (deviceType == null) { | 
 |  |  |             return R.error("设备类型不存在"); | 
 |  |  |         } | 
 |  |  |  | 
 |  |  |         ArrayList<ShuttleProtocol> data = new ArrayList<>(); | 
 |  |  |         List<Device> list = deviceService.list(new LambdaQueryWrapper<Device>() | 
 |  |  |                 .eq(Device::getHostId, getHostId()) | 
 |  |  |                 .eq(Device::getStatus, 1) | 
 |  |  |                 .eq(Device::getDeviceType, deviceType.getId())); | 
 |  |  |         for (Device device : list) { | 
 |  |  |             ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue()); | 
 |  |  |             ShuttleProtocol status = shuttleThread.getStatus(); | 
 |  |  |             data.add(status); | 
 |  |  |         } | 
 |  |  |         List<ShuttleProtocol> data = shuttleService.getShuttleStatusList(getHostId()); | 
 |  |  |         return R.ok().add(data); | 
 |  |  |     } | 
 |  |  |  |