modif sur les rdz

This commit is contained in:
Francis REAT 2025-11-12 17:10:56 +01:00
parent a151a0b655
commit bd7b24fed7
6 changed files with 119 additions and 16 deletions

View File

@ -17,11 +17,11 @@
"ActorID": "${carrier_apt.physical_depot}",
<#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "false">
<#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_RECEPTION>
<#assign duration = RfxDurationBetweenTwoDateTimetoInSeconds(carrier_apt.planned_unloading_start_datetime,carrier_apt.planned_unloading_end_datetime,time_zone_rfx) />
<#assign duration = (carrier_apt.planned_unloading_start_datetime,carrier_apt.planned_unloading_end_datetime,time_zone_rfx) />
<#else>
<#if carrier_apt.unloading_appointment == "false" && carrier_apt.load_appointment == "true" >
<#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_EXPEDITION>
<#assign duration = RfxDurationBetweenTwoDateTimetoInSeconds(carrier_apt.planned_load_start_datetime,carrier_apt.planned_load_end_datetime,time_zone_rfx) />
<#assign duration = DurationBetweenTwoDatetimeInSeconds(carrier_apt.planned_load_start_datetime?datetime.iso,carrier_apt.planned_load_end_datetime?datetime.iso,time_zone_rfx) />
<#else>
<#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "true">
<#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_BOTH>
@ -62,7 +62,7 @@
<#if carrier_apt.unloading_appointment == "false" && carrier_apt.load_appointment == "true">
"StartDateTime": "${carrier_apt.planned_load_start_datetime}"
<#else>
<#assign duration = RfxDurationBetweenTwoDateTimetoInSeconds(carrier_apt.planned_unloading_start_datetime,carrier_apt.planned_load_start_datetime,time_zone_rfx) />
<#assign duration = DurationBetweenTwoDatetimeInSeconds(carrier_apt.planned_unloading_start_datetime,carrier_apt.planned_load_start_datetime,time_zone_rfx) />
<#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "true">
<#if duration >= 0>
"StartDateTime": "${carrier_apt.planned_unloading_start_datetime}"

View File

@ -17,11 +17,11 @@
"ActorID": "${carrier_apt.physical_depot}",
<#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "false">
<#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_RECEPTION>
<#assign duration = RfxDurationBetweenTwoDateTimetoInSeconds(carrier_apt.planned_unloading_start_datetime,carrier_apt.planned_unloading_end_datetime,time_zone_rfx) />
<#assign duration = DurationBetweenTwoDatetimeInSeconds(carrier_apt.planned_unloading_start_datetime?datetime.iso,carrier_apt.planned_unloading_end_datetime?datetime.iso,time_zone_rfx) />
<#else>
<#if carrier_apt.unloading_appointment == "false" && carrier_apt.load_appointment == "true" >
<#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_EXPEDITION>
<#assign duration = RfxDurationBetweenTwoDateTimetoInSeconds(carrier_apt.planned_load_start_datetime,carrier_apt.planned_load_end_datetime,time_zone_rfx) />
<#assign duration = DurationBetweenTwoDatetimeInSeconds(carrier_apt.planned_load_start_datetime?datetime.iso,carrier_apt.planned_load_end_datetime?datetime.iso,time_zone_rfx) />
<#else>
<#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "true">
<#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_BOTH>
@ -47,7 +47,7 @@
<#if carrier_apt.unloading_appointment == "false" && carrier_apt.load_appointment == "true">
"StartDateTime": "${carrier_apt.planned_load_start_datetime}"
<#else>
<#assign duration = RfxDurationBetweenTwoDateTimetoInSeconds(carrier_apt.planned_unloading_start_datetime,carrier_apt.planned_load_start_datetime,time_zone_rfx) />
<#assign duration = DurationBetweenTwoDatetimeInSeconds(carrier_apt.planned_unloading_start_datetime?datetime.iso,carrier_apt.planned_load_start_datetime?datetime.iso,time_zone_rfx) />
<#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "true">
<#if duration >= 0>
"StartDateTime": "${carrier_apt.planned_unloading_start_datetime}"

View File

@ -15,11 +15,11 @@
"ActorID": "${carrier_apt.physical_depot}",
<#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "false">
<#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_RECEPTION>
<#assign duration = RfxDurationBetweenTwoDateTimetoInSeconds(carrier_apt.planned_unloading_start_datetime,carrier_apt.planned_unloading_end_datetime,time_zone_rfx) />
<#assign duration = DurationBetweenTwoDatetimeInSeconds(carrier_apt.planned_unloading_start_datetime?datetime.iso,carrier_apt.planned_unloading_end_datetime?datetime.iso,time_zone_rfx) />
<#else>
<#if carrier_apt.unloading_appointment == "false" && carrier_apt.load_appointment == "true" >
<#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_EXPEDITION>
<#assign duration = RfxDurationBetweenTwoDateTimetoInSeconds(carrier_apt.planned_load_start_datetime,carrier_apt.planned_load_end_datetime,time_zone_rfx) />
<#assign duration = DurationBetweenTwoDatetimeInSeconds(carrier_apt.planned_load_start_datetime?datetime.iso,carrier_apt.planned_load_end_datetime?datetime.iso,time_zone_rfx) />
<#else>
<#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "true">
<#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_BOTH>
@ -60,7 +60,7 @@
<#if carrier_apt.unloading_appointment == "false" && carrier_apt.load_appointment == "true">
"StartDateTime": "${carrier_apt.planned_load_start_datetime}"
<#else>
<#assign duration = RfxDurationBetweenTwoDateTimetoInSeconds(carrier_apt.planned_unloading_start_datetime,carrier_apt.planned_load_start_datetime,time_zone_rfx) />
<#assign duration = DurationBetweenTwoDatetimeInSeconds(carrier_apt.planned_unloading_start_datetime?datetime.iso,carrier_apt.planned_load_start_datetime?datetime.iso,time_zone_rfx) />
<#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "true">
<#if duration >= 0>
"StartDateTime": "${carrier_apt.planned_unloading_start_datetime}"

View File

@ -9,12 +9,23 @@
<#assign projectRP = project>
<#assign organisationRP = organisation>
<#-- initialisation map for SegmentationKey and MetaData -->
<#assign Header_MetaData_Map = {} />
<#assign SegmentationKeys_Map = {} />
<#assign Line_MetaData_Map = {} />
<#switch eventRP.event>
<#case "Created">
<#-- *********************************************** Action = CREATE or UPDATE ******************** -->
<#assign appointment = eventRP.data />
[
{
<#assign apiRestReflexID = ApiRestReflexID.appointment_post>
"apiRestReflexID" : "${apiRestReflexID}",
"datas" :
<#include "RPtoRFX_CarrierAppointment.ftl">
}
]
<#break>
<#default>
<#stop >
</#switch>
<#switch eventRP.event>
<#case "Created">
<#assign appointment = eventRP.data />

View File

@ -0,0 +1,76 @@
<#include "ActorPrefix.ftl">
<#include "HfRpConfig.ftl">
{
"id" : {"refid" : "${eventRP.refid?json_string}"},
"route" : "rest/public/v1/physical_depots/{physical_depot_code}/carrier_appointments",
"method" : "POST",
"uri_substitutions": {
"physical_depot_code": "DPF" <#-- "${RPtoRFXprefixDepot(appointment.ActorID)}" -->
},
"payload" :
{
"appointment_reference": "${appointment.a_defnir?json_string}",
<#switch appointment.AppointmentType>
<#case "APPOINTMENT_TYPE_EXPEDITION">
"unloading_appointment" : "false",
"load_appointment" : "true",
"planned_load_start_datetime : "${appointment.Slot.StartDateTime?iso_nz(time_zone_rfx)}",
"planned_load_end_datetime": "${AddSecondsToDatetime(appointment.Slot.StartDateTime,appointment.Slot.DurationInSeconds)?iso_nz(time_zone_rfx)}"
<#break>
<#case "APPOINTMENT_TYPE_RECEPTION">
"unloading_appointment" : "true",
"load_appointment" : "false",
"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)}"
<#break>
<#default>
<#stop "appointment.AppointmentType not implemented>
</#switch>
"planned_carrier" : "${appointment.CarrierName?json_string}",
<#if appointment.Commissions??>
"physical_receipt_list": [
<#list appointment.Commissions as commission>
{
"receipt_activity": "str",
"originator_code": "string",
"physical_receipt_reference": "string",
"receipt_year": 0,
"receipt_number": 0,
"comment_list": [
{
"line_number": 999,
"group_code": "str",
"text": "string"
}
]
{
"ProjectID": "recette-rfxdev",
"OrderID": "SPA-121125-02",
"Quantities": [
{
"UnitID": "PAL",
"Value": 1.0
}
],
"OrganisationID": "recette",
"PartnerAppID": "recette-rfxdev-rfxdev",
"ExecutionflowID": "DPFALIDEPT ALIMSPA-121125-02"
}
}
<#sep>,</#sep>
</#list>
],
</#if>
"constant_appointment": "false"
}
}

View File

@ -1,6 +1,6 @@
<#-- --------------------------------------------------------------------------------------- -->
<#-- -------------------------------------------------------------------------------------------- -->
<#-- Concat HARDIS WMS timestamp with HARDIS WMS time zone and format this date in ISO UTC format -->
<#-- --------------------------------------------------------------------------------------- -->
<#-- -------------------------------------------------------------------------------------------- -->
<#function RfxDateTimetoUTC rfxdatetime offset >
<#return ((rfxdatetime + offset)?datetime.iso?iso_utc)>
</#function>
@ -9,6 +9,22 @@
<#return dateutc?datetime.iso?iso_nz(locale)>
</#function>
<#-- -------------------------------------------------------------------------------------------- -->
<#-- Add second to dateTime ex: AddSecondsToDatetime("2025-11-17T09:15:00Z"?datetime.iso, 61) -->
<#-- -------------------------------------------------------------------------------------------- -->
<#function AddSecondsToDatetime date seconds>
<#assign timeInMilliseconds = (1000 * seconds) >
<#assign aDate = date?long + timeInMilliseconds?long>
<#return aDate?number_to_datetime>
</#function>
<#-- -------------------------------------------------------------------------------------------- -->
<#-- duration between two datetime in second -->
<#-- -------------------------------------------------------------------------------------------- -->
<#function DurationBetweenTwoDatetimeInsecond startDate endDate>
<#return (endDate?long - startDate?long) / 1000 >
</#function>
<#-- --------------------------------------------------------------------------------------- -->
<#-- Split email HARDIS WMS into json array string -->
<#-- Example : splitemail "john.doe@hardis-group.com,; name@hardis-group.com" -->