| | |
| | | BasDevp basDevp = basDevpService.queryByLocNo(liftSiteLocNo); |
| | | Short endStartCode = Short.parseShort(basDevp.getQrCodeValue());//站点二维码 |
| | | |
| | | String disLocNo = "190020" + Utils.getLev(liftSiteLocNo);//避让位置 |
| | | String disLocNo = "200020" + Utils.getLev(liftSiteLocNo);//避让位置 |
| | | LocMast locMast1 = locMastService.queryByLoc(disLocNo); |
| | | if (locMast1 == null) { |
| | | continue;//找不到库位 |
| | | } |
| | | short disCode = Short.parseShort(locMast1.getQrCodeValue()); |
| | | //任务执行完后,小车进入移开提升机口站点位置,以免坠落 |
| | | ShuttleCommand moveCommand = shuttleThread.getMoveCommand(endStartCode, disCode, 1400, ShuttleRunDirection.BOTTOM.id, endStartCode, 1400, 500); |
| | | ShuttleCommand moveCommand = shuttleThread.getMoveCommand(endStartCode, disCode, 2800, ShuttleRunDirection.BOTTOM.id, endStartCode, 2800, 1000); |
| | | commands.add(moveCommand); |
| | | |
| | | //分配目标库位 |
| | |
| | | BasDevp basDevp = basDevpService.queryByLocNo(liftSiteLocNo); |
| | | Short endStartCode = Short.parseShort(basDevp.getQrCodeValue());//站点二维码 |
| | | |
| | | String disLocNo = "190020" + Utils.getLev(liftSiteLocNo);//避让位置 |
| | | String disLocNo = "200020" + Utils.getLev(liftSiteLocNo);//避让位置 |
| | | LocMast locMast1 = locMastService.queryByLoc(disLocNo); |
| | | if (locMast1 == null) { |
| | | continue;//找不到库位 |
| | | } |
| | | short disCode = Short.parseShort(locMast1.getQrCodeValue()); |
| | | //任务执行完后,小车进入移开提升机口站点位置,以免坠落 |
| | | ShuttleCommand moveCommand2 = shuttleThread.getMoveCommand(endStartCode, disCode, 1400, ShuttleRunDirection.BOTTOM.id, endStartCode, 1400, 500); |
| | | ShuttleCommand moveCommand2 = shuttleThread.getMoveCommand(endStartCode, disCode, 2800, ShuttleRunDirection.BOTTOM.id, endStartCode, 2800, 1000); |
| | | |
| | | List<ShuttleCommand> commands = this.shuttleAssignCommand(liftSiteLocNo, wrkMast.getSourceLocNo(), liftSiteLocNo, assignCommand, shuttleThread); |
| | | if (commands == null) { |
| | |
| | | ArrayList<ShuttleThread> sameLev = new ArrayList<>();//相同楼层的穿梭车 |
| | | ArrayList<ShuttleThread> diffLev = new ArrayList<>();//不同楼层的穿梭车 |
| | | |
| | | //判断其他空闲穿梭车是否离任务最近 |
| | | String distLocNo = null;//目标地点,入库=》提升机口,出库=》货物库位号 |
| | | if (wrkMast.getIoType() < 101) { |
| | | //入库 |
| | | distLocNo = Utils.levToOutInStaLocNo(lev); |
| | | }else { |
| | | //出库 |
| | | distLocNo = locNo; |
| | | } |
| | | |
| | | for (ShuttleSlave shuttle : slaveProperties.getShuttle()) { |
| | | //获取四向穿梭车线程 |
| | | ShuttleThread shuttleThread = (ShuttleThread) SlaveConnection.get(SlaveType.Shuttle, shuttle.getId()); |
| | |
| | | if (shuttleLocNo == null) { |
| | | continue; |
| | | } |
| | | |
| | | if (shuttleLocNo.equals(distLocNo)) { |
| | | //车辆当前位置已经是目标库位,无需计算 |
| | | map.put("sameLay", true);//同层 |
| | | map.put("result", shuttleThread); |
| | | return map; |
| | | } |
| | | |
| | | int shuttleLocNoLey = Utils.getLev(shuttleLocNo);//库位号对应层高 |
| | | if (lev == shuttleLocNoLey) { |
| | | //工作档楼层相同的穿梭车 |
| | |
| | | for (ShuttleThread shuttleThread : sameLev) { |
| | | if (recentShuttle == null) {//最近穿梭车为空,则默认赋予为最近穿梭车 |
| | | recentShuttle = shuttleThread; |
| | | } |
| | | |
| | | //判断其他空闲穿梭车是否离任务最近 |
| | | String distLocNo = null;//目标地点,入库=》提升机口,出库=》货物库位号 |
| | | if (wrkMast.getIoType() < 101) { |
| | | //入库 |
| | | distLocNo = Utils.levToOutInStaLocNo(lev); |
| | | }else { |
| | | //出库 |
| | | distLocNo = locNo; |
| | | } |
| | | |
| | | //当前穿梭车库位号 |
| | |
| | | } |
| | | if (liftProtocol.getPlatShuttleCheck()) { |
| | | //提升机此时有四向车,可能有未完成的任务,禁止分配新任务 |
| | | continue; |
| | | } |
| | | |
| | | //获取目标站 |
| | | StaProtocol staProtocol = devpThread.getStation().get(wrkMast.getStaNo()); |
| | | if (staProtocol.isLoading() || !staProtocol.isInEnable()) {//目标站有物,不可入,禁止分配任务 |
| | | continue; |
| | | } |
| | | |
| | |
| | | && !liftProtocol.getRunning() |
| | | ) { |
| | | |
| | | //标记复位 |
| | | liftProtocol.setPakMk(true); |
| | | |
| | | DevpThread devpThread = null; |
| | | Integer devpId = null; |
| | | for (DevpSlave devp : slaveProperties.getDevp()){ |
| | |
| | | //将任务档标记为完成 |
| | | WrkMast wrkMast = wrkMastMapper.selectByWorkNo372428(liftProtocol.getTaskNo().intValue()); |
| | | if (wrkMast != null) { |
| | | //判断提升机是否到达任务楼层 |
| | | String locNo = wrkMast.getIoType() < 101 ? wrkMast.getLocNo() : wrkMast.getSourceLocNo(); |
| | | int lev = Utils.getLev(locNo);//任务目标楼层 |
| | | |
| | | //标记复位 |
| | | liftProtocol.setPakMk(true); |
| | | |
| | | switch (wrkMast.getWrkSts().intValue()) { |
| | | case 3://3.提升机搬运中 ==> 4.提升机搬运完成 |
| | | if (liftProtocol.getLev().intValue() != lev) { |
| | | continue;//提升机没有到达目标 |
| | | } |
| | | //给目标站设置工作号 |
| | | StaProtocol staProtocol = devpThread.getStation().get(wrkMast.getStaNo());//目标站 |
| | | staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue()); |
| | |
| | | if (!result) { |
| | | throw new CoolException("更新plc站点信息失败"); |
| | | } |
| | | //任务号清零 |
| | | liftProtocol.setTaskNo((short) 0); |
| | | wrkMast.setWrkSts(4L); |
| | | break; |
| | | case 7://7.提升机迁移小车中 ==> 8.提升机迁移小车完成 |
| | | if (liftProtocol.getLev().intValue() != lev) { |
| | | continue;//提升机没有到达目标 |
| | | } |
| | | wrkMast.setWrkSts(8L); |
| | | break; |
| | | case 24://24.提升机迁移小车中 ==> 25.提升机迁移小车完成 |
| | | if (liftProtocol.getLev().intValue() != lev) { |
| | | continue;//提升机没有到达目标 |
| | | } |
| | | wrkMast.setWrkSts(25L); |
| | | break; |
| | | case 28://28.提升机搬运中 ==> 29.提升机搬运完成 |
| | | if (liftProtocol.getPositionArrivalFeedback().intValue() != 2) { |
| | | continue;//提升机是否达到输送线楼层 |
| | | } |
| | | wrkMast.setWrkSts(29L); |
| | | wrkMast.setWrkSts(34L);//34.出库完成,暂时先直接完成出库工作档,后续需要根据输送线给出的状态来确定34.出库完成状态 |
| | | //任务号清零 |
| | |
| | | //查询是否有充电任务 |
| | | WrkCharge wrkCharge = wrkChargeMapper.selectByWorkNo(liftProtocol.getTaskNo().intValue()); |
| | | if (wrkCharge != null) { |
| | | //标记复位 |
| | | liftProtocol.setPakMk(true); |
| | | |
| | | switch (wrkCharge.getWrkSts().intValue()) { |
| | | case 54://提升机搬运中 |
| | | wrkCharge.setWrkSts(55L);//提升机搬运完成 |