cargosoft kreditoren import und Suchfunktion
This commit is contained in:
parent
a6830293fb
commit
4fabeed395
7 changed files with 227 additions and 4 deletions
16
README.md
16
README.md
|
|
@ -65,7 +65,7 @@ Es gibt ein Email Konto das wir für den Import von Rechnungen nutzen
|
||||||
|
|
||||||
# Cargosoft
|
# Cargosoft
|
||||||
|
|
||||||
Die Cargosoft Schnittstelle besteht aus einem eigenen Export modell "cargosoft-export-1.0.0". In diesem wird der CargoosftExportAdapter getriggert, der die Daten einer Rechnung an den FTP Server übermittelt.
|
Die Cargosoft Schnittstelle besteht aus einem eigenen BPMN modell "cargosoft-export-1.0.0". In diesem wird der CargoosftExportAdapter getriggert, der die Daten einer Rechnung an den FTP Server übermittelt.
|
||||||
|
|
||||||
Cargosoft prüft alle 10 Sekunden ob sich Dateien mit der Dateiendung ".xml" auf dem FTP befinden und holt diese ab.
|
Cargosoft prüft alle 10 Sekunden ob sich Dateien mit der Dateiendung ".xml" auf dem FTP befinden und holt diese ab.
|
||||||
|
|
||||||
|
|
@ -76,6 +76,20 @@ Die Konfiguration der FTP Schnittstelle erfolgt über den Konfigurationsdialog i
|
||||||
cargosoft.export.ftp.user=u248962-sub2
|
cargosoft.export.ftp.user=u248962-sub2
|
||||||
cargosoft.export.ftp.password=aXa61n9Un3jDNQlL
|
cargosoft.export.ftp.password=aXa61n9Un3jDNQlL
|
||||||
|
|
||||||
|
|
||||||
|
## Cargosoft Kreditoren
|
||||||
|
|
||||||
|
Wir importieren auch eine CSV Datei von Kreditoren mit dem namen *Vendors.csv*. Für den Import verwenden wir den Standard CSV Import Service aus dem [Imixs-Archive Importer Projekt](https://github.com/imixs/imixs-archive/tree/master/imixs-archive-importer).
|
||||||
|
|
||||||
|
Die Datei wird von Cargosoft einmal Täglich bereitgestellt und befindet sich auf dem FTP Sever unter:
|
||||||
|
|
||||||
|
/office-alexander-logistics/cargosoft/fromCargosoft/stammdaten/Vendors.csv
|
||||||
|
|
||||||
|
Das Schlüsselfeld ist *_VENDOR_NUM*. Zusätzlich indizieren wir das feld *_VENDOR_NAME*. So kann man über die Lucene SUche sowohl nach dem namen oder der Nummer suchen.
|
||||||
|
|
||||||
|
In der Erfassungsmaske haben wir dann eine JavaScript Implementierung mit Ajax die bei Eingabe in das Feld *cdtr.number* Vorschläge aus den importieren Kreditoren macht. Das ist ähnlich implementiert wie die Imixs-ML Suggest LIste
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# Imixs-ML
|
# Imixs-ML
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,121 @@
|
||||||
|
package com.alexanderlogistics;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.logging.Logger;
|
||||||
|
|
||||||
|
import javax.enterprise.context.ConversationScoped;
|
||||||
|
import javax.faces.context.FacesContext;
|
||||||
|
import javax.inject.Inject;
|
||||||
|
import javax.inject.Named;
|
||||||
|
|
||||||
|
import org.imixs.workflow.ItemCollection;
|
||||||
|
import org.imixs.workflow.engine.DocumentService;
|
||||||
|
import org.imixs.workflow.exceptions.QueryException;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The CargosoftController CDI Bean provides Front-End methods for the cargosoft kreditore objects.
|
||||||
|
* <p>
|
||||||
|
* The method search provides a suggest list searching a phrase within the
|
||||||
|
* cargosoft creditor list (type=cargosoftkreditor).
|
||||||
|
*
|
||||||
|
* @author rsoika
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Named
|
||||||
|
@ConversationScoped
|
||||||
|
public class CargosoftController implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
private static Logger logger = Logger.getLogger(CargosoftController.class.getName());
|
||||||
|
|
||||||
|
|
||||||
|
@Inject
|
||||||
|
protected DocumentService documentService;
|
||||||
|
|
||||||
|
private List<String> searchResult = null;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method searches a text phrase within the list of cargosoft kreditor objects (type=cargosoftkreditor).
|
||||||
|
* <p>
|
||||||
|
* JSF Integration:
|
||||||
|
*
|
||||||
|
* {@code
|
||||||
|
*
|
||||||
|
* <h:commandScript name="imixsOfficeWorkflow.mlSearch" action=
|
||||||
|
* "#{cargosoftController.search()}" rendered="#{cargosoftController!=null}" render=
|
||||||
|
* "cargosoft-results" /> }
|
||||||
|
*
|
||||||
|
* <p>
|
||||||
|
* JavaScript Example:
|
||||||
|
*
|
||||||
|
* <pre>
|
||||||
|
* {@code
|
||||||
|
* imixsOfficeWorkflow.cargosoftSearch({ item: '_invoicenumber' })
|
||||||
|
* }
|
||||||
|
* </pre>
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public void searchCreditor() {
|
||||||
|
|
||||||
|
searchResult = new ArrayList<String>();
|
||||||
|
// get the param from faces context....
|
||||||
|
FacesContext fc = FacesContext.getCurrentInstance();
|
||||||
|
String phrase = fc.getExternalContext().getRequestParameterMap().get("phrase");
|
||||||
|
if (phrase==null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
logger.fine("search prase '" + phrase + "'");
|
||||||
|
|
||||||
|
|
||||||
|
// String input =workflowController.getWorkitem().getItemValueString(itemName);
|
||||||
|
if (phrase == null || phrase.length() < 2) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// die cargosoft Kreditornummer beginnt seltsamerweise mit einem K.....
|
||||||
|
String query="(type:cargosoftkreditor) AND ( (name:K" + phrase + "*) OR ("+phrase.toLowerCase() + "*) )";
|
||||||
|
|
||||||
|
|
||||||
|
try {
|
||||||
|
List<ItemCollection> result = documentService.find(query, 20, 0);
|
||||||
|
logger.info("found " + result.size() + " creditors...");
|
||||||
|
if (result!=null) {
|
||||||
|
for (ItemCollection cdtr: result) {
|
||||||
|
// wir entfernen das führende K
|
||||||
|
String cdtrNo=cdtr.getItemValueString("_VENDOR_NUM");
|
||||||
|
if (cdtrNo.startsWith("K")) {
|
||||||
|
cdtrNo=cdtrNo.substring(1);
|
||||||
|
}
|
||||||
|
searchResult.add(cdtrNo + " - "+cdtr.getItemValueString("_VENDOR_Name"));
|
||||||
|
//logger.finest("...add: " + cdtr.getItemValueString("_VENDOR_NUM") + " - "+cdtr.getItemValueString("_VENDOR_Name"));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (QueryException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
public List<String> getSearchResult() {
|
||||||
|
return searchResult;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method reset the search and input state.
|
||||||
|
*/
|
||||||
|
public void reset() {
|
||||||
|
searchResult = new ArrayList<String>();
|
||||||
|
logger.fine("reset");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -2,7 +2,7 @@
|
||||||
# Imixs Lucene Plugin
|
# Imixs Lucene Plugin
|
||||||
##############################
|
##############################
|
||||||
lucence.indexDir=${imixs-office.IndexDir}
|
lucence.indexDir=${imixs-office.IndexDir}
|
||||||
index.fields=txtsearchstring,txtSubject,txtname,txtEmail,txtUserName,namCreator,txtworkflowgroup,txtworkflowstatus,txtWorkflowAbstract,txtWorkflowSummary,txtworkflowhistory,txtspacename,txtprocessname,_subject,_description,_name,_projectnumber,_projectname,_ordernumber,_contractnumber,datDueDate,txtcommentlog,htmldescription,htmldocumentation,dms,dms_names,_childitems,$file.names
|
index.fields=txtsearchstring,txtSubject,txtname,txtEmail,txtUserName,namCreator,txtworkflowgroup,txtworkflowstatus,txtWorkflowAbstract,txtWorkflowSummary,txtworkflowhistory,txtspacename,txtprocessname,_subject,_description,_name,_projectnumber,_projectname,_ordernumber,_contractnumber,datDueDate,txtcommentlog,htmldescription,htmldocumentation,dms,dms_names,_childitems,$file.names,_VENDOR_NAME
|
||||||
index.fields.analyze=txtUsername
|
index.fields.analyze=txtUsername
|
||||||
index.fields.noanalyze=type,$UniqueIDRef,$created,$modified,$ModelVersion,namCreator,$ProcessID,datDate,txtWorkflowGroup,txtemail, datdate, datfrom, datto, numsequencenumber,dms_count,invoice.number
|
index.fields.noanalyze=type,$UniqueIDRef,$created,$modified,$ModelVersion,namCreator,$ProcessID,datDate,txtWorkflowGroup,txtemail, datdate, datfrom, datto, numsequencenumber,dms_count,invoice.number
|
||||||
index.fields.store=process.name,txtProcessName,txtWorkflowImageURL
|
index.fields.store=process.name,txtProcessName,txtWorkflowImageURL
|
||||||
|
|
|
||||||
|
|
@ -183,6 +183,7 @@
|
||||||
<h:selectOneRadio value="#{documentImportController.source.item['type']}">
|
<h:selectOneRadio value="#{documentImportController.source.item['type']}">
|
||||||
<f:selectItem itemLabel="IMAP" itemValue="IMAP"/>
|
<f:selectItem itemLabel="IMAP" itemValue="IMAP"/>
|
||||||
<f:selectItem itemLabel="FTP" itemValue="FTP"/>
|
<f:selectItem itemLabel="FTP" itemValue="FTP"/>
|
||||||
|
<f:selectItem itemLabel="CSV" itemValue="CSV"/>
|
||||||
</h:selectOneRadio>
|
</h:selectOneRadio>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -194,6 +195,7 @@
|
||||||
<dd>
|
<dd>
|
||||||
<h:selectOneMenu
|
<h:selectOneMenu
|
||||||
value="#{documentImportController.source.item['workflowgroup']}">
|
value="#{documentImportController.source.item['workflowgroup']}">
|
||||||
|
<f:selectItem itemLabel=" - " itemValue=""/>
|
||||||
<c:forEach items="#{modelController.workflowGroups}" var="group">
|
<c:forEach items="#{modelController.workflowGroups}" var="group">
|
||||||
<f:selectItem itemLabel="#{group}" itemValue="#{group}" />
|
<f:selectItem itemLabel="#{group}" itemValue="#{group}" />
|
||||||
</c:forEach>
|
</c:forEach>
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,78 @@
|
||||||
|
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
|
||||||
|
xmlns:f="http://xmlns.jcp.org/jsf/core"
|
||||||
|
xmlns:h="http://xmlns.jcp.org/jsf/html"
|
||||||
|
xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
|
||||||
|
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
|
||||||
|
xmlns:pt="http://xmlns.jcp.org/jsf/passthrough"
|
||||||
|
xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty"
|
||||||
|
xmlns:i="http://xmlns.jcp.org/jsf/composite/imixs">
|
||||||
|
|
||||||
|
<!-- Cargosoft Search integration
|
||||||
|
|
||||||
|
This subform is loaded by the form_basic.xhtml page.
|
||||||
|
|
||||||
|
The subform provides a jsf commandScript which calls the cargosoftController.searchCreditor method in the backend.
|
||||||
|
|
||||||
|
The script below inits a autocompletion feature for the input field.
|
||||||
|
See imixs-office.autocompletion.js
|
||||||
|
|
||||||
|
See also:
|
||||||
|
https://stackoverflow.com/questions/16588327/how-to-invoke-a-jsf-managed-bean-on-a-html-dom-event-using-native-javascript
|
||||||
|
https://dzone.com/articles/execute-a-jsf-ajax-request-by-just-a-function-call
|
||||||
|
https://www.w3schools.com/howto/howto_js_autocomplete.asp
|
||||||
|
-->
|
||||||
|
<h:commandScript name="cargosoftSearch" action="#{cargosoftController.searchCreditor()}"
|
||||||
|
render="autocomplete-resultlist-cargosoft" onevent="autocompleteShowResult" />
|
||||||
|
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
/*<![CDATA[*/
|
||||||
|
|
||||||
|
// init ml input fields...
|
||||||
|
$(document).ready(function() {
|
||||||
|
|
||||||
|
// add autocomplete feature to cdtr.number...
|
||||||
|
var creditorField= $("input[data-item='cdtr.number']");
|
||||||
|
$(creditorField).each(function() {
|
||||||
|
$(this).addClass("imixs-ml");
|
||||||
|
//$(creditorField).attr('data-resultlist', 'autocomplete-resultlist-cargosoft');
|
||||||
|
autocompleteInitInput(this,cargosoftSearch,'autocomplete-resultlist-cargosoft',selectCdtrCallback);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
// schneide die kreditornnummer aus dem selectierten Text aus (wir brauchen nur die)
|
||||||
|
function selectCdtrCallback(selection) {
|
||||||
|
// extract the number between start and ' - '
|
||||||
|
var cdtrNo=selection.substring(0,selection.indexOf(' - '));
|
||||||
|
var cdtrName=selection.substring(selection.indexOf(' - ')+3);
|
||||||
|
var inputElement=$("input[data-item='cdtr.number']");
|
||||||
|
inputElement.val(cdtrNo);
|
||||||
|
// remove old cdtr.name
|
||||||
|
$('#cdtr-name-id').remove();
|
||||||
|
// append span with cdtr.name....
|
||||||
|
inputElement.after( "<span id='cdtr-name-id' class='small'>" + cdtrName + "</p>" );
|
||||||
|
}
|
||||||
|
|
||||||
|
/*]]>*/
|
||||||
|
</script>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<!-- cargosoft creditor suggest list -->
|
||||||
|
<h:panelGroup id="autocomplete-resultlist-cargosoft" layout="block" class="autocomplete-resultlist">
|
||||||
|
<ui:repeat var="suggest" value="#{cargosoftController.searchResult}">
|
||||||
|
<div class="autocomplete-resultlist-element" onclick="autocompleteSelectElement('#{suggest}')">
|
||||||
|
<a href="#">
|
||||||
|
<h:outputText value="#{suggest}" escape="false"/>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</ui:repeat>
|
||||||
|
</h:panelGroup>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
</ui:composition>
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -7,6 +7,14 @@
|
||||||
xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty"
|
xmlns:marty="http://xmlns.jcp.org/jsf/composite/marty"
|
||||||
xmlns:i="http://xmlns.jcp.org/jsf/composite/imixs">
|
xmlns:i="http://xmlns.jcp.org/jsf/composite/imixs">
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Cargosoft Creditor Search integration -->
|
||||||
|
<ui:include src="/pages/workitems/forms/alexander/cargsoft-creditor-search.xhtml">
|
||||||
|
<ui:param name="workitem" value="#{workflowController.workitem}" />
|
||||||
|
</ui:include>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<!-- the following code computes the txtworkflow abstract from the current modelversion and processid -->
|
<!-- the following code computes the txtworkflow abstract from the current modelversion and processid -->
|
||||||
<ui:param name="instruction"
|
<ui:param name="instruction"
|
||||||
value="#{modelController.getProcessDescription(workflowController.workitem.item['$taskid'],workflowController.workitem.item['$ModelVersion'],workflowController.workitem)}"></ui:param>
|
value="#{modelController.getProcessDescription(workflowController.workitem.item['$taskid'],workflowController.workitem.item['$ModelVersion'],workflowController.workitem)}"></ui:param>
|
||||||
|
|
|
||||||
4
pom.xml
4
pom.xml
|
|
@ -27,9 +27,9 @@
|
||||||
<!-- Versions -->
|
<!-- Versions -->
|
||||||
<org.imixs.workflow.version>5.2.9</org.imixs.workflow.version>
|
<org.imixs.workflow.version>5.2.9</org.imixs.workflow.version>
|
||||||
<org.imixs.marty.version>4.1.11</org.imixs.marty.version>
|
<org.imixs.marty.version>4.1.11</org.imixs.marty.version>
|
||||||
<org.imixs.office.version>4.4.4</org.imixs.office.version>
|
<org.imixs.office.version>4.4.5-SNAPSHOT</org.imixs.office.version>
|
||||||
<org.imixs.adapters.version>2.2.5-SNAPSHOT</org.imixs.adapters.version>
|
<org.imixs.adapters.version>2.2.5-SNAPSHOT</org.imixs.adapters.version>
|
||||||
<org.imixs.archive.version>2.2.9</org.imixs.archive.version>
|
<org.imixs.archive.version>2.2.11-SNAPSHOT</org.imixs.archive.version>
|
||||||
<org.imixs.melman.version>1.0.20</org.imixs.melman.version>
|
<org.imixs.melman.version>1.0.20</org.imixs.melman.version>
|
||||||
<org.imixs.ml.version>1.1.0-SNAPSHOT</org.imixs.ml.version>
|
<org.imixs.ml.version>1.1.0-SNAPSHOT</org.imixs.ml.version>
|
||||||
<microprofile.version>2.2</microprofile.version>
|
<microprofile.version>2.2</microprofile.version>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue