| | |
| | | Wrappers.<TechnologyBomStructure>lambdaQuery() |
| | | .eq(TechnologyBomStructure::getBomId, technologyRouting.getBomId()) |
| | | .isNotNull(TechnologyBomStructure::getOperationId) |
| | | .orderByAsc(TechnologyBomStructure::getId) |
| | | .orderByDesc(TechnologyBomStructure::getId) |
| | | ); |
| | | if (bomStructures.isEmpty()) { |
| | | throw new ServiceException("bom产品结构为空!"); |
| | | } |
| | | |
| | | // 同一个 BOM 中可能重复引用相同工序,这里按首次出现顺序去重。 |
| | | // 同一个 BOM 中可能重复引用相同工序,按照上一层的父节点的产品是否相同和工序是否相同 |
| | | Map<Long, TechnologyBomStructure> structureById = new HashMap<>(); |
| | | for (TechnologyBomStructure bomStructure : bomStructures) { |
| | | if (bomStructure != null && bomStructure.getId() != null) { |
| | |
| | | routingOperation.setProductModelId(resolveOutputProductModelId(bomStructure, structureById, technologyRouting.getProductModelId())); |
| | | routingOperation.setTechnologyOperationId(bomStructure.getOperationId()); |
| | | routingOperation.setDragSort(dragSort++); |
| | | routingOperation.setIsQuality(getOperationQuality(bomStructure.getOperationId())); |
| | | TechnologyOperation technologyOperation = getOperation(bomStructure.getOperationId()); |
| | | routingOperation.setIsQuality(technologyOperation != null ? technologyOperation.getIsQuality() : null); |
| | | routingOperation.setIsProduction(technologyOperation != null ? technologyOperation.getIsProduction() : null); |
| | | routingOperation.setType(technologyOperation != null ? technologyOperation.getType() : null); |
| | | technologyRoutingOperationMapper.insert(routingOperation); |
| | | syncRoutingOperationParams(routingOperation.getId(), bomStructure.getOperationId()); |
| | | } |
| | |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 质检标识以工序基础表定义为准。 |
| | | */ |
| | | private Boolean getOperationQuality(Long operationId) { |
| | | TechnologyOperation technologyOperation = technologyOperationMapper.selectById(operationId); |
| | | return technologyOperation != null ? technologyOperation.getIsQuality() : null; |
| | | private TechnologyOperation getOperation(Long operationId) { |
| | | if (operationId == null) { |
| | | return null; |
| | | } |
| | | return technologyOperationMapper.selectById(operationId); |
| | | } |
| | | |
| | | private String buildProcessRouteCode(Long id) { |