reflex-wms-connector/RFXtoRP_HsrCarrierApt.ftl
2025-12-23 11:31:35 +01:00

171 lines
6.9 KiB
Java

<#-- **** input parameters ***** -->
<#-- input : message RFX -->
<#-- project : projectId in ReflexPlatform -->
<#-- organisation : organisationtId in ReflexPlatform -->
<#include "ActorPrefix.ftl">
<#include "HfRpConfig.ftl">
<#include "ReflexUtils.ftl">
<#assign cloudEventMsg = JsonUtil.jsonToMap(input)>
<#assign projectRP = project>
<#assign organisationRP = organisation>
<#assign aDateTime = .now>
<#switch cloudEventMsg.action>
<#case "C">
<#-- *********************************************** Action = CREATE or UPDATE ******************** -->
<#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) />
<#assign carrier_apt = JsonUtil.jsonToMap(dataRfx)>
[
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.SiteForceBookAppointment>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrCarrierApt_SiteForceBookAppointment.ftl">
},
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentCarrierExpected>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrCarrierApt_AppointmentCarrierExpected.ftl">
},
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentCustomFieldsUpdated>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrCarrierApt_AppointmentCustomFieldsUpdated.ftl">
}
]
<#break>
<#case "U">
<#-- *********************************************** Action = Update ********************-->
<#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) />
<#assign carrier_apt = JsonUtil.jsonToMap(dataRfx)>
[
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentCustomFieldsUpdated>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrCarrierApt_AppointmentCustomFieldsUpdated.ftl">
},
<#include "RFXtoRP_HsrCarrierApt_AppointmentMetadataUpdated.ftl">
<#if carrier_apt.status?? && (carrier_apt.status.status_code=="999" || carrier_apt.status.status_code=="040" || carrier_apt.status.status_code=="030")>
[
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.SiteCancelAppointment>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrCarrierApt_SiteCancelAppointment.ftl">
}
]
<#else>
<#if carrier_apt.status?? && carrier_apt.status.status_code=="100"> <#--Carrier Arrived-->
[
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentCarrierArrived>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrCarrierApt_CarrierArrived.ftl">
}
]
<#else>
<#if carrier_apt.status?? && carrier_apt.status.status_code=="210"> <#--Unloading Started -->
[
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentUnloadingStarted>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrCarrierApt_UnloadingStarted.ftl">
}
]
<#else>
<#if carrier_apt.status?? && carrier_apt.status.status_code=="290"><#--Unloading Completed-->
[
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentUnloadingCompleted>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrCarrierApt_UnloadingCompleted.ftl">
}
]
<#else>
<#if carrier_apt.status?? && carrier_apt.status.status_code=="310"><#--Loading Started-->
[
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentLoadingStarted>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrCarrierApt_LoadingStarted.ftl">
}
]
<#else>
<#if carrier_apt.status?? && carrier_apt.status.status_code=="390"><#--Loading Completed-->
[
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentLoadingCompleted>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrCarrierApt_LoadingCompleted.ftl">
}
]
<#else>
<#if carrier_apt.status?? && carrier_apt.status.status_code=="500"><#--Carrier Departed-->
[
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentCarrierDeparted>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrCarrierApt_CarrierDeparted.ftl">
}
]
<#else>
<#if carrier_apt.physical_receipt_list?? && (carrier_apt.physical_receipt_list?filter(l ->l??)?size != 0) >
<#if carrier_apt.unloading_appointment !="true" && carrier_apt.load_appointment !="true">
[
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.SiteWMSUpdateAppointment>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrCarrierApt_UpdateAppointment.ftl">
}
]
<#else>
[
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.SiteForceRescheduleAppointment>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrCarrierApt_UpdateSlotAppointment.ftl">
}
]
</#if>
</#if>
</#if>
</#if>
</#if>
</#if>
</#if>
</#if>
</#if>
]
<#break>
<#case "D">
<#-- *********************************************** Action = Delete ******************** -->
<#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) />
<#assign carrier_apt = JsonUtil.jsonToMap(dataRfx)>
[
<#-- Ajout des lignes-->
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.SiteCancelAppointment>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_HsrCarrierApt_SiteCancelAppointment.ftl">
}
]
<#break>
<#default>
<#stop >
</#switch>