update excel update

This commit is contained in:
Ralph Soika 2025-08-21 12:09:41 +02:00
parent c2c3b6e798
commit b666ffdbb7
2 changed files with 1105 additions and 23 deletions

View file

@ -1,4 +1,4 @@
package com.alexanderlogistics.dwc; package com.alexanderlogistics.sepa;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
@ -30,7 +30,8 @@ import org.imixs.workflow.exceptions.PluginException;
import org.imixs.workflow.exceptions.QueryException; import org.imixs.workflow.exceptions.QueryException;
import org.imixs.workflow.sepa.services.SepaWorkflowService; import org.imixs.workflow.sepa.services.SepaWorkflowService;
import com.alexanderlogistics.KreditorDebitorService; import com.alexanderlogistics.BusinessPartnerService;
import com.alexanderlogistics.InvoiceUtil;
import com.alexanderlogistics.OPListExportAdapterByWeek; import com.alexanderlogistics.OPListExportAdapterByWeek;
import jakarta.ejb.EJB; import jakarta.ejb.EJB;
@ -56,9 +57,9 @@ import jakarta.inject.Inject;
* @version 1.0 * @version 1.0
* @author rsoika * @author rsoika
*/ */
public class SEPAExportAdapterNBD implements SignalAdapter { public class SEPAExportAdapterExcel implements SignalAdapter {
private static Logger logger = Logger.getLogger(SEPAExportAdapterNBD.class.getName()); private static Logger logger = Logger.getLogger(SEPAExportAdapterExcel.class.getName());
public static final String ERROR_CONFIG = "CONFIG_ERROR"; public static final String ERROR_CONFIG = "CONFIG_ERROR";
public static final String ERROR_MISSING_INVOICE = "ERROR_MISSING_INVOICE"; public static final String ERROR_MISSING_INVOICE = "ERROR_MISSING_INVOICE";
@ -81,7 +82,7 @@ public class SEPAExportAdapterNBD implements SignalAdapter {
SnapshotService snapshotService; SnapshotService snapshotService;
@Inject @Inject
KreditorDebitorService kreditorDebitorService; BusinessPartnerService businessPartnerService;
/** /**
* This method collects a data set with all invoices and computes a NBA Excel * This method collects a data set with all invoices and computes a NBA Excel
@ -242,7 +243,7 @@ public class SEPAExportAdapterNBD implements SignalAdapter {
logger.finest("......new document added"); logger.finest("......new document added");
} catch (IOException e) { } catch (IOException e) {
throw new PluginException(SEPAExportAdapterNBD.class.getSimpleName(), ERROR_CONFIG, throw new PluginException(SEPAExportAdapterExcel.class.getSimpleName(), ERROR_CONFIG,
"failed to update sepa export: " + e.getMessage()); "failed to update sepa export: " + e.getMessage());
} }
} }
@ -289,17 +290,12 @@ public class SEPAExportAdapterNBD implements SignalAdapter {
String result = ""; String result = "";
ItemCollection cdtrItemCol = null; ItemCollection cdtrItemCol = null;
String cdtrNumber = workitem.getItemValueString("cdtr.number"); cdtrItemCol = businessPartnerService.getBusinessPartnerByID(InvoiceUtil.getBPID(workitem));
try {
cdtrItemCol = kreditorDebitorService.findCreditor(cdtrNumber);
} catch (PluginException e) {
logger.warning("Unable to resolve address for " + cdtrNumber + " : " + e.getMessage());
}
if (cdtrItemCol != null) { if (cdtrItemCol != null) {
result = result + cdtrItemCol.getItemValueString("_vendor_zip_code") + " "; result = result + cdtrItemCol.getItemValueString("partner.zip") + " ";
result = result + cdtrItemCol.getItemValueString("_vendor_city") + " "; result = result + cdtrItemCol.getItemValueString("partner.city") + " ";
result = result + cdtrItemCol.getItemValueString("_vendor_str") + " "; result = result + cdtrItemCol.getItemValueString("partner.address") + " ";
} }
// length max 255 // length max 255
@ -308,16 +304,10 @@ public class SEPAExportAdapterNBD implements SignalAdapter {
} }
private String getVendorField(ItemCollection workitem, String fieldname) { private String getVendorField(ItemCollection workitem, String fieldname) {
String result = "";
ItemCollection cdtrItemCol = null; ItemCollection cdtrItemCol = null;
String cdtrNumber = workitem.getItemValueString("cdtr.number"); cdtrItemCol = businessPartnerService.getBusinessPartnerByID(InvoiceUtil.getBPID(workitem));
try {
cdtrItemCol = kreditorDebitorService.findCreditor(cdtrNumber);
} catch (PluginException e) {
logger.warning("Unable to resolve address for " + cdtrNumber + " : " + e.getMessage());
}
if (cdtrItemCol != null) { if (cdtrItemCol != null) {
return cdtrItemCol.getItemValueString(fieldname); return cdtrItemCol.getItemValueString(fieldname);
} }

File diff suppressed because it is too large Load diff