Files
reflex-wms-connector/RPtoRFX_CarrierAppointmentCreated.ftl
Francis Reat 71bd4918a9 SCPN1-9965
(cherry picked from commit 7c4c7ea395)
2026-02-13 10:58:36 +01:00

82 lines
3.9 KiB
Java

{
<#assign appointmentPathURL = JsonUtil.getAppointmentPathURL(eventRP.site,eventRP.refid)>
<#assign payLoad = '{ "Header": {"ProjectID": "${projectRP!""}"},"IsOnce": false,"IsPublic": true,"TimeToLive": "0","URL": "${appointmentPathURL}"}' />
<#assign projectGetTinyURL = QueryApiReflexPlatformID.ProjectGetTinyURL>
<#assign response = QueryApiReflexPlatformCall.call(projectGetTinyURL,payLoad) />
<#assign tinyURL = JsonUtil.jsonToMap(response)>
"id" : {"refid" : "${eventRP.refid?json_string}","actorID":"${RPtoRFXprefixDepot(eventRP.actor)}"},
"route" : "rest/public/v1/physical_depots/{physical_depot_code}/carrier_appointments",
"method" : "POST",
"uri_substitutions": {
"physical_depot_code": "${RPtoRFXprefixDepot(eventRP.actor)}"
},
"payload" :
{
<#if tinyURL?? && tinyURL.TinyURL?? >
"comment_list": [
{
"line_number": 1,
"group_code": "SCN",
"text": "${tinyURL.TinyURL.URL?json_string}"
}
],
</#if>
"appointment_reference": "${eventRP.refid?json_string}",
<#switch appointment.AppointmentType>
<#case "APPOINTMENT_TYPE_LOADING">
"unloading_appointment" : "false",
"load_appointment" : "true",
<#if appointment.TimeZone?? && appointment.TimeZone!="">
"planned_load_start_datetime" : "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.StartDateTime,appointment.TimeZone),time_zone_rfx)}",
"planned_load_end_datetime": "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.EndDateTime,appointment.TimeZone),time_zone_rfx)}",
<#else>
"planned_load_start_datetime" : "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.StartDateTime,time_zone_rfx),time_zone_rfx)}",
"planned_load_end_datetime": "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.EndDateTime,time_zone_rfx),time_zone_rfx)}",
</#if>
<#break>
<#case "APPOINTMENT_TYPE_UNLOADING">
"unloading_appointment" : "true",
"load_appointment" : "false",
<#if appointment.TimeZone?? && appointment.TimeZone!="">
"planned_unloading_start_datetime":"${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.StartDateTime,appointment.TimeZone),time_zone_rfx)}",
"planned_unloading_end_datetime" : "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.EndDateTime,appointment.TimeZone),time_zone_rfx)}",
<#else>
"planned_unloading_start_datetime":"${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.StartDateTime,time_zone_rfx),time_zone_rfx)}",
"planned_unloading_end_datetime" : "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.EndDateTime,time_zone_rfx),time_zone_rfx)}",
</#if>
<#break>
<#default>
<#stop "appointment.AppointmentType not implemented" >
</#switch>
<#include "RPtoRFX_CarrierAppointmentDefaultData.ftl">
<#if appointment.Commissions??>
<#if appointment.AppointmentType == "APPOINTMENT_TYPE_UNLOADING">
<#if appointment.Commissions[0].OrderID?? && appointment.Commissions[0].OrderID!="">
"physical_receipt_list": [
<#list eventRP.executionflowCustomFields.entrySet()?filter(l ->l.value?? && l.value?has_content) as custom>
{
"receipt_activity": "${custom.value.activity_code?json_string}",
"originator_code": "${custom.value.originator_code?json_string}",
"physical_receipt_reference": "${custom.value.reference?json_string}",
"receipt_year": "${custom.value.order_year?json_string}",
"receipt_number": "${custom.value.order_number?json_string}"
}
<#sep>,</#sep>
</#list>
],
<#else>
"appointment_designation":"${(appointment.Reason!"")!?json_string}",
</#if>
<#else>
<#if appointment.AppointmentType == "APPOINTMENT_TYPE_LOADING">
"appointment_designation":"${(appointment.Reason!"")?json_string}",
</#if>
</#if>
</#if>
"constant_appointment": "false"
}
}