diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/api/CargosoftMigrationRestService.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/api/CargosoftMigrationRestService.java index 7f82f38..9e45dc3 100644 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/api/CargosoftMigrationRestService.java +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/api/CargosoftMigrationRestService.java @@ -90,7 +90,7 @@ public class CargosoftMigrationRestService implements Serializable { int errors = 0; int count = 0; public static String _QUERY = "($modelversion:rechnungsausgang-de-1.0)\n" + - "AND $created:[20240604 TO 20240619]"; + "AND $created:[20240604 TO 20240701]"; // public static String _QUERY = "($modelversion:rechnungsausgang-dwc-1.0)\n" + // // // "AND $created:[20240604 TO 20240619]"; @@ -120,7 +120,7 @@ public class CargosoftMigrationRestService implements Serializable { @Path("/test") @Produces({ MediaType.TEXT_PLAIN }) public String testeFehlerhafteCargosoftDaten() throws QueryException { - + int falsch = 0; logger.info("query=" + _QUERY); log = "Query\n" + _QUERY; List result = documentService.find(_QUERY, 9999, 0); @@ -131,6 +131,24 @@ public class CargosoftMigrationRestService implements Serializable { log = log + "\n\nACHTUNG ES GIBT MEHR ALS 10000 RECHNUNGEN !"; } + for (ItemCollection workitem : result) { + String type = workitem.getItemValueString("invoice.type"); + if ("G".equals(type) || "SR".equals(type)) { + double total = workitem.getItemValueDouble("invoice.saldo"); + if (total >= 0) { + logger.info("---Falsch: " + workitem.getUniqueID()); + falsch++; + workitem.setItemValue("invoice.saldo", -total); + documentService.save(workitem); + } + } + + } + + log = log + "\n\n"; + log = log + "" + result.size() + " rechnungen geprüft"; + log = log + "" + falsch + " davon falsch"; + log = log + "\n\n"; return log; }