From 706c73a530275795e151b6f99154231aecccf694 Mon Sep 17 00:00:00 2001 From: Laurie Montant Date: Tue, 6 Jan 2026 14:37:00 +0100 Subject: [PATCH] RDV --- RPtoRFX_AppointmentEvent.ftl | 54 +++++++++++++------ ...mentPhysicalReceiptAssociationByNumber.ftl | 20 +++---- ...intmentPhysicalReceiptAssociationByRef.ftl | 10 +--- ...entPhysicalReceiptDissociationByNumber.ftl | 30 +++++++++++ ...ntmentPhysicalReceiptDissociationByRef.ftl | 29 ++++++++++ 5 files changed, 106 insertions(+), 37 deletions(-) create mode 100644 RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByNumber.ftl create mode 100644 RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByRef.ftl diff --git a/RPtoRFX_AppointmentEvent.ftl b/RPtoRFX_AppointmentEvent.ftl index 0ee48cc..76603fa 100644 --- a/RPtoRFX_AppointmentEvent.ftl +++ b/RPtoRFX_AppointmentEvent.ftl @@ -26,25 +26,45 @@ <#-- *********************************************** Action = CommissionsUpdated ******************** --> <#case "CommissionsUpdated"> <#assign appointment = eventRP.data /> - [ - <#list eventRP.executionflowCustomFields.entrySet()?filter(l ->l.value?? && l.value?has_content) as commission> - <#if eventRP.appointmentCustomFields?has_content> - { - <#assign apiRestReflexID = ApiRestReflexID.appointment_post_physical_receipt_associations_by_number> - "apiRestReflexID" : "${apiRestReflexID}", - "datas" : - <#include "RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByNumber.ftl"> - } + [ <#if appointment.AppointmentType == "APPOINTMENT_TYPE_UNLOADING"> + <#if eventRP.addedCommissions?? && eventRP.addedCommissions!=""> + <#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"> + } + <#else> - { - <#assign apiRestReflexID = ApiRestReflexID.appointment_post_physical_receipt_associations_by_ref> - "apiRestReflexID" : "${apiRestReflexID}", - "datas" : - <#include "RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByRef.ftl"> - } + <#if eventRP.removedCommissions?? && eventRP.removedCommissions!=""> + <#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"> + } + + + + <#else> + <#stop "Unsupported Appointment Type for Commissions Update"> - <#sep>, - ] <#break> <#-- *********************************************** Action = SlotUpdated ******************** --> diff --git a/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByNumber.ftl b/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByNumber.ftl index 7fa69f7..54e740b 100644 --- a/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByNumber.ftl +++ b/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByNumber.ftl @@ -9,22 +9,18 @@ }, "payload" : { - <#if appointment.Commissions??> - <#if appointment.AppointmentType == "APPOINTMENT_TYPE_UNLOADING"> + <#list eventRP.addedCommissions as addedCommission> + <#list eventRP.executionflowCustomFields.entrySet()?filter(l ->l.value?? && l.value?has_content) as CustomFields> + "physical_receipt_list": [ { - "receipt_activity": "${commission.value.activity_code?json_string}", - "originator_code": "${commission.value.originator_code?json_string}", - "physical_receipt_reference": "${commission.value.reference?json_string}", - "receipt_year": "${commission.value.order_year?json_string}", - "receipt_number": "${commission.value.order_number?json_string}" + "receipt_activity": "${CustomFields.value.activity_code?json_string}", + "originator_code": "${CustomFields.value.originator_code?json_string}", + "physical_receipt_reference": "${CustomFields.value.reference?json_string}", + "receipt_year": "${CustomFields.value.order_year?json_string}", + "receipt_number": "${CustomFields.value.order_number?json_string}" } ] - <#else> - <#if appointment.AppointmentType == "APPOINTMENT_TYPE_LOADING"> - "appointment_designation":"${appointment.Reason!""?json_string}" - - } } diff --git a/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByRef.ftl b/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByRef.ftl index 924f854..42ffb38 100644 --- a/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByRef.ftl +++ b/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByRef.ftl @@ -8,8 +8,8 @@ }, "payload" : { - <#if appointment.Commissions??> - <#if appointment.AppointmentType == "APPOINTMENT_TYPE_UNLOADING"> + <#list eventRP.addedCommissions as addedCommission> + <#list eventRP.executionflowCustomFields.entrySet()?filter(l ->l.value?? && l.value?has_content) as CustomFields> "physical_receipt_list": [ { "receipt_activity": "${commission.value.activity_code?json_string}", @@ -19,11 +19,5 @@ "receipt_number": "${commission.value.order_number?json_string}" } ] - <#else> - <#if appointment.AppointmentType == "APPOINTMENT_TYPE_LOADING"> - "appointment_designation":"${appointment.Reason!""?json_string}" - - - } } diff --git a/RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByNumber.ftl b/RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByNumber.ftl new file mode 100644 index 0000000..bc57059 --- /dev/null +++ b/RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByNumber.ftl @@ -0,0 +1,30 @@ +{ + "id" : {"refid" : "${eventRP.refid?json_string}","actorID":"${RPtoRFXprefixDepot(eventRP.actor)}"}, + "route" : "rest/public/v1/physical_depots/{physical_depot_code}/appointment_years/{appointment_year}/appointment_numbers/{appointment_number}/physical_receipt_dissociations", + "method" : "POST", + "uri_substitutions": { + "physical_depot_code": "${RPtoRFXprefixDepot(eventRP.actor)}", + "appointment_year":"${eventRP.appointmentCustomFields.year?json_string}", + "appointment_number":"${eventRP.appointmentCustomFields.number?json_string}" + }, + "payload" : + { + <#if appointment.Commissions??> + <#if appointment.AppointmentType == "APPOINTMENT_TYPE_UNLOADING"> + "physical_receipt_list": [ + { + "receipt_activity": "${commission.value.activity_code?json_string}", + "originator_code": "${commission.value.originator_code?json_string}", + "physical_receipt_reference": "${commission.value.reference?json_string}", + "receipt_year": "${commission.value.order_year?json_string}", + "receipt_number": "${commission.value.order_number?json_string}" + } + ] + <#else> + <#if appointment.AppointmentType == "APPOINTMENT_TYPE_LOADING"> + "appointment_designation":"${appointment.Reason!""?json_string}" + + + + } + } diff --git a/RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByRef.ftl b/RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByRef.ftl new file mode 100644 index 0000000..34b7ed5 --- /dev/null +++ b/RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByRef.ftl @@ -0,0 +1,29 @@ +{ + "id" : {"refid" : "${eventRP.refid?json_string}","actorID":"${RPtoRFXprefixDepot(eventRP.actor)}"}, + "route" : "rest/public/v1/physical_depots/{physical_depot_code}/carrier_appointments/{appointment_reference}/physical_receipt_dissociations", + "method" : "POST", + "uri_substitutions": { + "physical_depot_code": "${RPtoRFXprefixDepot(eventRP.actor)}", + "appointment_reference":"${eventRP.refid?json_string}" + }, + "payload" : + { + <#if appointment.Commissions??> + <#if appointment.AppointmentType == "APPOINTMENT_TYPE_UNLOADING"> + "physical_receipt_list": [ + { + "receipt_activity": "${commission.value.activity_code?json_string}", + "originator_code": "${commission.value.originator_code?json_string}", + "physical_receipt_reference": "${commission.value.reference?json_string}", + "receipt_year": "${commission.value.order_year?json_string}", + "receipt_number": "${commission.value.order_number?json_string}" + } + ] + <#else> + <#if appointment.AppointmentType == "APPOINTMENT_TYPE_LOADING"> + "appointment_designation":"${appointment.Reason!""?json_string}" + + + + } + }