|  |  |  | 
|---|
|  |  |  | import com.zy.asrs.wcs.core.entity.Task; | 
|---|
|  |  |  | import com.zy.asrs.wcs.core.entity.TaskCtg; | 
|---|
|  |  |  | import com.zy.asrs.wcs.core.kernel.AnalyzeService; | 
|---|
|  |  |  | import com.zy.asrs.wcs.core.model.enums.DeviceCtgType; | 
|---|
|  |  |  | import com.zy.asrs.wcs.core.model.enums.TaskStsType; | 
|---|
|  |  |  | import com.zy.asrs.wcs.core.service.BasShuttleService; | 
|---|
|  |  |  | import com.zy.asrs.wcs.core.service.MotionService; | 
|---|
|  |  |  | 
|---|
|  |  |  | import com.zy.asrs.wcs.rcs.model.enums.SlaveType; | 
|---|
|  |  |  | 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.thread.ShuttleThread; | 
|---|
|  |  |  | import com.zy.asrs.wcs.system.controller.BaseController; | 
|---|
|  |  |  | import com.zy.asrs.wcs.utils.ExcelUtil; | 
|---|
|  |  |  | 
|---|
|  |  |  | private MotionService motionService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private DeviceService deviceService; | 
|---|
|  |  |  | @Autowired | 
|---|
|  |  |  | private DeviceTypeService deviceTypeService; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PreAuthorize("hasAuthority('core:basShuttle:list')") | 
|---|
|  |  |  | @PostMapping("/basShuttle/page") | 
|---|
|  |  |  | 
|---|
|  |  |  | return R.error(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | String sourceLoc = null;//源库位 | 
|---|
|  |  |  | String targetLoc = null;//任务目标(借用字段) | 
|---|
|  |  |  | String targetSite = param.getShuttleTaskMode();//任务类型(借用字段) | 
|---|
|  |  |  | if (param.getShuttleTaskMode().equals("moveLoc")) { | 
|---|
|  |  |  | //迁移任务 | 
|---|
|  |  |  | targetLoc = param.getTargetLocNo(); | 
|---|
|  |  |  | } else if (param.getShuttleTaskMode().equals("takeMove")) { | 
|---|
|  |  |  | //取放货任务 | 
|---|
|  |  |  | targetLoc = param.getTargetLocNo(); | 
|---|
|  |  |  | sourceLoc = param.getSourceLocNo(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Task task = new Task(); | 
|---|
|  |  |  | 
|---|
|  |  |  | task.setTaskCtg(taskCtg.getId()); | 
|---|
|  |  |  | task.setPriority(10); | 
|---|
|  |  |  | task.setOriginSite(null); | 
|---|
|  |  |  | task.setOriginLoc(null); | 
|---|
|  |  |  | task.setOriginLoc(sourceLoc); | 
|---|
|  |  |  | task.setDestSite(targetSite); | 
|---|
|  |  |  | task.setDestLoc(targetLoc); | 
|---|
|  |  |  | task.setIoTime(new Date()); | 
|---|
|  |  |  | 
|---|
|  |  |  | @PostMapping("/basShuttle/moveLoc") | 
|---|
|  |  |  | @Transactional | 
|---|
|  |  |  | public synchronized R shuttleMoveLoc(@RequestBody ShuttleMoveLocParam param) { | 
|---|
|  |  |  | DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>() | 
|---|
|  |  |  | .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle)) | 
|---|
|  |  |  | .eq(DeviceType::getStatus, 1) | 
|---|
|  |  |  | .eq(DeviceType::getHostId, getHostId())); | 
|---|
|  |  |  | if (deviceType == null) { | 
|---|
|  |  |  | return R.error(); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | Device device = deviceService.getOne(new LambdaQueryWrapper<Device>() | 
|---|
|  |  |  | .eq(Device::getDeviceType, deviceType.getId()) | 
|---|
|  |  |  | .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()) | 
|---|
|  |  |  | .eq(Device::getStatus, 1) | 
|---|
|  |  |  | .eq(Device::getHostId, getHostId()) | 
|---|
|  |  |  | .eq(Device::getDeviceNo, param.getShuttleNo())); | 
|---|