update soa

This commit is contained in:
Ralph Soika 2024-11-18 11:03:02 +01:00
parent 89865fcde1
commit 81549ab4e0
3 changed files with 27 additions and 113 deletions

View file

@ -12,6 +12,7 @@ import org.apache.poi.ss.usermodel.CellCopyPolicy;
import org.apache.poi.ss.usermodel.Row.MissingCellPolicy; import org.apache.poi.ss.usermodel.Row.MissingCellPolicy;
import org.apache.poi.ss.util.CellReference; import org.apache.poi.ss.util.CellReference;
import org.apache.poi.xssf.usermodel.XSSFCell; import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFFormulaEvaluator;
import org.apache.poi.xssf.usermodel.XSSFRow; import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet; import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
@ -126,7 +127,7 @@ public class AGLAnalyticExcelAdapterDebitor extends POIFindReplaceAdapter {
// first add the columns for the currency list // first add the columns for the currency list
addCurrencyColumns(doc, sheet, currencyList); addCurrencyColumns(doc, sheet, currencyList);
// add rows
insertInvoiceRows(sheet, document, currencyList); insertInvoiceRows(sheet, document, currencyList);
// write back the updated excel file // write back the updated excel file
@ -154,23 +155,8 @@ public class AGLAnalyticExcelAdapterDebitor extends POIFindReplaceAdapter {
} }
} }
// Process POI instructions // Finally process POI instructions
// processPOIUpdate(document, event, targetName); processPOIUpdate(document, event, targetName);
// // read the config
// ItemCollection poiConfig = workflowService.evalWorkflowResult(event,
// "poi-update", document,
// false);
// if (poiConfig == null || !poiConfig.hasItem("findreplace")) {
// throw new PluginException(POIFindReplaceAdapter.class.getSimpleName(),
// CONFIG_ERROR,
// "missing poi configuration");
// }
// List<String> replaceDevList = poiConfig.getItemValue("findreplace");
// String eval = poiConfig.getItemValueString("eval");
// logger.info("... update template with normal poi information..");
// this.updateFileData(document.getFileData(targetName), document,
// replaceDevList, eval);
} catch (PluginException e) { } catch (PluginException e) {
throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(), throw new PluginException(AGLAnalyticExcelAdapter.class.getSimpleName(),
@ -261,7 +247,7 @@ public class AGLAnalyticExcelAdapterDebitor extends POIFindReplaceAdapter {
// jetzt füge alle Rechnungen an. // jetzt füge alle Rechnungen an.
int totalRowCount = invoices.size(); int totalRowCount = invoices.size();
POIUtil.insertRows(sheet, "A11", totalRowCount); POIUtil.insertRows(sheet, "A11", totalRowCount - 0);
for (ItemCollection invoice : invoices) { for (ItemCollection invoice : invoices) {
logger.fine("......add invoice " + invoice.getUniqueID()); logger.fine("......add invoice " + invoice.getUniqueID());
@ -297,6 +283,18 @@ public class AGLAnalyticExcelAdapterDebitor extends POIFindReplaceAdapter {
rowPos++; rowPos++;
} }
// setze Summen Formeln
for (int column = 6; column < currencyList.size() * 2 + 6; column++) {
XSSFCell cell = sheet.getRow(totalRowCount + 11).getCell(column); // G11
String cellRefFrom = POIUtil.getCellReference(column, 10);
String cellRefTo = POIUtil.getCellReference(column, totalRowCount + 10);
String formula = "SUM(" + cellRefFrom + ":" + cellRefTo + ")";
cell.setCellFormula(formula);
}
// Optional: Formel direkt evaluieren
XSSFFormulaEvaluator.evaluateAllFormulaCells(sheet.getWorkbook());
} }
/** /**

Binary file not shown.

View file

@ -90,7 +90,6 @@ th { font-weight: bold;}
<bpmn2:flowNodeRef>DataObject_1</bpmn2:flowNodeRef> <bpmn2:flowNodeRef>DataObject_1</bpmn2:flowNodeRef>
<bpmn2:flowNodeRef>event_HrHS9A</bpmn2:flowNodeRef> <bpmn2:flowNodeRef>event_HrHS9A</bpmn2:flowNodeRef>
<bpmn2:flowNodeRef>dataObject_00mX6w</bpmn2:flowNodeRef> <bpmn2:flowNodeRef>dataObject_00mX6w</bpmn2:flowNodeRef>
<bpmn2:flowNodeRef>event_n40tzw</bpmn2:flowNodeRef>
</bpmn2:lane> </bpmn2:lane>
</bpmn2:laneSet> </bpmn2:laneSet>
<bpmn2:startEvent id="StartEvent_1" name="Start"> <bpmn2:startEvent id="StartEvent_1" name="Start">
@ -125,7 +124,6 @@ th { font-weight: bold;}
<bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing> <bpmn2:outgoing>SequenceFlow_10</bpmn2:outgoing>
<bpmn2:incoming>sequenceFlow_OL83kQ</bpmn2:incoming> <bpmn2:incoming>sequenceFlow_OL83kQ</bpmn2:incoming>
<bpmn2:incoming>sequenceFlow_1K0l0g</bpmn2:incoming> <bpmn2:incoming>sequenceFlow_1K0l0g</bpmn2:incoming>
<bpmn2:incoming>sequenceFlow_P2Q9fQ</bpmn2:incoming>
</bpmn2:task> </bpmn2:task>
<bpmn2:sequenceFlow id="SequenceFlow_10" sourceRef="Task_2" targetRef="EndEvent_3"> <bpmn2:sequenceFlow id="SequenceFlow_10" sourceRef="Task_2" targetRef="EndEvent_3">
<bpmn2:documentation id="documentation_WzPj2A"/> <bpmn2:documentation id="documentation_WzPj2A"/>
@ -323,7 +321,15 @@ th { font-weight: bold;}
<template>soa_template.xlsx</template> <template>soa_template.xlsx</template>
<target-name>soa_<itemvalue>dbtr.number</itemvalue>_<itemvalue format="yyyy-MM-dd">$lasteventdate</itemvalue>.xlsx</target-name> <target-name>soa_<itemvalue>dbtr.number</itemvalue>_<itemvalue format="yyyy-MM-dd">$lasteventdate</itemvalue>.xlsx</target-name>
</soa> </soa>
<poi-update name="findreplace">
<find>F6</find>
<replace><itemvalue format="dd.MM.yyyy">$lasteventdate</itemvalue></replace>
<type>date</type>
</poi-update>
<poi-update name="findreplace">
<find>A7</find>
<replace><itemvalue>dbtr.name</itemvalue></replace>
</poi-update>
]]></imixs:value> ]]></imixs:value>
</imixs:item> </imixs:item>
@ -364,84 +370,6 @@ th { font-weight: bold;}
<bpmn2:sequenceFlow id="sequenceFlow_LhcuMQ" sourceRef="Task_1" targetRef="event_HrHS9A"> <bpmn2:sequenceFlow id="sequenceFlow_LhcuMQ" sourceRef="Task_1" targetRef="event_HrHS9A">
<bpmn2:documentation id="documentation_Ll2kVg"/> <bpmn2:documentation id="documentation_Ll2kVg"/>
</bpmn2:sequenceFlow> </bpmn2:sequenceFlow>
<bpmn2:intermediateCatchEvent id="event_n40tzw" imixs:activityid="201" name="Excel Export">
<bpmn2:extensionElements>
<imixs:item name="keylogtimeformat" type="xs:string">
<imixs:value><![CDATA[2]]></imixs:value>
</imixs:item>
<imixs:item name="keyarchive" type="xs:string">
<imixs:value><![CDATA[0]]></imixs:value>
</imixs:item>
<imixs:item name="txtmailsubject" type="xs:string">
<imixs:value/>
</imixs:item>
<imixs:item name="keyaccessmode" type="xs:string">
<imixs:value><![CDATA[0]]></imixs:value>
</imixs:item>
<imixs:item name="keyscheduledactivity" type="xs:string">
<imixs:value><![CDATA[0]]></imixs:value>
</imixs:item>
<imixs:item name="rtfmailbody" type="xs:string">
<imixs:value/>
</imixs:item>
<imixs:item name="keyversion" type="xs:string">
<imixs:value><![CDATA[0]]></imixs:value>
</imixs:item>
<imixs:item name="keyaddwritefields" type="xs:string"/>
<imixs:item name="numnextactivityid" type="xs:int">
<imixs:value><![CDATA[0]]></imixs:value>
</imixs:item>
<imixs:item name="keyfollowup" type="xs:string">
<imixs:value><![CDATA[2]]></imixs:value>
</imixs:item>
<imixs:item name="keypublicresult" type="xs:string">
<imixs:value><![CDATA[1]]></imixs:value>
</imixs:item>
<imixs:item name="keylogdateformat" type="xs:string">
<imixs:value><![CDATA[2]]></imixs:value>
</imixs:item>
<imixs:item name="keyownershipfields" type="xs:string"/>
<imixs:item name="numnextid" type="xs:int">
<imixs:value><![CDATA[5000]]></imixs:value>
</imixs:item>
<imixs:item name="txtnextprocesstree" type="xs:string">
<imixs:value/>
</imixs:item>
<imixs:item name="txtname" type="xs:string">
<imixs:value><![CDATA[Speichern]]></imixs:value>
</imixs:item>
<imixs:item name="keyownershipmode" type="xs:string">
<imixs:value><![CDATA[0]]></imixs:value>
</imixs:item>
<imixs:item name="rtfresultlog" type="xs:string">
<imixs:value><![CDATA[Analysedaten Debitor archiviert]]></imixs:value>
</imixs:item>
<imixs:item name="keyupdateacl" type="xs:boolean">
<imixs:value>false</imixs:value>
</imixs:item>
<imixs:item name="txtactivityresult" type="xs:string">
<imixs:value><![CDATA[<soa name="excel-export">
<textblock>SOA Template</textblock>
<template>soa_template.xlsx</template>
<target-name>soa_<itemvalue>dbtr.number</itemvalue>_<itemvalue format="yyyy-MM-dd">$lasteventdate</itemvalue>.xlsx</target-name>
</soa>
]]></imixs:value>
</imixs:item>
</bpmn2:extensionElements>
<bpmn2:documentation id="documentation_naV7Kg"><![CDATA[Excel Datei erzeugen]]></bpmn2:documentation>
<bpmn2:signalEventDefinition id="signalEventDefinition_0WFWhQ" signalRef="Signal_1"/>
<bpmn2:outgoing>sequenceFlow_P2Q9fQ</bpmn2:outgoing>
</bpmn2:intermediateCatchEvent>
<bpmn2:sequenceFlow id="sequenceFlow_P2Q9fQ" sourceRef="event_n40tzw" targetRef="Task_2">
<bpmn2:documentation id="documentation_J7LEZw"/>
</bpmn2:sequenceFlow>
</bpmn2:process> </bpmn2:process>
<bpmndi:BPMNDiagram id="BPMNDiagram_1" name="Default Process Diagram"> <bpmndi:BPMNDiagram id="BPMNDiagram_1" name="Default Process Diagram">
<bpmndi:BPMNPlane bpmnElement="Collaboration_1" id="BPMNPlane_1"> <bpmndi:BPMNPlane bpmnElement="Collaboration_1" id="BPMNPlane_1">
@ -526,7 +454,7 @@ th { font-weight: bold;}
<bpmndi:BPMNShape bpmnElement="dataObject_00mX6w" id="BPMNShape_UEsYmw"> <bpmndi:BPMNShape bpmnElement="dataObject_00mX6w" id="BPMNShape_UEsYmw">
<dc:Bounds height="50.0" width="35.0" x="560.0" y="190.0"/> <dc:Bounds height="50.0" width="35.0" x="560.0" y="190.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_ekwD3A"> <bpmndi:BPMNLabel id="BPMNLabel_ekwD3A">
<dc:Bounds height="20.0" width="100.0" x="528.0" y="229.0"/> <dc:Bounds height="20.0" width="100.0" x="526.0" y="239.0"/>
</bpmndi:BPMNLabel> </bpmndi:BPMNLabel>
</bpmndi:BPMNShape> </bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="association_hwRAUQ" id="BPMNEdge_9JCm5A" sourceElement="BPMNShape_UEsYmw" targetElement="BPMNShape_Task_2"> <bpmndi:BPMNEdge bpmnElement="association_hwRAUQ" id="BPMNEdge_9JCm5A" sourceElement="BPMNShape_UEsYmw" targetElement="BPMNShape_Task_2">
@ -545,18 +473,6 @@ th { font-weight: bold;}
<di:waypoint x="349.0" y="395.0"/> <di:waypoint x="349.0" y="395.0"/>
<di:waypoint x="467.0" y="395.0"/> <di:waypoint x="467.0" y="395.0"/>
</bpmndi:BPMNEdge> </bpmndi:BPMNEdge>
<bpmndi:BPMNShape bpmnElement="event_n40tzw" id="BPMNShape_0HF6DQ">
<dc:Bounds height="36.0" width="36.0" x="741.0" y="224.0"/>
<bpmndi:BPMNLabel id="BPMNLabel_QA6zUg">
<dc:Bounds height="20.0" width="100.0" x="709.0" y="263.0"/>
</bpmndi:BPMNLabel>
</bpmndi:BPMNShape>
<bpmndi:BPMNEdge bpmnElement="sequenceFlow_P2Q9fQ" id="BPMNEdge_v9l7hQ" sourceElement="BPMNShape_0HF6DQ" targetElement="BPMNShape_Task_2">
<di:waypoint x="741.0" y="242.0"/>
<di:waypoint x="710.5" y="242.0"/>
<di:waypoint x="710.5" y="315.0"/>
<di:waypoint x="680.0" y="315.0"/>
</bpmndi:BPMNEdge>
</bpmndi:BPMNPlane> </bpmndi:BPMNPlane>
<bpmndi:BPMNLabelStyle id="BPMNLabelStyle_1"> <bpmndi:BPMNLabelStyle id="BPMNLabelStyle_1">
<dc:Font name="arial" size="9.0"/> <dc:Font name="arial" size="9.0"/>