diff --git a/out/production/ImportExcel/com/tesr/Main.class b/out/production/ImportExcel/com/tesr/Main.class index 9282daa..86caf27 100644 --- a/out/production/ImportExcel/com/tesr/Main.class +++ b/out/production/ImportExcel/com/tesr/Main.class Binary files differ diff --git a/src/com/tesr/Main.java b/src/com/tesr/Main.java index 79c57f7..499ba4c 100644 --- a/src/com/tesr/Main.java +++ b/src/com/tesr/Main.java @@ -69,7 +69,7 @@ try { Workbook workbook = WorkbookFactory.create(new File(fileName)); sheet = workbook.getSheetAt(1); - //Fehler beim Einlesen der Exceldatei wird ausgegeben + //Fehler beim Einlesen der Exceldatei wird ausgegeben } catch (Exception exReadExcelFile) { System.out.println("Error in readExcelFileData()"); System.out.println("Error details: " + exReadExcelFile.toString()); @@ -82,7 +82,7 @@ try { double Kabine = 0; int c = 1; - int h = 0; + int h = 1; Workbook workbook = WorkbookFactory.create(new File(PfadDerTemplateDatei)); Sheet sheet = workbook.getSheet("Input"); @@ -92,77 +92,68 @@ Cell cell0 = row0.getCell(7); cell0.setCellValue(120); for (int i = 0; i < rows.size(); i++) { - double Kabinenfläche = rows.get(i).getCell(5).getNumericCellValue(); - Kabinenfläche = Kabinenfläche * 5; - rows.get(i).createCell(21).setCellValue(Kabinenfläche); rows.get(i).createCell(0).setCellValue(i + 1); String Farbe = rows.get(i).getCell(19).getStringCellValue(); //Für Fall Blau: Kabine 1 und Zuweisung der kombinierten Auftragsnummer und Auftragsanzahl if (Farbe.equals("Blau")) { rows.get(i).createCell(3).setCellValue("Paint_Shop_1"); + Kabine = Kabine + rows.get(i).getCell(14).getNumericCellValue(); if (Kabine < 30) { rows.get(i).createCell(1).setCellValue(c); - //rows.get(i).getCell(2).setCellValue(h); - h++; + } if (Kabine >= 30) { c++; - /*for (int hauke = h; hauke >= 0; hauke--) { - rows.get(i - hauke+1).getCell(2).setCellValue(h); - }*/ rows.get(i).createCell(1).setCellValue(c); - //rows.get(i).getCell(2).setCellValue(h); - h++; - Kabine = rows.get(i).getCell(14).getNumericCellValue(); } } //Für Fall Gelb: Kabine 2 und Zuweisung der kombinierten Auftragsnummer und Auftragsanzahl else if (Farbe.equals("Gelb")) { rows.get(i).getCell(3).setCellValue("Paint_Shop_2"); - + if(h==1){ + c++; + h++; + Kabine=0; + System.out.println("Gelb"); + } Kabine = Kabine + rows.get(i).getCell(14).getNumericCellValue(); if (Kabine < 30) { - rows.get(i).createCell(1).setCellValue(c); - //rows.get(i).getCell(2).setCellValue(h); - h++; } if (Kabine >= 30) { - h = 1; c++; rows.get(i).createCell(1).setCellValue(c); - //rows.get(i).getCell(2).setCellValue(h); - h++; - Kabine = rows.get(i).getCell(14).getNumericCellValue(); } } //Für Fall Grün: Kabine 1 und Zuweisung der kombinierten Auftragsnummer und Auftragsanzahl else if (Farbe.equals("Grün")) { rows.get(i).getCell(3).setCellValue("Paint_Shop_3"); - + if(h==2){ + c++; + h++; + Kabine=0; + System.out.println("Greun"); + } Kabine = Kabine + rows.get(i).getCell(14).getNumericCellValue(); if (Kabine < 30) { rows.get(i).createCell(1).setCellValue(c); - //rows.get(i).getCell(2).setCellValue(h); - h++; + } if (Kabine >= 30) { - h = 1; + c++; rows.get(i).createCell(1).setCellValue(c); - //rows.get(i).getCell(2).setCellValue(h); - h++; Kabine = rows.get(i).getCell(14).getNumericCellValue(); } @@ -170,29 +161,30 @@ //Für Fall Rot: Kabine 2 und Zuweisung der kombinierten Auftragsnummer und Auftragsanzahl else if (Farbe.equals("Rot")) { rows.get(i).getCell(3).setCellValue("Paint_Shop_1"); - + if(h==3) { + c++; + h++; + Kabine = 0; + System.out.println("Rot"); + } Kabine = Kabine + rows.get(i).getCell(14).getNumericCellValue(); if (Kabine < 30) { rows.get(i).createCell(1).setCellValue(c); - //rows.get(i).getCell(2).setCellValue(h); - h++; + } if (Kabine >= 30) { - h = 1; + c++; rows.get(i).createCell(1).setCellValue(c); - - h++; - Kabine = rows.get(i).getCell(14).getNumericCellValue(); } } } - + //Auftragsanzahl kombinierte Aufträge ArrayList KombAuftragsgroeße = new ArrayList(); ArrayList Auftragsanzahl = new ArrayList(); @@ -214,7 +206,13 @@ Zellenwert_Kombauftragsfläche1 = 0; hochzaehlen = 0; } + //if () { + } + KombAuftragsnummerVergleich++; + Auftragsanzahl.add(hochzaehlen); + KombAuftragsgroeße.add(Zellenwert_Kombauftragsfläche1); + //kombinierte Fläche berechnen int Reihe = 0; for (int ij = 0; ij < Auftragsanzahl.size(); ij++) { @@ -225,12 +223,17 @@ for (int ijk = 1; ijk <= Arraystellenwert_Auftraege; ijk++) { rows.get(Reihe).createCell(2).setCellValue(Arraystellenwert_Auftraege); rows.get(Reihe).createCell(5).setCellValue(Arraystellenwert_Flaeche); + double Kabinenfläche = rows.get(Reihe).getCell(5).getNumericCellValue(); + Kabinenfläche = Kabinenfläche * 5; + rows.get(Reihe).createCell(21).setCellValue(Kabinenfläche); Reihe++; System.out.println(Arraystellenwert_Auftraege); System.out.println(Arraystellenwert_Flaeche); } + } - //Korrekte Übertragung der Ausgangsdatei in die neue Exceldatei + + //Korrekte Übertragung in die neue Exceldatei for (int i = 0; i < rows.size(); i++) { Row row = sheet.createRow(i + startRow); for (int x = 0; x < rows.get(i).getPhysicalNumberOfCells(); x++) {