modif sur les rdz

This commit is contained in:
Francis REAT 2025-11-14 14:27:33 +01:00
parent a2fd6f1145
commit 4648c02a2c
9 changed files with 96 additions and 40 deletions

View File

@ -2,7 +2,9 @@
<#-- input : message RFX --> <#-- input : message RFX -->
<#-- project : projectId in ReflexPlatform --> <#-- project : projectId in ReflexPlatform -->
<#-- organisation : organisationtId in ReflexPlatform --> <#-- organisation : organisationtId in ReflexPlatform -->
<#-- site : siteID in ReflexPlatform --> <#include "ActorPrefix.ftl">
<#include "HfRpConfig.ftl">
<#include "ReflexUtils.ftl">
<#assign cloudEventMsg = JsonUtil.jsonToMap(input)> <#assign cloudEventMsg = JsonUtil.jsonToMap(input)>
<#assign projectRP = project> <#assign projectRP = project>

View File

@ -1,5 +1,3 @@
<#include "HfRpConfig.ftl">
<#include "ReflexUtils.ftl">
[ [
<#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.metadata.creation_datetime,time_zone_rfx) /> <#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.metadata.creation_datetime,time_zone_rfx) />
{ {

View File

@ -1,23 +1,12 @@
<#include "HfRpConfig.ftl">
<#include "ReflexUtils.ftl">
<#-- à quoi correspond ID du transporteur dans l'API a voir avec Vincent-->
[ [
{ {
<#assign appointment_reception_start_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.planned_unloading_start_datetime,time_zone_rfx) /> "Header":{
<#assign appointment_expedition_start_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.planned_load_start_datetime,time_zone_rfx) />
<#assign creation_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.metadata.creation_datetime,time_zone_rfx) />
"Header":{
"ProjectID": "${projectRP}" "ProjectID": "${projectRP}"
}, },
"ActorID": "${carrier_apt.physical_depot}", "ActorID": "${carrier_apt.physical_depot}",
<#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "false"> <#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "false">
<#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_RECEPTION> <#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_RECEPTION>
<#assign duration = (carrier_apt.planned_unloading_start_datetime,carrier_apt.planned_unloading_end_datetime,time_zone_rfx) /> <#assign duration = DurationBetweenTwoDatetimeInSeconds(carrier_apt.planned_unloading_start_datetime,carrier_apt.planned_unloading_end_datetime,time_zone_rfx) />
<#else> <#else>
<#if carrier_apt.unloading_appointment == "false" && carrier_apt.load_appointment == "true" > <#if carrier_apt.unloading_appointment == "false" && carrier_apt.load_appointment == "true" >
<#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_EXPEDITION> <#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_EXPEDITION>

View File

@ -1,8 +1,4 @@
<#include "HfRpConfig.ftl">
<#include "ReflexUtils.ftl">
<#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.metadata.last_update_datetime,time_zone_rfx) /> <#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.metadata.last_update_datetime,time_zone_rfx) />
[ [
{ {
"AppointmentID": "${carrier_apt.appointment_reference?trim?json_string}", "AppointmentID": "${carrier_apt.appointment_reference?trim?json_string}",

View File

@ -1,13 +1,9 @@
<#include "HfRpConfig.ftl">
<#include "ReflexUtils.ftl">
<#-- à quoi correspond ID du transporteur dans l'API a voir avec Vincent-->
[ [
{ {
"Header":{ "Header":{
"ProjectID": "${projectRP}" "ProjectID": "${projectRP}"
}, },
"ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}", "ActorID": "${RPtoRFXprefixDepot("DPF")}",
"AppointmentID": "${carrier_apt.appointment_reference?json_string}", "AppointmentID": "${carrier_apt.appointment_reference?json_string}",
"TimeZone":"${time_zone_rfx}", "TimeZone":"${time_zone_rfx}",
<#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "false"> <#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "false">

View File

@ -1,8 +1,3 @@
<#include "HfRpConfig.ftl">
<#include "ReflexUtils.ftl">
[ [
{ {
<#assign appointment_reception_start_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.planned_unloading_start_datetime,time_zone_rfx) /> <#assign appointment_reception_start_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.planned_unloading_start_datetime,time_zone_rfx) />

View File

@ -200,6 +200,88 @@
] ]
</#switch> </#switch>
<#break> <#break>
<#case "appointment_post">
<#switch restResponsetMsg.status!no_status>
<#case no_status>
[
{
<#if restResponsetMsg.body?? >
<#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) />
<#else>
<#assign restResponseBody = "${restResponsetMsg?trim?json_string}" />
</#if>
<#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_PlatformLogCreate.ftl">
},
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowAllocationError>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_RestResponseAllocationError.ftl">
}
]
<#break>
<#case 200>
<#case 201>
<#-- *********************************************** ApiRestID = receipts_post ******************** -->
<#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) />
<#assign preparationOrderPostResponse = JsonUtil.jsonToMap(restResponseBody)>
<#if preparationOrderPostResponse.status?? && preparationOrderPostResponse.status == "SUCCESS" >
[
{
<# stop "Création rdz OK" >
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDeleted>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_Receipt_ExecutionflowDeleted.ftl">
}
]
<#else>
[
{
<#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) />
<#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_PlatformLogCreate.ftl">
},
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowAllocationError>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_RestResponseAllocationError.ftl">
}
]
</#if>
<#break>
<#default>
[
{
<#if restResponsetMsg.body?? >
<#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) />
<#else>
<#assign restResponseBody = "${restResponsetMsg?trim?json_string}" />
</#if>
<#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_PlatformLogCreate.ftl">
},
{
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowAllocationError>
"apiReflexPlatformID" : "${apiReflexPlatformID}",
"datas" :
<#include "RFXtoRP_RestResponseAllocationError.ftl">
}
]
</#switch>
<#break>
<#default> <#default>
<#stop> <#stop>
</#switch> </#switch>

View File

@ -1,12 +1,9 @@
<#include "ActorPrefix.ftl">
<#include "HfRpConfig.ftl">
{ {
"id" : {"refid" : "${eventRP.refid?json_string}"}, "id" : {"refid" : "${eventRP.refid?json_string}"},
"route" : "rest/public/v1/physical_depots/{physical_depot_code}/carrier_appointments", "route" : "rest/public/v1/physical_depots/{physical_depot_code}/carrier_appointments",
"method" : "POST", "method" : "POST",
"uri_substitutions": { "uri_substitutions": {
"physical_depot_code": "DPF" <#-- "${RPtoRFXprefixDepot(appointment.ActorID)}" --> "physical_depot_code": "${RPtoRFXprefixDepot("DPF")}" <#-- "${RPtoRFXprefixDepot(appointment.ActorID)}" -->
}, },
"payload" : "payload" :
{ {
@ -25,11 +22,11 @@
<#case "APPOINTMENT_TYPE_RECEPTION"> <#case "APPOINTMENT_TYPE_RECEPTION">
"unloading_appointment" : "true", "unloading_appointment" : "true",
"load_appointment" : "false", "load_appointment" : "false",
"planned_unloading_start_datetime : "${appointment.Slot.StartDateTime?iso_nz(time_zone_rfx))}", "planned_unloading_start_datetime : "${appointment.Slot.StartDateTime?iso_nz(time_zone_rfx)}",
"planned_unloading_end_datetime": "${AddSecondsToDatetime(appointment.Slot.StartDateTime,appointment.Slot.DurationInSeconds)?iso_nz(time_zone_rfx)}" "planned_unloading_end_datetime": "${AddSecondsToDatetime(appointment.Slot.StartDateTime,appointment.Slot.DurationInSeconds)?iso_nz(time_zone_rfx)}"
<#break> <#break>
<#default> <#default>
<#stop "appointment.AppointmentType not implemented> <#stop "appointment.AppointmentType not implemented" >
</#switch> </#switch>
"planned_carrier" : "${appointment.CarrierName?json_string}", "planned_carrier" : "${appointment.CarrierName?json_string}",
@ -37,8 +34,8 @@
<#if appointment.Commissions??> <#if appointment.Commissions??>
"physical_receipt_list": [ "physical_receipt_list": [
<#list appointment.Commissions as commission> <#list appointment.Commissions as commission>
{ <#-- {
"receipt_activity": "str", "receipt_activity": "str",
"originator_code": "string", "originator_code": "string",
"physical_receipt_reference": "string", "physical_receipt_reference": "string",
"receipt_year": 0, "receipt_year": 0,
@ -65,6 +62,7 @@
"ExecutionflowID": "DPFALIDEPT ALIMSPA-121125-02" "ExecutionflowID": "DPFALIDEPT ALIMSPA-121125-02"
} }
} }
-->
<#sep>,</#sep> <#sep>,</#sep>
</#list> </#list>
], ],

View File

@ -19,9 +19,9 @@
</#function> </#function>
<#-- -------------------------------------------------------------------------------------------- --> <#-- -------------------------------------------------------------------------------------------- -->
<#-- duration between two datetime in second --> <#-- Duration between two datetimes in second -->
<#-- -------------------------------------------------------------------------------------------- --> <#-- -------------------------------------------------------------------------------------------- -->
<#function DurationBetweenTwoDatetimeInsecond startDate endDate> <#function DurationBetweenTwoDatetimeInSeconds startDate endDate>
<#return (endDate?long - startDate?long) / 1000 > <#return (endDate?long - startDate?long) / 1000 >
</#function> </#function>