From f602f74da17e704bd7315e5f111867922fefc769 Mon Sep 17 00:00:00 2001 From: Francis Reat Date: Tue, 24 Mar 2026 17:10:45 +0100 Subject: [PATCH] SCPN1-10471 SCPN1-10402 --- RPtoRFX_AppointmentEvent.ftl | 103 ++++++++++-------- RPtoRFX_CarrierAppointmentCreated.ftl | 35 +++--- ...mentPhysicalReceiptAssociationByNumber.ftl | 2 +- ...intmentPhysicalReceiptAssociationByRef.ftl | 2 +- ...entPhysicalReceiptDissociationByNumber.ftl | 2 +- ...ntmentPhysicalReceiptDissociationByRef.ftl | 2 +- ...arrierAppointmentReasonUpdatedByNumber.ftl | 4 +- ...X_CarrierAppointmentReasonUpdatedByRef.ftl | 4 +- ...lotOrCarrierInformationUpdatedByNumber.ftl | 4 +- ...ntSlotOrCarrierInformationUpdatedByRef.ftl | 4 +- 10 files changed, 85 insertions(+), 77 deletions(-) diff --git a/RPtoRFX_AppointmentEvent.ftl b/RPtoRFX_AppointmentEvent.ftl index 06f345f..8c17b0a 100644 --- a/RPtoRFX_AppointmentEvent.ftl +++ b/RPtoRFX_AppointmentEvent.ftl @@ -28,70 +28,79 @@ <#assign AddComma = false /> <#assign appointment = eventRP.data /> [ - <#if eventRP.commissionsUpdated> - <#if appointment.AppointmentType == "APPOINTMENT_TYPE_UNLOADING" && eventRP.addedUnloadCommissions?? && eventRP.addedUnloadCommissions != ""> - <#if eventRP.appointmentCustomFields?has_content> - { - <#assign apiRestReflexID = ApiRestReflexID.appointment_post_physical_receipt_associations_by_number> - "apiRestReflexID" : "${apiRestReflexID}", - "datas" : - <#include "RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByNumber.ftl"> - } - <#else> - { - <#assign apiRestReflexID = ApiRestReflexID.appointment_post_physical_receipt_associations_by_ref> - "apiRestReflexID" : "${apiRestReflexID}", - "datas" : - <#include "RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByRef.ftl"> - } + <#if appointment?? && appointment.Status?? && appointment.Status.Current?? && appointment.Status.Current.StatusCode?? && appointment.Status.Current.StatusCode == AppointmentStatusCode.APPOINTMENT_0150_ALLOCATION_ERROR> + { + <#assign apiRestReflexID = ApiRestReflexID.appointment_post_create> + "apiRestReflexID" : "${apiRestReflexID}", + "datas" : + <#include "RPtoRFX_CarrierAppointmentCreated.ftl"> + } + <#else> + <#if eventRP.commissionsUpdated> + <#if appointment.AppointmentType == "APPOINTMENT_TYPE_UNLOADING" && eventRP.addedUnloadCommissions?? && eventRP.addedUnloadCommissions != ""> + <#if eventRP.appointmentCustomFields?has_content> + { + <#assign apiRestReflexID = ApiRestReflexID.appointment_post_physical_receipt_associations_by_number> + "apiRestReflexID" : "${apiRestReflexID}", + "datas" : + <#include "RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByNumber.ftl"> + } + <#else> + { + <#assign apiRestReflexID = ApiRestReflexID.appointment_post_physical_receipt_associations_by_ref> + "apiRestReflexID" : "${apiRestReflexID}", + "datas" : + <#include "RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByRef.ftl"> + } + + <#assign AddComma = true /> - <#assign AddComma = true /> - - <#if appointment.AppointmentType == "APPOINTMENT_TYPE_UNLOADING" && eventRP.removedUnloadCommissions?? && eventRP.removedUnloadCommissions!=""> + <#if appointment.AppointmentType == "APPOINTMENT_TYPE_UNLOADING" && eventRP.removedUnloadCommissions?? && eventRP.removedUnloadCommissions!=""> + <#if AddComma == true> + , + + + <#if eventRP.appointmentCustomFields?has_content> + { + <#assign apiRestReflexID = ApiRestReflexID.appointment_post_physical_receipt_dissociations_by_number> + "apiRestReflexID" : "${apiRestReflexID}", + "datas" : + <#include "RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByNumber.ftl"> + } + <#else> + { + <#assign apiRestReflexID = ApiRestReflexID.appointment_post_physical_receipt_dissociations_by_ref> + "apiRestReflexID" : "${apiRestReflexID}", + "datas" : + <#include "RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByRef.ftl"> + } + + <#assign AddComma = true /> + + + <#-- *********************************************** Action = reasonUpdated or slotUpdated ******************** --> + <#if eventRP.reasonUpdated || eventRP.slotUpdated || eventRP.carrierInformationUpdated> <#if AddComma == true> , - <#if eventRP.appointmentCustomFields?has_content> { - <#assign apiRestReflexID = ApiRestReflexID.appointment_post_physical_receipt_dissociations_by_number> + <#assign apiRestReflexID = ApiRestReflexID.appointment_put_update_by_number> "apiRestReflexID" : "${apiRestReflexID}", "datas" : - <#include "RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByNumber.ftl"> + <#include "RPtoRFX_CarrierAppointmentSlotOrCarrierInformationUpdatedByNumber.ftl"> } <#else> { - <#assign apiRestReflexID = ApiRestReflexID.appointment_post_physical_receipt_dissociations_by_ref> + <#assign apiRestReflexID = ApiRestReflexID.appointment_put_update_by_ref> "apiRestReflexID" : "${apiRestReflexID}", "datas" : - <#include "RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByRef.ftl"> + <#include "RPtoRFX_CarrierAppointmentSlotOrCarrierInformationUpdatedByRef.ftl"> } <#assign AddComma = true /> - -<#-- *********************************************** Action = reasonUpdated or slotUpdated ******************** --> - <#if eventRP.reasonUpdated || eventRP.slotUpdated || eventRP.carrierInformationUpdated> - <#if AddComma == true> - , - - <#if eventRP.appointmentCustomFields?has_content> - { - <#assign apiRestReflexID = ApiRestReflexID.appointment_put_update_by_number> - "apiRestReflexID" : "${apiRestReflexID}", - "datas" : - <#include "RPtoRFX_CarrierAppointmentSlotOrCarrierInformationUpdatedByNumber.ftl"> - } - <#else> - { - <#assign apiRestReflexID = ApiRestReflexID.appointment_put_update_by_ref> - "apiRestReflexID" : "${apiRestReflexID}", - "datas" : - <#include "RPtoRFX_CarrierAppointmentSlotOrCarrierInformationUpdatedByRef.ftl"> - } - - <#assign AddComma = true /> - + ] <#break> <#-- *********************************************** Action = Canceled ******************** --> diff --git a/RPtoRFX_CarrierAppointmentCreated.ftl b/RPtoRFX_CarrierAppointmentCreated.ftl index ebc72cb..f332b98 100644 --- a/RPtoRFX_CarrierAppointmentCreated.ftl +++ b/RPtoRFX_CarrierAppointmentCreated.ftl @@ -9,7 +9,7 @@ { "appointment_reference": "${eventRP.refid?json_string}", <#switch appointment.AppointmentType> - <#case "APPOINTMENT_TYPE_LOADING"> + <#case AppointmentType.APPOINTMENT_TYPE_LOADING> "unloading_appointment" : "false", "load_appointment" : "true", <#if appointment.TimeZone?? && appointment.TimeZone!=""> @@ -20,7 +20,7 @@ "planned_load_end_datetime": "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.EndDateTime,time_zone_rfx),time_zone_rfx)}", <#break> - <#case "APPOINTMENT_TYPE_UNLOADING"> + <#case AppointmentType.APPOINTMENT_TYPE_UNLOADING> "unloading_appointment" : "true", "load_appointment" : "false", <#if appointment.TimeZone?? && appointment.TimeZone!=""> @@ -35,30 +35,29 @@ <#stop "appointment.AppointmentType not implemented" > <#include "RPtoRFX_CarrierAppointmentDefaultData.ftl"> - <#if appointment.AppointmentType == "APPOINTMENT_TYPE_UNLOADING" > + <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING > <#if appointment.Unloading?? && appointment.Unloading.Projects?? && appointment.Unloading.Projects[0]?? && appointment.Unloading.Projects[0].Commissions?? && - appointment.Unloading.Projects[0].Commissions[0]?? && - appointment.Unloading.Projects[0].Commissions[0].OrderID?? && - appointment.Unloading.Projects[0].Commissions[0].OrderID != ""> + appointment.Unloading.Projects[0].Commissions[0]??> "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>, - + <#list appointment.Unloading.Projects[0].Commissions?filter(l ->l.ExecutionflowID?? && l.ExecutionflowID !="") as commission> + <#list eventRP.executionflowCustomFields.entrySet()?filter(l ->l.key == commission.ExecutionflowID && 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>, + + ], <#else> "appointment_designation":"${(appointment.Reason!"")!?json_string}", <#else> - <#if appointment.AppointmentType == "APPOINTMENT_TYPE_LOADING"> + <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_LOADING> "appointment_designation":"${(appointment.Reason!"")?json_string}", diff --git a/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByNumber.ftl b/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByNumber.ftl index 5677a75..2d532b1 100644 --- a/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByNumber.ftl +++ b/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByNumber.ftl @@ -10,7 +10,7 @@ "payload" : { <#assign executionflowCustomFields = eventRP.executionflowCustomFields > - <#if appointment.AppointmentType == "APPOINTMENT_TYPE_UNLOADING"> + <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING> <#assign addedCommissions = eventRP.addedUnloadCommissions /> <#else> <#assign addedCommissions = eventRP.addedLoadCommissions /> diff --git a/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByRef.ftl b/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByRef.ftl index d19ea66..0fef024 100644 --- a/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByRef.ftl +++ b/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByRef.ftl @@ -9,7 +9,7 @@ "payload" : { <#assign executionflowCustomFields = eventRP.executionflowCustomFields > - <#if appointment.AppointmentType == "APPOINTMENT_TYPE_UNLOADING"> + <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING> <#assign addedCommissions = eventRP.addedUnloadCommissions /> <#else> <#assign addedCommissions = eventRP.addedLoadCommissions /> diff --git a/RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByNumber.ftl b/RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByNumber.ftl index f3f2b2b..2f70e6c 100644 --- a/RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByNumber.ftl +++ b/RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByNumber.ftl @@ -10,7 +10,7 @@ "payload" : { <#assign executionflowCustomFields = eventRP.executionflowCustomFields > - <#if appointment.AppointmentType == "APPOINTMENT_TYPE_UNLOADING"> + <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING> <#assign removedCommissions = eventRP.removedUnloadCommissions /> <#else> <#assign removedCommissions = eventRP.removedLoadCommissions /> diff --git a/RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByRef.ftl b/RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByRef.ftl index 85a66dc..20735f9 100644 --- a/RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByRef.ftl +++ b/RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByRef.ftl @@ -9,7 +9,7 @@ "payload" : { <#assign executionflowCustomFields = eventRP.executionflowCustomFields > - <#if appointment.AppointmentType == "APPOINTMENT_TYPE_UNLOADING"> + <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING> <#assign removedCommissions = eventRP.removedUnloadCommissions /> <#else> <#assign removedCommissions = eventRP.removedLoadCommissions /> diff --git a/RPtoRFX_CarrierAppointmentReasonUpdatedByNumber.ftl b/RPtoRFX_CarrierAppointmentReasonUpdatedByNumber.ftl index 7a57906..a8c7598 100644 --- a/RPtoRFX_CarrierAppointmentReasonUpdatedByNumber.ftl +++ b/RPtoRFX_CarrierAppointmentReasonUpdatedByNumber.ftl @@ -12,7 +12,7 @@ "unloading_appointment" : "${eventRP.appointmentCustomFields.unloading?json_string}", "load_appointment" : "${eventRP.appointmentCustomFields.loading?json_string}", <#switch appointment.AppointmentType> - <#case "APPOINTMENT_TYPE_LOADING"> + <#case AppointmentType.APPOINTMENT_TYPE_LOADING> <#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)}", @@ -21,7 +21,7 @@ "planned_load_end_datetime": "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.EndDateTime,time_zone_rfx),time_zone_rfx)}", <#break> - <#case "APPOINTMENT_TYPE_UNLOADING"> + <#case AppointmentType.APPOINTMENT_TYPE_UNLOADING> <#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)}", diff --git a/RPtoRFX_CarrierAppointmentReasonUpdatedByRef.ftl b/RPtoRFX_CarrierAppointmentReasonUpdatedByRef.ftl index 00595f4..1ccf476 100644 --- a/RPtoRFX_CarrierAppointmentReasonUpdatedByRef.ftl +++ b/RPtoRFX_CarrierAppointmentReasonUpdatedByRef.ftl @@ -9,7 +9,7 @@ "payload" : { <#switch appointment.AppointmentType> - <#case "APPOINTMENT_TYPE_LOADING"> + <#case AppointmentType.APPOINTMENT_TYPE_LOADING> "unloading_appointment" : "false", "load_appointment" : "true", <#if appointment.TimeZone?? && appointment.TimeZone!=""> @@ -20,7 +20,7 @@ "planned_load_end_datetime": "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.EndDateTime,time_zone_rfx),time_zone_rfx)}", <#break> - <#case "APPOINTMENT_TYPE_UNLOADING"> + <#case AppointmentType.APPOINTMENT_TYPE_UNLOADING> "unloading_appointment" : "true", "load_appointment" : "false", <#if appointment.TimeZone?? && appointment.TimeZone!=""> diff --git a/RPtoRFX_CarrierAppointmentSlotOrCarrierInformationUpdatedByNumber.ftl b/RPtoRFX_CarrierAppointmentSlotOrCarrierInformationUpdatedByNumber.ftl index 7cc0667..1c94ae1 100644 --- a/RPtoRFX_CarrierAppointmentSlotOrCarrierInformationUpdatedByNumber.ftl +++ b/RPtoRFX_CarrierAppointmentSlotOrCarrierInformationUpdatedByNumber.ftl @@ -13,7 +13,7 @@ "unloading_appointment" : "${eventRP.appointmentCustomFields.unloading?json_string}", "load_appointment" : "${eventRP.appointmentCustomFields.loading?json_string}", <#switch appointment.AppointmentType> - <#case "APPOINTMENT_TYPE_LOADING"> + <#case AppointmentType.APPOINTMENT_TYPE_LOADING> <#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)}", @@ -22,7 +22,7 @@ "planned_load_end_datetime": "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.EndDateTime,time_zone_rfx),time_zone_rfx)}", <#break> - <#case "APPOINTMENT_TYPE_UNLOADING"> + <#case AppointmentType.APPOINTMENT_TYPE_UNLOADING> <#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)}", diff --git a/RPtoRFX_CarrierAppointmentSlotOrCarrierInformationUpdatedByRef.ftl b/RPtoRFX_CarrierAppointmentSlotOrCarrierInformationUpdatedByRef.ftl index 8c9f571..043550a 100644 --- a/RPtoRFX_CarrierAppointmentSlotOrCarrierInformationUpdatedByRef.ftl +++ b/RPtoRFX_CarrierAppointmentSlotOrCarrierInformationUpdatedByRef.ftl @@ -10,7 +10,7 @@ { <#include "RPtoRFX_CarrierAppointmentDataUpdated.ftl"> <#switch appointment.AppointmentType> - <#case "APPOINTMENT_TYPE_LOADING"> + <#case AppointmentType.APPOINTMENT_TYPE_LOADING> "unloading_appointment" : "false", "load_appointment" : "true", <#if appointment.TimeZone?? && appointment.TimeZone!=""> @@ -21,7 +21,7 @@ "planned_load_end_datetime": "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.EndDateTime,time_zone_rfx),time_zone_rfx)}", <#break> - <#case "APPOINTMENT_TYPE_UNLOADING"> + <#case AppointmentType.APPOINTMENT_TYPE_UNLOADING> "unloading_appointment" : "true", "load_appointment" : "false", <#if appointment.TimeZone?? && appointment.TimeZone!="">