diff --git a/RFXtoRP_HliAntRecLr.ftl b/RFXtoRP_HliAntRecLr.ftl new file mode 100644 index 0000000..295e220 --- /dev/null +++ b/RFXtoRP_HliAntRecLr.ftl @@ -0,0 +1,49 @@ +<#-- **** input parameters ***** --> +<#-- input : message HARDIS WMS --> +<#-- project : projectId in HARDIS SC NETWORK --> +<#-- organisation : organisationtId in HARDIS SC NETWORK --> + +<#assign cloudEventMsg = JsonUtil.jsonToMap(input)> +<#assign projectRP = project> +<#assign organisationRP = organisation> + +<#assign aDateTime = .now> + +<#switch cloudEventMsg.action> + <#case "C"> + <#-- *********************************************** Action = CREATE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign ancReceiptLine = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#stop "create anticipated receipt line"> + } + ] + <#break> + <#case "U"> + <#-- *********************************************** Action = UPDATE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign ancReceiptLine = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#stop "update anticipated receipt line"> + } + ] + <#break> + + <#case "D"> + <#-- *********************************************** Action = DELETE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign ancReceiptLine = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#stop "delete anticipated receipt line"> + } + ] + <#break> + + + <#default> + <#stop > + + diff --git a/RFXtoRP_HsaLstCarSta_CarrierArrived.ftl b/RFXtoRP_HsaLstCarSta_CarrierArrived.ftl index bf31116..1cd4134 100644 --- a/RFXtoRP_HsaLstCarSta_CarrierArrived.ftl +++ b/RFXtoRP_HsaLstCarSta_CarrierArrived.ftl @@ -5,11 +5,19 @@ "ProjectID": "${projectRP}" }, "ID": { - <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> - "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#if carrier_apt_status.constant_appointment?? && carrier_apt_status.constant_appointment== "true"> + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference!=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}-${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + <#else> + "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + <#else> - "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", - + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + + "RefDate": { "DateTime": "${ref_datetime}", "AuthorTimeZone": "${time_zone_rfx}" diff --git a/RFXtoRP_HsaLstCarSta_CarrierDeparted.ftl b/RFXtoRP_HsaLstCarSta_CarrierDeparted.ftl index dc4ed53..c5648cd 100644 --- a/RFXtoRP_HsaLstCarSta_CarrierDeparted.ftl +++ b/RFXtoRP_HsaLstCarSta_CarrierDeparted.ftl @@ -5,11 +5,19 @@ "ProjectID": "${projectRP}" }, "ID": { - <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> - "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#if carrier_apt_status.constant_appointment?? && carrier_apt_status.constant_appointment== "true"> + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference!=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}-${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + <#else> + "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + <#else> - "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", - + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + + "RefDate": { "DateTime": "${ref_datetime}", "AuthorTimeZone": "${time_zone_rfx}" diff --git a/RFXtoRP_HsaLstCarSta_CarrierExpected.ftl b/RFXtoRP_HsaLstCarSta_CarrierExpected.ftl index dc4ed53..4fe7837 100644 --- a/RFXtoRP_HsaLstCarSta_CarrierExpected.ftl +++ b/RFXtoRP_HsaLstCarSta_CarrierExpected.ftl @@ -5,11 +5,19 @@ "ProjectID": "${projectRP}" }, "ID": { - <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> - "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#if carrier_apt_status.constant_appointment?? && carrier_apt_status.constant_appointment== "true"> + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference!=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}-${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + <#else> + "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + <#else> - "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", - + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + + "RefDate": { "DateTime": "${ref_datetime}", "AuthorTimeZone": "${time_zone_rfx}" diff --git a/RFXtoRP_HsaLstCarSta_LoadingCompleted.ftl b/RFXtoRP_HsaLstCarSta_LoadingCompleted.ftl index dc4ed53..c5648cd 100644 --- a/RFXtoRP_HsaLstCarSta_LoadingCompleted.ftl +++ b/RFXtoRP_HsaLstCarSta_LoadingCompleted.ftl @@ -5,11 +5,19 @@ "ProjectID": "${projectRP}" }, "ID": { - <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> - "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#if carrier_apt_status.constant_appointment?? && carrier_apt_status.constant_appointment== "true"> + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference!=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}-${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + <#else> + "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + <#else> - "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", - + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + + "RefDate": { "DateTime": "${ref_datetime}", "AuthorTimeZone": "${time_zone_rfx}" diff --git a/RFXtoRP_HsaLstCarSta_LoadingStarted.ftl b/RFXtoRP_HsaLstCarSta_LoadingStarted.ftl index dc4ed53..4fe7837 100644 --- a/RFXtoRP_HsaLstCarSta_LoadingStarted.ftl +++ b/RFXtoRP_HsaLstCarSta_LoadingStarted.ftl @@ -5,11 +5,19 @@ "ProjectID": "${projectRP}" }, "ID": { - <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> - "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#if carrier_apt_status.constant_appointment?? && carrier_apt_status.constant_appointment== "true"> + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference!=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}-${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + <#else> + "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + <#else> - "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", - + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + + "RefDate": { "DateTime": "${ref_datetime}", "AuthorTimeZone": "${time_zone_rfx}" diff --git a/RFXtoRP_HsaLstCarSta_UnloadingCompleted.ftl b/RFXtoRP_HsaLstCarSta_UnloadingCompleted.ftl index dc4ed53..4fe7837 100644 --- a/RFXtoRP_HsaLstCarSta_UnloadingCompleted.ftl +++ b/RFXtoRP_HsaLstCarSta_UnloadingCompleted.ftl @@ -5,11 +5,19 @@ "ProjectID": "${projectRP}" }, "ID": { - <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> - "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#if carrier_apt_status.constant_appointment?? && carrier_apt_status.constant_appointment== "true"> + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference!=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}-${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + <#else> + "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + <#else> - "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", - + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + + "RefDate": { "DateTime": "${ref_datetime}", "AuthorTimeZone": "${time_zone_rfx}" diff --git a/RFXtoRP_HsaLstCarSta_UnloadingStarted.ftl b/RFXtoRP_HsaLstCarSta_UnloadingStarted.ftl index 3b8b98e..4fe7837 100644 --- a/RFXtoRP_HsaLstCarSta_UnloadingStarted.ftl +++ b/RFXtoRP_HsaLstCarSta_UnloadingStarted.ftl @@ -5,11 +5,19 @@ "ProjectID": "${projectRP}" }, "ID": { - <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> - "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#if carrier_apt_status.constant_appointment?? && carrier_apt_status.constant_appointment== "true"> + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference!=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}-${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + <#else> + "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + <#else> - "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", - + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt_status.appointment_year_number?json_string}-${carrier_apt_status.appointment_number?json_string}", + + "RefDate": { "DateTime": "${ref_datetime}", "AuthorTimeZone": "${time_zone_rfx}" diff --git a/RFXtoRP_HsrAntRec.ftl b/RFXtoRP_HsrAntRec.ftl new file mode 100644 index 0000000..440b422 --- /dev/null +++ b/RFXtoRP_HsrAntRec.ftl @@ -0,0 +1,55 @@ +<#-- **** input parameters ***** --> +<#-- input : message HARDIS WMS --> +<#-- project : projectId in HARDIS SC NETWORK --> +<#-- organisation : organisationtId in HARDIS SC NETWORK --> + +<#assign cloudEventMsg = JsonUtil.jsonToMap(input)> +<#assign projectRP = project> +<#assign organisationRP = organisation> + +<#assign aDateTime = .now> + +<#switch cloudEventMsg.action> + <#case "C"> + <#-- *********************************************** Action = CREATE ******************** --> + + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign ancReceipt = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#--<#assign apiReflexPlatformID = ApiReflexPlatformID.OrderCreated> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrAntRec_Created.ftl">--> + <#stop "create anticipated receipt"> + } + ] + <#break> + <#case "U"> + <#-- *********************************************** Action = UPDATE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign ancReceipt = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#stop "update anticipated receipt"> + } + ] + <#break> + + <#case "D"> + <#-- *********************************************** Action = DELETE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign ancReceipt = JsonUtil.jsonToMap(dataRfx)> + [ + { + + <#stop "delete anticipated receipt"> + } + ] + <#break> + + + <#default> + <#stop > + + diff --git a/RFXtoRP_HsrAntRec_Created.ftl b/RFXtoRP_HsrAntRec_Created.ftl new file mode 100644 index 0000000..3963b77 --- /dev/null +++ b/RFXtoRP_HsrAntRec_Created.ftl @@ -0,0 +1,81 @@ +<#include "ReflexUtils.ftl"> +<#include "HfRpConfig.ftl"> +<#include "ActorPrefix.ftl"> +[ + { + <#assign creationDate = RfxDateTimetoUTCWithTimezone(dataRfx.@timestamp,time_zone_rfx) /> + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "CustomFields": [ + { + "Key": "anticipated_receipt_reference", + "Value": "${ancReceipt.anticipated_receipt_reference?json_string}" + }, + { + "Key": "anticipated_receipt_year", + "Value": "${ancReceipt.anticipated_receipt_year?json_string}" + }, + { + "Key": "anticipated_receipt_number", + "Value": "${ancReceipt.anticipated_receipt_number?json_string}" + }, + { + "Key": "originator_code", + "Value": "${ancReceipt.originator_code?json_string}" + }, + { + "Key": "activity_code", + "Value": "${ancReceipt.activity_code?json_string}" + }, + { + "Key": "depot_code", + "Value": "${ancReceipt.physical_depot_code?json_string}" + } + ], + "RefID": "${ancReceipt.anticipated_receipt_reference?json_string}" + }, + "Payload": { + "ShipFrom": { + "ActorID": "${RFXtoRPprefixSupplier(ancReceipt.original_code?json_string)}" + }, + "ShipTo": { + "ActorID": "${RFXtoRPprefixDepot(ancReceipt.physical_depot_code?json_string)}" + }, + "CreationDateTime": { + "DateTime": "${creationDate}", + "AuthorTimeZone": "${time_zone_rfx}" + }, + "LanguageCodeISO6391":"fr", + <#-- Header Metadata inclusion --> + <#include "RFXtoRP_HsrAntRec_Created_HeaderMetadata.ftl">, + "Lines": [ + <#list ancReceipt.line_list?filter(l -> l??) as line> + { + <#if line.anticipated_receipt_reference_line_no?? && line.anticipated_receipt_reference_line_no!=0> + "LineID": ${line.anticipated_receipt_reference_line_no}, + <#else> + "LineID": ${line.anticipated_receipt_line_number}, + + <#-- Line Metadata inclusion --> + <#include "RFXtoRP_HsrAntRec_Created_LineMetadata.ftl">, + "RequestedContent":{ + "Goods":{ + "ItemID":"${line.item_code?trim?json_string!"0"}", + "LVBranchID":"${line.item_lv_code?trim?json_string!"0"}", + <#-- Segmentation Keys inclusion --> + <#include "RFXtoRP_HsrAntRec_Created_SegmentationKeys.ftl"> + }, + "Quantity" : + { + "LVID": "${quantity_in_base_lv_RP_Cst}", + "Value": "${line.planned_quantity_in_base_lv!0}" + } + } + }<#sep>, + + ] + } +} +] diff --git a/RFXtoRP_HsrAntRec_Created_HeaderMetadata.ftl b/RFXtoRP_HsrAntRec_Created_HeaderMetadata.ftl new file mode 100644 index 0000000..40f44a9 --- /dev/null +++ b/RFXtoRP_HsrAntRec_Created_HeaderMetadata.ftl @@ -0,0 +1,19 @@ +<#-- use protobuf of class HsrReceiptList to find HARDIS WMS fields names --> + +<#-- +<#-- Best practices: + If the SK is of type: + - string: add ?json_string (e.g. "${stock.batch_1?json_string}") + - boolean: possible values: true and false + - datetime: expected format: 2025-10-30T10:12:10.000Z + - decimal number: the separator is a point (e.g. 10.5) +"MetaData": [ + { + "Key": "OrderType", + "Value": { "String" : "${order.optional_attributes.reason_code}"} + } + ], +--> + + +"MetaData": [ ] \ No newline at end of file diff --git a/RFXtoRP_HsrAntRec_Created_LineMetadata.ftl b/RFXtoRP_HsrAntRec_Created_LineMetadata.ftl new file mode 100644 index 0000000..b920b69 --- /dev/null +++ b/RFXtoRP_HsrAntRec_Created_LineMetadata.ftl @@ -0,0 +1,10 @@ +<#-- use protobuf of class HsrReceiptList to find HARDIS WMS fields names --> + +<#-- Best practices: + If the SK is of type: + - string: add ?json_string (e.g. "${stock.batch_1?json_string}") + - boolean: possible values: true and false + - datetime: expected format: 2025-10-30T10:12:10.000Z + - decimal number: the separator is a point (e.g. 10.5)--> + +"MetaData": [ ] \ No newline at end of file diff --git a/RFXtoRP_HsrAntRec_Created_SegmentationKeys.ftl b/RFXtoRP_HsrAntRec_Created_SegmentationKeys.ftl new file mode 100644 index 0000000..de24f8b --- /dev/null +++ b/RFXtoRP_HsrAntRec_Created_SegmentationKeys.ftl @@ -0,0 +1,47 @@ +<#-- use protobuf of class HsrReceiptList to find HARDIS WMS fields names --> + +<#-- +<#-- Best practices: + If the SK is of type: + - string: add ?json_string (e.g. "${stock.batch_1?json_string}") + - boolean: possible values: true and false + - datetime: expected format: 2025-10-30T10:12:10.000Z + - decimal number: the separator is a point (e.g. 10.5) +"SegmentationKeys": [ + { + "Key": "Grade", + "Value": { "String" : "${line.grade_code}"} + }, + { + "Key": "Owner", + "Value": { "String" : "${line.owner_code}"} + }, + { + "Key": "BatchNumber", + <#if reflexMvtStockInterface.batch_1 == ""> + "Value": { "String" : "no batch"} + <#else> + "Value": { "String" : "${line_without_detail.batch_1}"} + + }, + { + "Key": "HeldForSpecificCode", + <#if line_without_detail.hold_for_specific_code == "true"> + "Value": { "Bool" : "True"} + <#else> + "Value": { "Bool" : "False"} + }, + + { + <#assign manufacturing_date = line_without_detail.ipg_date_of_manufacture_date?datetime(rfx_date_format_default)?iso_utc /> + "Key": "ManufacturingDate", + "Value": "Timestamp": { + "AuthorTimeZone": "${time_zone_rfx}", + "DateTime": "${manufacturing_date}" + } + } + + ] + +--> +"SegmentationKeys": [ ] \ No newline at end of file diff --git a/RFXtoRP_HsrCarrierApt.ftl b/RFXtoRP_HsrCarrierApt.ftl index df68af9..d96a39e 100644 --- a/RFXtoRP_HsrCarrierApt.ftl +++ b/RFXtoRP_HsrCarrierApt.ftl @@ -1,5 +1,5 @@ <#-- **** input parameters ***** --> -<#-- input : message RFX --> +<#-- input : message HARDIS-WMS --> <#-- project : projectId in ReflexPlatform --> <#-- organisation : organisationtId in ReflexPlatform --> <#include "ActorPrefix.ftl"> @@ -12,11 +12,12 @@ <#assign aDateTime = .now> +<#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> +<#assign carrier_apt = JsonUtil.jsonToMap(dataRfx)> + <#switch cloudEventMsg.action> <#case "C"> <#-- *********************************************** Action = CREATE or UPDATE ******************** --> - <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign carrier_apt = JsonUtil.jsonToMap(dataRfx)> [ { <#assign apiReflexPlatformID = ApiReflexPlatformID.SiteForceBookAppointment> @@ -24,23 +25,10 @@ "datas" : <#include "RFXtoRP_HsrCarrierApt_SiteForceBookAppointment.ftl"> } - <#if (carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "false" && (carrier_apt.planned_unloading_start_datetime?starts_with("00") || carrier_apt.planned_unloading_start_datetime?contains("-00-") || carrier_apt.planned_unloading_end_datetime?starts_with("00") || carrier_apt.planned_unloading_end_datetime?contains("-00-"))) || (carrier_apt.unloading_appointment == "false" && carrier_apt.load_appointment == "true" && (carrier_apt.planned_load_start_datetime?starts_with("00") || carrier_apt.planned_load_start_datetime?contains("-00-") || carrier_apt.planned_load_end_datetime?starts_with("00") || carrier_apt.planned_load_end_datetime?contains("-00-"))) || (carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "true" && (carrier_apt.planned_load_end_datetime?starts_with("00") || carrier_apt.planned_load_end_datetime?contains("-00-") || carrier_apt.planned_unloading_start_datetime?starts_with("00") || carrier_apt.planned_unloading_start_datetime?contains("-00-")))> - <#stop "One of the datetime fields of appointment is not initialized" > - <#else> - , - { - <#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentCustomFieldsUpdated> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_HsrCarrierApt_AppointmentCustomFieldsUpdated.ftl"> - } - ] <#break> <#case "U"> <#-- *********************************************** Action = Update ********************--> - <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign carrier_apt = JsonUtil.jsonToMap(dataRfx)> [ { <#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentCustomFieldsUpdated> @@ -149,8 +137,6 @@ <#break> <#case "D"> <#-- *********************************************** Action = Delete ******************** --> - <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign carrier_apt = JsonUtil.jsonToMap(dataRfx)> [ <#-- Ajout des lignes--> { diff --git a/RFXtoRP_HsrCarrierApt_SiteForceBookAppointment.ftl b/RFXtoRP_HsrCarrierApt_SiteForceBookAppointment.ftl index cbe7549..781e568 100644 --- a/RFXtoRP_HsrCarrierApt_SiteForceBookAppointment.ftl +++ b/RFXtoRP_HsrCarrierApt_SiteForceBookAppointment.ftl @@ -138,6 +138,8 @@ <#stop "planned_unloading_start_datetime field of appointmend is not initialized" > "StartDateTime": "${carrier_apt.planned_unloading_start_datetime}" + <#else> + <#stop "Appointment type not supported" > diff --git a/RFXtoRP_HsrCarrierApt_UpdateAppointment.ftl b/RFXtoRP_HsrCarrierApt_UpdateAppointment.ftl index d9fb6f5..1ffc660 100644 --- a/RFXtoRP_HsrCarrierApt_UpdateAppointment.ftl +++ b/RFXtoRP_HsrCarrierApt_UpdateAppointment.ftl @@ -133,7 +133,12 @@ "StartDateTime": "${carrier_apt.planned_load_start_datetime}" <#else> <#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "true"> - <#stop "Not managed"> + <#if carrier_apt.planned_unloading_start_datetime?starts_with("00") || carrier_apt.planned_unloading_start_datetime?contains("-00-")> + <#stop "planned_unloading_start_datetime field of appointmend is not initialized" > + + "StartDateTime": "${carrier_apt.planned_unloading_start_datetime}" + <#else> + <#stop "Appointment type not supported" > diff --git a/RFXtoRP_HsrCarrierApt_UpdateSlotAppointment.ftl b/RFXtoRP_HsrCarrierApt_UpdateSlotAppointment.ftl index b8a1d02..fddb56b 100644 --- a/RFXtoRP_HsrCarrierApt_UpdateSlotAppointment.ftl +++ b/RFXtoRP_HsrCarrierApt_UpdateSlotAppointment.ftl @@ -69,11 +69,13 @@ "StartDateTime": "${carrier_apt.planned_load_start_datetime}" <#else> <#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "true"> - <#if carrier_apt.planned_unloading_start_datetime?starts_with("00") || carrier_apt.planned_unloading_start_datetime?contains("-00-")> - <#stop "planned_unloading_start_datetime field of appointmend is not initialized" > - - "StartDateTime": "${carrier_apt.planned_unloading_start_datetime}" - + <#if carrier_apt.planned_unloading_start_datetime?starts_with("00") || carrier_apt.planned_unloading_start_datetime?contains("-00-")> + <#stop "planned_unloading_start_datetime field of appointmend is not initialized" > + + "StartDateTime": "${carrier_apt.planned_unloading_start_datetime}" + <#else> + <#stop "Appointment type not supported" > + }] diff --git a/RFXtoRP_HsrPro_ExecutionflowDetected.ftl b/RFXtoRP_HsrPro_ExecutionflowDetected.ftl index f2b4ca9..32d421c 100644 --- a/RFXtoRP_HsrPro_ExecutionflowDetected.ftl +++ b/RFXtoRP_HsrPro_ExecutionflowDetected.ftl @@ -9,6 +9,32 @@ "ProjectID": "${projectRP}" }, "ID": { + "CustomFields": [ + { + "Key": "depot_code", + "Value": "${preparation_order.physical_depot_code?trim?json_string}" + }, + { + "Key": "activity_code", + "Value": "${preparation_order.activity_code?trim?json_string}" + }, + { + "Key": "originator_code", + "Value": "${preparation_order.originator_code?trim?json_string}" + }, + { + "Key": "reference", + "Value": "${preparation_order.originator_reference?trim?json_string}" + }, + { + "Key": "order_year", + "Value": "${preparation_order.preparation_order_year}" + }, + { + "Key": "order_number", + "Value": "${preparation_order.preparation_order_number}" + } + ], <#if preparation_order.originator_reference?? && preparation_order.originator_reference!=""> "RefID": "${preparation_order.physical_depot_code?trim?json_string}${preparation_order.activity_code?trim?json_string}${preparation_order.originator_code?trim?json_string}${preparation_order.originator_reference?trim?json_string}", <#else> diff --git a/RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl b/RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl index b8b8924..d340648 100644 --- a/RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl +++ b/RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl @@ -9,6 +9,32 @@ "ProjectID": "${projectRP}" }, "ID": { + "CustomFields": [ + { + "Key": "depot_code", + "Value": "${receipt.physical_depot_code?trim?json_string}" + }, + { + "Key": "activity_code", + "Value": "${receipt.activity_code?trim?json_string}" + }, + { + "Key": "originator_code", + "Value": "${receipt.originator_code?trim?json_string}" + }, + { + "Key": "reference", + "Value": "${receipt.receipt_reference?trim?json_string}" + }, + { + "Key": "order_year", + "Value": "${receipt.receipt_year}" + }, + { + "Key": "order_number", + "Value": "${receipt.receipt_number}" + } + ], "RefID": "R${receipt.physical_depot_code?trim?json_string}${receipt.activity_code?trim?json_string}${receipt.originator_code?trim?json_string}${receipt.receipt_year}${receipt.receipt_number}", "RefDate": { "DateTime": "${receipt_creation_datetime}", diff --git a/RFXtoRP_HsrReceiptList_TransfertExecutionflowDetected.ftl b/RFXtoRP_HsrReceiptList_TransfertExecutionflowDetected.ftl index 55ae697..bffb8ec 100644 --- a/RFXtoRP_HsrReceiptList_TransfertExecutionflowDetected.ftl +++ b/RFXtoRP_HsrReceiptList_TransfertExecutionflowDetected.ftl @@ -9,6 +9,36 @@ { "Header": {"ProjectID": "${projectRP}"}, "ID": { + "CustomFields": [ + { + "Key": "depot_code", + <#if receipt.origin_order_line_depot?? && receipt.origin_order_line_depot!=""> + "Value": "${receipt.origin_order_line_depot?trim?json_string}" + <#else> + "Value": "${receipt.physical_depot_code?trim?json_string}" + + }, + { + "Key": "activity_code", + "Value": "${receipt.activity_code?trim?json_string}" + }, + { + "Key": "originator_code", + "Value": "${receipt.originator_code?trim?json_string}" + }, + { + "Key": "reference", + "Value": "${receipt.receipt_reference?trim?json_string}" + }, + { + "Key": "order_year", + "Value": "${receipt.receipt_year}" + }, + { + "Key": "order_number", + "Value": "${receipt.receipt_number}" + } + ], <#if receipt.origin_order_line_depot?? && receipt.origin_order_line_depot!=""> "RefID": "${receipt.origin_order_line_depot?trim?json_string}${receipt.activity_code?trim?json_string}${receipt.originator_code?trim?json_string}${receipt.receipt_reference?trim?json_string}", <#else> diff --git a/RPtoRFX_Receipt.ftl b/RPtoRFX_Receipt.ftl index bd37d24..99470fa 100644 --- a/RPtoRFX_Receipt.ftl +++ b/RPtoRFX_Receipt.ftl @@ -20,7 +20,6 @@ "work_mode_code" : "${work_mode_code}", "original_code" : "${RPtoRFXprefixSupplier(executionflow.ShipFrom.ActorID)}", "carrier_code" : "${RPtoRFXprefixCarrier(executionflow.Carrier.ActorID!"")}", - <#if executionflow.RequestedMilestones?? && executionflow.RequestedMilestones.RequestedDeliveryDateTime??> "receipt_datetime": "${DateTimeUTCtoRfxLocale(executionflow.RequestedMilestones.RequestedDeliveryDateTime.DateTime,time_zone_rfx)}", <#else>