This commit is contained in:
Ralph Soika 2021-01-29 14:39:19 +01:00
parent cf9bfd952b
commit 268f24fafc
12 changed files with 351 additions and 223 deletions

View file

@ -11,6 +11,7 @@ import javax.xml.bind.JAXBException;
import javax.xml.transform.TransformerException;
import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.imixs.archive.core.SnapshotService;
import org.imixs.workflow.FileData;
import org.imixs.workflow.ItemCollection;
import org.imixs.workflow.SignalAdapter;
@ -27,14 +28,16 @@ import org.imixs.workflow.exceptions.PluginException;
* report = report definition to transfere the workitem into the cargosoft xml
* structure
*
* <p>
*
* <pre>
* {@code
<cargosoft name="report">cargosoft</cargosoft>
}
* </pre>
* <p>
* Because we also export the attachment data to cargosoft, the adaper lookups
* the conente of the attachment in the snapshot of the origin workitem
*
*
* @version 1.0
* @author rsoika
@ -49,15 +52,16 @@ public class CargosoftExportAdapter implements SignalAdapter {
private static Logger logger = Logger.getLogger(CargosoftExportAdapter.class.getName());
@Inject
@ConfigProperty(name = FTPConnector.ENV_EXPORT_FTP_HOST)
Optional<String> ftpServer;
@Inject
WorkflowService workflowService;
@Inject
SnapshotService snapshotService;
@Inject
ReportService reportService;
@ -89,7 +93,9 @@ public class CargosoftExportAdapter implements SignalAdapter {
}
List<ItemCollection> sourceData = new ArrayList<ItemCollection>();
sourceData.add(document);
// add the file data form the snapshot origin workitem
ItemCollection documentWithFileData = loadFileDataFromSnapshot(document);
sourceData.add(documentWithFileData);
// start transformation
FileData exportFile = reportService.transformDataSource(report, sourceData,
document.getUniqueID() + ".xml");
@ -114,4 +120,48 @@ public class CargosoftExportAdapter implements SignalAdapter {
return document;
}
/**
* This method lookups the origin snapshot data and add the content of the $file
* to the export document
*
* @param document
* @return
*/
@SuppressWarnings("unchecked")
private ItemCollection loadFileDataFromSnapshot(ItemCollection document) {
ItemCollection origin = null;
ItemCollection result = (ItemCollection) document.clone();
// find the origin document
List<String> refs = document.getItemValue(WorkflowService.UNIQUEIDREF);
for (String ref : refs) {
origin = workflowService.getWorkItem(ref);
if ("Rechnungseingang".equals(origin.getWorkflowGroup())) {
break;
}
origin = null;
}
// we should have found the origin...
if (origin != null) {
ItemCollection snapshot = snapshotService.findSnapshot(origin);
// we should have found a snapshot...
if (snapshot != null) {
List<FileData> fileDataList = snapshot.getFileData();
// transfer origin file content
result.removeItem("$file");
for (FileData filedata : fileDataList) {
result.addFileData(filedata);
}
} else {
logger.warning("...did not found snapshot for origin workitem " + origin.getUniqueID());
}
} else {
logger.warning("...did not found origin workitem " + document.getUniqueID());
}
return result;
}
}

View file

@ -0,0 +1,19 @@
package com.alexanderlogistics;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.validator.FacesValidator;
import javax.faces.validator.Validator;
import javax.faces.validator.ValidatorException;
@FacesValidator("com.validators.MyValidator")
public class TestValidator implements Validator{
@Override
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
// TODO Auto-generated method stub
}
}

View file

@ -13,7 +13,7 @@ $(document).ready(function() {
if (date.val()!="" && period.val()=="") {
// no data - so build the period from 05.12.2020
part1=date.val().substring(6,10);
part2=date.val().substring(0,2);
part2=date.val().substring(3,5);
newval=""+part1 +part2;
$("input[data-item='invoice.period']").val(newval);
}

View file

@ -17,7 +17,8 @@
<tr>
<th style="">#</th>
<th style="">Positionsnummer<span class="imixs-required"> *</span></th>
<th style="width: 150px;">Steuer</th>
<th style="width: 100px;">Steuer</th>
<th style="width: 100px;">Leistungsart</th>
<th style="width: 150px;text-align:right;">Netto</th>
<th style="width: 150px;text-align:right;">Brutto</th>
<th style="">
@ -46,6 +47,25 @@
<f:selectItem itemLabel="Reverse-Charge-EU" itemValue="RCE"></f:selectItem>
</h:selectOneMenu></td>
<!-- Leistungsart -->
<td><h:selectOneMenu value="#{orderitem.item['category']}" a:data-id="orderitem_category" >
<f:selectItem itemLabel="" itemValue="" />
<f:selectItem itemLabel="Dieselzuschlag" itemValue="DIESEL"></f:selectItem>
<f:selectItem itemLabel="EUSt" itemValue="EUST"></f:selectItem>
<f:selectItem itemLabel="Transportkosten - Nachlauf" itemValue="FRACHT"></f:selectItem>
<f:selectItem itemLabel="Umschlagkosten" itemValue="HANDL"></f:selectItem>
<f:selectItem itemLabel="Joloda" itemValue="JOLODA"></f:selectItem>
<f:selectItem itemLabel="Lagerkosten" itemValue="LAGER"></f:selectItem>
<f:selectItem itemLabel="Luftfracht" itemValue="LUFT"></f:selectItem>
<f:selectItem itemLabel="Mautgebühren" itemValue="MAUT"></f:selectItem>
<f:selectItem itemLabel="Seefracht" itemValue="SEE"></f:selectItem>
<f:selectItem itemLabel="Shipping Agency" itemValue="SHA"></f:selectItem>
<f:selectItem itemLabel="Sonstige" itemValue="SONST"></f:selectItem>
<f:selectItem itemLabel="Lagerkosten" itemValue="STORAGE"></f:selectItem>
<f:selectItem itemLabel="THC-Kosten" itemValue="THC"></f:selectItem>
<f:selectItem itemLabel="Zoll" itemValue="Zoll"></f:selectItem>
</h:selectOneMenu></td>
<!-- Netto Betrag -->
<td style="text-align:right;"><h:inputText value="#{orderitem.item['amount']}"
a:data-id="orderitem_amount" style="text-align: right;width:100%;">
@ -74,6 +94,7 @@
<td />
<td />
<td />
<td />
<td data-id="orderlist_summary" style="text-align: right;padding-right:10px;font-wight:bold;"></td>
<td />
</tr>

View file

@ -14,7 +14,8 @@
<tr>
<th style="">#</th>
<th style="">Positionsnummer<span class="imixs-required"> *</span></th>
<th style="width: 150px;">Steuer</th>
<th style="width: 100px;">Steuer</th>
<th style="width: 100px;">Leistungsart</th>
<th style="width: 150px;text-align:right;">Netto</th>
<th style="width: 150px;text-align:right;">Brutto</th>
</tr>
@ -31,6 +32,8 @@
<td><h:outputText value="#{orderitem.item['tax']}" /></td>
<td><h:outputText value="#{orderitem.item['category']}" /></td>
<td style="text-align: right;"><h:outputText value="#{orderitem.item['amount']}"
/></td>
@ -49,6 +52,7 @@
<td />
<td />
<td />
<td />
<td style="text-align: right;">Summe:</td>
<td class="orderlist_summary" style="text-align: right;">
<h:outputText value="#{workitem.item['order.total']}">

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1,163 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:strip-space elements="*" />
<xsl:output method="xml" indent="yes" encoding="UTF-8"
standalone="yes" />
<xsl:template match="/">
<xsl:variable name="date"
select="/data/document/item[@name='$modified']/value" />
<Invoices version="2020.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Message>
<SenderID>Imixs-Office-Workflow</SenderID>
<ReceiverID>Cargosoft</ReceiverID>
<MessageID><xsl:value-of select="/data/document/item[@name='$uniqueid']/value" /></MessageID>
<MessageDate>
<DateTime><xsl:value-of select="$date" /></DateTime>
</MessageDate>
</Message>
<xsl:apply-templates
select="/data/document[normalize-space(item[@name = '$workflowgroup']/value) = 'Cargosoft-Export']" />
</Invoices>
</xsl:template>
<!-- This template builds invoice info -->
<xsl:template
match="/data/document[normalize-space(item[@name = '$workflowgroup']/value) = 'Cargosoft-Export']">
<xsl:variable name="date" select="item[@name='$modified']/value"/>
<xsl:variable name="currency" select="item[@name='invoice.currency']/value"/>
<Invoice>
<InvoiceHeader>
<Client>
<Codes>
<!-- Als Typ muss „cs“ übermittelt werden und im Code wird
dann der Cargosoft Mandant erwartet. -->
<Code Type="cs">001</Code>
</Codes>
</Client>
<!-- Hier muss eine eindeutige Belegnummer für jeden einzelnen
Beleg übermittelt werden. Es muss sich um eine Nummer
handeln, die pro Beleg hochgezählt wird und darf sich nicht
überschneiden mit dem CargoSoft Belegnummernkreis.
Daher den Nummernkreis vorher mit CargoSoft absprechen. -->
<InvoiceNumber><xsl:value-of select="item[@name='numsequencenumber']/value" /></InvoiceNumber>
<InvoiceType>
<Codes>
<Code Type="cs">INVOICE</Code>
</Codes>
</InvoiceType>
<InvoiceCurrency>
<Codes>
<Code Type="cs"><xsl:value-of select="$currency" /></Code>
</Codes>
</InvoiceCurrency>
<InvoiceAmount>
<NetAmount>
<Amount>
<Currency>
<Codes>
<Code Type="cs"><xsl:value-of select="$currency" /></Code>
</Codes>
</Currency>
<Value><xsl:value-of select="item[@name='invoice.total']/value" /></Value>
<ExchangeRate><xsl:value-of select="item[@name='invoice.exchangerate']/value" /></ExchangeRate>
</Amount>
</NetAmount>
<VATInformation>
<VATAmount>
<Amount isDomesticCurrency="true">
<Currency>
<Codes>
<Code Type="cs"><xsl:value-of select="$currency" /></Code>
</Codes>
</Currency>
<Value>0</Value>
</Amount>
</VATAmount>
</VATInformation>
</InvoiceAmount>
<CollectionInvoice>false</CollectionInvoice>
<xsl:if test="string-length(item[@name='invoice.period']/value) > 0">
<BookingPeriod><xsl:value-of select="item[@name='invoice.period']/value" /></BookingPeriod>
</xsl:if>
<Booked>false</Booked>
<InvoiceDate><xsl:value-of select="item[@name='invoice.date']/value" /></InvoiceDate>
<InvoiceAddress type="CN">
<Codes>
<Code Type="cs"><xsl:value-of select="item[@name='cdtr.number']/value" /></Code>
</Codes>
</InvoiceAddress>
<References>
<Reference type="cs"><xsl:value-of select="item[@name='invoice.number']/value" /></Reference>
</References>
<!-- Attachements -->
<xsl:if test="item[@name='$file.count']/value > 0">
<Attachments>
<xsl:for-each
select="item[@name='$file']/value/item">
<Attachment>
<xsl:attribute name="id"><xsl:value-of select="./value/item[@name='md5checksum']/value" /></xsl:attribute>
<xsl:attribute name="version">1</xsl:attribute>
<Filename><xsl:value-of select="./@name" /></Filename>
<Description>Imixs-Office-Workflow</Description>
<Content><xsl:value-of select="./value[2]" /></Content>
</Attachment>
</xsl:for-each>
</Attachments>
</xsl:if>
</InvoiceHeader>
<InvoiceRows>
<xsl:for-each
select="item[@name='_childitems']/value">
<InvoiceRow>
<Row><xsl:value-of select="./item[@name='numpos']/value" /></Row>
<FileNumber><xsl:value-of select="./item[@name='name']/value" /></FileNumber>
<InvoiceAmount>
<NetAmount>
<Amount>
<Currency>
<Codes>
<Code Type="cs"><xsl:value-of select="$currency" /></Code>
</Codes>
</Currency>
<Value><xsl:value-of select="./item[@name='amount']/value" /></Value>
</Amount>
</NetAmount>
<VATInformation>
<VAT>
<Codes>
<Code Type="cs"><xsl:value-of select="./item[@name='tax']/value" /></Code>
</Codes>
</VAT>
</VATInformation>
</InvoiceAmount>
<ActivityType>
<Codes>
<Code Type="cs"><xsl:value-of select="./item[@name='category']/value" /></Code>
</Codes>
</ActivityType>
</InvoiceRow>
</xsl:for-each>
</InvoiceRows>
</Invoice>
</xsl:template>
</xsl:stylesheet>

View file

@ -1,202 +0,0 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<xsl:stylesheet
xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="2.0">
<xsl:strip-space elements="*" />
<xsl:output method="xml" indent="yes" encoding="UTF-8"
standalone="yes" />
<xsl:template match="/">
<xsl:variable name="date"
select="/data/document/item[@name='$modified']/value" />
<xsl:variable name="subject"
select="/data/document/item[@name='_subject']/value" />
<xsl:variable name="currency"
select="/data/document/item[@name='_currency']/value" />
<xsl:variable name="invoiceid"
select="/data/document/item[@name='_invoicenumber']/value" />
<xsl:variable name="gegenkonto"
select="/data/document/item[@name='_kreditor_konto']/value" />
<Invoices version="2020.2"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<Message>
<SenderID>Imixs-Office-Workflow</SenderID>
<ReceiverID>Cargosoft</ReceiverID>
<MessageID>1</MessageID>
<MessageDate>
<DateTime><xsl:value-of select="$date" /></DateTime>
</MessageDate>
</Message>
<Invoice>
<InvoiceHeader>
<Client>
<Codes>
<!-- Als Typ muss „cs“ übermittelt werden und im Code wird
dann der Cargosoft Mandant erwartet. -->
<Code Type="cs">001</Code>
</Codes>
</Client>
<!-- Hier muss eine eindeutige Belegnummer für jeden einzelnen
Beleg übermittelt werden. Es muss sich um eine Nummer
handeln, die pro Beleg hochgezählt wird und darf sich nicht
überschneiden mit dem CargoSoft Belegnummernkreis.
Daher den Nummernkreis vorher mit CargoSoft absprechen. -->
<InvoiceNumber><xsl:value-of select="/data/document/item[@name='numsequencenumber']/value" /></InvoiceNumber>
<InvoiceType>
<Codes>
<Code Type="cs">INVOICE</Code>
</Codes>
</InvoiceType>
<InvoiceCurrency>
<Codes>
<Code Type="cs"><xsl:value-of select="/data/document/item[@name='invoice.currency']/value" /></Code>
</Codes>
</InvoiceCurrency>
<InvoiceAmount>
<NetAmount>
<Amount isDomesticCurrency="true">
<Currency>
<Codes>
<Code Type="cs">EUR</Code>
</Codes>
</Currency>
<Value>500</Value>
</Amount>
</NetAmount>
<VATInformation>
<VATAmount>
<Amount isDomesticCurrency="true">
<Currency>
<Codes>
<Code Type="cs">EUR</Code>
</Codes>
</Currency>
<Value>0</Value>
</Amount>
</VATAmount>
</VATInformation>
</InvoiceAmount>
<CollectionInvoice>false</CollectionInvoice>
<Booked>false</Booked>
<InvoiceDate>2016-07-06T00:00:00.0Z</InvoiceDate>
<InvoiceAddress type="CN">
<Codes>
<Code Type="cs">9999999</Code>
</Codes>
</InvoiceAddress>
<References>
<Reference type="cs">201606-ABS1425131</Reference>
</References>
</InvoiceHeader>
<InvoiceRows>
<InvoiceRow>
<Row>1</Row>
<FileNumber>999-201606-99999</FileNumber>
<InvoiceAmount>
<NetAmount>
<Amount isDomesticCurrency="true">
<Currency>
<Codes>
<Code Type="cs">EUR</Code>
</Codes>
</Currency>
<Value>300.00</Value>
</Amount>
</NetAmount>
<VATInformation>
<VAT>
<Codes>
<Code Type="cs">45</Code>
</Codes>
</VAT>
</VATInformation>
</InvoiceAmount>
<ActivityType>
<Codes>
<Code Type="cs">ACT</Code>
</Codes>
</ActivityType>
</InvoiceRow>
</InvoiceRows>
</Invoice>
<consolidate>
<xsl:attribute name="consolidatedAmount"><xsl:value-of
select="/data/document/item[@name='_amount_brutto']/value" /></xsl:attribute>
<xsl:attribute name="consolidatedDate"><xsl:value-of
select="format-dateTime($date, '[Y0001]-[M01]-[D01]')" /></xsl:attribute>
<xsl:attribute name="consolidatedInvoiceId"><xsl:value-of
select="$invoiceid" /></xsl:attribute>
<xsl:attribute name="consolidatedCurrencyCode"><xsl:value-of
select="$currency" /></xsl:attribute>
<xsl:for-each
select="/data/document/item[@name='_childitems']/value">
<accountsPayableLedger>
<date>
<xsl:value-of
select="format-dateTime($date, '[Y0001]-[M01]-[D01]')" />
</date>
<amount>
<xsl:value-of select="./item[@name='_amount']/value" />
</amount>
<accountNo>
<xsl:value-of select="./item[@name='_konto']/value" />
</accountNo>
<buCode>
<xsl:value-of select="./item[@name='_tax']/value" />
</buCode>
<information>
<xsl:value-of select="$subject" />
</information>
<currencyCode>
<xsl:value-of select="$currency" />
</currencyCode>
<invoiceId>
<xsl:value-of select="$invoiceid" />
</invoiceId>
<bpAccountNo>
<xsl:value-of select="$gegenkonto" />
</bpAccountNo>
</accountsPayableLedger>
</xsl:for-each>
</consolidate>
</Invoices>
</xsl:template>
</xsl:stylesheet>

View file

@ -60,6 +60,21 @@
<Code Type="cs">9876545</Code>
</Codes>
</InvoiceAddress>
<References>
<Reference type="cs">RE2020110040</Reference>
</References>
<Attachments>
<Attachment id="067C441F2E760E359803560975AB26F5" version="1">
<Filename>vwicn285.png</Filename>
<Description>Imixs-Office-Workflow</Description>
<Content>067C441F2E760E359803560975AB26F5067C441F2E760E359803560975AB26F5==</Content>
</Attachment>
<Attachment id="48350AFE4ABBFAB516F1CF4DD9CB64CE" version="1">
<Filename>vwicn259.png</Filename>
<Description>Imixs-Office-Workflow</Description>
<Content>48350AFE4ABBFAB516F1CF4DD9CB64CE48350AFE4ABBFAB516F1CF4DD9CB64CE==</Content>
</Attachment>
</Attachments>
</InvoiceHeader>
<InvoiceRows>
<InvoiceRow>
@ -86,7 +101,7 @@
</InvoiceAmount>
<ActivityType>
<Codes>
<Code Type="cs">ACT</Code>
<Code Type="cs">FRACHT</Code>
</Codes>
</ActivityType>
</InvoiceRow>
@ -114,7 +129,7 @@
</InvoiceAmount>
<ActivityType>
<Codes>
<Code Type="cs">ACT</Code>
<Code Type="cs">ZOLL</Code>
</Codes>
</ActivityType>
</InvoiceRow>

View file

@ -22,13 +22,64 @@
<value xsi:type="xs:string">2020-11-30T15:27:14.411|cargosoft-export-1.0|1000.300|1800|</value>
</item>
<item name="$file">
<value xsi:nil="true" />
<value xsi:type="xmlItemArray">
<item name="vwicn285.png">
<value xsi:type="xs:string">image/png</value>
<value xsi:type="xs:base64Binary">067C441F2E760E359803560975AB26F5067C441F2E760E359803560975AB26F5==</value>
<value xsi:type="xmlItemArray">
<item name="$creator">
<value xsi:type="xs:string">rsoika</value>
</item>
<item name="size">
<value xsi:type="xs:int">1646</value>
</item>
<item name="$created">
<value xsi:type="xs:dateTime">2021-01-29T13:36:31.923+01:00</value>
</item>
<item name="txtname">
<value xsi:type="xs:string">vwicn285.png</value>
</item>
<item name="md5checksum">
<value xsi:type="xs:string">067C441F2E760E359803560975AB26F5</value>
</item>
<item name="namcreator">
<value xsi:type="xs:string">rsoika</value>
</item>
</value>
</item>
<item name="vwicn259.png">
<value xsi:type="xs:string">image/png</value>
<value xsi:type="xs:base64Binary">48350AFE4ABBFAB516F1CF4DD9CB64CE48350AFE4ABBFAB516F1CF4DD9CB64CE==</value>
<value xsi:type="xmlItemArray">
<item name="$creator">
<value xsi:type="xs:string">rsoika</value>
</item>
<item name="size">
<value xsi:type="xs:int">1275</value>
</item>
<item name="$created">
<value xsi:type="xs:dateTime">2021-01-29T13:36:31.923+01:00</value>
</item>
<item name="txtname">
<value xsi:type="xs:string">vwicn259.png</value>
</item>
<item name="md5checksum">
<value xsi:type="xs:string">48350AFE4ABBFAB516F1CF4DD9CB64CE</value>
</item>
<item name="namcreator">
<value xsi:type="xs:string">rsoika</value>
</item>
</value>
</item>
</value>
</item>
<item name="$file.count">
<value xsi:type="xs:int">0</value>
<value xsi:type="xs:int">2</value>
</item>
<item name="$file.names">
<value xsi:nil="true" />
<value xsi:type="xs:string">vwicn285.png</value>
<value xsi:type="xs:string">vwicn259.png</value>
</item>
<item name="$isauthor">
<value xsi:type="xs:boolean">true</value>
@ -105,6 +156,9 @@
<item name="tax">
<value xsi:type="xs:string">0EU</value>
</item>
<item name="category">
<value xsi:type="xs:string">FRACHT</value>
</item>
<item name="numpos">
<value xsi:type="xs:int">1</value>
</item>
@ -119,6 +173,9 @@
<item name="tax">
<value xsi:type="xs:string">0EU</value>
</item>
<item name="category">
<value xsi:type="xs:string">ZOLL</value>
</item>
<item name="numpos">
<value xsi:type="xs:int">2</value>
</item>

View file

@ -436,6 +436,7 @@ var b= workitem.get("order.total")[0];
<bpmn2:incoming>SequenceFlow_8</bpmn2:incoming>
<bpmn2:outgoing>SequenceFlow_51</bpmn2:outgoing>
<bpmn2:outputSet id="OutputSet_2" name="Output Set 2"/>
<bpmn2:signalEventDefinition id="SignalEventDefinition_3"/>
</bpmn2:intermediateCatchEvent>
<bpmn2:intermediateCatchEvent id="IntermediateCatchEvent_5005-10" imixs:activityid="10" name="Speichern">
<bpmn2:extensionElements>