| | |
| | | param.setBarcode(barcode); |
| | | param.setIoType(1); |
| | | param.setSourceStaNo(inSta.getStaNo()); |
| | | // param.setLocType1(locTypeDto.getLocType1()); |
| | | param.setLocType1(locTypeDto.getLocType1()); |
| | | String response = new HttpHandler.Builder() |
| | | .setUri(wmsUrl) |
| | | .setPath("/rpc/pakin/loc/v1") |
| | |
| | | } |
| | | if (staProtocol.isAutoing() |
| | | && staProtocol.isLoading() |
| | | && (staProtocol.getWorkNo() > 0 && staProtocol.getWorkNo() < 9999) |
| | | && staProtocol.getStaNo().equals(staProtocol.getSiteId().shortValue()) |
| | | // && (staProtocol.getWorkNo() > 0 && staProtocol.getWorkNo() < 9999) |
| | | // && staProtocol.getStaNo().equals(staProtocol.getSiteId().shortValue()) |
| | | && staProtocol.isPakMk()){ |
| | | |
| | | // 获取条码扫描仪信息 |
| | |
| | | } |
| | | |
| | | String sourceLocNo = wrkMast.getSourceLocNo().trim(); |
| | | LiftStaProtocol liftStaProtocol = NyLiftUtils.getLiftStaByLev(pickSta.getLiftNo(), Utils.getLev(sourceLocNo));//获取回库提升机目标站 |
| | | if (liftStaProtocol == null) { |
| | | continue; |
| | | } |
| | | |
| | | // 更新工作档数据状态 |
| | | wrkMast.setIoType(wrkMast.getIoType() - 50); // 入出库类型: 103->53,104->54,107->57 |
| | | wrkMast.setWrkSts(2L); // 工作状态: 2.设备上走 |
| | | wrkMast.setSourceStaNo(pickSta.getStaNo()); // 源站 |
| | | wrkMast.setStaNo(dto.getStaNo()); // 目标站 |
| | | wrkMast.setCrnNo(dto.getCrnNo()); |
| | | // wrkMast.setStaNo(dto.getStaNo()); // 目标站 |
| | | // wrkMast.setCrnNo(dto.getCrnNo()); |
| | | wrkMast.setStaNo(liftStaProtocol.getStaNo());//目标站 |
| | | wrkMast.setLocNo(sourceLocNo); // 目标库位 = 出库时的源库位 |
| | | wrkMast.setShuttleNo(null); // 穿梭车清空 |
| | | wrkMast.setModiTime(new Date()); |
| | |
| | | throw new CoolException("修改库位状态失败"); |
| | | } |
| | | |
| | | // 更新站点信息 且 下发plc命令 |
| | | staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue()); |
| | | staProtocol.setStaNo(wrkMast.getStaNo().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | if (!result) { |
| | | News.error("发布命令至输送线队列失败!!! [plc编号:{}]", devp.getId()); |
| | | } |
| | | // // 更新站点信息 且 下发plc命令 |
| | | // staProtocol.setWorkNo(wrkMast.getWrkNo().shortValue()); |
| | | // staProtocol.setStaNo(wrkMast.getStaNo().shortValue()); |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // boolean result = MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // if (!result) { |
| | | // News.error("发布命令至输送线队列失败!!! [plc编号:{}]", devp.getId()); |
| | | // } |
| | | |
| | | barcodeThread.setBarcode("");//清理条码 |
| | | |
| | | } else if (code == 500){ |
| | | if (ledThread != null) { |
| | |
| | | } |
| | | News.error("请求接口失败!!!url:{};request:{};response:{}", wmsUrl + "/rpc/pakin/loc/v1", JSON.toJSONString(param), response); |
| | | } else { |
| | | staProtocol.setWorkNo((short) 32002); |
| | | staProtocol.setStaNo(pickSta.getBackSta().shortValue()); |
| | | devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | // staProtocol.setWorkNo((short) 32002); |
| | | // staProtocol.setStaNo(pickSta.getBackSta().shortValue()); |
| | | // devpThread.setPakMk(staProtocol.getSiteId(), false); |
| | | // MessageQueue.offer(SlaveType.Devp, devp.getId(), new Task(2, staProtocol)); |
| | | |
| | | // led 异常显示 |
| | | if (ledThread != null) { |
| | |
| | | //判断小车令牌是否未被占领 |
| | | if (shuttleProtocol.getToken() != 0) { |
| | | return false;//小车已被独占,禁止再派发任务 |
| | | } |
| | | |
| | | //判断小车是否存在移动任务 |
| | | WrkMast hasMoveWorking = wrkMastMapper.selectShuttleHasMoveWorking(wrkMast.getShuttleNo()); |
| | | if (hasMoveWorking != null) { |
| | | return false;//存在移动任务,禁止执行入库任务 |
| | | } |
| | | |
| | | //判断小车是否到达输送站点库位 |
| | |
| | | |
| | | //获取提升机命令 |
| | | NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_TRAY.id, startSta, targetSta, wrkMast.getWrkNo()); |
| | | if (wrkMast.getIoType() == 53) { |
| | | //拣料再回库,重新分配设备工作号 |
| | | Random random = new Random(); |
| | | int deviceWrk = Math.abs((liftCommand.getTaskNo().intValue() + random.nextInt(9999)));//获取设备工作号 |
| | | liftCommand.setTaskNo((short) deviceWrk); |
| | | } |
| | | ArrayList<NyLiftCommand> commands = new ArrayList<>(); |
| | | commands.add(liftCommand); |
| | | |
| | |
| | | } |
| | | |
| | | //获取小车到输送站点行走命令 |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), liftSta.getLocNo()); |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), liftSta.getLocNo(), NavigationMapType.NORMAL.id); |
| | | List<NyShuttleHttpCommand> commands = result.getCommands(); |
| | | |
| | | ShuttleAssignCommand assignCommand = new ShuttleAssignCommand(); |
| | |
| | | NyLiftCommand liftCommand = NyLiftUtils.getLiftCommand(liftProtocol.getLiftNo().intValue(), NyLiftTaskModelType.MOVE_CAR.id, sourceLiftSta.getStaNo(), sourceLiftSta.getStaNo(), wrkMast.getWrkNo()); |
| | | |
| | | Random random = new Random(); |
| | | liftCommand.setTaskNo((short) Math.abs((liftCommand.getTaskNo().intValue() + random.nextInt(9999))));//更换随机任务号 |
| | | int deviceWrk = Math.abs((liftCommand.getTaskNo().intValue() + random.nextInt(9999)));//获取设备工作号 |
| | | liftCommand.setTaskNo((short) deviceWrk);//更换随机任务号 |
| | | |
| | | ArrayList<NyLiftCommand> commands = new ArrayList<>(); |
| | | commands.add(liftCommand); |
| | |
| | | // NavigateNode liftNode = new NavigateNode(basLift.getPoint$().getX(), basLift.getPoint$().getY()); |
| | | // liftNode.setZ(basLift.getPoint$().getZ()); |
| | | |
| | | //小车已经在目标库位,直接认定小车移动任务完成 |
| | | if (shuttleProtocol.getCurrentLocNo().equals(wrkMast.getLocNo())) { |
| | | wrkMast.setWrkSts(111L);//111.小车移动完成 |
| | | wrkMast.setLiftNo(null);//释放提升机 |
| | | wrkMast.setModiTime(now); |
| | | wrkMastMapper.updateById(wrkMast); |
| | | return false; |
| | | } |
| | | |
| | | //获取小车到目标库位命令 |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getLocNo()); |
| | | NyShuttleOperaResult result = NyShuttleOperaUtils.getStartToTargetCommands(shuttleThread.getSlave().getId(), wrkMast.getWrkNo(), shuttleProtocol.getCurrentLocNo(), wrkMast.getLocNo(), NavigationMapType.NORMAL.id); |
| | | if (result == null) { |
| | | return false;//路径计算失败 |
| | | } |