|  |  | 
 |  |  | import com.zy.asrs.domain.enums.NotifyMsgType; | 
 |  |  | import com.zy.asrs.domain.param.*; | 
 |  |  | import com.zy.asrs.entity.ApiLog; | 
 |  |  | import com.zy.asrs.entity.DeviceConfig; | 
 |  |  | import com.zy.asrs.entity.LocMast; | 
 |  |  | import com.zy.asrs.entity.WrkMast; | 
 |  |  | import com.zy.asrs.service.ApiLogService; | 
 |  |  | import com.zy.asrs.service.DeviceConfigService; | 
 |  |  | import com.zy.asrs.service.LocMastService; | 
 |  |  | import com.zy.asrs.service.WrkMastService; | 
 |  |  | import com.zy.asrs.utils.NotifyUtils; | 
 |  |  | 
 |  |  | import com.zy.core.dispatcher.ShuttleDispatchUtils; | 
 |  |  | import com.zy.core.enums.SlaveType; | 
 |  |  | import com.zy.core.enums.WrkIoType; | 
 |  |  | import com.zy.core.model.ForkLiftSlave; | 
 |  |  | import com.zy.core.model.ShuttleSlave; | 
 |  |  | import com.zy.core.model.protocol.ForkLiftProtocol; | 
 |  |  | import com.zy.core.model.protocol.ShuttleProtocol; | 
 |  |  | import com.zy.core.properties.SlaveProperties; | 
 |  |  | import com.zy.core.thread.ForkLiftThread; | 
 |  |  | import com.zy.core.thread.ShuttleThread; | 
 |  |  | import lombok.extern.slf4j.Slf4j; | 
 |  |  | 
 |  |  |     @Autowired | 
 |  |  |     private NotifyUtils notifyUtils; | 
 |  |  |     @Autowired | 
 |  |  |     private SlaveProperties slaveProperties; | 
 |  |  |     @Autowired | 
 |  |  |     private ApiLogService apiLogService; | 
 |  |  |     @Autowired | 
 |  |  |     private LocMastService locMastService; | 
 |  |  |     @Autowired | 
 |  |  |     private WrkMastService wrkMastService; | 
 |  |  |     @Autowired | 
 |  |  |     private DeviceConfigService deviceConfigService; | 
 |  |  |  | 
 |  |  |     @PostMapping("/createMoveTask") | 
 |  |  |     @OpenApiLog(memo = "小车移动任务") | 
 |  |  | 
 |  |  |         HashMap<String, Object> map = new HashMap<>(); | 
 |  |  |         //获取小车数据 | 
 |  |  |         ArrayList<ShuttleProtocol> shuttleProtocols = new ArrayList<>(); | 
 |  |  |         for (ShuttleSlave slave : slaveProperties.getShuttle()) { | 
 |  |  |             ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, slave.getId()); | 
 |  |  |         List<DeviceConfig> shuttleList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() | 
 |  |  |                 .eq("device_type", String.valueOf(SlaveType.Shuttle))); | 
 |  |  |         for (DeviceConfig device : shuttleList) { | 
 |  |  |             ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getDeviceNo()); | 
 |  |  |             if (shuttleThread == null) { | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  | 
 |  |  |  | 
 |  |  |         //获取货叉提升机数据 | 
 |  |  |         ArrayList<ForkLiftProtocol> forkLiftProtocols = new ArrayList<>(); | 
 |  |  |         for (ForkLiftSlave slave : slaveProperties.getForkLift()) { | 
 |  |  |             ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, slave.getId()); | 
 |  |  |         List<DeviceConfig> forkLiftList = deviceConfigService.selectList(new EntityWrapper<DeviceConfig>() | 
 |  |  |                 .eq("device_type", String.valueOf(SlaveType.ForkLift))); | 
 |  |  |         for (DeviceConfig device : forkLiftList) { | 
 |  |  |             ForkLiftThread forkLiftThread = (ForkLiftThread) SlaveConnection.get(SlaveType.ForkLift, device.getDeviceNo()); | 
 |  |  |             if (forkLiftThread == null) { | 
 |  |  |                 continue; | 
 |  |  |             } | 
 |  |  | 
 |  |  |                 , null | 
 |  |  |                 , null | 
 |  |  |                 , null | 
 |  |  |                 , null | 
 |  |  |                 , JSON.toJSONString(param) | 
 |  |  |                 , JSON.toJSONString(shuttleGather) | 
 |  |  |                 , null | 
 |  |  |                 , null | 
 |  |  | 
 |  |  |         )); | 
 |  |  |  | 
 |  |  |         return R.ok().add(shuttleGather); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PostMapping("/shuttleDemo") | 
 |  |  |     @OpenApiLog(memo = "小车演示") | 
 |  |  |     public R shuttleDemo(@RequestBody ShuttleDemoParam param) { | 
 |  |  |         shuttleDispatchUtils.shuttleDemo(param); | 
 |  |  |  | 
 |  |  |         apiLogService.insert(new ApiLog( | 
 |  |  |                 null | 
 |  |  |                 , "小车演示" | 
 |  |  |                 , "/shuttleDemo" | 
 |  |  |                 , null | 
 |  |  |                 , null | 
 |  |  |                 , null | 
 |  |  |                 , JSON.toJSONString(param) | 
 |  |  |                 , null | 
 |  |  |                 , null | 
 |  |  |                 , null | 
 |  |  |                 , 1 | 
 |  |  |                 , new Date() | 
 |  |  |                 , null | 
 |  |  |                 , null | 
 |  |  |         )); | 
 |  |  |  | 
 |  |  |         return R.ok(); | 
 |  |  |     } | 
 |  |  |  | 
 |  |  |     @PostMapping("/queryTask") | 
 |  |  | 
 |  |  |                 , null | 
 |  |  |                 , null | 
 |  |  |                 , null | 
 |  |  |                 , null | 
 |  |  |                 , JSON.toJSONString(param) | 
 |  |  |                 , JSON.toJSONString(wrkMasts) | 
 |  |  |                 , null | 
 |  |  |                 , null |