reflex-wms-connector/RFXtoRP_HsrPro.ftl
2025-06-06 16:25:00 +02:00

64 lines
2.2 KiB
Java

<#-- **** input parameters ***** -->
<#-- input : message RFX -->
<#-- project : projectId in ReflexPlatform -->
<#-- organisation : organisationtId in ReflexPlatform -->
<#assign cloudEventMsg = JsonUtil.jsonToMap(input)>
<#assign projectRP = project>
<#assign organisationRP = organisation>
<#assign aDateTime = .now>
<#switch cloudEventMsg.action>
<#case "C">
<#case "U">
<#-- *********************************************** Action = CREATE or UPDATE ******************** -->
<#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) />
<#assign preparation_order = JsonUtil.jsonToMap(dataRfx)>
[
<#-- check preparation type code (internal order and reservation are ignored) -->
<#if preparation_order.preparation_type_code == "010" || preparation_order.preparation_type_code == "030">
<#-- Only if preparation order not confirmed -->
<#if preparation_order.preparation_order_confirmed == "false" >
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrPro_ExecutionflowDetected.ftl">
}
<#else>
<#-- preparation order already confirmed -->
<#stop>
</#if>
<#else>
<#-- preparation order type not supported -->
<#stop>
</#if>
]
<#break>
<#case "D">
<#-- *********************************************** Action = DELETE ******************** -->
<#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) />
<#assign preparation_order = JsonUtil.jsonToMap(dataRfx)>
[
<#if preparation_order.originator_reference?? && preparation_order.originator_reference!="">
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowCancelled>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrPro_ExecutionflowCancelled.ftl">
}
<#else>
<#stop "PRO reference is empty">
</#if>
]
<#break>
<#default>
<#stop >
</#switch>