From 15e37ff2c865478f84b746d6c2d1c458b30fef22 Mon Sep 17 00:00:00 2001 From: Ralph Soika Date: Fri, 19 Sep 2025 12:13:43 +0200 Subject: [PATCH] =?UTF-8?q?verbesserte=20Pr=C3=BCfung=20der=20Partner.ID?= =?UTF-8?q?=20Eingabe=20,=20Speziall=C3=B6sung=20Frau=20Mwanig=20f=C3=BCr?= =?UTF-8?q?=20sonder=20Gutschriften=20Export=20an=20Cargosoft?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../BusinessPartnerService.java | 36 +- .../CargosoftSplitAdapter.java | 26 +- .../com/alexanderlogistics/InvoicePlugin.java | 9 +- .../api/CargosoftMigrationRestService.java | 359 +++--- .../xml/BusinessPartnerImportService.java | 4 +- .../resources/bundle/custom_de.properties | 4 +- .../resources/bundle/custom_en.properties | 4 +- workflow/businesspartner-de-1.0.3.bpmn | 1141 +++++++++++++++++ workflow/usa/rechnungseingang-usa-1.0.1.bpmn | 2 +- 9 files changed, 1393 insertions(+), 192 deletions(-) create mode 100644 workflow/businesspartner-de-1.0.3.bpmn diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/BusinessPartnerService.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/BusinessPartnerService.java index 172310c..96e111f 100644 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/BusinessPartnerService.java +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/BusinessPartnerService.java @@ -129,9 +129,10 @@ public class BusinessPartnerService { * * @param partnerID * @param workitem + * @return BusinessPartner Object * @throws PluginException */ - public void updateBusinessPartnerData(ItemCollection workitem) throws PluginException { + public ItemCollection updateBusinessPartnerData(ItemCollection workitem) throws PluginException { String partnerID = workitem.getItemValueString("partner.id"); // Migration wenn keine partner.id existier! if (partnerID.isEmpty()) { @@ -145,12 +146,35 @@ public class BusinessPartnerService { } if (partnerID == null || partnerID.isEmpty()) { - return; + return null; } + // load Business Partner + // + // DO NOT CHANGE THIS LOGIC! + // ItemCollection businessPartner = getBusinessPartnerByID(partnerID); if (businessPartner == null) { - return; + // Falls jemand eine ungültige Partner ID eingetippt hat und einfach auf weiter + // klickt , müssen wir genau prüfen + // Wir prüfen ob es eine Zahl war - dann versuchen wir nochmal mit dem Prefix BP + // zu suchen.... + // Beispiel: 13342 + try { + Integer.parseInt(partnerID); + // it is an int - get last 4 digits + partnerID = "BP" + partnerID.substring(Math.max(0, partnerID.length() - 4)); + workitem.setItemValue("partner.id", partnerID); + businessPartner = getBusinessPartnerByID(partnerID); + } catch (NumberFormatException e) { + /* not an int */ + } + if (businessPartner == null) { + workitem.removeItem("partner.id"); + logger.warning("Business Partner for Partner ID " + partnerID + " not found!"); + return null; + } + } // because the method can be called multiple times within one worklfow // processing cycle @@ -158,14 +182,16 @@ public class BusinessPartnerService { businessPartner = documentService.load(businessPartner.getUniqueID()); if (businessPartner != null) { workitem.setItemValue("partner.name", businessPartner.getItemValueString("partner.name")); - + logger.info("check invoice type...."); // Update Invoice Partner Meta Data if (InvoiceUtil.isDebitorInvoice(workitem)) { + logger.info("...is debitor invoice"); workitem.setItemValue("dbtr.number", businessPartner.getItemValueString("dbtr.number")); workitem.setItemValue("dbtr.name", businessPartner.getItemValueString("partner.name")); workitem.setItemValue("dbtr.mail", businessPartner.getItemValueString("dbtr.mail")); workitem.setItemValue("invoice.country", businessPartner.getItemValueString("_vendor_country")); } + logger.info("...is creditor invoice"); if (InvoiceUtil.isCreditorInvoice(workitem)) { workitem.setItemValue("cdtr.number", businessPartner.getItemValueString("cdtr.number")); workitem.setItemValue("cdtr.name", businessPartner.getItemValueString("partner.name")); @@ -195,8 +221,10 @@ public class BusinessPartnerService { } catch (PluginException | ProcessingErrorException | AccessDeniedException | ModelException e) { logger.warning("Failed to update BusinessPartner object '" + partnerID + "'!"); } + return businessPartner; } else { logger.warning("BusinessPartner '" + partnerID + "' not found!"); + return null; } } diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/CargosoftSplitAdapter.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/CargosoftSplitAdapter.java index 05c2b25..557ce1f 100644 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/CargosoftSplitAdapter.java +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/CargosoftSplitAdapter.java @@ -26,7 +26,7 @@ import jakarta.inject.Inject; * notwendig, da Cargosoft selbst nicht mit unterschiedlichen Buchungsperioden * in einer Rechnung umgehen kann. *

- * adapter exports the invoice data to a ftp server connected to cargosoft. Da + * Die Daten werden als XML Datei auf einem FTP Laufwerk abgelegt. Da * auch eine fortlaufene Rechnungsnummer von Cargosoft zwingend vorgeschrieben * ist, erzeugt der adapter auch für jedes weiteres cargosoft export worktiem * ein neue Sequencenummer die im Hautpworkitem gespeichert wird. @@ -48,9 +48,13 @@ import jakarta.inject.Inject; * Because we also export the attachment data to cargosoft, the adapter lookups * the conente of the attachment in the snapshot of the origin workitem * - * + *

* Der Adapter validiert zusätzlich ob die Kreditorennnummer cdtr.number gültig * ist. + *

+ * Es kann auch vorkommen das speziell Gutschriften auf ein alternatives + * Cargosoft Konto gebucht werden müssen. Dies prüfen wir und ändern ggf. das + * Konto ab (Anforderung Frau Mahner 18.9.2025) * * @version 1.0 * @author rsoika @@ -89,6 +93,20 @@ public class CargosoftSplitAdapter implements SignalAdapter { throw new PluginException(CargosoftSplitAdapter.class.getSimpleName(), CONFIG_ERROR, "Missing or wrong Creditor Number, please check your data."); } + /** + * Sonderfall: + * Es kann sein, das Frau Mahner oder Frau Mwangi für diesen Kreditor + * Gutschriften (NUR Gutschriften!!) auf ein alternatives Konto buchen will. + * In diesem Fall ändern wir JETZT das feld cdtr.number!!!! + */ + if ("credit".equals(workitem.getItemValueString("payment.type"))) { + // Haben wir ein alternative Konto im Business Partner hinterlegt? + String alternativKonto = partner.getItemValueString("cargosot.credit.cdtr.number"); + if (!alternativKonto.isBlank()) { + cdtrNumber = alternativKonto; + workitem.setItemValue("cdtr.number", alternativKonto); + } + } // read the cargosoft split options ItemCollection evalItemCollection = workflowService.evalWorkflowResult(event, "cargosoft", workitem, false); @@ -107,10 +125,10 @@ public class CargosoftSplitAdapter implements SignalAdapter { "missing cargosoft configuration 'model', 'task', 'event' - please check model configuration"); } - // Zunaechst müssen wir festelstellen, ob es mehrere unterschiedliche + // Zunaechst müssen wir feststellen, ob es mehrere unterschiedliche // Buchungsperioden in der Positionstabelle gibt. List buchungsPersioden = new ArrayList(); - // add haupt buchungsperiode + // add Haupt-Buchungsperiode buchungsPersioden.add(workitem.getItemValueString("invoice.period")); List positionsTabelle = InvoiceUtil.explodeChildList(workitem); for (ItemCollection posItem : positionsTabelle) { diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/InvoicePlugin.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/InvoicePlugin.java index c6e48f9..6b4168d 100644 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/InvoicePlugin.java +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/InvoicePlugin.java @@ -83,7 +83,7 @@ public class InvoicePlugin extends AbstractPlugin { public ItemCollection run(ItemCollection workitem, ItemCollection event) throws PluginException { // Update BUsiness Partner Data - businessPartnerService.updateBusinessPartnerData(workitem); + ItemCollection businessPartner = businessPartnerService.updateBusinessPartnerData(workitem); updateImg(workitem); @@ -102,6 +102,13 @@ public class InvoicePlugin extends AbstractPlugin { boolean isPublicEvent = !("0".equals(event.getItemValueString("keypublicresult"))); if (isPublicEvent) { + + // validate Partner id.... + if (businessPartner == null) { + String message = resourceBundleHandler.findMessage("ERROR_MISSING_BUSINESSPARTNER"); + throw new PluginException(InvoicePlugin.class.getName(), ERROR_MISSING_DATA, message); + } + validateInvoiceNumber(workitem); validateBuchungsperiode(workitem.getItemValueString(InvoiceUtil.ITEM_INVOICE_PERIOD)); checkIBANNumber(workitem); 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 209fe66..306c8b3 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 @@ -27,8 +27,15 @@ package com.alexanderlogistics.api; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; import java.io.Serializable; +import java.nio.charset.StandardCharsets; +import java.util.HashMap; import java.util.List; +import java.util.Map; import java.util.logging.Logger; import org.imixs.marty.team.TeamService; @@ -51,7 +58,6 @@ import jakarta.ejb.TransactionAttribute; import jakarta.ejb.TransactionAttributeType; import jakarta.enterprise.context.ApplicationScoped; import jakarta.inject.Inject; -import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.QueryParam; @@ -122,9 +128,9 @@ public class CargosoftMigrationRestService implements Serializable { * @throws PluginException * @throws ModelException */ - @GET - @Path("/bp-sync") - @Produces({ MediaType.TEXT_PLAIN }) + // @GET + // @Path("/bp-sync") + // @Produces({ MediaType.TEXT_PLAIN }) public String syncBusinessPartner(@QueryParam("maxcount") int maxcount) throws QueryException, AccessDeniedException, ProcessingErrorException, PluginException, ModelException { StringBuffer messageBuffer = new StringBuffer(); @@ -199,100 +205,100 @@ public class CargosoftMigrationRestService implements Serializable { // @GET // @Path("/cargosoft-renew_cdtr_number") // @Produces({ MediaType.TEXT_PLAIN }) - // public String migrationAdresswandlungOpenInvoices(@QueryParam("maxcount") int - // maxcount, - // @QueryParam("type") String type) - // throws QueryException, AccessDeniedException, ProcessingErrorException, - // PluginException, ModelException { - // StringBuffer messageBuffer = new StringBuffer(); - // if (maxcount <= 0) { - // maxcount = 10; - // } - // if (type == null || type.isEmpty()) { - // type = "workitem"; - // } + public String migrationAdresswandlungOpenInvoices(@QueryParam("maxcount") int maxcount, + @QueryParam("type") String type) + throws QueryException, AccessDeniedException, ProcessingErrorException, + PluginException, ModelException { + StringBuffer messageBuffer = new StringBuffer(); + if (maxcount <= 0) { + maxcount = 10; + } + if (type == null || type.isEmpty()) { + type = "workitem"; + } - // if (isRunning) { - // log("├── sync process already running!", messageBuffer); - // return messageBuffer.toString(); - // } - // isRunning = true; + if (isRunning) { + log("├── sync process already running!", messageBuffer); + return messageBuffer.toString(); + } + isRunning = true; - // log("├── read cargosoft migration file....", messageBuffer); - // Map mapping = readAdressMapping(); - // log("├── found " + mapping.size() + " mappings", messageBuffer); + log("├── read cargosoft migration file....", messageBuffer); + Map mapping = readAdressMapping(); + log("├── found " + mapping.size() + " mappings", messageBuffer); - // String query = "(type:" + type + ") AND ($modelversion:rechnungseingang*)"; - // // int syncs = 0; - // long l = System.currentTimeMillis(); - // int batchSize = 100; - // int totalUpdates = 0; + String query = "(type:" + type + ") AND ($modelversion:rechnungseingang*)"; + // int syncs = 0; + long l = System.currentTimeMillis(); + int batchSize = 100; + int totalUpdates = 0; - // log("├── migration cargosoft addresses....", messageBuffer); - // log("│ ├── query=" + query, messageBuffer); + log("├── migration cargosoft addresses....", messageBuffer); + log("│ ├── query=" + query, messageBuffer); - // int totalCount = documentService.count(query); - // log("│ ├── found " + totalCount + " invoices", messageBuffer); + int totalCount = documentService.count(query); + log("│ ├── found " + totalCount + " invoices", messageBuffer); - // // Berechne Anzahl der benötigten Pages - // int totalPages = (int) Math.ceil((double) totalCount / batchSize); + // Berechne Anzahl der benötigten Pages + int totalPages = (int) Math.ceil((double) totalCount / batchSize); - // // Verarbeite Page für Page - // for (int pageIndex = 0; pageIndex < totalPages; pageIndex++) { - // log("│ ├── read page " + pageIndex, messageBuffer); - // List invoiceList = documentService.find(query, batchSize, - // pageIndex); - // long l1 = System.currentTimeMillis(); - // log("│ ├── ...verifying " + invoiceList.size() + " invoices...", - // messageBuffer); - // int updates = migratateInvioceBPAddress(invoiceList, mapping); - // totalUpdates = totalUpdates + updates; - // log("│ ├── " + updates + " invoices migrated in " + - // (System.currentTimeMillis() - l1) + "ms ", messageBuffer); - // // break; - // if (totalUpdates >= maxcount) { - // break; - // } - // } - // long duration = System.currentTimeMillis() - l; - // double objectsPerSecond = totalUpdates / (duration / 1000.0); - // log("├── Successfully " + totalUpdates + " invoices migrated in " + duration - // + "ms (" - // + String.format("%.1f", objectsPerSecond) + " objects/sec)", messageBuffer); + // Verarbeite Page für Page + for (int pageIndex = 0; pageIndex < totalPages; pageIndex++) { + log("│ ├── read page " + pageIndex, messageBuffer); + List invoiceList = documentService.find(query, batchSize, + pageIndex); + long l1 = System.currentTimeMillis(); + log("│ ├── ...verifying " + invoiceList.size() + " invoices...", + messageBuffer); + int updates = migratateInvioceBPAddress(invoiceList, mapping); + totalUpdates = totalUpdates + updates; + log("│ ├── " + updates + " invoices migrated in " + + (System.currentTimeMillis() - l1) + "ms ", messageBuffer); + // break; + if (totalUpdates >= maxcount) { + break; + } + } + long duration = System.currentTimeMillis() - l; + double objectsPerSecond = totalUpdates / (duration / 1000.0); + log("├── Successfully " + totalUpdates + " invoices migrated in " + duration + + "ms (" + + String.format("%.1f", objectsPerSecond) + " objects/sec)", messageBuffer); - // isRunning = false; - // return messageBuffer.toString(); - // } + isRunning = false; + return messageBuffer.toString(); + } - // @TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW) - // private int migratateInvioceBPAddress(List invoices, - // Map map) { - // int count = 0; - // for (ItemCollection invoice : invoices) { - // String cdtrNumber = invoice.getItemValueString("cdtr.number"); - // if (cdtrNumber.isBlank()) { - // logger.warning(" ..Invoice " + invoice.getUniqueID() + " has no - // cdtr.number!"); - // continue; - // } + @TransactionAttribute(value = TransactionAttributeType.REQUIRES_NEW) + private int migratateInvioceBPAddress(List invoices, + Map map) { + int count = 0; + for (ItemCollection invoice : invoices) { + String cdtrNumber = invoice.getItemValueString("cdtr.number"); + if (cdtrNumber.isBlank()) { + logger.warning(" ..Invoice " + invoice.getUniqueID() + " has no cdtr.number!"); + continue; + } - // // logger.info("==> check cdtr.number: " + cdtrNumber); - // // K überspringen - // String newNumber = map.get(cdtrNumber.substring(1)); - // if (newNumber != null) { - // // migrate number - // invoice.setItemValue("cdtr.number.old", cdtrNumber); - // invoice.setItemValue("cdtr.number", "K" + newNumber); + // logger.info("==> check cdtr.number: " + cdtrNumber); + // K überspringen + String newNumber = map.get(cdtrNumber.substring(1)); + if (newNumber != null) { + // migrate number + invoice.setItemValue("cdtr.number.old", cdtrNumber); + invoice.setItemValue("cdtr.number", "K" + newNumber); - // logger.info("│ ├── replace " + cdtrNumber + " -> K" + newNumber + " : " + - // invoice.getUniqueID()); - // documentService.save(invoice); - // count++; + logger.info("│ ├── replace " + cdtrNumber + " -> K" + newNumber + " : " + + invoice.getUniqueID()); + documentService.save(invoice); - // } - // } - // return count; - // } + // logger.info("-- kein update! disabled save!!"); + count++; + + } + } + return count; + } /** * Migriert die Rechnungen mit den neuen cdtr. Nummern @@ -302,114 +308,111 @@ public class CargosoftMigrationRestService implements Serializable { // @GET // @Path("/fix-separun") // @Produces({ MediaType.TEXT_PLAIN }) - // public String fixSepaRun(@QueryParam("maxcount") int maxcount) - // throws QueryException, AccessDeniedException, ProcessingErrorException, - // PluginException, ModelException { - // StringBuffer messageBuffer = new StringBuffer(); - // int totalUpdates = 0; - // if (maxcount <= 0) { - // maxcount = 10; + public String fixSepaRun(@QueryParam("maxcount") int maxcount) + throws QueryException, AccessDeniedException, ProcessingErrorException, + PluginException, ModelException { + StringBuffer messageBuffer = new StringBuffer(); + int totalUpdates = 0; + if (maxcount <= 0) { + maxcount = 10; - // if (isRunning) { - // log("├── sync process already running!", messageBuffer); - // return messageBuffer.toString(); - // } - // isRunning = true; + if (isRunning) { + log("├── sync process already running!", messageBuffer); + return messageBuffer.toString(); + } + isRunning = true; - // String query = "(type:workitem) AND ($modelversion:rechnungseingang*) AND - // ($taskid:5500)"; - // // int syncs = 0; - // long l = System.currentTimeMillis(); + String query = "(type:workitem) AND ($modelversion:rechnungseingang*) AND ($taskid:5500)"; + // int syncs = 0; + long l = System.currentTimeMillis(); - // log("├── migration sepa run....", messageBuffer); - // log("│ ├── query=" + query, messageBuffer); - // int totalCount = documentService.count(query); - // log("│ ├── found " + totalCount + " invoices", messageBuffer); - // List invoiceList = documentService.find(query, 999, 0); - // long l1 = System.currentTimeMillis(); - // log("│ ├── ...verifying " + invoiceList.size() + " invoices...", - // messageBuffer); + log("├── migration sepa run....", messageBuffer); + log("│ ├── query=" + query, messageBuffer); + int totalCount = documentService.count(query); + log("│ ├── found " + totalCount + " invoices", messageBuffer); + List invoiceList = documentService.find(query, 999, 0); + long l1 = System.currentTimeMillis(); + log("│ ├── ...verifying " + invoiceList.size() + " invoices...", + messageBuffer); - // for (ItemCollection invoice : invoiceList) { + for (ItemCollection invoice : invoiceList) { - // String cdtrNumber = invoice.getItemValueString("cdtr.number"); - // String cdtrNumberOld = invoice.getItemValueString("cdtr.number.old"); - // String bpPartnerID = invoice.getItemValueString("partner.id"); - // if (bpPartnerID.isEmpty()) { - // continue; - // } - // if (cdtrNumberOld.isEmpty()) { - // continue; - // } + String cdtrNumber = invoice.getItemValueString("cdtr.number"); + String cdtrNumberOld = invoice.getItemValueString("cdtr.number.old"); + String bpPartnerID = invoice.getItemValueString("partner.id"); + if (bpPartnerID.isEmpty()) { + continue; + } + if (cdtrNumberOld.isEmpty()) { + continue; + } - // // lookup bp .... - // ItemCollection bpPartner = - // businessPartnerService.getBusinessPartnerByID(InvoiceUtil.getBPID(invoice)); - // String fixPartnerName = bpPartner.getItemValueString("partner.name"); - // String fixPartnerId = bpPartner.getItemValueString("partner.id"); + // lookup bp .... + ItemCollection bpPartner = businessPartnerService.getBusinessPartnerByID(InvoiceUtil.getBPID(invoice)); + String fixPartnerName = bpPartner.getItemValueString("partner.name"); + String fixPartnerId = bpPartner.getItemValueString("partner.id"); - // if (!bpPartnerID.equals(fixPartnerId)) { - // logger.info("Problem found with invoice: " + invoice.getUniqueID() + " wrong - // partnerID=" - // + bpPartnerID + " correct= " + fixPartnerId); - // logger.info(" correct name= " + fixPartnerName); + if (!bpPartnerID.equals(fixPartnerId)) { + logger.info("Problem found with invoice: " + invoice.getUniqueID() + " wrong partnerID=" + + bpPartnerID + " correct= " + fixPartnerId); + logger.info(" correct name= " + fixPartnerName); - // invoice.setItemValue("partner.id", fixPartnerId); - // invoice.setItemValue("cdtr.name", fixPartnerName); - // invoice.setItemValue("partner.name", fixPartnerName); - // documentService.save(invoice); - // // workflowService.processWorkItem(invoice.event(10)); - // totalUpdates++; - // } - // } + invoice.setItemValue("partner.id", fixPartnerId); + invoice.setItemValue("cdtr.name", fixPartnerName); + invoice.setItemValue("partner.name", fixPartnerName); + documentService.save(invoice); + // workflowService.processWorkItem(invoice.event(10)); + totalUpdates++; + } + } - // log("│ ├── " + totalUpdates + " invoices migrated in " + - // (System.currentTimeMillis() - l1) + "ms ", messageBuffer); + log("│ ├── " + totalUpdates + " invoices migrated in " + + (System.currentTimeMillis() - l1) + "ms ", messageBuffer); - // } + } - // log("├── Successfully " + totalUpdates + " invoices migrated", - // messageBuffer); + log("├── Successfully " + totalUpdates + " invoices migrated", + messageBuffer); - // isRunning = false; - // return messageBuffer.toString(); - // } + isRunning = false; + return messageBuffer.toString(); + } /** * Diese hilfsmethode liest die Cargosoft Datei mit den Mapping - alt->neu ein * * @return */ - // private Map readAdressMapping() { - // Map result = new HashMap<>(); - // try (InputStream inputStream = getClass().getClassLoader() - // .getResourceAsStream("agl_wandlung_20250822.csv"); - // BufferedReader reader = new BufferedReader( - // new InputStreamReader(inputStream, StandardCharsets.UTF_8))) { + private Map readAdressMapping() { + Map result = new HashMap<>(); + try (InputStream inputStream = getClass().getClassLoader() + .getResourceAsStream("agl_wandlung_20250822.csv"); + BufferedReader reader = new BufferedReader( + new InputStreamReader(inputStream, StandardCharsets.UTF_8))) { - // String line; - // boolean firstLine = true; + String line; + boolean firstLine = true; - // while ((line = reader.readLine()) != null) { - // if (firstLine) { - // firstLine = false; - // continue; // Header überspringen - // } + while ((line = reader.readLine()) != null) { + if (firstLine) { + firstLine = false; + continue; // Header überspringen + } - // String[] parts = line.split(";"); - // if (parts.length == 2) { - // String oldID = parts[0].trim(); - // String newID = parts[1].trim(); - // result.put(oldID, newID); + String[] parts = line.split(";"); + if (parts.length == 2) { + String oldID = parts[0].trim(); + String newID = parts[1].trim(); + result.put(oldID, newID); - // } - // } - // } catch (IOException e) { - // // Logging framework verwenden - // System.err.println("Fehler beim Laden der CSV: " + e.getMessage()); - // } - // return result; - // } + } + } + } catch (IOException e) { + // Logging framework verwenden + System.err.println("Fehler beim Laden der CSV: " + e.getMessage()); + } + return result; + } /** * Hilfsmethode speichert eine cargoosft kreditor object... @@ -444,9 +447,9 @@ public class CargosoftMigrationRestService implements Serializable { * @throws PluginException * @throws ModelException */ - @GET - @Path("/bp-delete") - @Produces({ MediaType.TEXT_PLAIN }) + // @GET + // @Path("/bp-delete") + // @Produces({ MediaType.TEXT_PLAIN }) public String deleteBusinessPartner(@QueryParam("maxcount") int maxcount) throws QueryException, AccessDeniedException, ProcessingErrorException, PluginException, ModelException { StringBuffer messageBuffer = new StringBuffer(); @@ -526,9 +529,9 @@ public class CargosoftMigrationRestService implements Serializable { * @throws PluginException * @throws ModelException */ - @GET - @Path("/remove-dubletten") - @Produces({ MediaType.TEXT_PLAIN }) + // @GET + // @Path("/remove-dubletten") + // @Produces({ MediaType.TEXT_PLAIN }) public String deleteCargosoftDupplicates(@QueryParam("maxcount") int maxcount) throws QueryException, AccessDeniedException, ProcessingErrorException, PluginException, ModelException { StringBuffer messageBuffer = new StringBuffer(); diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/xml/BusinessPartnerImportService.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/xml/BusinessPartnerImportService.java index f7af57e..90ad477 100644 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/xml/BusinessPartnerImportService.java +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/xml/BusinessPartnerImportService.java @@ -144,12 +144,12 @@ public class BusinessPartnerImportService { String cargosoftID = importDoc.getItemValueString("name"); String partnerID = InvoiceUtil.buildBPID(cargosoftID); ItemCollection businesspartner = lookupBusinessPartner(partnerID); - if (businesspartner != null) { + if (businesspartner != null && businesspartner.getTaskID() != 1800) { logger.info("lock business partner object...."); try { businesspartner.setEventID(80); workflowService.processWorkItemByNewTransaction(businesspartner); - } catch (AccessDeniedException | ProcessingErrorException | PluginException | ModelException e) { + } catch (Exception e) { logger.warning( "Failed to lock Business Partner Object " + cargosoftID + " - " + e.getMessage()); } diff --git a/office-alexander-logistics-app/src/main/resources/bundle/custom_de.properties b/office-alexander-logistics-app/src/main/resources/bundle/custom_de.properties index 80a9d9f..a59aa68 100644 --- a/office-alexander-logistics-app/src/main/resources/bundle/custom_de.properties +++ b/office-alexander-logistics-app/src/main/resources/bundle/custom_de.properties @@ -74,4 +74,6 @@ ERROR_MISSING_PAYMENT=Eingabefehler - Bitte wählen Sie eine Zahlungsart aus! ERROR_PAYMENT1="Der Zahlungseingang kann nicht verbucht werden, da die Währung {1} nicht mit der Währung der Rechnung {2} übereinstimmt!" ERROR_PAYMENT2="Der Zahlungseingang ist nicht identisch mit den ausgebuchten Rechnungssalden. Sollte die Eingabe korrekt sein, wiederholen Sie die Aktion." ERROR_PAYMENT3="Der Zahlungseingang kann nicht verbucht werden, da der Restsaldo der Rechnung {1} kleiner als der Zahlbetrag ist!" -ERROR_PAYMENT4="Wenigstens eine ausgewählte Währung muss der Hauptwährung {1} entsprechen!" \ No newline at end of file +ERROR_PAYMENT4="Wenigstens eine ausgewählte Währung muss der Hauptwährung {1} entsprechen!" + +ERROR_MISSING_BUSINESSPARTNER="Bitte wählen Sie einen Business Partner aus!" \ No newline at end of file diff --git a/office-alexander-logistics-app/src/main/resources/bundle/custom_en.properties b/office-alexander-logistics-app/src/main/resources/bundle/custom_en.properties index 9e5fea3..b191591 100644 --- a/office-alexander-logistics-app/src/main/resources/bundle/custom_en.properties +++ b/office-alexander-logistics-app/src/main/resources/bundle/custom_en.properties @@ -75,4 +75,6 @@ ERROR_MISSING_PAYMENT=Input error - Please select a payment method! ERROR_PAYMENT1="The payment cannot be posted because the currency {1} does not match the invoice currency {2}!" ERROR_PAYMENT2="The incoming payment does not match the posted invoice balances. If the input is correct, please repeat the action." ERROR_PAYMENT3="The payment cannot be posted because the remaining balance of invoice {1} is less than the payment amount!" -ERROR_PAYMENT4="At least one selected currency must match the main currency {1}!" \ No newline at end of file +ERROR_PAYMENT4="At least one selected currency must match the main currency {1}!" + +ERROR_MISSING_BUSINESSPARTNER="Please select a Business Partner!" \ No newline at end of file diff --git a/workflow/businesspartner-de-1.0.3.bpmn b/workflow/businesspartner-de-1.0.3.bpmn new file mode 100644 index 0000000..26a5b52 --- /dev/null +++ b/workflow/businesspartner-de-1.0.3.bpmn @@ -0,0 +1,1141 @@ + + + + + + + association_83sZPw + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + task_ToMZaQ + event_WmkBvw + event_1clvlg + task_Q80A1Q + task_B8Pi7A + event_aSdkwg + event_Tr0aug + dataObject_UQIXAQ + event_vwH0cA + textAnnotation_LyGTCw + event_TuyuwQ + event_h0Kk5g + task_delO7Q + event_1OVorA + event_baWU4w + event_ofjVfg + event_i7yQVw + gateway_uK0c6g + event_6250fg + task_NohgrQ + event_AMs05g + event_feLZFQ + event_GTXFMw + event_u8OBFg + gateway_whpM0w + event_Idvwtg + event_8yN0uw + gateway_Kjobpw + event_pYaI6A + event_00CWpg + textAnnotation_pSbYVQ + event_AOFZ0A + event_4A016g + event_JGwJaQ + + + + + + + + + + + + + + + + + + + + + + sequenceFlow_25otUg + sequenceFlow_S9LVXg + + + + sequenceFlow_25otUg + + + + sequenceFlow_rwdWxw + + + + + + + + + + + partner.name (partner.id)]]> + + + Adresse:
+partner.name
+partner.address
+partner.zip partner.city
+
+ +BPID: partner.id
+Kreditoren-Nr.: cdtr.number
+Debitoren-Nr.: dbtr.number
+]]>
+
+ + + + + + + + + + + + + + + + + + +
+ + sequenceFlow_avahXg + sequenceFlow_9atLFA + sequenceFlow_b4BcVA + sequenceFlow_03b60w + sequenceFlow_0Icsbw + sequenceFlow_e8q82w +
+ + + + partner.name (partner.id)]]> + + + + + + Adresse:
+partner.name
+partner.address
+partner.zip partner.city
+
+ +BPID: partner.id
+Kreditoren-Nr.: cdtr.number
+Debitoren-Nr.: dbtr.number
+]]>
+
+ + + + + + + + + + + + + + + + + + +
+ + sequenceFlow_1mXO8A + sequenceFlow_m9tokw + sequenceFlow_rwdWxw + sequenceFlow_kS2fMA + sequenceFlow_U2uXSQ +
+ + + + + + + + + + Partnermanagement]]> + + + + sequenceFlow_jAU3VA + sequenceFlow_8O1EtQ + + + + + + + + + + + home]]> + + + + + + + sequenceFlow_1mXO8A + sequenceFlow_X4XnjQ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + sequenceFlow_avahXg + + + + + + + + + + + + + + + + + + + + + + + + + + sequenceFlow_9atLFA + + + + + + + + + + + + + + + sequenceFlow_m9tokw + + + + + + + + partner.name (partner.id)]]> + + + Adresse:
+partner.name
+partner.address
+partner.zip partner.city
+
+ +BPID: partner.id
+Kreditoren-Nr.: cdtr.number
+Debitoren-Nr.: dbtr.number
+]]>
+
+ + + + + + + + + + + + + + + + + + + + + +
+ + sequenceFlow_NNbMhg + sequenceFlow_avahXg + sequenceFlow_pvIENQ + sequenceFlow_BWOtzA + sequenceFlow_ofWWuw + sequenceFlow_b0Bj3Q + sequenceFlow_BHsRkQ +
+ + + + + + + + + + Partnermanagement]]> + + + + sequenceFlow_BHsRkQ + sequenceFlow_5pT4Tw + + + + + + + + home]]> + + + + + + + + + + + + + + + + + + + sequenceFlow_pvIENQ + sequenceFlow_b4BcVA + + + + + + + + + + + + + + + + + + sequenceFlow_BWOtzA + + + + + + + + Partnermanagement]]> + + + + + + + sequenceFlow_ofWWuw + + + + + + + + + + sequenceFlow_S9LVXg + sequenceFlow_jAU3VA + sequenceFlow_8BTEtw + + + + + + + + + + + + + + + + sequenceFlow_kS2fMA + + + + + + + + + + + partner.name (partner.id)]]> + + + Adresse:
+partner.name
+partner.address
+partner.zip partner.city
+
+ +BPID: partner.id
+Kreditoren-Nr.: cdtr.number
+Debitoren-Nr.: dbtr.number
+]]>
+
+ + + + + + + + + + + + + + + + + + +
+ + sequenceFlow_9atLFA + sequenceFlow_8O1EtQ + sequenceFlow_QS6m0Q + sequenceFlow_neSsFQ + sequenceFlow_zd6RWA + sequenceFlow_8O1EtQ + sequenceFlow_Zl0LZA + sequenceFlow_BbA3Gg + sequenceFlow_3SU0Xw +
+ + + + + + + sequenceFlow_5pT4Tw + + + + + sequenceFlow_8BTEtw + + + + + + + + + + + sequenceFlow_OwZZBw + + + + + + + + sequenceFlow_zd6RWA + + + + + + + sequenceFlow_b0Bj3Q + sequenceFlow_neSsFQ + sequenceFlow_DC7n0g + sequenceFlow_X4XnjQ + + + + + + + + + + + + + + + sequenceFlow_Zl0LZA + sequenceFlow_0Icsbw + + + + + + + + + + + + + + home]]> + + + + + + + + + + + + + + + + + + + sequenceFlow_RkjrPQ + + sequenceFlow_b0d63g + + + + sequenceFlow_03b60w + sequenceFlow_OwZZBw + sequenceFlow_RkjrPQ + sequenceFlow_DC7n0g + + + + + + + + + + + sequenceFlow_b0d63g + + + + + + + + sequenceFlow_BbA3Gg + + + + + + + + + + + + + + + + + + + + + + sequenceFlow_3SU0Xw + + + + + + + + + mahnlauf-de-1.0 + 1000 + 10 + partner.id,partner.name,dbtr.number,dbtr.mail,partner.name|dbtr.name + /pages/workitems/workitem.jsf?id=$uniqueid +]]> + + + + + + + + + + + sequenceFlow_e8q82w + + + + + + + + + + + + + + home]]> + + + + + + + sequenceFlow_U2uXSQ + sequenceFlow_QS6m0Q + + + + + + + + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
diff --git a/workflow/usa/rechnungseingang-usa-1.0.1.bpmn b/workflow/usa/rechnungseingang-usa-1.0.1.bpmn index 6d43e0d..5e3f810 100644 --- a/workflow/usa/rechnungseingang-usa-1.0.1.bpmn +++ b/workflow/usa/rechnungseingang-usa-1.0.1.bpmn @@ -4101,7 +4101,7 @@ result.isValid=true; - +