Files
reflex-wms-connector/RFXtoRP_HsrAntRec.ftl
2026-06-09 10:35:38 +02:00

81 lines
3.1 KiB
Java

<#-- **** input parameters ***** -->
<#-- input : message HARDIS WMS for anticipated receipt -->
<#-- project : projectId in HARDIS SC NETWORK -->
<#-- organisation : organisationtId in HARDIS SC NETWORK -->
<#assign cloudEventMsg = JsonUtil.jsonToMap(input)>
<#assign projectRP = project>
<#assign organisationRP = organisation>
<#assign aDateTime = .now>
<#switch cloudEventMsg.action>
<#case "C">
<#-- *********************************************** Action = CREATE ******************** -->
<#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) />
<#assign AncReceipt = JsonUtil.jsonToMap(dataRfx)>
[
<#if AncReceipt.line_list?? && AncReceipt.line_list[0]??>
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.OrderCreated>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrAntRec_Created.ftl">
},
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.OrderReceiptExpected>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrAntRec_ReceiptExpected.ftl">
}
]
<#else>
<#stop>
</#if>
<#break>
<#case "U">
<#-- *********************************************** Action = UPDATE ******************** -->
<#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) />
<#assign AncReceipt = JsonUtil.jsonToMap(dataRfx)>
[
<#if AncReceipt.generated?? && AncReceipt.generated.total_level_1_quantity==0 && AncReceipt.generated.total_level_2_quantity==0 && AncReceipt.generated.total_level_3_quantity==0 && AncReceipt.anticipated_receipt_closed == "true" && AncReceipt.all_receipt_validated=="true">
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.OrderCancelled>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrAntRec_Cancelled.ftl">
}
<#else>
<#if AncReceipt.anticipated_receipt_closed == "true" && AncReceipt.all_receipt_validated=="true">
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.OrderReceiptCompleted>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrAntRec_ReceiptCompleted.ftl">
}
</#if>
</#if>
]
<#break>
<#case "D">
<#-- *********************************************** Action = DELETE ******************** -->
<#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) />
<#assign AncReceipt = JsonUtil.jsonToMap(dataRfx)>
[
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.OrderCancelled>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrAntRec_Cancelled.ftl">
}
]
<#break>
<#default>
<#stop >
</#switch>