Merge branch 'develop-rdz' into 'develop'
Develop rdz See merge request r-d-technique/tiers/reflex-wms-connector!161
This commit is contained in:
commit
355e170831
@ -2,7 +2,9 @@
|
||||
<#-- input : message RFX -->
|
||||
<#-- project : projectId 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 projectRP = project>
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
<#include "HfRpConfig.ftl">
|
||||
<#include "ReflexUtils.ftl">
|
||||
[
|
||||
<#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.metadata.creation_datetime,time_zone_rfx) />
|
||||
{
|
||||
|
||||
@ -1,27 +1,16 @@
|
||||
<#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) />
|
||||
<#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":{
|
||||
"Header":{
|
||||
"ProjectID": "${projectRP}"
|
||||
},
|
||||
"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,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 +51,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}"
|
||||
|
||||
@ -1,8 +1,4 @@
|
||||
<#include "HfRpConfig.ftl">
|
||||
<#include "ReflexUtils.ftl">
|
||||
|
||||
<#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.metadata.last_update_datetime,time_zone_rfx) />
|
||||
|
||||
[
|
||||
{
|
||||
"AppointmentID": "${carrier_apt.appointment_reference?trim?json_string}",
|
||||
|
||||
@ -1,27 +1,18 @@
|
||||
<#include "HfRpConfig.ftl">
|
||||
<#include "ReflexUtils.ftl">
|
||||
<#include "ActorPrefix.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) />
|
||||
<#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}"
|
||||
},
|
||||
"ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}",
|
||||
"ActorID": "${RPtoRFXprefixDepot("DPF")}",
|
||||
"AppointmentID": "${carrier_apt.appointment_reference?json_string}",
|
||||
"TimeZone":"${time_zone_rfx}",
|
||||
<#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 appointmentType = AppointmentType.APPOINTMENT_TYPE_RECEPTION>
|
||||
<#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>
|
||||
@ -67,8 +58,8 @@
|
||||
<#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) />
|
||||
<#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "true">
|
||||
<#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}"
|
||||
<#else>
|
||||
|
||||
@ -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) />
|
||||
@ -15,11 +10,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 +55,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}"
|
||||
|
||||
@ -200,6 +200,88 @@
|
||||
]
|
||||
</#switch>
|
||||
<#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>
|
||||
<#stop>
|
||||
</#switch>
|
||||
|
||||
@ -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 />
|
||||
|
||||
74
RPtoRFX_CarrierAppointment.ftl
Normal file
74
RPtoRFX_CarrierAppointment.ftl
Normal file
@ -0,0 +1,74 @@
|
||||
{
|
||||
"id" : {"refid" : "${eventRP.refid?json_string}"},
|
||||
"route" : "rest/public/v1/physical_depots/{physical_depot_code}/carrier_appointments",
|
||||
"method" : "POST",
|
||||
"uri_substitutions": {
|
||||
"physical_depot_code": "${RPtoRFXprefixDepot("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"
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@ -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 datetimes in second -->
|
||||
<#-- -------------------------------------------------------------------------------------------- -->
|
||||
<#function DurationBetweenTwoDatetimeInSeconds 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" -->
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user