| | |
| | | private final TechnologyBomMapper technologyBomMapper; |
| | | private ProductModelMapper productModelMapper; |
| | | |
| | | private static final List<String> IMPORT_SHEET_NAMES = Arrays.asList("原料", "半成品", "成品"); |
| | | private static final List<String> IMPORT_SHEET_NAMES = Arrays.asList("原材料", "原料", "半成品", "成品"); |
| | | |
| | | @Override |
| | | public int addOrEditProductModel(ProductModelDto productModelDto) { |
| | |
| | | String parentName = trimToNull(row.getProductParentName()); |
| | | String categoryName = trimToNull(row.getProductCategoryName()); |
| | | String productName = trimToNull(row.getProductName()); |
| | | if (categoryName == null) { |
| | | throw new ServiceException("第 " + rowNum + " 行 [产品大类] 不能为空"); |
| | | } |
| | | if (productName == null) { |
| | | throw new ServiceException("第 " + rowNum + " 行 [产品名称] 不能为空"); |
| | | } |
| | | |
| | | String path = String.valueOf(topId); |
| | | Long parentNodeId = topId; |
| | | Long currentParentId = topId; |
| | | if (parentName != null) { |
| | | path = path + ">" + parentName; |
| | | parentNodeId = ensureChildNode(nodeCache, path, parentNodeId, parentName); |
| | | currentParentId = ensureChildNode(nodeCache, path, currentParentId, parentName); |
| | | } |
| | | path = path + ">" + categoryName; |
| | | Long categoryId = ensureChildNode(nodeCache, path, parentNodeId, categoryName); |
| | | if (categoryName != null) { |
| | | path = path + ">" + categoryName; |
| | | currentParentId = ensureChildNode(nodeCache, path, currentParentId, categoryName); |
| | | } |
| | | path = path + ">" + productName; |
| | | Long leafId = ensureChildNode(nodeCache, path, categoryId, productName); |
| | | Long leafId = ensureChildNode(nodeCache, path, currentParentId, productName); |
| | | |
| | | String code = trimToNull(row.getProductCode()); |
| | | if (code == null) { |