| | |
| | | } |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public R AGVBindAndInTaskStart(String barcode) { |
| | | //验证条码 |
| | | boolean b = checkStaStatus(barcode); |
| | | if (!b) { |
| | | return R.error("条码未找到对应规则"); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | @Override |
| | | public R getStaMsgSelect(Map<String, Object> params) { |
| | | String sta = params.get("sta").toString(); |
| | | if (Cools.isEmpty(sta)) { |
| | |
| | | if (!basStation.getUseStatus().equals("O")) { |
| | | throw new CoolException("站点状态不为空闲"); |
| | | } |
| | | if (basStation.getType()==0) { |
| | | throw new CoolException("站点为光电站点,禁止呼叫AGV"); |
| | | } |
| | | |
| | | List<String> areaList = JSONObject.parseArray(basStation.getCrossZoneArea(), String.class); |
| | | if (!areaList.contains(area)) { |
| | |
| | | for (BasContainer container : containers) { |
| | | String codeType = container.getCodeType(); // 获取正则表达式 |
| | | if (barcode.matches(codeType)) { // 判断条码是否符合这个正则 |
| | | List<String> areaList2 = JSONObject.parseArray(container.getAreas(), String.class); |
| | | if (!areaList2.contains(area)) { |
| | | List<Integer> areaList2 = container.getAreas(); |
| | | if (!areaList2.contains(Integer.valueOf(area))) { |
| | | matches2 = false; |
| | | continue; |
| | | } |
| | |
| | | throw new CoolException("查询到的容器不支持目标库区"); |
| | | } |
| | | if (!matches) { |
| | | throw new CoolException("条码与站点不匹配"); |
| | | throw new CoolException("容器与站点不匹配"); |
| | | } |
| | | } else { |
| | | throw new CoolException("数据异常:验证基础信息"); |
| | |
| | | |
| | | return basStation; |
| | | } |
| | | private boolean checkStaStatus(String barcode) { |
| | | if (Cools.isEmpty(barcode)) { |
| | | throw new CoolException("容器码不能为空"); |
| | | } |
| | | WaitPakin waitPakin = waitPakinService.getOne(new LambdaQueryWrapper<WaitPakin>() |
| | | .eq(WaitPakin::getBarcode, barcode) |
| | | .eq(WaitPakin::getIoStatus, PakinIOStatus.PAKIN_IO_STATUS_DONE.val) |
| | | ); |
| | | if (Cools.isEmpty(waitPakin)) { |
| | | throw new CoolException("容器码未找到组托信息,请检查组托状态"); |
| | | } |
| | | BasStation isBarcodeSta = basStationService.getOne(new LambdaQueryWrapper<BasStation>() |
| | | .eq(BasStation::getBarcode, barcode) |
| | | , false |
| | | ); |
| | | if (!Cools.isEmpty(isBarcodeSta)) { |
| | | throw new CoolException("该条码已被" + isBarcodeSta.getStationName() + "站绑定"); |
| | | } |
| | | |
| | | List<BasContainer> containers = basContainerService.list( |
| | | new LambdaQueryWrapper<BasContainer>()); |
| | | boolean matches = false; |
| | | for (BasContainer container : containers) { |
| | | String codeType = container.getCodeType(); // 获取正则表达式 |
| | | if (barcode.matches(codeType)) { // 判断条码是否符合这个正则 |
| | | matches = true; |
| | | return true; |
| | | } |
| | | } |
| | | // boolean matches = containers.stream() |
| | | // .map(BasContainer::getCodeType) |
| | | // .anyMatch(codeType -> barcode.matches(codeType)); |
| | | if (!matches) { |
| | | return false; |
| | | } |
| | | |
| | | return true; |
| | | } |
| | | } |