support list of atc.number items

This commit is contained in:
Ralph Soika 2024-08-17 09:01:18 +02:00
parent 316ea10de5
commit 5a04a70a4d

View file

@ -472,8 +472,8 @@ public class CargosoftXMLInvoiceImportService {
// Row Positions lesen // Row Positions lesen
readXMLRows(doc, workitem); readXMLRows(doc, workitem);
// Suche die ATC Nummer.... // Suche die ATC Nummern....
resolveATCNumber(doc, workitem); resolveATCNumbers(doc, workitem);
// Jetzt noch das Space mapping // Jetzt noch das Space mapping
mahnlaufService.mapInvoiceTextToSpace(workitem, spacePosMappings); mahnlaufService.mapInvoiceTextToSpace(workitem, spacePosMappings);
@ -566,26 +566,29 @@ public class CargosoftXMLInvoiceImportService {
} }
/** /**
* Hilfsmethode die die ATC Nummer sucht. * Hilfsmethode die die ATC Nummer sucht und in das workitem feld
* invoice.atc.number einträgt.
* Wir gehen davon aus, das wir über die ChildItems diese aus dem billingtexts * Wir gehen davon aus, das wir über die ChildItems diese aus dem billingtexts
* schon ermittel haben. * schon ermittel haben.
* Es können mehrere ATC nummern existieren. Diese werden in einer Liste
* gespeichert
* *
* @param doc * @param doc
* @param workitem * @param workitem
*/ */
private void resolveATCNumber(Document doc, ItemCollection workitem) { private void resolveATCNumbers(Document doc, ItemCollection workitem) {
String atcNumber = null; String atcNumber = null;
List<ItemCollection> childs = InvoiceUtil.explodeChildList(workitem); List<ItemCollection> childs = InvoiceUtil.explodeChildList(workitem);
for (ItemCollection child : childs) { for (ItemCollection child : childs) {
if (child.hasItem("atc.number")) { if (child.hasItem("atc.number")) {
atcNumber = child.getItemValueString("atc.number"); atcNumber = child.getItemValueString("atc.number");
break; workitem.appendItemValue("invoice.atc.number", atcNumber);
// break;
} }
} }
if (atcNumber != null && !atcNumber.isEmpty()) { // if (atcNumber != null && !atcNumber.isEmpty()) {
workitem.setItemValue("invoice.atc.number", atcNumber); // workitem.setItemValue("invoice.atc.number", atcNumber);
} // }
} }
/** /**