|  |  | 
 |  |  | package com.zy.asrs.wcs.core.kernel; | 
 |  |  |  | 
 |  |  | import com.alibaba.fastjson.JSON; | 
 |  |  | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | 
 |  |  | import com.zy.asrs.wcs.core.domain.dto.MotionDto; | 
 |  |  | import com.zy.asrs.wcs.core.entity.*; | 
 |  |  | import com.zy.asrs.wcs.core.model.NavigateNode; | 
 |  |  | import com.zy.asrs.wcs.core.model.enums.*; | 
 |  |  | import com.zy.asrs.wcs.core.service.*; | 
 |  |  | import com.zy.asrs.wcs.core.utils.*; | 
 |  |  | import com.zy.asrs.wcs.rcs.News; | 
 |  |  | import com.zy.asrs.wcs.rcs.cache.SlaveConnection; | 
 |  |  | import com.zy.asrs.wcs.rcs.entity.Device; | 
 |  |  | import com.zy.asrs.wcs.rcs.model.enums.SlaveType; | 
 |  |  | 
 |  |  |                         MotionCtgType.SHUTTLE_MOVE | 
 |  |  |                 )); | 
 |  |  |  | 
 |  |  |                 // 锁定换层路径 | 
 |  |  |                 motionList.addAll(kernelService.mapLockPath( | 
 |  |  |                         null, | 
 |  |  |                         MotionDto.build((dto -> { | 
 |  |  |                             dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  |                             dto.setLocNo(JSON.toJSONString(lockPath)); | 
 |  |  |                         })) | 
 |  |  |                 )); | 
 |  |  | //                // 锁定换层路径 | 
 |  |  | //                motionList.addAll(kernelService.mapLockPath( | 
 |  |  | //                        null, | 
 |  |  | //                        MotionDto.build((dto -> { | 
 |  |  | //                            dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  | //                            dto.setLocNo(JSON.toJSONString(lockPath)); | 
 |  |  | //                        })) | 
 |  |  | //                )); | 
 |  |  |  | 
 |  |  |                 // 提升机空载移动到穿梭车层 | 
 |  |  |                 motionList.addAll(kernelService.liftMove( | 
 |  |  | 
 |  |  |                         })) | 
 |  |  |                 )); | 
 |  |  |  | 
 |  |  |                 // 解锁换层路径 | 
 |  |  |                 motionList.addAll(kernelService.mapUnlockPath( | 
 |  |  |                         null, | 
 |  |  |                         MotionDto.build((dto -> { | 
 |  |  |                             dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  |                             dto.setLocNo(JSON.toJSONString(lockPath)); | 
 |  |  |                         })) | 
 |  |  |                 )); | 
 |  |  | //                // 解锁换层路径 | 
 |  |  | //                motionList.addAll(kernelService.mapUnlockPath( | 
 |  |  | //                        null, | 
 |  |  | //                        MotionDto.build((dto -> { | 
 |  |  | //                            dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  | //                            dto.setLocNo(JSON.toJSONString(lockPath)); | 
 |  |  | //                        })) | 
 |  |  | //                )); | 
 |  |  |  | 
 |  |  |                 // 穿梭车入库顶升 | 
 |  |  |                 motionList.addAll(kernelService.shuttleAction( | 
 |  |  | 
 |  |  |                 return motionList; | 
 |  |  |             } | 
 |  |  |  | 
 |  |  |             //分析出库路径待机库位 | 
 |  |  |             String lastPathStartLoc = shuttleDispatcher.analyzeOutPathWaitLoc(originLoc, standbyLocNoTo, shuttleDevice); | 
 |  |  |             if (lastPathStartLoc == null) { | 
 |  |  |                 return motionList;//未分析成功 | 
 |  |  |             } | 
 |  |  | //            //分析出库路径待机库位 | 
 |  |  | //            String lastPathStartLoc = shuttleDispatcher.analyzeOutPathWaitLoc(originLoc, standbyLocNoTo, shuttleDevice); | 
 |  |  | //            if (lastPathStartLoc == null) { | 
 |  |  | //                return motionList;//未分析成功 | 
 |  |  | //            } | 
 |  |  |  | 
 |  |  |             /** | 
 |  |  |              * 出库 | 
 |  |  | 
 |  |  |                         MotionCtgType.SHUTTLE_PALLET_LIFT | 
 |  |  |                 )); | 
 |  |  |  | 
 |  |  |                 if (!originLoc.equals(lastPathStartLoc)) { | 
 |  |  |                     // 穿梭车载货出库至最后一段路径等待 | 
 |  |  |                     motionList.addAll(kernelService.shuttleMove( | 
 |  |  |                             MotionDto.build((dto -> { | 
 |  |  |                                 dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  |                                 dto.setLocNo(originLoc); | 
 |  |  |                             })), | 
 |  |  |                             MotionDto.build((dto -> { | 
 |  |  |                                 dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  |                                 dto.setShuttleDevice(shuttleDevice); | 
 |  |  |                                 dto.setLocNo(lastPathStartLoc); | 
 |  |  |                             })), | 
 |  |  |                             MotionCtgType.SHUTTLE_TRANSPORT | 
 |  |  |                     )); | 
 |  |  |                 } | 
 |  |  | //                if (!originLoc.equals(lastPathStartLoc)) { | 
 |  |  | //                    // 穿梭车载货出库至最后一段路径等待 | 
 |  |  | //                    motionList.addAll(kernelService.shuttleMove( | 
 |  |  | //                            MotionDto.build((dto -> { | 
 |  |  | //                                dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  | //                                dto.setLocNo(originLoc); | 
 |  |  | //                            })), | 
 |  |  | //                            MotionDto.build((dto -> { | 
 |  |  | //                                dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  | //                                dto.setShuttleDevice(shuttleDevice); | 
 |  |  | //                                dto.setLocNo(lastPathStartLoc); | 
 |  |  | //                            })), | 
 |  |  | //                            MotionCtgType.SHUTTLE_TRANSPORT | 
 |  |  | //                    )); | 
 |  |  | //                } | 
 |  |  | // | 
 |  |  | //                // 穿梭车载货至提升机待机位 | 
 |  |  | //                motionList.addAll(kernelService.shuttleMove( | 
 |  |  | //                        MotionDto.build((dto -> { | 
 |  |  | //                            dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  | //                            dto.setLocNo(lastPathStartLoc); | 
 |  |  | //                        })), | 
 |  |  | //                        MotionDto.build((dto -> { | 
 |  |  | //                            dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  | //                            dto.setShuttleDevice(shuttleDevice); | 
 |  |  | //                            dto.setLiftNo(transferLiftDevice.getId().intValue()); | 
 |  |  | //                            dto.setLocNo(standbyLocNoTo); | 
 |  |  | //                            dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//输送站 | 
 |  |  | //                        })), | 
 |  |  | //                        MotionCtgType.SHUTTLE_TRANSPORT_TO_CONVEYOR | 
 |  |  | //                )); | 
 |  |  |  | 
 |  |  |                 // 穿梭车载货至提升机待机位 | 
 |  |  |                 motionList.addAll(kernelService.shuttleMove( | 
 |  |  |                         MotionDto.build((dto -> { | 
 |  |  |                             dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  |                             dto.setLocNo(lastPathStartLoc); | 
 |  |  |                             dto.setLocNo(originLoc); | 
 |  |  |                         })), | 
 |  |  |                         MotionDto.build((dto -> { | 
 |  |  |                             dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  | 
 |  |  |                         MotionCtgType.SHUTTLE_MOVE | 
 |  |  |                 )); | 
 |  |  |  | 
 |  |  |                 // 锁定换层路径 | 
 |  |  |                 motionList.addAll(kernelService.mapLockPath( | 
 |  |  |                         null, | 
 |  |  |                         MotionDto.build((dto -> { | 
 |  |  |                             dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  |                             dto.setLocNo(JSON.toJSONString(lockPath)); | 
 |  |  |                         })) | 
 |  |  |                 )); | 
 |  |  | //                // 锁定换层路径 | 
 |  |  | //                motionList.addAll(kernelService.mapLockPath( | 
 |  |  | //                        null, | 
 |  |  | //                        MotionDto.build((dto -> { | 
 |  |  | //                            dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  | //                            dto.setLocNo(JSON.toJSONString(lockPath)); | 
 |  |  | //                        })) | 
 |  |  | //                )); | 
 |  |  |  | 
 |  |  |                 // 提升机空载移动到穿梭车层 | 
 |  |  |                 motionList.addAll(kernelService.liftMove( | 
 |  |  | 
 |  |  |                         })) | 
 |  |  |                 )); | 
 |  |  |  | 
 |  |  |                 // 解锁换层路径 | 
 |  |  |                 motionList.addAll(kernelService.mapUnlockPath( | 
 |  |  |                         null, | 
 |  |  |                         MotionDto.build((dto -> { | 
 |  |  |                             dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  |                             dto.setLocNo(JSON.toJSONString(lockPath)); | 
 |  |  |                         })) | 
 |  |  |                 )); | 
 |  |  | //                // 解锁换层路径 | 
 |  |  | //                motionList.addAll(kernelService.mapUnlockPath( | 
 |  |  | //                        null, | 
 |  |  | //                        MotionDto.build((dto -> { | 
 |  |  | //                            dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  | //                            dto.setLocNo(JSON.toJSONString(lockPath)); | 
 |  |  | //                        })) | 
 |  |  | //                )); | 
 |  |  |  | 
 |  |  |                 // 穿梭车提升机待机位至出库库位 | 
 |  |  |                 motionList.addAll(kernelService.shuttleMove( | 
 |  |  | 
 |  |  |                         MotionCtgType.SHUTTLE_PALLET_LIFT | 
 |  |  |                 )); | 
 |  |  |  | 
 |  |  |                 if (!originLoc.equals(lastPathStartLoc)) { | 
 |  |  |                     // 穿梭车载货出库至最后一段路径等待 | 
 |  |  |                     motionList.addAll(kernelService.shuttleMove( | 
 |  |  |                             MotionDto.build((dto -> { | 
 |  |  |                                 dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  |                                 dto.setLocNo(originLoc); | 
 |  |  |                             })), | 
 |  |  |                             MotionDto.build((dto -> { | 
 |  |  |                                 dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  |                                 dto.setShuttleDevice(shuttleDevice); | 
 |  |  |                                 dto.setLocNo(lastPathStartLoc); | 
 |  |  |                             })), | 
 |  |  |                             MotionCtgType.SHUTTLE_TRANSPORT | 
 |  |  |                     )); | 
 |  |  |                 } | 
 |  |  | //                if (!originLoc.equals(lastPathStartLoc)) { | 
 |  |  | //                    // 穿梭车载货出库至最后一段路径等待 | 
 |  |  | //                    motionList.addAll(kernelService.shuttleMove( | 
 |  |  | //                            MotionDto.build((dto -> { | 
 |  |  | //                                dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  | //                                dto.setLocNo(originLoc); | 
 |  |  | //                            })), | 
 |  |  | //                            MotionDto.build((dto -> { | 
 |  |  | //                                dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  | //                                dto.setShuttleDevice(shuttleDevice); | 
 |  |  | //                                dto.setLocNo(lastPathStartLoc); | 
 |  |  | //                            })), | 
 |  |  | //                            MotionCtgType.SHUTTLE_TRANSPORT | 
 |  |  | //                    )); | 
 |  |  | //                } | 
 |  |  | // | 
 |  |  | //                // 穿梭车载货至提升机待机位 | 
 |  |  | //                motionList.addAll(kernelService.shuttleMove( | 
 |  |  | //                        MotionDto.build((dto -> { | 
 |  |  | //                            dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  | //                            dto.setLocNo(lastPathStartLoc); | 
 |  |  | //                        })), | 
 |  |  | //                        MotionDto.build((dto -> { | 
 |  |  | //                            dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  | //                            dto.setShuttleDevice(shuttleDevice); | 
 |  |  | //                            dto.setLiftNo(transferLiftDevice.getId().intValue()); | 
 |  |  | //                            dto.setLocNo(standbyLocNoFrom); | 
 |  |  | //                            dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//输送站 | 
 |  |  | //                        })), | 
 |  |  | //                        MotionCtgType.SHUTTLE_TRANSPORT_TO_CONVEYOR | 
 |  |  | //                )); | 
 |  |  |  | 
 |  |  |                 // 穿梭车载货至提升机待机位 | 
 |  |  |                 motionList.addAll(kernelService.shuttleMove( | 
 |  |  |                         MotionDto.build((dto -> { | 
 |  |  |                             dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  |                             dto.setLocNo(lastPathStartLoc); | 
 |  |  |                             dto.setLocNo(originLoc); | 
 |  |  |                         })), | 
 |  |  |                         MotionDto.build((dto -> { | 
 |  |  |                             dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  | 
 |  |  |             //穿梭车到提升机待机位库位号 | 
 |  |  |             String standbyLocNoTo = liftDispatcher.getLiftStandByLocNo(liftThread, Utils.getLev(shuttleLocNo)); | 
 |  |  |  | 
 |  |  |             //穿梭车换层时待机位置 使用表列 memo数据 | 
 |  |  |             String standbyLocNoMemo = liftDispatcher.getInLiftStandByLocNo(liftThread, Utils.getLev(shuttleLocNo)); | 
 |  |  |  | 
 |  |  |             //穿梭车出提升机待机位库位号 | 
 |  |  |             String standbyLocNoFrom = liftDispatcher.getLiftStandByLocNo(liftThread, Utils.getLev(task.getDestLoc())); | 
 |  |  |  | 
 |  |  | 
 |  |  |                         dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  |                         dto.setShuttleDevice(shuttleDevice); | 
 |  |  |                         dto.setLiftNo(liftDevice.getId().intValue()); | 
 |  |  |                         dto.setLocNo(standbyLocNoTo); | 
 |  |  |                         dto.setLocNo(standbyLocNoMemo); | 
 |  |  |                     })), | 
 |  |  |                     MotionCtgType.SHUTTLE_MOVE | 
 |  |  |             )); | 
 |  |  |  | 
 |  |  |             // 锁定换层路径 | 
 |  |  |             motionList.addAll(kernelService.mapLockPath( | 
 |  |  |                     null, | 
 |  |  |                     MotionDto.build((dto -> { | 
 |  |  |                         dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  |                         dto.setLocNo(JSON.toJSONString(lockPath)); | 
 |  |  |                     })) | 
 |  |  |             )); | 
 |  |  | //            // 锁定换层路径 | 
 |  |  | //            motionList.addAll(kernelService.mapLockPath( | 
 |  |  | //                    null, | 
 |  |  | //                    MotionDto.build((dto -> { | 
 |  |  | //                        dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  | //                        dto.setLocNo(JSON.toJSONString(lockPath)); | 
 |  |  | //                    })) | 
 |  |  | //            )); | 
 |  |  |  | 
 |  |  |             // 提升机空载移动到穿梭车层 | 
 |  |  |             motionList.addAll(kernelService.liftMove( | 
 |  |  | 
 |  |  |             motionList.addAll(kernelService.shuttleMove( | 
 |  |  |                     MotionDto.build((dto -> { | 
 |  |  |                         dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  |                         dto.setLocNo(standbyLocNoTo); | 
 |  |  |                         dto.setLocNo(standbyLocNoMemo); | 
 |  |  |                     })), | 
 |  |  |                     MotionDto.build((dto -> { | 
 |  |  |                         dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  | 
 |  |  |                     })) | 
 |  |  |             )); | 
 |  |  |  | 
 |  |  |             // 解锁换层路径 | 
 |  |  |             motionList.addAll(kernelService.mapUnlockPath( | 
 |  |  |                     null, | 
 |  |  |                     MotionDto.build((dto -> { | 
 |  |  |                         dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  |                         dto.setLocNo(JSON.toJSONString(lockPath)); | 
 |  |  |                     })) | 
 |  |  |             )); | 
 |  |  | //            // 解锁换层路径 | 
 |  |  | //            motionList.addAll(kernelService.mapUnlockPath( | 
 |  |  | //                    null, | 
 |  |  | //                    MotionDto.build((dto -> { | 
 |  |  | //                        dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  | //                        dto.setLocNo(JSON.toJSONString(lockPath)); | 
 |  |  | //                    })) | 
 |  |  | //            )); | 
 |  |  |  | 
 |  |  |             // 穿梭车提升机待机位至目标位置 | 
 |  |  |             motionList.addAll(kernelService.shuttleMove( | 
 |  |  | 
 |  |  |                     MotionCtgType.SHUTTLE_MOVE | 
 |  |  |             )); | 
 |  |  |  | 
 |  |  |             // 锁定换层路径 | 
 |  |  |             motionList.addAll(kernelService.mapLockPath( | 
 |  |  |                     null, | 
 |  |  |                     MotionDto.build((dto -> { | 
 |  |  |                         dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  |                         dto.setLocNo(JSON.toJSONString(lockPath)); | 
 |  |  |                     })) | 
 |  |  |             )); | 
 |  |  | //            // 锁定换层路径 | 
 |  |  | //            motionList.addAll(kernelService.mapLockPath( | 
 |  |  | //                    null, | 
 |  |  | //                    MotionDto.build((dto -> { | 
 |  |  | //                        dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  | //                        dto.setLocNo(JSON.toJSONString(lockPath)); | 
 |  |  | //                    })) | 
 |  |  | //            )); | 
 |  |  |  | 
 |  |  |             // 提升机空载移动到穿梭车层 | 
 |  |  |             motionList.addAll(kernelService.liftMove( | 
 |  |  | 
 |  |  |                     })) | 
 |  |  |             )); | 
 |  |  |  | 
 |  |  |             // 解锁换层路径 | 
 |  |  |             motionList.addAll(kernelService.mapUnlockPath( | 
 |  |  |                     null, | 
 |  |  |                     MotionDto.build((dto -> { | 
 |  |  |                         dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  |                         dto.setLocNo(JSON.toJSONString(lockPath)); | 
 |  |  |                     })) | 
 |  |  |             )); | 
 |  |  | //            // 解锁换层路径 | 
 |  |  | //            motionList.addAll(kernelService.mapUnlockPath( | 
 |  |  | //                    null, | 
 |  |  | //                    MotionDto.build((dto -> { | 
 |  |  | //                        dto.setShuttleNo(shuttleDevice.getId().intValue()); | 
 |  |  | //                        dto.setLocNo(JSON.toJSONString(lockPath)); | 
 |  |  | //                    })) | 
 |  |  | //            )); | 
 |  |  |  | 
 |  |  |             // 穿梭车提升机待机位至出库库位 | 
 |  |  |             motionList.addAll(kernelService.shuttleMove( |