| | |
| | | List<ProductionBomStructure> updateList = new ArrayList<>(); |
| | | Map<String, ProductionBomStructure> tempEntityMap = new HashMap<>(); |
| | | |
| | | Map<Long, Boolean> operationPickMap = loadOperationPickMap(flatDtoList.stream() |
| | | .map(ProductionBomStructureDto::getTechnologyOperationId) |
| | | .collect(Collectors.toList())); |
| | | |
| | | for (ProductionBomStructureDto item : flatDtoList) { |
| | | ProductionBomStructure entity = new ProductionBomStructure(); |
| | | BeanUtils.copyProperties(item, entity); |
| | | entity.setProductionOrderBomId(orderBomId); |
| | | entity.setIsPick(operationPickMap.getOrDefault(item.getTechnologyOperationId(), Boolean.FALSE)); |
| | | if (item.getId() == null) { |
| | | entity.setParentId(null); |
| | | insertList.add(entity); |
| | |
| | | return technologyOperationMapper.selectById(technologyOperationId); |
| | | } |
| | | |
| | | /** |
| | | * 批量读取工序的“是否领料”标记,保证生产BOM结构中的领料标记与工序主数据一致。 |
| | | */ |
| | | private Map<Long, Boolean> loadOperationPickMap(List<Long> technologyOperationIds) { |
| | | if (technologyOperationIds == null || technologyOperationIds.isEmpty()) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | Set<Long> operationIdSet = technologyOperationIds.stream() |
| | | .filter(Objects::nonNull) |
| | | .collect(Collectors.toSet()); |
| | | if (operationIdSet.isEmpty()) { |
| | | return Collections.emptyMap(); |
| | | } |
| | | return technologyOperationMapper.selectBatchIds(operationIdSet).stream() |
| | | .filter(item -> item != null && item.getId() != null) |
| | | .collect(Collectors.toMap(TechnologyOperation::getId, |
| | | item -> Boolean.TRUE.equals(item.getIsPick()), |
| | | (left, right) -> left)); |
| | | } |
| | | |
| | | private String generateNextTaskNo() { |
| | | String datePrefix = LocalDate.now().format(DateTimeFormatter.ofPattern("yyyyMMdd")); |
| | | ProductionOperationTask latestTask = productionOperationTaskMapper.selectOne( |