diff --git a/RPtoRFX_AppointmentEvent.ftl b/RPtoRFX_AppointmentEvent.ftl index d57a990..c1405f6 100644 --- a/RPtoRFX_AppointmentEvent.ftl +++ b/RPtoRFX_AppointmentEvent.ftl @@ -64,6 +64,7 @@ } <#else> <#if eventRP.commissionsUpdated> + <#-- Associate receipts to appointment --> <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING && eventRP.addedUnloadCommissions?? && eventRP.addedUnloadCommissions != "" && eventRP.addedUnloadCommissions?filter(x -> (x.ExecutionflowID?? && x.ExecutionflowID != ""))?size != 0> <#if eventRP.appointmentCustomFields?has_content> { @@ -82,11 +83,11 @@ <#assign AddComma = true /> + <#-- Dissociate receipts from appointment --> <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING && eventRP.removedUnloadCommissions?? && eventRP.removedUnloadCommissions!="" && eventRP.removedUnloadCommissions?filter(x -> (x.ExecutionflowID?? && x.ExecutionflowID != ""))?size != 0> <#if AddComma == true> , - <#if eventRP.appointmentCustomFields?has_content> { <#assign apiRestReflexID = ApiRestReflexID.appointment_post_physical_receipt_dissociations_by_number> @@ -104,7 +105,7 @@ <#assign AddComma = true /> - + <#-- Associate anticipated receipts to appointment --> <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING && eventRP.addedUnloadCommissions?? && eventRP.addedUnloadCommissions != "" && eventRP.addedUnloadCommissions?filter(x -> (!x.ExecutionflowID?? || x.ExecutionflowID == ""))?size != 0> <#if AddComma == true> , @@ -119,11 +120,11 @@ <#assign AddComma = true /> + <#-- Dissociate anticipated receipts from appointment --> <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING && eventRP.removedUnloadCommissions?? && eventRP.removedUnloadCommissions!="" && eventRP.removedUnloadCommissions?filter(x -> (!x.ExecutionflowID?? || x.ExecutionflowID == ""))?size != 0> <#if AddComma == true> , - <#if eventRP.appointmentCustomFields?has_content> { <#assign apiRestReflexID = ApiRestReflexID.appointment_post_anticipated_receipt_dissociations_by_number> @@ -134,6 +135,50 @@ <#assign AddComma = true /> + <#-- Associate preparations to appointment --> + <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_LOADING && eventRP.addedLoadCommissions?? && eventRP.addedLoadCommissions != "" && eventRP.addedLoadCommissions?filter(x -> (x.ExecutionflowID?? && x.ExecutionflowID != ""))?size != 0> + <#if AddComma == true> + , + + <#if eventRP.appointmentCustomFields?has_content> + { + <#assign apiRestReflexID = ApiRestReflexID.appointment_post_preparation_associations_by_number> + "apiRestReflexID" : "${apiRestReflexID}", + "datas" : + <#include "RPtoRFX_CarrierAppointmentPreparationAssociationByNumber.ftl"> + } + <#else> + { + <#assign apiRestReflexID = ApiRestReflexID.appointment_post_preparation_associations_by_ref> + "apiRestReflexID" : "${apiRestReflexID}", + "datas" : + <#include "RPtoRFX_CarrierAppointmentPreparationAssociationByRef.ftl"> + } + + <#assign AddComma = true /> + + <#-- Dissociate preparations from appointment --> + <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_LOADING && eventRP.removedLoadCommissions?? && eventRP.removedLoadCommissions!="" && eventRP.removedLoadCommissions?filter(x -> (x.ExecutionflowID?? && x.ExecutionflowID != ""))?size != 0> + <#if AddComma == true> + , + + <#if eventRP.appointmentCustomFields?has_content> + { + <#assign apiRestReflexID = ApiRestReflexID.appointment_post_preparation_dissociations_by_number> + "apiRestReflexID" : "${apiRestReflexID}", + "datas" : + <#include "RPtoRFX_CarrierAppointmentPreparationDissociationByNumber.ftl"> + } + <#else> + { + <#assign apiRestReflexID = ApiRestReflexID.appointment_post_preparation_dissociations_by_ref> + "apiRestReflexID" : "${apiRestReflexID}", + "datas" : + <#include "RPtoRFX_CarrierAppointmentPreparationDissociationByRef.ftl"> + } + + <#assign AddComma = true /> + <#-- *********************************************** Action = reasonUpdated or slotUpdated ******************** --> <#if eventRP.reasonUpdated || eventRP.slotUpdated || eventRP.carrierInformationUpdated> diff --git a/RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByRef.ftl b/RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByRef.ftl index a5223eb..97dac4a 100644 --- a/RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByRef.ftl +++ b/RPtoRFX_CarrierAppointmentPhysicalReceiptDissociationByRef.ftl @@ -9,7 +9,7 @@ "payload" : { <#assign executionflowCustomFields = eventRP.executionflowCustomFields > - <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING> + <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING> <#assign removedCommissions = eventRP.removedUnloadCommissions /> <#else> <#assign removedCommissions = eventRP.removedLoadCommissions /> diff --git a/RPtoRFX_CarrierAppointmentPreparationDissociationByNumber.ftl b/RPtoRFX_CarrierAppointmentPreparationDissociationByNumber.ftl index 6528680..fda86e3 100644 --- a/RPtoRFX_CarrierAppointmentPreparationDissociationByNumber.ftl +++ b/RPtoRFX_CarrierAppointmentPreparationDissociationByNumber.ftl @@ -1,6 +1,6 @@ { "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}/anticipated_receipt_dissociations", + "route" : "rest/public/v1/physical_depots/{physical_depot_code}/appointment_years/{appointment_year}/appointment_numbers/{appointment_number}/preparation_dissociations", "method" : "POST", "uri_substitutions": { "physical_depot_code": "${RPtoRFXprefixDepot(eventRP.actor)}", @@ -9,22 +9,19 @@ }, "payload" : { - <#assign orderCustomFields = eventRP.orderCustomFields > + <#assign executionflowCustomFields = eventRP.executionflowCustomFields > <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING> <#assign removedCommissions = eventRP.removedUnloadCommissions /> <#else> <#assign removedCommissions = eventRP.removedLoadCommissions /> - "anticipated_receipt_list": [ - <#list removedCommissions?filter(l -> (l.OrderID?? && (!l.ExecutionflowID?? || l.ExecutionflowID == ""))) as removedCommission> + "preparation_list": [ + <#list removedCommissions?filter(l -> (l.ExecutionflowID?? && l.ExecutionflowID != "")) as removedCommission> { - "activity": "${orderCustomFields[removedCommission.OrderID].activity_code?json_string}", - "originator_code": "${orderCustomFields[removedCommission.OrderID].originator_code?json_string}", - "anticipated_receipt_reference": "${orderCustomFields[removedCommission.OrderID].anticipated_receipt_reference?json_string}", - "planned_receipt_date": "${orderCustomFields[removedCommission.OrderID].planned_receipt_datetime?json_string}", - "anticipated_receipt_year": "${orderCustomFields[removedCommission.OrderID].anticipated_receipt_year?json_string}", - "anticipated_receipt_number": "${orderCustomFields[removedCommission.OrderID].anticipated_receipt_number?json_string}" + "activity_code": "${executionflowCustomFields[removedCommission.ExecutionflowID].activity_code?json_string}", + "preparation_year": "${executionflowCustomFields[removedCommission.ExecutionflowID].preparation_year?json_string}", + "preparation_number": "${executionflowCustomFields[removedCommission.ExecutionflowID].preparation_number?json_string}" } <#sep>, diff --git a/RPtoRFX_CarrierAppointmentPreparationDissociationByRef.ftl b/RPtoRFX_CarrierAppointmentPreparationDissociationByRef.ftl index 6528680..7427b99 100644 --- a/RPtoRFX_CarrierAppointmentPreparationDissociationByRef.ftl +++ b/RPtoRFX_CarrierAppointmentPreparationDissociationByRef.ftl @@ -1,33 +1,29 @@ { "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}/anticipated_receipt_dissociations", + "route" : "rest/public/v1/physical_depots/{physical_depot_code}/carrier_appointments/{appointment_reference}/preparation_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}" + "appointment_reference":"${eventRP.refid?json_string}" }, "payload" : { - <#assign orderCustomFields = eventRP.orderCustomFields > + <#assign executionflowCustomFields = eventRP.executionflowCustomFields > <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING> <#assign removedCommissions = eventRP.removedUnloadCommissions /> <#else> <#assign removedCommissions = eventRP.removedLoadCommissions /> - "anticipated_receipt_list": [ - <#list removedCommissions?filter(l -> (l.OrderID?? && (!l.ExecutionflowID?? || l.ExecutionflowID == ""))) as removedCommission> + "preparation_list": [ + <#list removedCommissions?filter(l -> (l.ExecutionflowID?? && l.ExecutionflowID != "")) as removedCommission> { - "activity": "${orderCustomFields[removedCommission.OrderID].activity_code?json_string}", - "originator_code": "${orderCustomFields[removedCommission.OrderID].originator_code?json_string}", - "anticipated_receipt_reference": "${orderCustomFields[removedCommission.OrderID].anticipated_receipt_reference?json_string}", - "planned_receipt_date": "${orderCustomFields[removedCommission.OrderID].planned_receipt_datetime?json_string}", - "anticipated_receipt_year": "${orderCustomFields[removedCommission.OrderID].anticipated_receipt_year?json_string}", - "anticipated_receipt_number": "${orderCustomFields[removedCommission.OrderID].anticipated_receipt_number?json_string}" + "activity_code": "${executionflowCustomFields[removedCommission.ExecutionflowID].activity_code?json_string}", + "preparation_year": "${executionflowCustomFields[removedCommission.ExecutionflowID].preparation_year?json_string}", + "preparation_number": "${executionflowCustomFields[removedCommission.ExecutionflowID].preparation_number?json_string}" } <#sep>, ] } - } + } \ No newline at end of file