corretto errore su esportazione reparti

This commit is contained in:
2024-11-07 15:03:50 +01:00
parent 6d16b8183e
commit 8833d7dffc

View File

@@ -694,24 +694,28 @@ public class SteUPService {
} else if (activityTypeId.equalsIgnoreCase(tipoAttivitaRotturaStock)) {
List<HashMap<String, Object>> pluRepo = getGrigliaPluRepo(codMdep, codJfas, activityTypeId, null, dataCreation, true, barcodes);
if (repartiFreschi != null && repartiFreschi.contains(codJfas)) {
List<String> finalBarcodes = barcodes;
barcodes = new ArrayList<>();
if ( barcodes != null && barcodes.size() > 0 ) {
List<String> finalBarcodes = barcodes;
barcodes = new ArrayList<>();
Map<String, List<HashMap<String, Object>>> pluByCodMarts = pluRepo.stream()
.collect(groupingBy(x -> x.get("cod_mart").toString()));
Map<String, List<HashMap<String, Object>>> pluByCodMarts = pluRepo.stream()
.collect(groupingBy(x -> x.get("cod_mart").toString()));
for (Map.Entry<String, List<HashMap<String, Object>>> entry : pluByCodMarts.entrySet()) {
List<HashMap<String, Object>> hashMapList = entry.getValue();
String codMart = entry.getKey();
System.out.println(codMart);
for (Map.Entry<String, List<HashMap<String, Object>>> entry : pluByCodMarts.entrySet()) {
List<HashMap<String, Object>> hashMapList = entry.getValue();
String codMart = entry.getKey();
logger.info("Articolo: " + codMart);
boolean containBarcode = hashMapList.stream().anyMatch(x -> finalBarcodes.contains(((String) x.get("barcode"))));
boolean containBarcode = hashMapList.stream().anyMatch(x -> finalBarcodes.contains(((String) x.get("barcode"))));
if (!containBarcode) {
java.util.stream.Stream<HashMap<String, Object>> barcode = hashMapList.stream().filter(x -> x.get("barcode") != null);
if (barcode.count() > 0)
barcodes.add(barcode.findFirst().map(x -> x.get("barcode").toString()).get());
if (containBarcode) {
java.util.stream.Stream<HashMap<String, Object>> barcode = hashMapList.stream().filter(x -> x.get("barcode") != null);
if (barcode.count() > 0)
barcodes.add(barcode.findFirst().map(x -> x.get("barcode").toString()).get());
}
}
} else {
barcodes.addAll(pluRepo.stream().filter(x -> x.get("barcode") != null).map(x->x.get("barcode").toString()).collect(Collectors.toList()));
}
// barcodes = pluRepo.stream().filter(a-> !finalBarcodes.contains(((String) a.get("barcode")))).map(a->(String) a.get("barcode")).collect(Collectors.toList());
} else {