zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/action/LiftAction.java
@@ -104,7 +104,8 @@ LiftCommand command = commands.get(commandStep - 1); if (command.getMode() == LiftCommandModeType.MOVE.id) { //提升机升降 if (liftProtocol.getLev() == command.getTargetLev()) { Integer target = liftDispatcher.getLiftLevLogic(liftThread.getDevice().getId().intValue(), command.getTargetLev()); if (liftProtocol.getLev() == target) { command.setComplete(true); } } else if (command.getMode() == LiftCommandModeType.MOVE_CAR.id) { zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/AnalyzeService.java
@@ -153,8 +153,9 @@ dto.setLiftNo(transferLiftDevice.getId().intValue()); dto.setLev(Utils.getLev(task.getDestLoc())); dto.setStaNo(Integer.parseInt(task.getDestSite())); dto.setReleaseLift(1);//执行完成后释放提升机 })) // dto.setReleaseLift(1);//执行完成后释放提升机 })), MotionCtgType.LIFT_WITH_GOODS_IN )); // 穿梭车走行至提升机库位 @@ -191,6 +192,7 @@ dto.setShuttleDevice(shuttleDevice); dto.setLiftNo(transferLiftDevice.getId().intValue()); dto.setLocNo(standbyLocNoTo); dto.setReleaseLift(1);//执行完成后释放提升机 })), MotionCtgType.SHUTTLE_TRANSPORT )); @@ -262,11 +264,6 @@ return motionList; } BasConveyorSta basConveyorStaOrigin = basConveyorStaService.selectBySiteNo(task.getOriginSite()); if (basConveyorStaOrigin == null) { return motionList; } //检测穿梭车是否有任务绑定 boolean shuttleResult = Utils.checkShuttleHasBinding(shuttleDevice, task.getTaskNo()); if (shuttleResult) { @@ -286,22 +283,14 @@ //穿梭车进提升机待机位库位号 输送线位置 String standbyLocNoTo = shuttleStandbyTo.getDeviceStandbyLoc(); //穿梭车换层时待机位置 使用表列 memo数据 String standbyLocNoMemo = shuttleStandbyTo.getMemo(); //穿梭车待机位置 使用表列 String standbyLocNoList = shuttleStandbyTo.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; } @@ -371,15 +360,16 @@ dto.setLocNo(standbyLocNoTo); dto.setStaNo(getStaByLev(Utils.getLev(task.getOriginLoc())));//输送站 })), MotionCtgType.SHUTTLE_TRANSPORT_TO_CONVEYOR MotionCtgType.SHUTTLE_TRANSPORT )); Integer liftLevLogic = liftDispatcher.getLiftLevOffset(transferLiftDevice.getId().intValue(), Utils.getLev(originLoc)); // 提升机空载移动到出库层 motionList.addAll(kernelService.liftMove( null , MotionDto.build((dto -> { dto.setLiftNo(transferLiftDevice.getId().intValue()); dto.setLev(Utils.getLev(originLoc)); dto.setLev(liftLevLogic); })) )); @@ -415,8 +405,8 @@ MotionDto.build((dto -> { dto.setShuttleNo(shuttleDevice.getId().intValue()); dto.setShuttleDevice(shuttleDevice); dto.setLocNo(standbyLocNoTo); dto.setSync(0);//异步执行 dto.setLocNo(standbyLocNoList); // dto.setSync(0);//异步执行 dto.setReleaseShuttle(1);//执行完成后释放小车 })), MotionCtgType.SHUTTLE_MOVE_STANDBY @@ -432,9 +422,9 @@ , MotionDto.build((dto -> { dto.setLiftNo(transferLiftDevice.getId().intValue()); dto.setStaNo(Integer.parseInt(task.getDestSite()));//出库站点 dto.setDevpNo(basConveyorStaOrigin.getConveyorDeviceId().intValue()); dto.setReleaseLift(1);//执行完成后释放提升机 })) })), MotionCtgType.LIFT_WITH_GOODS_OUT )); } @@ -597,6 +587,14 @@ return motionList;//未分析成功 } //获取小车待机库位 ==> 进提升机 ShuttleStandby shuttleStandbyTo = shuttleStandbyService.getOne(new LambdaQueryWrapper<ShuttleStandby>() .eq(ShuttleStandby::getDeviceLev, Utils.getLev(shuttleLocNo)) .eq(ShuttleStandby::getStatus, 1)); //穿梭车待机位置 使用表列 String standbyLocNoList = shuttleStandbyTo.getStandbyLoc(); String standbyLocNo; if (originSite == 1015) { standbyLocNo = "1200101"; @@ -686,8 +684,8 @@ MotionDto.build((dto -> { dto.setShuttleNo(shuttleDevice.getId().intValue()); dto.setShuttleDevice(shuttleDevice); dto.setLocNo(standbyLocNo); dto.setSync(0);//异步执行 dto.setLocNo(standbyLocNoList); // dto.setSync(0);//异步执行 dto.setReleaseShuttle(1);//执行完成后释放小车 })), MotionCtgType.SHUTTLE_MOVE_STANDBY @@ -1213,12 +1211,13 @@ if (destSite.equals("move")) { //提升机升降楼层 Integer liftLevLogic = liftDispatcher.getLiftLevOffset(device.getId().intValue(), Integer.parseInt(task.getDestLoc())); // 提升机空载移动到穿梭车层 motionList.addAll(kernelService.liftMove( null , MotionDto.build((dto -> { dto.setLiftNo(device.getId().intValue()); dto.setLev(Integer.parseInt(task.getDestLoc())); dto.setLev(liftLevLogic); })) )); @@ -1230,19 +1229,23 @@ return motionList; } Integer originLev = liftDispatcher.getLiftLevOffset(device.getId().intValue(), Utils.getLev(basConveyorStaOrigin.getLocNo())); Integer targetLev = liftDispatcher.getLiftLevOffset(device.getId().intValue(), Utils.getLev(basConveyorStaDest.getLocNo())); // 提升机移动托盘 motionList.addAll(kernelService.liftMoveGoods( MotionDto.build((dto -> { dto.setLiftNo(device.getId().intValue()); dto.setLev(Utils.getLev(basConveyorStaOrigin.getLocNo())); dto.setLev(originLev); dto.setStaNo(Integer.parseInt(task.getOriginSite())); })) , MotionDto.build((dto -> { dto.setLiftNo(device.getId().intValue()); dto.setLev(Utils.getLev(basConveyorStaDest.getLocNo())); dto.setLev(targetLev); dto.setDevpNo(basConveyorStaDest.getConveyorDeviceId().intValue()); dto.setStaNo(Integer.parseInt(task.getDestSite())); })) })), MotionCtgType.LIFT_WITH_GOODS )); } else if (destSite.equals("lock")) { zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/KernelService.java
@@ -85,7 +85,7 @@ /** * 提升机载货移动 */ public List<Motion> liftMoveGoods(MotionDto origin, MotionDto target) { public List<Motion> liftMoveGoods(MotionDto origin, MotionDto target, MotionCtgType type) { List<Motion> motionList = new ArrayList<>(); motionList.add(Motion.build(motion -> { @@ -93,6 +93,9 @@ motion.setDevice(String.valueOf(target.getLiftNo())); motion.setMotionCtg(MotionCtgType.LIFT_WITH_GOODS.val()); if (type != null) { motion.setMotionCtg(type.val()); } if (null != origin) { // motion.setOrigin(String.valueOf(liftDispatcher.getLiftLevOffset(target.getLiftNo(), origin.getLev()))); zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/kernel/command/LiftCommandService.java
@@ -140,6 +140,40 @@ motionService.updateById(motion); return liftAction.assignWork(liftThread.getDevice(), assignCommand); case LIFT_WITH_GOODS_IN: //判断提升机是否自动 if (!liftThread.isIdle()) { return false; } if (liftProtocol.getHasTray()) { return false; } command = liftThread.getPalletInOutCommand(assignCommand.getDeviceTaskNo(), Integer.parseInt(motion.getOrigin()), Integer.parseInt(motion.getTarget()), motion.getOriDrt(), motion.getTarDrt(), task.getTaskSts() < 100 ? LiftCommandModeType.PALLET_IN : LiftCommandModeType.PALLET_OUT); list.addAll(command); motion.setTemp(String.valueOf(assignCommand.getDeviceTaskNo())); motion.setUpdateTime(new Date()); motionService.updateById(motion); return liftAction.assignWork(liftThread.getDevice(), assignCommand); case LIFT_WITH_GOODS_OUT: //判断提升机是否自动 if (!liftThread.isIdle()) { return false; } if (!liftProtocol.getHasTray()) { return false; } command = liftThread.getPalletInOutCommand(assignCommand.getDeviceTaskNo(), Integer.parseInt(motion.getOrigin()), Integer.parseInt(motion.getTarget()), motion.getOriDrt(), motion.getTarDrt(), task.getTaskSts() < 100 ? LiftCommandModeType.PALLET_IN : LiftCommandModeType.PALLET_OUT); list.addAll(command); motion.setTemp(String.valueOf(assignCommand.getDeviceTaskNo())); motion.setUpdateTime(new Date()); motionService.updateById(motion); return liftAction.assignWork(liftThread.getDevice(), assignCommand); case LIFT_WITH_SHUTTLE: //判断提升机是否自动 if (!liftThread.isIdle()) { @@ -226,7 +260,7 @@ return false; } if (!liftProtocol.getLev().equals(Integer.valueOf(motion.getTarget()))) { if (!liftProtocol.getLev().equals(liftDispatcher.getLiftLevLogic(liftThread.getDevice().getId().intValue(), Integer.valueOf(motion.getTarget())))) { return false; } @@ -250,10 +284,10 @@ return false; } //判断提升机托盘是否存在 if (!liftProtocol.getHasTray()) { return false; } // //判断提升机托盘是否存在 // if (!liftProtocol.getHasTray()) { // return false; // } // //判断目标站是否有托盘 // Integer conveyorDeviceId = Integer.parseInt(motion.getDockNo()); @@ -293,6 +327,54 @@ } break; case LIFT_WITH_GOODS_IN: // 判断提升机是否空闲 if (!liftThread.isIdle()) { return false; } if (!liftProtocol.getLev().equals(liftDispatcher.getLiftLevLogic(liftThread.getDevice().getId().intValue(), Integer.valueOf(motion.getTarget())))) { return false; } //判断提升机托盘是否存在 if (!liftProtocol.getHasTray()) { return false; } if (motion.getReleaseLift() == 1) {//释放提升机 task.setLiftNo(0); task.setUpdateTime(new Date()); if (!taskService.updateById(task)) { return false; } } break; case LIFT_WITH_GOODS_OUT: // 判断提升机是否空闲 if (!liftThread.isIdle()) { return false; } if (!liftProtocol.getLev().equals(liftDispatcher.getLiftLevLogic(liftThread.getDevice().getId().intValue(), Integer.valueOf(motion.getTarget())))) { return false; } //判断提升机托盘是否存在 if (liftProtocol.getHasTray()) { return false; } if (motion.getReleaseLift() == 1) {//释放提升机 task.setLiftNo(0); task.setUpdateTime(new Date()); if (!taskService.updateById(task)) { return false; } } break; case LIFT_WITH_SHUTTLE: // 判断提升机是否空闲 if (!liftThread.isIdle()) { zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/model/enums/MotionCtgType.java
@@ -23,6 +23,8 @@ // 提升机 -------------------------------------------- LIFT_MOVE(LIFT), LIFT_WITH_GOODS(LIFT), LIFT_WITH_GOODS_IN(LIFT), LIFT_WITH_GOODS_OUT(LIFT), LIFT_WITH_SHUTTLE(LIFT), LIFT_WITH_GOODS_AND_SHUTTLE(LIFT), LIFT_TRANSPORT_TO_CONVEYOR(LIFT), zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/service/impl/MainServiceImpl.java
@@ -489,9 +489,10 @@ // 判断是否满足入库条件 if (staProtocol.isAutoing() && staProtocol.isLoading() && staProtocol.isInEnable() && (workNo >= 0) && staProtocol.isPakMk() // && staProtocol.isPakMk() ) { Task task = taskService.getOne(new LambdaQueryWrapper<Task>() @@ -671,40 +672,26 @@ } for (Task task : tasks) { BasConveyorSta originStaObj = basConveyorStaService.selectBySiteNo(task.getOriginSite());//获取源站 if (originStaObj == null) { BasConveyorSta destStaObj = basConveyorStaService.selectBySiteNo(task.getDestSite());//获取目标站 if (destStaObj == null) { continue; } BasConveyor basConveyor = basConveyorService.getById(originStaObj.getConveyorId()); BasConveyor basConveyor = basConveyorService.getById(destStaObj.getConveyorId()); if(basConveyor == null) { continue; } DevpThread devpThread = (DevpThread) SlaveConnection.get(SlaveType.Conveyor, basConveyor.getDeviceId().intValue()); StaProtocol staProtocol = devpThread.getStation().get(Integer.parseInt(task.getOriginSite()));//源站 // StaProtocol staProtocol1 = devpThread.getStation().get(Integer.parseInt(task.getDestSite()));//目标站 StaProtocol staProtocol = devpThread.getStation().get(Integer.parseInt(task.getDestSite()));//目标站 if (staProtocol == null) { continue; } else { staProtocol = staProtocol.clone(); // staProtocol1 = staProtocol1.clone(); } // 判断出库站状态 if (staProtocol.isAutoing() && !staProtocol.isLoading() && staProtocol.getWorkNo() == 0 && staProtocol.isOutEnable()) { // if (!(staProtocol1.isAutoing() && !staProtocol1.isLoading() && staProtocol1.getWorkNo() == 0 && staProtocol1.isOutEnable())) { // continue; // } // //同库位组校验 // List<String> outerLoc = Utils.getGroupOuterLoc(wrkMast.getSourceLocNo()); // List<LocMast> outerLocMasts = locMastService.selectNotEmptyLocNos(outerLoc); // if (!outerLocMasts.isEmpty()) { // News.info("{}任务,浅库位存在货物,系统等待中", wrkMast.getWrkNo()); // continue;//浅库位存在未执行任务 // } if (Cools.isEmpty(task.getShuttleNo())) { //分配小车 //搜索空闲车 @@ -725,7 +712,7 @@ // generate motion list List<Motion> motionList = analyzeService.generateMotion(task); if (Cools.isEmpty(motionList)) { log.error("出库 ===>> 暂时没有空闲小车, 任务号={}", task.getTaskNo()); log.error("出库 ===>> 任务解析失败, 任务号={}", task.getTaskNo()); continue; } motionService.batchInsert(motionList, task.getUuid(), Integer.valueOf(task.getTaskNo()), task.getHostId()); zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/timer/TaskTimer.java
@@ -102,10 +102,10 @@ if(task.getTaskSts().equals(TaskStsType.COMPLETE_INBOUND.sts) || task.getTaskSts().equals(TaskStsType.COMPLETE_OUTBOUND.sts) || task.getTaskSts().equals(TaskStsType.COMPLETE_LADEN_MOVE.sts)){ boolean httpRequest = doHttpRequest(task, wmsUrl, "/open/asrs/wrkMast/finish/v1"); if (!httpRequest) { continue; } // boolean httpRequest = doHttpRequest(task, wmsUrl, "/open/asrs/wrkMast/finish/v1"); // if (!httpRequest) { // continue; // } } } zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/LiftDispatcher.java
@@ -216,7 +216,7 @@ } List<BasLiftLevOffsetDto> levOffsetDtos = JSON.parseArray(basLift.getLevOffset(), BasLiftLevOffsetDto.class); for (BasLiftLevOffsetDto offsetDto : levOffsetDtos) { if (lev == offsetDto.getLogicLev()) { if (lev.equals(offsetDto.getLogicLev())) { return offsetDto.getRealLev(); } } @@ -232,7 +232,7 @@ } List<BasLiftLevOffsetDto> levOffsetDtos = JSON.parseArray(basLift.getLevOffset(), BasLiftLevOffsetDto.class); for (BasLiftLevOffsetDto offsetDto : levOffsetDtos) { if (lev == offsetDto.getRealLev()) { if (lev.equals(offsetDto.getRealLev())) { return offsetDto.getLogicLev(); } } zy-asrs-wcs/src/main/java/com/zy/asrs/wcs/core/utils/ShuttleDispatcher.java
@@ -112,6 +112,10 @@ } if (resThread != null) { if (resThread.getStatus().getCurrentLocNo().equals(locNo)) { return resThread.getDevice(); } Task result = generateMoveTask(resThread.getDevice(), locNo); if (result != null) { return resThread.getDevice(); @@ -142,6 +146,10 @@ continue; } if (shuttleProtocol.getCurrentLocNo() == null) { continue; } int shuttleLev = Utils.getLev(shuttleProtocol.getCurrentLocNo()); if (shuttleLev == lev) { currentLevDevices.add(device);