| | |
| | | package com.zy.asrs.wcs.core.kernel; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.zy.asrs.framework.common.Cools; |
| | | import com.zy.asrs.wcs.core.domain.dto.MotionDto; |
| | | import com.zy.asrs.wcs.core.entity.Task; |
| | | import com.zy.asrs.wcs.core.entity.*; |
| | | import com.zy.asrs.wcs.core.model.enums.DeviceCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.MotionCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.TaskCtgType; |
| | | import com.zy.asrs.wcs.core.model.enums.TaskStsType; |
| | | import com.zy.asrs.wcs.core.model.enums.WorkZoneType; |
| | | import com.zy.asrs.wcs.core.service.TaskService; |
| | | import com.zy.asrs.wcs.core.service.*; |
| | | import com.zy.asrs.wcs.core.utils.ConveyorDispatcher; |
| | | import com.zy.asrs.wcs.core.utils.LiftDispatcher; |
| | | import com.zy.asrs.wcs.core.utils.ShuttleDispatcher; |
| | | import com.zy.asrs.wcs.core.utils.Utils; |
| | | import com.zy.asrs.wcs.rcs.cache.SlaveConnection; |
| | | import com.zy.asrs.wcs.core.entity.Motion; |
| | | import com.zy.asrs.wcs.rcs.entity.Device; |
| | | import com.zy.asrs.wcs.rcs.entity.DeviceType; |
| | | import com.zy.asrs.wcs.rcs.model.enums.SlaveType; |
| | | import com.zy.asrs.wcs.rcs.model.protocol.LiftProtocol; |
| | | import com.zy.asrs.wcs.rcs.model.protocol.ShuttleProtocol; |
| | | import com.zy.asrs.wcs.core.service.MotionService; |
| | | import com.zy.asrs.wcs.rcs.service.DeviceService; |
| | | import com.zy.asrs.wcs.rcs.service.DeviceTypeService; |
| | | import com.zy.asrs.wcs.rcs.thread.LiftThread; |
| | | import com.zy.asrs.wcs.rcs.thread.ShuttleThread; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * todo:luxiaotao 1.充电任务,2.库位移转,3.小车迁移 |
| | | * 1.充电任务,2.库位移转,3.小车迁移,4.手动任务 |
| | | * Created by vincent on 2023/10/11 |
| | | */ |
| | | @Service |
| | |
| | | private ShuttleDispatcher shuttleDispatcher; |
| | | @Autowired |
| | | private LiftDispatcher liftDispatcher; |
| | | // @Autowired |
| | | // private ConveyorDispatcher conveyorDispatcher; |
| | | @Autowired |
| | | private ConveyorDispatcher conveyorDispatcher; |
| | | @Autowired |
| | | private DeviceService deviceService; |
| | | @Autowired |
| | | private DeviceTypeService deviceTypeService; |
| | | private ShuttleStandbyService shuttleStandbyService; |
| | | @Autowired |
| | | private BasConveyorPathService basConveyorPathService; |
| | | @Autowired |
| | | private TaskCtgService taskCtgService; |
| | | |
| | | 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; |
| | | } |
| | | |
| | | public List<Motion> generateFirstZoneMotion(Task task) { |
| | | List<Motion> motionList = new ArrayList<>(); |
| | | |
| | | String shuttleNo = null; |
| | | String liftNo = null; |
| | | /** |
| | | * 入库 |
| | | * 一、入库目标层有穿梭车 |
| | |
| | | * 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 |
| | | // 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; } |
| | | 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(); |
| | | // String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | String shuttleLocNo = "0100201"; |
| | | if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) { |
| | | return motionList; |
| | | } |
| | | if (!shuttleThread.isIdle()) { |
| | | return motionList; |
| | | } |
| | | |
| | | // // conveyor |
| | | // DevpSlave devpSlave = conveyorDispatcher.queryByInBound(task.getSourceStaNo()); |
| | | // DevpSlave.Sta slaveInSta = devpSlave.queryInSta(wrkMast.getSourceStaNo()); |
| | | String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | |
| | | // //检测穿梭车是否有任务绑定 |
| | | // boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleProtocol.getShuttleNo().intValue()); |
| | | // if (shuttleResult) { |
| | | // //存在任务,禁止解析 |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // //检测提升机是否有任务绑定 |
| | | // boolean liftResult = Utils.checkLiftHasBinding(liftSlave.getId()); |
| | | // if (liftResult) { |
| | | // //存在任务,禁止解析 |
| | | // return motionList; |
| | | // } |
| | | //获取距离目标位置最近的空闲可换层提升机 |
| | | LiftThread liftThread = liftDispatcher.searchIdleLift(shuttleLocNo, task.getHostId(), true); |
| | | if (liftThread == null) { |
| | | return motionList; |
| | | } |
| | | Device transferLiftDevice = liftThread.getDevice(); |
| | | |
| | | // //穿梭车到提升机库位号 |
| | | // String liftLocNoTo = LiftCodeType.getLocNo(Integer.parseInt(liftNo), Utils.getLev(shuttleLocNo), task.getHostId()); |
| | | // |
| | | // //穿梭车出提升机库位号 |
| | | // String liftLocNoFrom = LiftCodeType.getLocNo(Integer.parseInt(liftNo), Utils.getLev(task.getDestLoc()), task.getHostId()); |
| | | // |
| | | // //穿梭车到提升机待机位库位号 |
| | | // String standbyLocNoTo = LiftCodeType.getStandbyLocNo(Integer.parseInt(liftNo), Utils.getLev(shuttleLocNo)); |
| | | // |
| | | // //穿梭车出提升机待机位库位号 |
| | | // String standbyLocNoFrom = LiftCodeType.getStandbyLocNo(Integer.parseInt(liftNo), Utils.getLev(task.getDestLoc())); |
| | | LiftProtocol liftProtocol = liftThread.getStatus(); |
| | | if (liftProtocol == null || liftProtocol.getLiftNo() == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | //检测穿梭车是否有任务绑定 |
| | | boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleDevice, task.getTaskNo()); |
| | | if (shuttleResult) { |
| | | //存在任务,禁止解析 |
| | | 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(); |
| | | |
| | | // 入库目标层有穿梭车 |
| | | if (Utils.getLev(shuttleLocNo) == Utils.getLev(task.getDestLoc())) { |
| | | |
| | | // 穿梭车走行至库位 |
| | | // 提升机载货移动 |
| | | motionList.addAll(kernelService.liftMoveGoods( |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(5);//索牌项目5层是输送线层 |
| | | dto.setStaNo(1);//提升机左侧 |
| | | })) |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(task.getDestLoc())); |
| | | dto.setStaNo(0);//提升机内侧 |
| | | dto.setSync(0);//异步执行 |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车走行至提升机库位待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(Integer.valueOf(shuttleProtocol.getShuttleNo())); |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(Integer.valueOf(shuttleProtocol.getShuttleNo())); |
| | | dto.setLocNo(task.getDestLoc()); |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // // 提升机空载移动 |
| | | // motionList.addAll(kernelService.liftMove( |
| | | // null |
| | | // , MotionDto.build((dto -> { |
| | | // dto.setLiftNo(Integer.valueOf(liftProtocol.getLiftNo())); |
| | | //// dto.setLev(slaveInSta.getLiftLev()); |
| | | // dto.setLev(1); |
| | | // })) |
| | | // )); |
| | | // |
| | | // // 输送线入库至提升机口 |
| | | // motionList.addAll(kernelService.conveyorInbound( |
| | | // MotionDto.build((dto -> { |
| | | //// dto.setDevpNo(devpSlave.getId()); |
| | | // dto.setDevpNo(1); |
| | | // dto.setStaNo(Integer.valueOf(task.getOriginSite())); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(Integer.valueOf(liftProtocol.getLiftNo())); |
| | | //// dto.setLev(slaveInSta.getLiftLev()); |
| | | // dto.setLev(1); |
| | | // })), |
| | | // MotionCtgType.CONVEYOR_INBOUND_TO_LIFT |
| | | // )); |
| | | // |
| | | // // 目标库位是否与输送线入库站属于同一层 |
| | | // if (!slaveInSta.getLiftLev().equals(Utils.getLev(wrkMast.getLocNo()))) { |
| | | // // 提升机载货移动 |
| | | // motionList.addAll(kernelService.liftMoveGoods( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLev(slaveInSta.getLiftLev()); |
| | | // })) |
| | | // , MotionDto.build((dto -> { |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLev(Utils.getLev(wrkMast.getLocNo())); |
| | | // })) |
| | | // )); |
| | | // } |
| | | // |
| | | // // 穿梭车走行至提升机库位待机位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(shuttleLocNo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLocNo(standbyLocNoTo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE |
| | | // )); |
| | | // |
| | | // // 提升机移动至小车楼层 |
| | | // motionList.addAll(kernelService.liftMove( |
| | | // null |
| | | // , MotionDto.build((dto -> { |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | // })) |
| | | // )); |
| | | // |
| | | // // 穿梭车待机位至提升机库位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoTo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLocNo(liftLocNoTo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | // )); |
| | | // |
| | | // // 穿梭车入库顶升并移动至提升机待机位 |
| | | // motionList.addAll(kernelService.shuttleTransport( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLocNo(liftLocNoFrom); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoFrom); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_TRANSPORT_FROM_LIFT |
| | | // )); |
| | | // |
| | | // // 穿梭车走行至提升机库位待机位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoFrom); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLocNo(wrkMast.getLocNo()); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE_DOWN_PALLET |
| | | // )); |
| | | // 锁定提升机 |
| | | motionList.addAll(kernelService.liftLock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车待机位至提升机 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | )); |
| | | |
| | | // 穿梭车入库顶升 |
| | | motionList.addAll(kernelService.shuttleAction( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })), |
| | | MotionCtgType.SHUTTLE_PALLET_LIFT |
| | | )); |
| | | |
| | | // 穿梭车入库移动至提升机待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | )); |
| | | |
| | | // 解锁提升机 |
| | | motionList.addAll(kernelService.liftUnlock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setReleaseLift(1);//执行完成后释放提升机 |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车走行至目标库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(destLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 穿梭车入库托盘下降 |
| | | motionList.addAll(kernelService.shuttleAction( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })), |
| | | MotionCtgType.SHUTTLE_PALLET_DOWN |
| | | )); |
| | | |
| | | /** |
| | | * 二、入库目标层没有穿梭车 |
| | |
| | | * 6.穿梭车入库至目标库位 |
| | | */ |
| | | } else { |
| | | // |
| | | // // 穿梭车走行至提升机库位待机位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(shuttleLocNo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLocNo(standbyLocNoTo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE |
| | | // )); |
| | | // |
| | | // // 提升机空载移动到穿梭车层 |
| | | // motionList.addAll(kernelService.liftMove( |
| | | // null |
| | | // , MotionDto.build((dto -> { |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | // })) |
| | | // )); |
| | | // |
| | | // // 穿梭车待机位至提升机库位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoTo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLocNo(liftLocNoTo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | // )); |
| | | // |
| | | // // 提升机搬车 至 输送线层 |
| | | // motionList.addAll(kernelService.liftMoveShuttle( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLev(slaveInSta.getLiftLev()); |
| | | // })) |
| | | // )); |
| | | // |
| | | // // 输送线入库至提升机口 |
| | | // motionList.addAll(kernelService.conveyorInbound( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setDevpNo(devpSlave.getId()); |
| | | // dto.setStaNo(wrkMast.getSourceStaNo()); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLev(slaveInSta.getLiftLev()); |
| | | // })), |
| | | // MotionCtgType.CONVEYOR_INBOUND_TO_LIFT |
| | | // )); |
| | | // |
| | | // // 目标库位是否与输送线入库站属于同一层 |
| | | // if (!slaveInSta.getLiftLev().equals(Utils.getLev(wrkMast.getLocNo()))) { |
| | | // // 提升机载货移动 |
| | | // motionList.addAll(kernelService.liftMoveGoodsAndShuttle( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLev(slaveInSta.getLiftLev()); |
| | | // })) |
| | | // , MotionDto.build((dto -> { |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLev(Utils.getLev(wrkMast.getLocNo())); |
| | | // })) |
| | | // )); |
| | | // } |
| | | // |
| | | // // 穿梭车入库顶升并移动至提升机待机位 |
| | | // motionList.addAll(kernelService.shuttleTransport( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLocNo(liftLocNoFrom); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoFrom); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_TRANSPORT_FROM_LIFT |
| | | // )); |
| | | // |
| | | // // 穿梭车待机位至入库库位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoFrom); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLocNo(wrkMast.getLocNo()); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE_DOWN_PALLET |
| | | // )); |
| | | |
| | | // 穿梭车走行至提升机库位待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 提升机空载移动到穿梭车层 |
| | | motionList.addAll(kernelService.liftMove( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | })) |
| | | )); |
| | | |
| | | // 锁定提升机 |
| | | motionList.addAll(kernelService.liftLock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车待机位至提升机 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | )); |
| | | |
| | | // 解锁提升机 |
| | | motionList.addAll(kernelService.liftUnlock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 提升机载货移动 |
| | | motionList.addAll(kernelService.liftMoveGoods( |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(5);//索牌项目5层是输送线层 |
| | | dto.setStaNo(1);//提升机左侧 |
| | | })) |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(task.getDestLoc())); |
| | | dto.setStaNo(0);//提升机内侧 |
| | | })) |
| | | )); |
| | | |
| | | // 锁定提升机 |
| | | motionList.addAll(kernelService.liftLock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车入库顶升 |
| | | motionList.addAll(kernelService.shuttleAction( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })), |
| | | MotionCtgType.SHUTTLE_PALLET_LIFT |
| | | )); |
| | | |
| | | // 更新小车坐标 |
| | | motionList.addAll(kernelService.shuttleUpdateLocation( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoFrom); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车入库移动至提升机待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | )); |
| | | |
| | | // 解锁提升机 |
| | | motionList.addAll(kernelService.liftUnlock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setReleaseLift(1);//执行完成后释放提升机 |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车走行至目标库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(destLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 穿梭车入库托盘下降 |
| | | motionList.addAll(kernelService.shuttleAction( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })), |
| | | MotionCtgType.SHUTTLE_PALLET_DOWN |
| | | )); |
| | | |
| | | } |
| | | |
| | | shuttleNo = String.valueOf(shuttleProtocol.getShuttleNo()); |
| | | // liftNo = String.valueOf(liftProtocol.getLiftNo()); |
| | | } |
| | | |
| | | /** |
| | | * 出库 |
| | | */ |
| | | if (task.getTaskSts() == TaskStsType.NEW_OUTBOUND.sts) { |
| | | // // lift |
| | | // LiftProtocol liftProtocol = liftDispatcher.queryLiftForTransport(wrkMast.getStaNo()); |
| | | // LiftSlave liftSlave = liftProtocol.querySlave(); |
| | | // |
| | | // // shuttle |
| | | // ShuttleProtocol shuttleProtocol = shuttleDispatcher.queryShuttleWhichConvenient(wrkMast, liftProtocol.getLiftNo().intValue()); |
| | | // if (Cools.isEmpty(shuttleProtocol)) { return motionList; } |
| | | // String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | // |
| | | // // conveyor |
| | | // DevpSlave devpSlave = conveyorDispatcher.queryByOutBound(wrkMast.getSourceStaNo()); |
| | | // DevpSlave.Sta slaveOutSta = devpSlave.queryOutSta(wrkMast.getSourceStaNo()); |
| | | // |
| | | // //检测穿梭车是否有任务绑定 |
| | | // boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleProtocol.getShuttleNo().intValue()); |
| | | // if (shuttleResult) { |
| | | // //存在任务,禁止解析 |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // //检测提升机是否有任务绑定 |
| | | // boolean liftResult = Utils.checkLiftHasBinding(liftSlave.getId()); |
| | | // if (liftResult) { |
| | | // //存在任务,禁止解析 |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // //穿梭车到提升机库位号 |
| | | // String liftLocNoTo = LiftCodeType.getLocNo(liftSlave.getId(), Utils.getLev(shuttleLocNo)); |
| | | // |
| | | // //穿梭车出提升机库位号 |
| | | // String liftLocNoFrom = LiftCodeType.getLocNo(liftSlave.getId(), Utils.getLev(wrkMast.getSourceLocNo())); |
| | | // |
| | | // //穿梭车到提升机待机位库位号 |
| | | // String standbyLocNoTo = LiftCodeType.getStandbyLocNo(liftSlave.getId(), Utils.getLev(shuttleLocNo)); |
| | | // |
| | | // //穿梭车出提升机待机位库位号 |
| | | // String standbyLocNoFrom = LiftCodeType.getStandbyLocNo(liftSlave.getId(), Utils.getLev(wrkMast.getSourceLocNo())); |
| | | // |
| | | // /** |
| | | // * 出库 |
| | | // * 一、出库起始层有穿梭车 |
| | | // * 1.穿梭车走行至出库库位 |
| | | // * 2.提升机到出库起始层 |
| | | // * 3.穿梭车出库至提升机 |
| | | // * 4.穿梭车离开提升机 |
| | | // * 5.提升机载货移动(非必需) |
| | | // * 6.输送线运输至出库口 |
| | | // */ |
| | | // if (Utils.getLev(shuttleLocNo) == Utils.getLev(wrkMast.getSourceLocNo())) { |
| | | // |
| | | // //穿梭车不在出库库位 |
| | | // if (!shuttleLocNo.equals(wrkMast.getSourceLocNo())) { |
| | | // // 穿梭车走行至出库库位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(shuttleLocNo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(wrkMast.getSourceLocNo()); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE |
| | | // )); |
| | | // } |
| | | // |
| | | // // 穿梭车出库至提升机待机位 |
| | | // motionList.addAll(kernelService.shuttleTransport( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(wrkMast.getSourceLocNo()); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLocNo(standbyLocNoTo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE_LIFT_PALLET |
| | | // )); |
| | | // |
| | | // // 提升机空载移动 |
| | | // motionList.addAll(kernelService.liftMove( |
| | | // null |
| | | // , MotionDto.build((dto -> { |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLev(Utils.getLev(wrkMast.getSourceLocNo())); |
| | | // })) |
| | | // )); |
| | | // |
| | | // // 穿梭车待机位至提升机 |
| | | // motionList.addAll(kernelService.shuttleTransport( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoTo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLocNo(liftLocNoTo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_TRANSPORT_TO_LIFT |
| | | // )); |
| | | // |
| | | // // 穿梭车离开提升机 - 到提升机待机位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLocNo(liftLocNoFrom); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoFrom); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | // )); |
| | | // |
| | | // // 提升机载货移动 |
| | | // // 出库库位是否与输送线出库站属于同一层 |
| | | // if (!slaveOutSta.getLiftLev().equals(Utils.getLev(wrkMast.getSourceLocNo()))) { |
| | | // motionList.addAll(kernelService.liftMoveGoods( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLev(Utils.getLev(wrkMast.getSourceLocNo())); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLev(slaveOutSta.getLiftLev()); |
| | | // })) |
| | | // )); |
| | | // } |
| | | // |
| | | // LiftNeighborType neighborType = LiftNeighborType.query(liftSlave.getId(), slaveOutSta.getLiftLev(), false, wrkMast.getStaNo()); |
| | | // |
| | | // // 提升机运输到输送线 |
| | | // motionList.addAll(kernelService.liftTransportGoodsToConveyor( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLev(slaveOutSta.getLiftLev()); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setDevpNo(devpSlave.getId()); |
| | | // dto.setStaNo(neighborType.staNo); |
| | | // })) |
| | | // )); |
| | | // |
| | | // // 穿梭车提升机待机位 - 到待机位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoFrom); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo( |
| | | // ShuttleTempLocType.query(shuttleProtocol.getShuttleNo().intValue(), liftSlave.getId(), Utils.getLev(wrkMast.getSourceLocNo())).locNo |
| | | // ); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE |
| | | // )); |
| | | // |
| | | // /** |
| | | // * 二、出库起始层没有穿梭车 |
| | | // * |
| | | // * 1.提升机到穿梭车层 |
| | | // * 2.穿梭车走行至提升机 |
| | | // * 3.提升机载车至出库起始层 |
| | | // * 4.穿梭车走行至出库库位 |
| | | // * 5.穿梭车出库至提升机 |
| | | // * 6.穿梭车离开提升机 |
| | | // * 7.提升机载货移动(非必需) |
| | | // * 8.输送线运输至出库口 |
| | | // * |
| | | // */ |
| | | // } else { |
| | | // |
| | | // // 穿梭车走行至提升机待机位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(shuttleLocNo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLocNo(standbyLocNoTo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE |
| | | // )); |
| | | // |
| | | // // 提升机到穿梭车层 |
| | | // motionList.addAll(kernelService.liftMove( |
| | | // null |
| | | // , MotionDto.build((dto -> { |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | // })) |
| | | // )); |
| | | // |
| | | // // 穿梭车待机位至提升机 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoTo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLocNo(liftLocNoTo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | // )); |
| | | // |
| | | // // 提升机载车至出库起始层 |
| | | // motionList.addAll(kernelService.liftMoveShuttle( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLev(Utils.getLev(wrkMast.getSourceLocNo())); |
| | | // })) |
| | | // )); |
| | | // |
| | | // // 穿梭车走行至提升机待机位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLocNo(liftLocNoFrom); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoFrom); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | // )); |
| | | // |
| | | // // 穿梭车提升机待机位至出库库位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLocNo(standbyLocNoFrom); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(wrkMast.getSourceLocNo()); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE |
| | | // )); |
| | | // |
| | | // // 穿梭车出库至提升机待机位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(wrkMast.getSourceLocNo()); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLocNo(standbyLocNoFrom); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE_LIFT_PALLET |
| | | // )); |
| | | // |
| | | // // 穿梭车提升机待机位至提升机 |
| | | // motionList.addAll(kernelService.shuttleTransport( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoFrom); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLocNo(liftLocNoFrom); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_TRANSPORT_TO_LIFT |
| | | // )); |
| | | // |
| | | // // 穿梭车离开提升机 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLocNo(liftLocNoFrom); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo( |
| | | // ShuttleTempLocType.query(shuttleProtocol.getShuttleNo().intValue(), liftSlave.getId(), Utils.getLev(wrkMast.getSourceLocNo())).locNo |
| | | // ); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | // )); |
| | | // |
| | | // // 提升机载货移动 |
| | | // // 出库库位是否与输送线出库站属于同一层 |
| | | // if (!slaveOutSta.getLiftLev().equals(Utils.getLev(wrkMast.getSourceLocNo()))) { |
| | | // motionList.addAll(kernelService.liftMoveGoods( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLev(Utils.getLev(wrkMast.getSourceLocNo())); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLev(slaveOutSta.getLiftLev()); |
| | | // })) |
| | | // )); |
| | | // } |
| | | // |
| | | // LiftNeighborType neighborType = LiftNeighborType.query(liftSlave.getId(), slaveOutSta.getLiftLev(), false, wrkMast.getStaNo()); |
| | | // |
| | | // // 提升机运输到输送线 |
| | | // motionList.addAll(kernelService.liftTransportGoodsToConveyor( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(liftSlave.getId()); |
| | | // dto.setLev(slaveOutSta.getLiftLev()); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setDevpNo(devpSlave.getId()); |
| | | // dto.setStaNo(neighborType.staNo); |
| | | // })) |
| | | // )); |
| | | // |
| | | // } |
| | | // |
| | | // shuttleNo = String.valueOf(shuttleProtocol.getShuttleNo()); |
| | | // liftNo = String.valueOf(liftProtocol.getLiftNo()); |
| | | } |
| | | // locNo |
| | | String originLoc = task.getOriginLoc(); |
| | | |
| | | assert !Cools.isEmpty(shuttleNo); |
| | | // task.setShuttleNo(Integer.parseInt(shuttleNo)); |
| | | // task.setLiftNo(Integer.parseInt(liftNo)); |
| | | // 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, task.getTaskNo()); |
| | | if (shuttleResult) { |
| | | //存在任务,禁止解析 |
| | | 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(originLoc)) |
| | | .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(); |
| | | |
| | | //穿梭车出提升机后全部待机位 |
| | | String standbyLocs = shuttleStandbyFrom.getStandbyLoc();//获取全部待机位 |
| | | |
| | | |
| | | //获取出库任务类型 |
| | | TaskCtg taskCtg = taskCtgService.getOne(new LambdaQueryWrapper<TaskCtg>() |
| | | .eq(TaskCtg::getFlag, String.valueOf(TaskCtgType.OUT)) |
| | | .eq(TaskCtg::getStatus, 1)); |
| | | if (taskCtg == null) { |
| | | return motionList; |
| | | } |
| | | //获取输送线路径 |
| | | BasConveyorPath basConveyorPath = basConveyorPathService.getOne(new LambdaQueryWrapper<BasConveyorPath>() |
| | | .eq(BasConveyorPath::getDeviceStn, task.getOriginSite()) |
| | | .eq(BasConveyorPath::getDeviceNo, liftProtocol.getLiftNo()) |
| | | .eq(BasConveyorPath::getTypeNo, taskCtg.getId())); |
| | | if (basConveyorPath == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | /** |
| | | * 出库 |
| | | * 一、出库起始层有穿梭车 |
| | | * 1.穿梭车走行至出库库位 |
| | | * 2.提升机到出库起始层 |
| | | * 3.穿梭车出库至提升机 |
| | | * 4.穿梭车离开提升机 |
| | | * 5.提升机载货移动(非必需) |
| | | * 6.输送线运输至出库口 |
| | | */ |
| | | if (Utils.getLev(shuttleLocNo) == Utils.getLev(originLoc)) { |
| | | |
| | | //穿梭车不在出库库位 |
| | | if (!shuttleLocNo.equals(task.getOriginLoc())) { |
| | | // 穿梭车走行至出库库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(originLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | } |
| | | |
| | | // 穿梭车出库顶升 |
| | | motionList.addAll(kernelService.shuttleAction( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })), |
| | | MotionCtgType.SHUTTLE_PALLET_LIFT |
| | | )); |
| | | |
| | | // 穿梭车出库至提升机待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(originLoc); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 提升机空载移动到穿梭车层 |
| | | motionList.addAll(kernelService.liftMove( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | })) |
| | | )); |
| | | |
| | | // 锁定提升机 |
| | | motionList.addAll(kernelService.liftLock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车待机位至提升机 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | )); |
| | | |
| | | // 穿梭车出库托盘下降 |
| | | motionList.addAll(kernelService.shuttleAction( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })), |
| | | MotionCtgType.SHUTTLE_PALLET_DOWN |
| | | )); |
| | | |
| | | // 穿梭车离开提升机 - 到提升机待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | )); |
| | | |
| | | // 解锁提升机 |
| | | motionList.addAll(kernelService.liftUnlock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 提升机载货移动 |
| | | motionList.addAll(kernelService.liftMoveGoods( |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(task.getOriginLoc())); |
| | | dto.setStaNo(0);//提升机内侧 |
| | | })) |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(5);//索牌项目5层是输送线层 |
| | | dto.setStaNo(1);//提升机左侧 |
| | | dto.setSync(0);//异步执行 |
| | | dto.setReleaseLift(1);//执行完成后释放提升机 |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车提升机待机位 - 到待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocs); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 输送线运输至出库口 |
| | | motionList.addAll(kernelService.conveyorOutbound( |
| | | MotionDto.build((dto -> { |
| | | dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); |
| | | dto.setStaNo(basConveyorPath.getDeviceStn()); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); |
| | | dto.setStaNo(basConveyorPath.getStnNo()); |
| | | })), |
| | | MotionCtgType.CONVEYOR_OUTBOUND |
| | | )); |
| | | |
| | | /** |
| | | * 二、出库起始层没有穿梭车 |
| | | * |
| | | * 1.提升机到穿梭车层 |
| | | * 2.穿梭车走行至提升机 |
| | | * 3.提升机载车至出库起始层 |
| | | * 4.穿梭车走行至出库库位 |
| | | * 5.穿梭车出库至提升机 |
| | | * 6.穿梭车离开提升机 |
| | | * 7.提升机载货移动(非必需) |
| | | * 8.输送线运输至出库口 |
| | | * |
| | | */ |
| | | } else { |
| | | |
| | | // 穿梭车走行至提升机库位待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 锁定目标楼层穿梭车待机位路径 |
| | | motionList.addAll(kernelService.mapLockPath( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })) |
| | | )); |
| | | |
| | | // 提升机空载移动到穿梭车层 |
| | | motionList.addAll(kernelService.liftMove( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | })) |
| | | )); |
| | | |
| | | // 锁定提升机 |
| | | motionList.addAll(kernelService.liftLock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车待机位至提升机 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | )); |
| | | |
| | | // 解锁提升机 |
| | | motionList.addAll(kernelService.liftUnlock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 提升机搬车 至 目标位置层 |
| | | motionList.addAll(kernelService.liftMoveShuttle( |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(liftLocNoFrom)); |
| | | })) |
| | | )); |
| | | |
| | | // 锁定提升机 |
| | | motionList.addAll(kernelService.liftLock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 更新小车坐标 |
| | | motionList.addAll(kernelService.shuttleUpdateLocation( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoFrom); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车走行至提升机待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | )); |
| | | |
| | | // 解锁提升机 |
| | | motionList.addAll(kernelService.liftUnlock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setReleaseLift(1);//执行完成后释放提升机 |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车提升机待机位至出库库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(originLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 穿梭车出库顶升 |
| | | motionList.addAll(kernelService.shuttleAction( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })), |
| | | MotionCtgType.SHUTTLE_PALLET_LIFT |
| | | )); |
| | | |
| | | // 穿梭车出库至提升机待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(originLoc); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 提升机空载移动到目标层 |
| | | motionList.addAll(kernelService.liftMove( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(originLoc)); |
| | | })) |
| | | )); |
| | | |
| | | // 锁定提升机 |
| | | motionList.addAll(kernelService.liftLock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车待机位至提升机 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | )); |
| | | |
| | | // 穿梭车出库托盘下降 |
| | | motionList.addAll(kernelService.shuttleAction( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })), |
| | | MotionCtgType.SHUTTLE_PALLET_DOWN |
| | | )); |
| | | |
| | | // 穿梭车离开提升机 - 到提升机待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | )); |
| | | |
| | | // 解锁提升机 |
| | | motionList.addAll(kernelService.liftUnlock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 提升机载货移动 |
| | | motionList.addAll(kernelService.liftMoveGoods( |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(task.getOriginLoc())); |
| | | dto.setStaNo(0);//提升机内侧 |
| | | })) |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(5);//索牌项目5层是输送线层 |
| | | dto.setStaNo(1);//提升机左侧 |
| | | dto.setSync(0);//异步执行 |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车提升机待机位 - 到待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocs); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_STANDBY |
| | | )); |
| | | |
| | | // 输送线运输至出库口 |
| | | motionList.addAll(kernelService.conveyorOutbound( |
| | | MotionDto.build((dto -> { |
| | | dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); |
| | | dto.setStaNo(basConveyorPath.getDeviceStn()); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setDevpNo(basConveyorPath.getDeviceId().intValue()); |
| | | dto.setStaNo(basConveyorPath.getStnNo()); |
| | | })), |
| | | MotionCtgType.CONVEYOR_OUTBOUND |
| | | )); |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | return motionList; |
| | | } |
| | |
| | | */ |
| | | public List<Motion> generateChargeMotion(Task task) { |
| | | List<Motion> motionList = new ArrayList<>(); |
| | | // if (wrkCharge.getWrkSts() != WrkMastStsType.NEW_CHARGE.sts || wrkCharge.getIoType() != WrkIoTypeType.CHARGE.sts) { |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // // locNo |
| | | // String chargeLocNo = wrkCharge.getLocNo(); |
| | | // |
| | | // // lift |
| | | // Integer transferLiftNo = 2; |
| | | // SiemensLiftThread liftThread = (SiemensLiftThread) SlaveConnection.get(SlaveType.Lift, transferLiftNo); |
| | | // LiftProtocol liftProtocol = liftThread.getLiftProtocol(); |
| | | // if (liftProtocol == null || liftProtocol.getLiftNo() == null) { |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // // shuttle |
| | | // Integer shuttleNo = wrkCharge.getShuttleNo(); |
| | | // ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo); |
| | | // ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); |
| | | // if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) { |
| | | // return motionList; |
| | | // } |
| | | // if (!shuttleProtocol.isIdle()) { |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // //检测穿梭车是否有任务绑定 |
| | | // boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleProtocol.getShuttleNo().intValue()); |
| | | // if (shuttleResult) { |
| | | // //存在任务,禁止解析 |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // //检测提升机是否有任务绑定 |
| | | // boolean liftResult = Utils.checkLiftHasBinding(transferLiftNo); |
| | | // if (liftResult) { |
| | | // //存在任务,禁止解析 |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | // |
| | | // //穿梭车到提升机库位号 |
| | | // String liftLocNoTo = LiftCodeType.getLocNo(transferLiftNo, Utils.getLev(shuttleLocNo)); |
| | | // |
| | | // //穿梭车出提升机库位号 |
| | | // String liftLocNoFrom = LiftCodeType.getLocNo(transferLiftNo, Utils.getLev(wrkCharge.getLocNo())); |
| | | // |
| | | // //穿梭车到提升机待机位库位号 |
| | | // String standbyLocNoTo = LiftCodeType.getStandbyLocNo(transferLiftNo, Utils.getLev(shuttleLocNo)); |
| | | // |
| | | // //穿梭车出提升机待机位库位号 |
| | | // String standbyLocNoFrom = LiftCodeType.getStandbyLocNo(transferLiftNo, Utils.getLev(wrkCharge.getLocNo())); |
| | | // |
| | | // // 判断穿梭车是否在充电层 |
| | | // if (Utils.getLev(shuttleLocNo) == Utils.getLev(chargeLocNo)) { |
| | | // |
| | | // // 穿梭车走行至充电桩库位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(shuttleLocNo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(chargeLocNo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE |
| | | // )); |
| | | // |
| | | // } else { |
| | | // |
| | | // // 穿梭车走行至提升机待机位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(shuttleLocNo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoTo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE |
| | | // )); |
| | | // |
| | | // // 提升机空载移动到穿梭车层 |
| | | // motionList.addAll(kernelService.liftMove( |
| | | // null |
| | | // , MotionDto.build((dto -> { |
| | | // dto.setLiftNo(transferLiftNo); |
| | | // dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | // })) |
| | | // )); |
| | | // |
| | | // // 穿梭车提升机待机位至提升机库位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoTo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(transferLiftNo); |
| | | // dto.setLocNo(liftLocNoTo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | // )); |
| | | // |
| | | // // 提升机搬车 至 输送线层 |
| | | // motionList.addAll(kernelService.liftMoveShuttle( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(transferLiftNo); |
| | | // dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setLiftNo(transferLiftNo); |
| | | // dto.setLev(Utils.getLev(chargeLocNo)); |
| | | // })) |
| | | // )); |
| | | // |
| | | // // 穿梭车提升机至提升机待机位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLiftNo(transferLiftNo); |
| | | // dto.setLocNo(liftLocNoFrom); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoFrom); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | // )); |
| | | // |
| | | // // 穿梭车提升机待机位至充电位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(standbyLocNoFrom); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(chargeLocNo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE |
| | | // )); |
| | | // |
| | | // wrkCharge.setLiftNo(transferLiftNo); |
| | | // wrkChargeMapper.updateById(wrkCharge); |
| | | // } |
| | | // |
| | | // // 穿梭车开始充电 |
| | | // motionList.addAll(kernelService.shuttleCharge( |
| | | // null, |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // })) |
| | | // )); |
| | | if (task.getTaskSts() != TaskStsType.NEW_CHARGE.sts) { |
| | | return motionList; |
| | | } |
| | | |
| | | // locNo |
| | | String chargeLocNo = 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, task.getTaskNo()); |
| | | if (shuttleResult) { |
| | | //存在任务,禁止解析 |
| | | 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(chargeLocNo)) |
| | | .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(); |
| | | |
| | | // 判断穿梭车是否在充电层 |
| | | if (Utils.getLev(shuttleLocNo) == Utils.getLev(chargeLocNo)) { |
| | | |
| | | // 穿梭车走行至充电桩库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(chargeLocNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | } else { |
| | | |
| | | // 穿梭车走行至提升机待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 提升机空载移动到穿梭车层 |
| | | motionList.addAll(kernelService.liftMove( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | })) |
| | | )); |
| | | |
| | | // 锁定提升机 |
| | | motionList.addAll(kernelService.liftLock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车提升机待机位至提升机 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | )); |
| | | |
| | | // 解锁提升机 |
| | | motionList.addAll(kernelService.liftUnlock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 提升机搬车 至 充电层 |
| | | motionList.addAll(kernelService.liftMoveShuttle( |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(chargeLocNo)); |
| | | })) |
| | | )); |
| | | |
| | | // 锁定提升机 |
| | | motionList.addAll(kernelService.liftLock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 更新小车坐标 |
| | | motionList.addAll(kernelService.shuttleUpdateLocation( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoFrom); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车提升机至提升机待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | )); |
| | | |
| | | // 解锁提升机 |
| | | motionList.addAll(kernelService.liftUnlock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(transferLiftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车提升机待机位至充电位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(chargeLocNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | } |
| | | |
| | | // 穿梭车开始充电 |
| | | motionList.addAll(kernelService.shuttleAction( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })), |
| | | MotionCtgType.SHUTTLE_CHARGE_ON |
| | | )); |
| | | |
| | | return motionList; |
| | | } |
| | |
| | | */ |
| | | public List<Motion> generateShuttleChargeWrkComplete(Task task) { |
| | | List<Motion> motionList = new ArrayList<>(); |
| | | // if (wrkCharge.getWrkSts() != WrkMastStsType.NEW_MOVE.sts || wrkCharge.getIoType() != WrkIoTypeType.MOVE.sts) { |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // // locNo |
| | | // String locNo = wrkCharge.getLocNo(); |
| | | // |
| | | // // shuttle |
| | | // Integer shuttleNo = wrkCharge.getShuttleNo(); |
| | | // ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleNo); |
| | | // ShuttleProtocol shuttleProtocol = shuttleThread.getShuttleProtocol(); |
| | | // if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) { |
| | | // return motionList; |
| | | // } |
| | | // |
| | | // String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | // |
| | | // // 判断穿梭车是否在目标层 |
| | | // if (Utils.getLev(shuttleLocNo) == Utils.getLev(locNo)) { |
| | | // |
| | | // // 穿梭车走行至目标库位 |
| | | // motionList.addAll(kernelService.shuttleMove( |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(shuttleLocNo); |
| | | // })), |
| | | // MotionDto.build((dto -> { |
| | | // dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | // dto.setLocNo(locNo); |
| | | // })), |
| | | // MotionCtgType.SHUTTLE_MOVE |
| | | // )); |
| | | // |
| | | // } |
| | | if (task.getTaskSts() != TaskStsType.NEW_MOVE.sts) { |
| | | return motionList; |
| | | } |
| | | |
| | | // locNo |
| | | String locNo = 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; |
| | | } |
| | | |
| | | String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | |
| | | // 判断穿梭车是否在目标层 |
| | | if (Utils.getLev(shuttleLocNo) == Utils.getLev(locNo)) { |
| | | |
| | | // 穿梭车关闭充电 |
| | | motionList.addAll(kernelService.shuttleAction( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | })), |
| | | MotionCtgType.SHUTTLE_CHARGE_OFF |
| | | )); |
| | | |
| | | // 穿梭车走行至目标库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(locNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | } |
| | | return motionList; |
| | | } |
| | | |
| | |
| | | // locNo |
| | | String locNo = task.getDestLoc(); |
| | | |
| | | //获取穿梭车类型 |
| | | DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>() |
| | | .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle)) |
| | | .eq(DeviceType::getStatus, 1)); |
| | | if (deviceType == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | Device device = deviceService.getOne(new LambdaQueryWrapper<Device>() |
| | | Device shuttleDevice = deviceService.getOne(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceNo, task.getShuttleNo()) |
| | | .eq(Device::getDeviceType, deviceType.getId()) |
| | | .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()) |
| | | .eq(Device::getHostId, task.getHostId()) |
| | | .eq(Device::getStatus, 1)); |
| | | if (device == null) { |
| | | if (shuttleDevice == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, device.getId().intValue()); |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttleDevice.getId().intValue()); |
| | | if (shuttleThread == null) { |
| | | return motionList; |
| | | } |
| | |
| | | // 判断穿梭车是否在目标层 |
| | | if (Utils.getLev(shuttleLocNo) == Utils.getLev(locNo)) { |
| | | |
| | | // 穿梭车走行至目标库位 |
| | | if (!shuttleLocNo.equals(locNo)) {//小车不在目标库位 |
| | | // 穿梭车走行至目标库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(locNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | } |
| | | |
| | | } else { |
| | | //小车跨层 |
| | | |
| | | //获取距离目标位置最近的空闲可换层提升机 |
| | | LiftThread liftThread = liftDispatcher.searchIdleLift(locNo, task.getHostId(), true); |
| | | if (liftThread == null) { |
| | | return motionList; |
| | | } |
| | | Device liftDevice = liftThread.getDevice(); |
| | | |
| | | //穿梭车到提升机库位号 |
| | | String liftLocNoTo = liftDispatcher.getLiftLocNo(liftThread, Utils.getLev(shuttleLocNo)); |
| | | |
| | | //穿梭车出提升机库位号 |
| | | String liftLocNoFrom = liftDispatcher.getLiftLocNo(liftThread, Utils.getLev(task.getDestLoc())); |
| | | |
| | | //穿梭车到提升机待机位库位号 |
| | | String standbyLocNoTo = liftDispatcher.getLiftStandByLocNo(liftThread, Utils.getLev(shuttleLocNo)); |
| | | |
| | | //穿梭车出提升机待机位库位号 |
| | | String standbyLocNoFrom = liftDispatcher.getLiftStandByLocNo(liftThread, Utils.getLev(task.getDestLoc())); |
| | | |
| | | |
| | | // 穿梭车走行至提升机库位待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 锁定目标楼层穿梭车待机位路径 |
| | | motionList.addAll(kernelService.mapLockPath( |
| | | null, |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })) |
| | | )); |
| | | |
| | | // 提升机空载移动到穿梭车层 |
| | | motionList.addAll(kernelService.liftMove( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | })) |
| | | )); |
| | | |
| | | // 锁定提升机 |
| | | motionList.addAll(kernelService.liftLock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车待机位至提升机 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoTo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoTo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_TO_LIFT |
| | | )); |
| | | |
| | | // 向提升机发送小车已到位信号 |
| | | motionList.addAll(kernelService.liftShuttleArrival( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 解锁提升机 |
| | | motionList.addAll(kernelService.liftUnlock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 提升机搬车 至 目标位置层 |
| | | motionList.addAll(kernelService.liftMoveShuttle( |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(shuttleLocNo)); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | dto.setLev(Utils.getLev(locNo)); |
| | | })) |
| | | )); |
| | | |
| | | // 锁定提升机 |
| | | motionList.addAll(kernelService.liftLock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 更新小车坐标 |
| | | motionList.addAll(kernelService.shuttleUpdateLocation( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoFrom); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车走行至提升机待机位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | dto.setLocNo(liftLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE_FROM_LIFT |
| | | )); |
| | | |
| | | // 解锁提升机 |
| | | motionList.addAll(kernelService.liftUnlock( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | })) |
| | | )); |
| | | |
| | | // 穿梭车提升机待机位至目标位置 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLiftNo(liftDevice.getId().intValue()); |
| | | dto.setLocNo(standbyLocNoFrom); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(locNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | } |
| | | return motionList; |
| | | } |
| | | /** |
| | | * 生成小车载货迁移动作 |
| | | */ |
| | | public List<Motion> generateShuttleLadenMoveMotion(Task task) { |
| | | List<Motion> motionList = new ArrayList<>(); |
| | | if (task.getTaskSts() != TaskStsType.NEW_LADEN_MOVE.sts) { |
| | | return motionList; |
| | | } |
| | | //originLoc 源库位 |
| | | String originLoc = task.getOriginLoc(); |
| | | // locNo 目标库位 |
| | | String locNo = task.getDestLoc(); |
| | | |
| | | 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()); |
| | | if (shuttleThread == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | ShuttleProtocol shuttleProtocol = shuttleThread.getStatus(); |
| | | if (shuttleProtocol == null || shuttleProtocol.getShuttleNo() == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | |
| | | // 判断穿梭车是否在目标层 |
| | | if (Utils.getLev(shuttleLocNo) == Utils.getLev(locNo)) { |
| | | |
| | | if (!shuttleLocNo.equals(locNo)) {//小车不在目标库位 |
| | | // 穿梭车走行至源库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(originLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | // 穿梭车顶升 |
| | | motionList.add(Motion.build(motion -> { |
| | | motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val()); |
| | | motion.setDevice(String.valueOf(shuttleDevice.getId())); |
| | | motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_LIFT.val()); |
| | | })); |
| | | |
| | | // 穿梭车走行至目标库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(originLoc); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleDevice.getId().intValue()); |
| | | dto.setLocNo(locNo); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | //穿梭车托盘下降 |
| | | motionList.add(Motion.build(motion -> { |
| | | motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val()); |
| | | motion.setDevice(String.valueOf(shuttleDevice.getId())); |
| | | motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_DOWN.val()); |
| | | })); |
| | | |
| | | } |
| | | |
| | | } else { |
| | | //小车跨层 |
| | | } |
| | | return motionList; |
| | | } |
| | |
| | | return motionList; |
| | | } |
| | | |
| | | String sourceLoc = task.getOriginLoc();//源库位 |
| | | String targetLoc = task.getDestLoc();//任务目标(借用字段) |
| | | String targetSite = task.getDestSite();//任务类型(借用字段) |
| | | |
| | | //获取穿梭车类型 |
| | | DeviceType deviceType = deviceTypeService.getOne(new LambdaQueryWrapper<DeviceType>() |
| | | .eq(DeviceType::getFlag, String.valueOf(SlaveType.Shuttle)) |
| | | .eq(DeviceType::getStatus, 1)); |
| | | if (deviceType == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | Device device = deviceService.getOne(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceNo, task.getShuttleNo()) |
| | | .eq(Device::getDeviceType, deviceType.getId()) |
| | | .eq(Device::getDeviceType, DeviceCtgType.SHUTTLE.val()) |
| | | .eq(Device::getHostId, task.getHostId()) |
| | | .eq(Device::getStatus, 1)); |
| | | if (device == null) { |
| | |
| | | // 穿梭车走行至目标库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | dto.setShuttleNo(device.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(shuttleProtocol.getShuttleNo().intValue()); |
| | | dto.setShuttleNo(device.getId().intValue()); |
| | | dto.setLocNo(targetLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | |
| | | //托盘顶升 |
| | | motionList.add(Motion.build(motion -> { |
| | | motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val()); |
| | | motion.setDevice(String.valueOf(task.getShuttleNo())); |
| | | motion.setDevice(String.valueOf(device.getId())); |
| | | motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_LIFT.val()); |
| | | })); |
| | | } else if (targetSite.equals("palletDown")) { |
| | | //托盘下降 |
| | | motionList.add(Motion.build(motion -> { |
| | | motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val()); |
| | | motion.setDevice(String.valueOf(task.getShuttleNo())); |
| | | motion.setDevice(String.valueOf(device.getId())); |
| | | motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_DOWN.val()); |
| | | })); |
| | | } else if (targetSite.equals("chargeOpen")) { |
| | | //充电开 |
| | | motionList.add(Motion.build(motion -> { |
| | | motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val()); |
| | | motion.setDevice(String.valueOf(task.getShuttleNo())); |
| | | motion.setDevice(String.valueOf(device.getId())); |
| | | motion.setMotionCtg(MotionCtgType.SHUTTLE_CHARGE_ON.val()); |
| | | })); |
| | | } else if (targetSite.equals("chargeClose")) { |
| | | //充电关 |
| | | motionList.add(Motion.build(motion -> { |
| | | motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val()); |
| | | motion.setDevice(String.valueOf(task.getShuttleNo())); |
| | | motion.setDevice(String.valueOf(device.getId())); |
| | | motion.setMotionCtg(MotionCtgType.SHUTTLE_CHARGE_OFF.val()); |
| | | })); |
| | | } else if (targetSite.equals("reset")) { |
| | | //复位 |
| | | } else if (targetSite.equals("takeMove")) { |
| | | //取放货 |
| | | String shuttleLocNo = shuttleProtocol.getCurrentLocNo(); |
| | | |
| | | // 判断穿梭车是否在目标层 |
| | | if (Utils.getLev(shuttleLocNo) == Utils.getLev(targetLoc)) { |
| | | |
| | | if (!shuttleLocNo.equals(sourceLoc)) {//小车不在目标库位 |
| | | // 穿梭车走行至源库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(device.getId().intValue()); |
| | | dto.setLocNo(shuttleLocNo); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(device.getId().intValue()); |
| | | dto.setLocNo(sourceLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | } |
| | | |
| | | //托盘顶升 |
| | | motionList.add(Motion.build(motion -> { |
| | | motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val()); |
| | | motion.setDevice(String.valueOf(device.getId())); |
| | | motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_LIFT.val()); |
| | | })); |
| | | |
| | | // 穿梭车走行至目标库位 |
| | | motionList.addAll(kernelService.shuttleMove( |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(device.getId().intValue()); |
| | | dto.setLocNo(sourceLoc); |
| | | })), |
| | | MotionDto.build((dto -> { |
| | | dto.setShuttleNo(device.getId().intValue()); |
| | | dto.setLocNo(targetLoc); |
| | | })), |
| | | MotionCtgType.SHUTTLE_MOVE |
| | | )); |
| | | |
| | | //托盘下降 |
| | | motionList.add(Motion.build(motion -> { |
| | | motion.setDeviceCtg(DeviceCtgType.SHUTTLE.val()); |
| | | motion.setDevice(String.valueOf(device.getId())); |
| | | motion.setMotionCtg(MotionCtgType.SHUTTLE_PALLET_DOWN.val()); |
| | | })); |
| | | |
| | | } |
| | | } |
| | | |
| | | return motionList; |
| | | } |
| | | |
| | | /** |
| | | * 生成提升机手动动作 |
| | | */ |
| | | public List<Motion> generateLiftManualMotion(Task task) { |
| | | List<Motion> motionList = new ArrayList<>(); |
| | | if (task.getTaskSts() != TaskStsType.NEW_MANUAL.sts) { |
| | | return motionList; |
| | | } |
| | | |
| | | Device device = deviceService.getOne(new LambdaQueryWrapper<Device>() |
| | | .eq(Device::getDeviceNo, task.getLiftNo()) |
| | | .eq(Device::getDeviceType, DeviceCtgType.LIFT.val()) |
| | | .eq(Device::getHostId, task.getHostId()) |
| | | .eq(Device::getStatus, 1)); |
| | | if (device == null) { |
| | | return motionList; |
| | | } |
| | | |
| | | if (task.getDestSite().equals("move")) { |
| | | //提升机升降楼层 |
| | | |
| | | // 提升机空载移动到穿梭车层 |
| | | motionList.addAll(kernelService.liftMove( |
| | | null |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(device.getId().intValue()); |
| | | dto.setLev(Integer.parseInt(task.getDestLoc())); |
| | | })) |
| | | )); |
| | | |
| | | } else if (task.getDestSite().equals("movePallet")) { |
| | | //移动托盘 |
| | | |
| | | // 提升机移动托盘 |
| | | motionList.addAll(kernelService.liftMoveGoods( |
| | | MotionDto.build((dto -> { |
| | | dto.setLiftNo(device.getId().intValue()); |
| | | dto.setLev(Integer.parseInt(task.getOriginLoc())); |
| | | dto.setStaNo(Integer.parseInt(task.getOriginSite())); |
| | | })) |
| | | , MotionDto.build((dto -> { |
| | | dto.setLiftNo(device.getId().intValue()); |
| | | dto.setLev(Integer.parseInt(task.getDestLoc())); |
| | | dto.setStaNo(Integer.parseInt(task.getDestSite())); |
| | | })) |
| | | )); |
| | | |
| | | } |
| | | |
| | | return motionList; |