| | |
| | | |
| | | public List<Motion> generateMotion(Task task) { |
| | | List<Motion> motionList = new ArrayList<>(); |
| | | // switch (Objects.requireNonNull(WorkZoneType.query(task.getTaskSts() == TaskStsType.NEW_INBOUND.sts ? task.getOriginSite() : task.getDestSite()))) { |
| | | // case FIRST_ZONE: |
| | | // motionList = this.generateFirstZoneMotion(task); |
| | | // break; |
| | | // default: |
| | | // } |
| | | motionList = this.generateFirstZoneMotion(task); |
| | | return motionList; |
| | | } |
| | |
| | | * 5.穿梭车入库至目标库位 |
| | | */ |
| | | if (task.getTaskSts() == TaskStsType.NEW_INBOUND.sts) { |
| | | // // lift |
| | | // LiftThread liftThread = liftDispatcher.queryLiftForTransport(task.getOriginSite()); |
| | | // LiftProtocol liftProtocol = liftThread.getStatus(); |
| | | // if (liftProtocol == null) { |
| | | // return motionList; |
| | | // } |
| | | // locNo |
| | | String destLoc = task.getDestLoc(); |
| | | |
| | | // shuttle |
| | | Device shuttleDevice = deviceService.getOne(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceNo, task.getShuttleNo()) |
| | | .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()) |
| | | .eq(Device::getHostId, task.getHostId()) |
| | | .eq(Device::getStatus, 1)); |
| | | if (shuttleDevice == null) { |
| | | return motionList; |
| | | } |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleDevice.getId().intValue()); |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); |
| | | if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) { |
| | | return motionList; |
| | | } |
| | | if (!shuttleThread.isIdle()) { |
| | | return motionList; |
| | | } |
| | | |
| | | String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | |
| | | //获取距离目标位置最近的空闲可换层提升机 |
| | | LiftThread liftThread = liftDispatcher.searchIdleLift(shuttleLocNo, task.getHostId(), true); |
| | | if (liftThread == null) { |
| | | return motionList; |
| | | } |
| | | Device transferLiftDevice = liftThread.getDevice(); |
| | | |
| | | LiftProtocol liftProtocol = liftThread.getStatus(); |
| | | if (liftProtocol == null || liftProtocol.getLiftNo() == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | //检测穿梭车是否有任务绑定 |
| | | boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleDevice); |
| | | if (shuttleResult) { |
| | | //存在任务,禁止解析 |
| | | return motionList; |
| | | } |
| | | |
| | | //检测提升机是否有任务绑定 |
| | | boolean liftResult = Utils.checkLiftHasBinding(Integer.parseInt(transferLiftDevice.getDeviceNo())); |
| | | if (liftResult) { |
| | | //存在任务,禁止解析 |
| | | return motionList; |
| | | } |
| | | |
| | | //获取小车待机库位 ==> 进提升机 |
| | | ShuttleStandby shuttleStandbyTo = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>() |
| | | .eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId()) |
| | | .eq(ShuttleStandby::getDeviceLev, Utils.getLev(shuttleLocNo)) |
| | | .eq(ShuttleStandby::getStatus, 1)); |
| | | |
| | | //获取小车待机库位 ==> 出提升机 |
| | | ShuttleStandby shuttleStandbyFrom = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>() |
| | | .eq(ShuttleStandby::getDeviceId, transferLiftDevice.getId()) |
| | | .eq(ShuttleStandby::getDeviceLev, Utils.getLev(destLoc)) |
| | | .eq(ShuttleStandby::getStatus, 1)); |
| | | if (shuttleStandbyTo == null || shuttleStandbyFrom == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | //穿梭车进提升机库位号 |
| | | String liftLocNoTo = shuttleStandbyTo.getDeviceLoc(); |
| | | |
| | | //穿梭车出提升机库位号 |
| | | String liftLocNoFrom = shuttleStandbyFrom.getDeviceLoc(); |
| | | |
| | | //穿梭车进提升机待机位库位号 |
| | | String standbyLocNoTo = shuttleStandbyTo.getDeviceStandbyLoc(); |
| | | |
| | | //穿梭车出提升机待机位库位号 |
| | | String standbyLocNoFrom = shuttleStandbyFrom.getDeviceStandbyLoc(); |
| | | |
| | | // shuttle |
| | | // ShuttleThread shuttleThread = shuttleDispatcher.queryShuttleWhichConvenient(task, Integer.parseInt(liftThread.getStatus().getLiftNo())); |
| | | // ShuttleThread shuttleThread = shuttleDispatcher.queryShuttleWhichConvenient(task, 1); |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, 6); |
| | | if (Cools.isEmpty(shuttleThread)) { return motionList; } |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); |
| | | // String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | String shuttleLocNo = "0100201"; |
| | | |
| | | // // conveyor |
| | | // DevpSlave devpSlave = conveyorDispatcher.queryByInBound(task.getSourceStaNo()); |
| | |
| | | |
| | | String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | |
| | | // lift |
| | | Device transferLiftDevice = Utils.getRecentTransferLift(shuttleLocNo, shuttleProtocol.getShuttleNo()); |
| | | if (transferLiftDevice == null) { |
| | | //获取距离目标位置最近的空闲可换层提升机 |
| | | LiftThread liftThread = liftDispatcher.searchIdleLift(shuttleLocNo, task.getHostId(), true); |
| | | if (liftThread == null) { |
| | | return motionList; |
| | | } |
| | | LiftThread liftThread = (LiftThread) SlaveConnection.get(SlaveType.Lift, transferLiftDevice.getId().intValue()); |
| | | Device transferLiftDevice = liftThread.getDevice(); |
| | | |
| | | LiftProtocol liftProtocol = liftThread.getStatus(); |
| | | if (liftProtocol == null || liftProtocol.getLiftNo() == null) { |
| | | return motionList; |
| | |
| | | MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | )); |
| | | |
| | | // 提升机搬车 至 输送线层 |
| | | // 提升机搬车 至 充电层 |
| | | motionList.addAll(kernelService.liftMoveShuttle( |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |