You've already forked reflex-wms-connector
186 lines
7.9 KiB
Java
186 lines
7.9 KiB
Java
<#-- **** input parameters ***** -->
|
|
<#-- input : message HARDIS-WMS -->
|
|
<#-- 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 partnerApplicationRP = partnerApplication>
|
|
|
|
<#assign aDateTime = .now>
|
|
|
|
<#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) />
|
|
<#assign carrier_apt = JsonUtil.jsonToMap(dataRfx)>
|
|
|
|
<#switch cloudEventMsg.action>
|
|
<#case "C">
|
|
<#-- *********************************************** Action = CREATE or UPDATE ******************** -->
|
|
[
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.BookingForceBookAppointment>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsrCarrierApt_BookingForceBookAppointment.ftl">
|
|
},
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentCarrierExpected>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsrCarrierApt_CarrierExpected.ftl">
|
|
}
|
|
]
|
|
<#break>
|
|
<#case "U">
|
|
<#-- *********************************************** Action = Update ********************-->
|
|
<#if carrier_apt.constant_appointment?? && carrier_apt.constant_appointment== "true">
|
|
<#if carrier_apt.appointment_reference?? && carrier_apt.appointment_reference!="">
|
|
<#assign ID = "${carrier_apt.appointment_reference?json_string}-${carrier_apt.year_number}-${carrier_apt.appointment_number}" />
|
|
<#else>
|
|
<#assign ID = "${carrier_apt.year_number}-${carrier_apt.appointment_number}" />
|
|
</#if>
|
|
<#else>
|
|
<#if carrier_apt.appointment_reference?? && carrier_apt.appointment_reference!="">
|
|
<#assign ID = "${carrier_apt.appointment_reference?json_string}" />
|
|
<#else>
|
|
<#assign ID = "${carrier_apt.year_number}-${carrier_apt.appointment_number}" />
|
|
</#if>
|
|
</#if>
|
|
<#assign payload = '{"Header": {"ProjectID": "${projectRP}:${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}"},"IDs": [{"RefID": "${ID}"}],"Options": {"Only": ["ID.RefID","Payload.WMSCreated"]}}'/>
|
|
<#assign queryApiReflexPlatformID = QueryApiReflexPlatformID.AppointmentGetByIds>
|
|
<#assign response = QueryApiReflexPlatformCall.call(queryApiReflexPlatformID,payload) />
|
|
<#assign appointmentRP = JsonUtil.jsonToMap(response)>
|
|
|
|
<#if !appointmentRP?? || !appointmentRP.Objects?? || !appointmentRP.Objects[0]?? || !appointmentRP.Objects[0].ID.RefID?? || !appointmentRP.Objects[0].Payload?? || !appointmentRP.Objects[0].Payload.WMSCreated?? || !appointmentRP.Objects[0].Payload.WMSCreated>
|
|
[
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.BookingForceBookAppointment>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsrCarrierApt_BookingForceBookAppointment.ftl">
|
|
}
|
|
]
|
|
<#else>
|
|
[
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentCustomFieldsUpdated>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsrCarrierApt_AppointmentCustomFieldsUpdated.ftl">
|
|
},
|
|
<#include "RFXtoRP_HsrCarrierApt_AppointmentMetadataUpdated.ftl">
|
|
<#include "RFXtoRP_HsrCarrierApt_AppointmentCarrierInformationUpdated.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.BookingForceCancelAppointment>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsrCarrierApt_BookingForceCancelAppointment.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">
|
|
},
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentCarrierExpected>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsrCarrierApt_CarrierExpected.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>
|
|
[
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.BookingWMSUpdateAppointment>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsrCarrierApt_BookingWMSUpdateAppointment.ftl">
|
|
}
|
|
]
|
|
</#if>
|
|
</#if>
|
|
</#if>
|
|
</#if>
|
|
</#if>
|
|
</#if>
|
|
</#if>
|
|
]
|
|
</#if>
|
|
<#break>
|
|
<#case "D">
|
|
<#-- *********************************************** Action = Delete ******************** -->
|
|
[
|
|
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.BookingForceCancelAppointment>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsrCarrierApt_BookingForceCancelAppointment.ftl">
|
|
}
|
|
]
|
|
<#break>
|
|
<#default>
|
|
<#stop >
|
|
</#switch>
|
|
|