From 7b56b62e7f2911fcba5ae3cb97989ec2202d04c5 Mon Sep 17 00:00:00 2001 From: Ralph Soika Date: Wed, 3 Nov 2021 17:06:25 +0100 Subject: [PATCH] Umsetzugn Stapelverteilung --- .../InvoiceDispatchAdapter.java | 88 +++ .../InvoiceDispatchController.java | 49 -- .../alexander/section_invoices_dispatch.xhtml | 189 +++--- .../stapelverarbeitung-pruefung-de-1.0.0.bpmn | 586 ++---------------- 4 files changed, 256 insertions(+), 656 deletions(-) create mode 100644 office-alexander-logistics-app/src/main/java/com/alexanderlogistics/InvoiceDispatchAdapter.java delete mode 100644 office-alexander-logistics-app/src/main/java/com/alexanderlogistics/InvoiceDispatchController.java diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/InvoiceDispatchAdapter.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/InvoiceDispatchAdapter.java new file mode 100644 index 0000000..e01f55b --- /dev/null +++ b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/InvoiceDispatchAdapter.java @@ -0,0 +1,88 @@ +package com.alexanderlogistics; + +import java.util.logging.Logger; + +import javax.inject.Inject; + +import org.imixs.workflow.ItemCollection; +import org.imixs.workflow.SignalAdapter; +import org.imixs.workflow.engine.WorkflowService; +import org.imixs.workflow.exceptions.AccessDeniedException; +import org.imixs.workflow.exceptions.AdapterException; +import org.imixs.workflow.exceptions.ModelException; +import org.imixs.workflow.exceptions.PluginException; +import org.imixs.workflow.exceptions.ProcessingErrorException; + +/** + * Der InvoiceDispatchAdapter verteilt die vom Abteilungsleiter ausgewählten + * Rechnungen + * + * @version 1.0 + * @author rsoika + */ +public class InvoiceDispatchAdapter implements SignalAdapter { + + private static Logger logger = Logger.getLogger(InvoiceDispatchAdapter.class.getName()); + + @Inject + WorkflowService workflowService; + + /** + * This method computes the cargosoft export data file + * + * @throws PluginException + */ + @Override + public ItemCollection execute(ItemCollection document, ItemCollection event) + throws AdapterException, PluginException { + + logger.info("......stapelverarbeitung pruefung..."); + + String spaceRef = document.getItemValueString("space.ref"); + String sbTeam = document.getItemValueString("sb.team"); + String sbAssist = document.getItemValueString("sb.assist"); + logger.info("...... space.ref=" + spaceRef); + logger.info("...... sb.team=" + sbTeam); + logger.info("...... sb.assist=" + sbAssist); + // read selection + String sSelection = document.getItemValueString("invoice.selection"); + // cut first , + if (sSelection.startsWith(",")) { + sSelection=sSelection.substring(1); + } + String[] ids = sSelection.split(","); + + if (ids.length==0 || ids[0].isEmpty()) { + throw new PluginException(InvoiceDispatchAdapter.class.getSimpleName(), "PROCESSING_ERROR", + "Es wurden keine Rechnungen zur Verteilung ausgewählt."); + } + + for (String id : ids) { + // load invoice + ItemCollection invoice = workflowService.getWorkItem(id); + if (invoice != null) { + logger.info("...stapelverarbeitung : " + id); + + invoice.setItemValue("space.ref", spaceRef); + invoice.setItemValue("sb.team", sbTeam); + invoice.setItemValue("sb.assist", sbAssist); + + // append workitemref + document.appendItemValue("$workitemref", invoice.getUniqueID()); + // now process invoice..... event = 20 + + try { + workflowService.processWorkItem(invoice, 20); + } catch (AccessDeniedException | ProcessingErrorException | PluginException | ModelException e) { + throw new PluginException(InvoiceDispatchAdapter.class.getSimpleName(), "PROCESSING_ERROR", + "Failed to process invoice : " + invoice.getUniqueID()); + } + + } + + } + + return document; + } + +} \ No newline at end of file diff --git a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/InvoiceDispatchController.java b/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/InvoiceDispatchController.java deleted file mode 100644 index 4897240..0000000 --- a/office-alexander-logistics-app/src/main/java/com/alexanderlogistics/InvoiceDispatchController.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.alexanderlogistics; - -import java.io.Serializable; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.logging.Logger; - -import javax.enterprise.context.ConversationScoped; -import javax.enterprise.context.RequestScoped; -import javax.inject.Inject; -import javax.inject.Named; - -import org.imixs.workflow.engine.DocumentService; - -/** - * Der InvoiceDispatchController ist nur für die form 'section_inovice_dispatch' da um die angwählten checkboxen zu - * notieren - * - * @se: https://stackoverflow.com/questions/2524514/how-to-use-hselectbooleancheckbox-in-hdatatable-or-uirepeat-to-select-m - * @author rsoika - * - */ -@Named -@RequestScoped -public class InvoiceDispatchController implements Serializable { - - private static final long serialVersionUID = 1L; - private static Logger logger = Logger.getLogger(InvoiceDispatchController.class.getName()); - - private Map checked = new HashMap(); - private List invoices; - public Map getChecked() { - return checked; - } - public void setChecked(Map checked) { - this.checked = checked; - } - public List getInvoices() { - return invoices; - } - public void setInvoices(List invoices) { - this.invoices = invoices; - } - - - - -} diff --git a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_invoices_dispatch.xhtml b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_invoices_dispatch.xhtml index 0365fff..49eaaf7 100644 --- a/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_invoices_dispatch.xhtml +++ b/office-alexander-logistics-app/src/main/webapp/pages/workitems/forms/alexander/section_invoices_dispatch.xhtml @@ -7,105 +7,124 @@ xmlns:marty="http://java.sun.com/jsf/composite/marty"> - - - - - -
- - - - - - - - - - - - - - + + + + + + + + +
+

Es liegen derzeit keine Rechnungen zur Prüfung für Sie vor.

+
+
+ + + + + +
+ +
Bereich#{message['form.company']}#{message['form.invoicenumber']}#{message['form.date']}Fälligkeit#{message['form.amount']}
- - - - - + + + + + + + + + + + + + + + + - - - - - - - + + + + + + + + + + + + + + + +
- - #{invoice.item['space.name']} + Bereich#{message['form.company']}#{message['form.invoicenumber']}#{message['form.date']}Fälligkeit#{message['form.amount']}
#{invoice.item['space.name']} #{invoice.item['cdtr.name']} - - #{invoice.item['invoice.number']} - - - - - - #{invoice.item['invoice.number']} + + + + + + #{invoice.item['invoice.currency']}
+
+ + - #{invoice.item['invoice.currency']} - - - - - - - - - - - - - - + diff --git a/workflow/stapelverarbeitung-pruefung-de-1.0.0.bpmn b/workflow/stapelverarbeitung-pruefung-de-1.0.0.bpmn index 7a3edbb..a5bad15 100644 --- a/workflow/stapelverarbeitung-pruefung-de-1.0.0.bpmn +++ b/workflow/stapelverarbeitung-pruefung-de-1.0.0.bpmn @@ -40,6 +40,7 @@ + @@ -48,98 +49,11 @@ Task_2 StartEvent_1 - IntermediateCatchEvent_13 - IntermediateCatchEvent_19 - IntermediateThrowEvent_3 - EventBasedGateway_1 - IntermediateCatchEvent_24 - IntermediateCatchEvent_7 - EndEvent_3 - Task_8 + IntermediateCatchEvent_1 Task_5 - IntermediateCatchEvent_23 EndEvent_2 - IntermediateCatchEvent_5000-20 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - home]]> - - - - - - - - - space.name ]]> - - - false - - - - - - - SequenceFlow_46 - SequenceFlow_4 - SequenceFlow_1 @@ -179,9 +93,8 @@ result.isValid=true; $workflowgroup - $workflowstatus]]> - SequenceFlow_20 SequenceFlow_1 - SequenceFlow_22 + SequenceFlow_3 @@ -192,78 +105,6 @@ result.isValid=true; ]]> - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ]]> - - - - - - - - - - - - false - - - - - SequenceFlow_20 - - @@ -276,10 +117,10 @@ result.isValid=true; - + - numsequencenumber: cdtr.name invoice.number (invoice.currency invoice.total) space.name]]> + space.name sb.team / sb.assist]]> true @@ -298,69 +139,15 @@ result.isValid=true; $workflowgroup - $workflowstatus]]> - SequenceFlow_52 - SequenceFlow_4 + SequenceFlow_5 SequenceFlow_47 SequenceFlow_47 - - - - - - - txtlastcomment]]> - - - - - - - - - numsequencenumber: cdtr.name invoice.number (invoice.currency invoice.total) space.name]]> - - - true - - - - - - - - - - - - - - - $workflowgroup - $workflowstatus]]> - SequenceFlow_17 - SequenceFlow_60 - SequenceFlow_9 - - - SequenceFlow_9 - - - - SequenceFlow_17 - - - - - SequenceFlow_22 - SequenceFlow_46 - SequenceFlow_49 - - - - + + @@ -384,8 +171,10 @@ result.isValid=true; - + + + @@ -400,213 +189,73 @@ result.isValid=true; - + + - + - home -false -Wollen Sie den Vorgang wirklich löschen?]]> + home]]> - + - + space.name ]]> false + + result.errorMessage='Bitte wählen Sie eine(n) Verantwortliche(n) aus.'; + } +]]> - - SequenceFlow_49 - SequenceFlow_48 + + SequenceFlow_3 + SequenceFlow_5 + + + DataOutput_1 + + + DataOutput_1 + + - - SequenceFlow_48 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ]]> - - - - - - - - - - - - false - - - - SequenceFlow_52 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ]]> - - - - - - - - - - - - false - - - - SequenceFlow_60 - - - - + + - - Liegt eine Logistik Leistung vor, wird ein Fachbereich ausgewählt - - + - + - + - + @@ -615,12 +264,6 @@ result.isValid=true; - - - - - - @@ -639,74 +282,22 @@ result.isValid=true; - - - - - - - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + @@ -715,78 +306,29 @@ result.isValid=true; - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + +