| | |
| | | ProductBom bom,ProductModel rootModel, |
| | | Map<String, Long> processMap, |
| | | List<BomImportErrorDto> errorList ) { |
| | | // 1. 获取children中子项产品编号为空的数据 |
| | | List<BomImportDto> parentChildren = children |
| | | .stream() |
| | | .filter(child -> StringUtils.isEmpty(child.getChildCode())) |
| | | .collect(Collectors.toList()); |
| | | if(CollectionUtils.isEmpty(parentChildren)){ |
| | | return; |
| | | } |
| | | BomImportDto parentId = parentChildren.get(0); // 父级数据 |
| | | ProductStructure rootNode = new ProductStructure(); |
| | | rootNode.setBomId(bom.getId()); |
| | | rootNode.setParentId(null); // 顶层没有父节点 |
| | |
| | | continue; |
| | | } |
| | | // 获取子项模型信息 |
| | | ProductModel childModel = findModel(child.getChildName(), child.getChildSpec()); |
| | | ProductModel childModel = findModel(child.getChildName(), child.getChildCode()); |
| | | if(childModel.getId() == null){ |
| | | BomImportErrorDto errorDto = new BomImportErrorDto(); |
| | | BeanUtils.copyProperties(child, errorDto); |
| | |
| | | |
| | | // 创建 BOM 数据 |
| | | BomImportDto first = entry.getValue().get(0); |
| | | ProductModel rootModel = findModel(first.getParentName(), first.getParentSpec()); |
| | | ProductModel rootModel = findModel(first.getParentName(), first.getParentCode()); |
| | | if(rootModel.getId() == null){ |
| | | BomImportErrorDto error = new BomImportErrorDto(); |
| | | BeanUtils.copyProperties(first, error); |