diff --git a/README.md b/README.md index 4f870a1..481e1e3 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ ## Overview The **HARDIS WMS Connector** is a set of **FreeMarker templates (FTL)** designed to transform **outgoing JSON flows from HARDIS WMS** into **flows compatible with HARDIS SC NETWORK**. +The **HARDIS WMS Connector** is a set of **FreeMarker templates (FTL)** designed to transform **outgoing JSON flows from HARDIS WMS** into **flows compatible with HARDIS SC NETWORK**. This connector does not contain any standalone executable code: it is intended to be used by **Reflex integration engines** or **data exchange pipelines**, where it applies the mapping rules defined in the `.ftl` files. @@ -17,4 +18,3 @@ This connector does not contain any standalone executable code: it is intended t - [FreeMarker Documentation](https://freemarker.apache.org/docs/index.html) - [HARDIS SC NETWORK](https://auth.reflex-platform.com/) - diff --git a/RFX_PartnerAPP_Settings.ftl b/RFX_PartnerAPP_Settings.ftl index 6e5411d..719e2ca 100644 --- a/RFX_PartnerAPP_Settings.ftl +++ b/RFX_PartnerAPP_Settings.ftl @@ -1 +1,2 @@ +<#-- To configure the tracking setting carrier --> <#assign trackingNumberSource = 3> diff --git a/RFXtoRP_HfDtlStockLs_StockSnapshotted_SegmentationKeys.ftl b/RFXtoRP_HfDtlStockLs_StockSnapshotted_SegmentationKeys.ftl index 8fefdd0..2c862de 100644 --- a/RFXtoRP_HfDtlStockLs_StockSnapshotted_SegmentationKeys.ftl +++ b/RFXtoRP_HfDtlStockLs_StockSnapshotted_SegmentationKeys.ftl @@ -1,6 +1,12 @@ <#-- use protobuf of class HfDtlStockLs 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": [ { diff --git a/RFXtoRP_HliPrepaL.ftl b/RFXtoRP_HliPrepaL.ftl index aefd91c..b92a2b4 100644 --- a/RFXtoRP_HliPrepaL.ftl +++ b/RFXtoRP_HliPrepaL.ftl @@ -1,7 +1,7 @@ <#-- **** input parameters ***** --> -<#-- input : message RFX --> -<#-- project : projectId in ReflexPlatform --> -<#-- organisation : organisationtId in ReflexPlatform --> +<#-- input : message HARDIS WMS --> +<#-- project : projectId in HARDIS SC NETWORK --> +<#-- organisation : organisationtId in HARDIS SC NETWORK --> <#include "ReflexUtils.ftl"> <#include "HfRpConfig.ftl"> <#assign cloudEventMsg = JsonUtil.jsonToMap(input)> @@ -34,7 +34,6 @@ "datas" : <#include "RFXtoRP_HsrPrepa_HandlingUnitDispatched.ftl"> } - <#assign refIDHmap ={}> <#assign hd_numberHmap ={}> <#assign hd_numberHmapHUadded ={}> @@ -49,7 +48,7 @@ "datas" : <#include "RFXtoRP_HsrPrepa_TrackingHuLabelled.ftl"> } - + <#if despatched_ipg.carton_number != "000000000000000000" && despatched_ipg.carton_number!=despatched_ipg.hd_number > , { diff --git a/RFXtoRP_HsaCarrier.ftl b/RFXtoRP_HsaCarrier.ftl index 6b47034..a8e71a5 100644 --- a/RFXtoRP_HsaCarrier.ftl +++ b/RFXtoRP_HsaCarrier.ftl @@ -1,7 +1,7 @@ <#-- **** input parameters ***** --> -<#-- input : message RFX --> -<#-- project : projectId in ReflexPlatform --> -<#-- organisation : organisationtId in ReflexPlatform --> +<#-- input : message HARDIS WMS --> +<#-- project : projectId in HARDIS SC NETWORK --> +<#-- organisation : organisationtId in HARDIS SC NETWORK --> <#assign cloudEventMsg = JsonUtil.jsonToMap(input)> <#assign projectRP = project> diff --git a/RFXtoRP_HsaCarrier_ActorCreated_Metadata.ftl b/RFXtoRP_HsaCarrier_ActorCreated_Metadata.ftl index ceb5dfe..572e497 100644 --- a/RFXtoRP_HsaCarrier_ActorCreated_Metadata.ftl +++ b/RFXtoRP_HsaCarrier_ActorCreated_Metadata.ftl @@ -1,4 +1,10 @@ <#-- use protobuf of class HsaCarrier 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_HsaCons.ftl b/RFXtoRP_HsaCons.ftl index 198e656..0c8a922 100644 --- a/RFXtoRP_HsaCons.ftl +++ b/RFXtoRP_HsaCons.ftl @@ -1,5 +1,5 @@ <#-- **** input parameters ***** --> -<#-- input : message HARDIS WMS --> +<#-- input : message HARDIS- WMS --> <#-- project : projectId in HARDIS SC NETWORK --> <#-- organisation : organisationtId in HARDIS SC NETWORK --> diff --git a/RFXtoRP_HsaCons_ActorCreated_Metadata.ftl b/RFXtoRP_HsaCons_ActorCreated_Metadata.ftl index 8555307..772efa2 100644 --- a/RFXtoRP_HsaCons_ActorCreated_Metadata.ftl +++ b/RFXtoRP_HsaCons_ActorCreated_Metadata.ftl @@ -1,4 +1,10 @@ <#-- use protobuf of class HsaCons 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_HsaDesPatch.ftl b/RFXtoRP_HsaDesPatch.ftl new file mode 100644 index 0000000..202981f --- /dev/null +++ b/RFXtoRP_HsaDesPatch.ftl @@ -0,0 +1,32 @@ +<#-- **** input parameters ***** --> +<#-- input : message RFX --> +<#-- project : projectId in ReflexPlatform --> +<#-- organisation : organisationtId in ReflexPlatform --> + +<#assign cloudEventMsg = JsonUtil.jsonToMap(input)> +<#assign projectRP = project> +<#assign organisationRP = organisation> + +<#assign aDateTime = .now> + +<#switch cloudEventMsg.action> + <#case "C"> + <#case "U"> + <#-- *********************************************** Action = CREATE or UPDATE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign desPatch = JsonUtil.jsonToMap(dataRfx)> + + <#stop "no generic FTL file available yet for desPatch"> + <#break> + + <#case "D"> + <#-- *********************************************** Action = DELETE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign desPatch = JsonUtil.jsonToMap(dataRfx)> + + <#stop "no generic FTL file available yet for desPatch"> + <#break> + <#default> + <#stop > + + diff --git a/RFXtoRP_HsaDespNt.ftl b/RFXtoRP_HsaDespNt.ftl new file mode 100644 index 0000000..da1d0c2 --- /dev/null +++ b/RFXtoRP_HsaDespNt.ftl @@ -0,0 +1,32 @@ +<#-- **** input parameters ***** --> +<#-- input : message RFX --> +<#-- project : projectId in ReflexPlatform --> +<#-- organisation : organisationtId in ReflexPlatform --> + +<#assign cloudEventMsg = JsonUtil.jsonToMap(input)> +<#assign projectRP = project> +<#assign organisationRP = organisation> + +<#assign aDateTime = .now> + +<#switch cloudEventMsg.action> + <#case "C"> + <#case "U"> + <#-- *********************************************** Action = CREATE or UPDATE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign despNt = JsonUtil.jsonToMap(dataRfx)> + + <#stop "no generic FTL file available yet for despNt"> + <#break> + + <#case "D"> + <#-- *********************************************** Action = DELETE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign despNt = JsonUtil.jsonToMap(dataRfx)> + + <#stop "no generic FTL file available yet for despNt"> + <#break> + <#default> + <#stop > + + diff --git a/RFXtoRP_HsaDispute.ftl b/RFXtoRP_HsaDispute.ftl index eff3e64..fe36e7c 100644 --- a/RFXtoRP_HsaDispute.ftl +++ b/RFXtoRP_HsaDispute.ftl @@ -2,13 +2,11 @@ <#-- input : message HARDIS WMS --> <#-- project : projectId in HARDIS SC NETWORK --> <#-- organisation : organisationtId in HARDIS SC NETWORK --> - +<#-- For dispute creation WMS to Platform --> <#assign cloudEventMsg = JsonUtil.jsonToMap(input)> <#assign projectRP = project> <#assign organisationRP = organisation> - <#assign aDateTime = .now> - <#switch cloudEventMsg.action> <#case "C"> <#case "U"> @@ -17,6 +15,7 @@ <#assign dispute = JsonUtil.jsonToMap(dataRfx)> [ <#if dispute.dispute_closed == true > + <#-- Only for preparation and receipt disputes --> <#if ((dispute.dispute_type_code=="030" || dispute.dispute_type_code=="070") && dispute.dispute_reception?? && dispute.dispute_reception.reception_reference!="") || (dispute.dispute_type_code=="050" && dispute.dispute_preparation.preparation_order_list?? && dispute.dispute_preparation.preparation_order_list[0].preparation_order_contractor_reference?trim?json_string!="")> { <#assign apiReflexPlatformID = ApiReflexPlatformID.ClaimCreated> @@ -24,9 +23,11 @@ "datas" : <#include "RFXtoRP_HsaDispute_Created.ftl"> } + <#-- Create the table for reason code in RFXtoRP_HsaDispute_TableReasonCodeToClaimTypeID.ftl --> <#if TableReasonCode[dispute.dispute_reason_code]??> , { + <#-- Add message in dispute tchat room --> <#assign apiReflexPlatformID = ApiReflexPlatformID.ClaimMessageSent> "apiReflexPlatformID" : "${apiReflexPlatformID}", "datas" : diff --git a/RFXtoRP_HsaDispute_ClaimMetadata.ftl b/RFXtoRP_HsaDispute_ClaimMetadata.ftl index d0a8314..e2afd54 100644 --- a/RFXtoRP_HsaDispute_ClaimMetadata.ftl +++ b/RFXtoRP_HsaDispute_ClaimMetadata.ftl @@ -1,4 +1,10 @@ <#-- use protobuf of class HsaDispute 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_HsaDispute_MessageSent.ftl b/RFXtoRP_HsaDispute_MessageSent.ftl index 6b59ba0..ece9c2b 100644 --- a/RFXtoRP_HsaDispute_MessageSent.ftl +++ b/RFXtoRP_HsaDispute_MessageSent.ftl @@ -2,6 +2,7 @@ <#include "ReflexUtils.ftl"> [ { + <#-- Add refer --> "Header": { "ProjectID": "${projectRP}" }, diff --git a/RFXtoRP_HsaIpgMove_GoodsReceived_SegmentationKeys.ftl b/RFXtoRP_HsaIpgMove_GoodsReceived_SegmentationKeys.ftl index f47abd4..be83a84 100644 --- a/RFXtoRP_HsaIpgMove_GoodsReceived_SegmentationKeys.ftl +++ b/RFXtoRP_HsaIpgMove_GoodsReceived_SegmentationKeys.ftl @@ -1,7 +1,12 @@ <#-- use protobuf of class HsaIpgMove 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": [ { diff --git a/RFXtoRP_HsaIpgMove_StockMoved_SegmentationKeys.ftl b/RFXtoRP_HsaIpgMove_StockMoved_SegmentationKeys.ftl index 29d1851..e5b9d05 100644 --- a/RFXtoRP_HsaIpgMove_StockMoved_SegmentationKeys.ftl +++ b/RFXtoRP_HsaIpgMove_StockMoved_SegmentationKeys.ftl @@ -1,5 +1,12 @@ <#-- use protobuf of class HsaIpgMove 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", diff --git a/RFXtoRP_HsaItmLv.ftl b/RFXtoRP_HsaItmLv.ftl index 09e176c..19224f5 100644 --- a/RFXtoRP_HsaItmLv.ftl +++ b/RFXtoRP_HsaItmLv.ftl @@ -1,45 +1,45 @@ -<#-- **** 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"> - <#case "U"> - <#-- *********************************************** Action = CREATE or UPDATE ******************** --> - <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign lv = JsonUtil.jsonToMap(dataRfx)> - [ - { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ItemLogisticVariantUpdated> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_HsaItmLv_LogisticVariantUpdated.ftl"> - } - ] - <#break> - - <#case "D"> - <#-- *********************************************** Action = DELETE ******************** --> - <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign lv = JsonUtil.jsonToMap(dataRfx)> - [ - { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ItemLogisticVariantRemoved> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_HsaItmLv_LogisticVariantRemoved.ftl"> - } - ] - <#break> - <#default> - <#stop > - - +<#-- **** 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"> + <#case "U"> + <#-- *********************************************** Action = CREATE or UPDATE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign lv = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ItemLogisticVariantUpdated> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaItmLv_LogisticVariantUpdated.ftl"> + } + ] + <#break> + + <#case "D"> + <#-- *********************************************** Action = DELETE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign lv = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ItemLogisticVariantRemoved> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaItmLv_LogisticVariantRemoved.ftl"> + } + ] + <#break> + <#default> + <#stop > + + diff --git a/RFXtoRP_HsaItmLv_LogisticVariantUpdated_Metadata.ftl b/RFXtoRP_HsaItmLv_LogisticVariantUpdated_Metadata.ftl index cbbb6f7..744d05d 100644 --- a/RFXtoRP_HsaItmLv_LogisticVariantUpdated_Metadata.ftl +++ b/RFXtoRP_HsaItmLv_LogisticVariantUpdated_Metadata.ftl @@ -1,4 +1,10 @@ <#-- use protobuf of class HsaItmLv 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_HsaItm_ItemCreated_ItemMetadata.ftl b/RFXtoRP_HsaItm_ItemCreated_ItemMetadata.ftl index 11676ae..a4620da 100644 --- a/RFXtoRP_HsaItm_ItemCreated_ItemMetadata.ftl +++ b/RFXtoRP_HsaItm_ItemCreated_ItemMetadata.ftl @@ -1,4 +1,10 @@ <#-- use protobuf of class HsaItm 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_HsaItm_ItemCreated_LogisticVariantMetadata.ftl b/RFXtoRP_HsaItm_ItemCreated_LogisticVariantMetadata.ftl index 2b30c89..895a30f 100644 --- a/RFXtoRP_HsaItm_ItemCreated_LogisticVariantMetadata.ftl +++ b/RFXtoRP_HsaItm_ItemCreated_LogisticVariantMetadata.ftl @@ -1,4 +1,10 @@ <#-- use protobuf of class HsaItm 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_HsaLstCarSta.ftl b/RFXtoRP_HsaLstCarSta.ftl index 1e7ac8c..c831d81 100644 --- a/RFXtoRP_HsaLstCarSta.ftl +++ b/RFXtoRP_HsaLstCarSta.ftl @@ -1,40 +1,89 @@ <#-- **** input parameters ***** --> <#-- input : message HARDIS WMS --> -<#-- project : projectId in HARDIS SC NETWORK --> -<#-- organisation : organisationtId in HARDIS SC NETWORK --> +<#-- project : projectId in ReflexPlatform --> +<#-- organisation : organisationtId in ReflexPlatform --> +<#include "ActorPrefix.ftl"> +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> <#assign cloudEventMsg = JsonUtil.jsonToMap(input)> <#assign projectRP = project> + <#assign organisationRP = organisation> <#assign aDateTime = .now> -<#stop> - <#switch cloudEventMsg.action> <#case "C"> <#case "U"> - <#-- *********************************************** Action = CREATE or UPDATE ******************** --> - <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign depot = JsonUtil.jsonToMap(dataRfx)> - [ - { - - } - ] - <#break> - - <#case "D"> - <#-- *********************************************** Action = DELETE *************************** --> + <#-- *********************************************** Action = Update ******************** --> <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign depot = JsonUtil.jsonToMap(dataRfx)> - [ - { + <#assign carrier_apt_status = JsonUtil.jsonToMap(dataRfx)> + <#if !carrier_apt_status.status??> + <#stop 'the updated appointment Status not initialized'> + + [ + { + <#switch carrier_apt_status.status.carrier_status_code> + <#case "010"> <#--Carrier Expected --> + <#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentCarrierExpected> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaLstCarSta_CarrierExpected.ftl"> + <#break> + <#case "020"> <#--Carrier Arrived--> + <#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentCarrierArrived> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaLstCarSta_CarrierArrived.ftl"> + <#break> + <#case "040"> <#--Unloading Started --> + <#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentUnloadingStarted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaLstCarSta_UnloadingStarted.ftl"> + <#break> + <#case "050"> <#--Unloading Completed--> + <#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentUnloadingCompleted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaLstCarSta_UnloadingCompleted.ftl"> + <#break> + <#case "060"> <#--Loading Started--> + <#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentLoadingStarted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaLstCarSta_LoadingStarted.ftl"> + <#break> + <#case "070"> <#--Loading Completed--> + <#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentLoadingCompleted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaLstCarSta_LoadingCompleted.ftl"> + <#break> + <#case "090"> <#--Carrier Departed--> + <#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentCarrierDeparted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaLstCarSta_CarrierDeparted.ftl"> + <#break> - } - ] - <#break> + <#default> + <#stop 'this updated appointment Status not implemented'> + + + } + ] + <#break> + +<#case "D"> + <#-- *********************************************** Action = Delete ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign carrier_apt_status = JsonUtil.jsonToMap(dataRfx)> + <#stop 'Delete Appointment Status not implemented' > + <#break> <#default> <#stop > - \ No newline at end of file + + diff --git a/RFXtoRP_HsaLstCarSta_CarrierArrived.ftl b/RFXtoRP_HsaLstCarSta_CarrierArrived.ftl new file mode 100644 index 0000000..256ab68 --- /dev/null +++ b/RFXtoRP_HsaLstCarSta_CarrierArrived.ftl @@ -0,0 +1,22 @@ +[ + <#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt_status.status.creation_datetime,time_zone_rfx) /> + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt_status.physical_depot?json_string}${carrier_apt_status.appointment_year_number?json_string}${carrier_apt_status.appointment_number?json_string}", + + "RefDate": { + "DateTime": "${ref_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + "Payload":{ + "ActorID": "${RFXtoRPprefixDepot(carrier_apt_status.physical_depot?json_string)}" + } + } +] \ No newline at end of file diff --git a/RFXtoRP_HsaLstCarSta_CarrierDeparted.ftl b/RFXtoRP_HsaLstCarSta_CarrierDeparted.ftl new file mode 100644 index 0000000..c39c0c3 --- /dev/null +++ b/RFXtoRP_HsaLstCarSta_CarrierDeparted.ftl @@ -0,0 +1,22 @@ +[ + <#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt_status.status.creation_datetime,time_zone_rfx) /> + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt_status.physical_depot?json_string}${carrier_apt_status.appointment_year_number?json_string}${carrier_apt_status.appointment_number?json_string}", + + "RefDate": { + "DateTime": "${ref_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + "Payload":{ + "ActorID": "${RFXtoRPprefixDepot(carrier_apt_status.physical_depot?json_string)}" + } + } +] \ No newline at end of file diff --git a/RFXtoRP_HsaLstCarSta_CarrierExpected.ftl b/RFXtoRP_HsaLstCarSta_CarrierExpected.ftl new file mode 100644 index 0000000..c39c0c3 --- /dev/null +++ b/RFXtoRP_HsaLstCarSta_CarrierExpected.ftl @@ -0,0 +1,22 @@ +[ + <#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt_status.status.creation_datetime,time_zone_rfx) /> + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt_status.physical_depot?json_string}${carrier_apt_status.appointment_year_number?json_string}${carrier_apt_status.appointment_number?json_string}", + + "RefDate": { + "DateTime": "${ref_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + "Payload":{ + "ActorID": "${RFXtoRPprefixDepot(carrier_apt_status.physical_depot?json_string)}" + } + } +] \ No newline at end of file diff --git a/RFXtoRP_HsaLstCarSta_LoadingCompleted.ftl b/RFXtoRP_HsaLstCarSta_LoadingCompleted.ftl new file mode 100644 index 0000000..c39c0c3 --- /dev/null +++ b/RFXtoRP_HsaLstCarSta_LoadingCompleted.ftl @@ -0,0 +1,22 @@ +[ + <#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt_status.status.creation_datetime,time_zone_rfx) /> + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt_status.physical_depot?json_string}${carrier_apt_status.appointment_year_number?json_string}${carrier_apt_status.appointment_number?json_string}", + + "RefDate": { + "DateTime": "${ref_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + "Payload":{ + "ActorID": "${RFXtoRPprefixDepot(carrier_apt_status.physical_depot?json_string)}" + } + } +] \ No newline at end of file diff --git a/RFXtoRP_HsaLstCarSta_LoadingStarted.ftl b/RFXtoRP_HsaLstCarSta_LoadingStarted.ftl new file mode 100644 index 0000000..c39c0c3 --- /dev/null +++ b/RFXtoRP_HsaLstCarSta_LoadingStarted.ftl @@ -0,0 +1,22 @@ +[ + <#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt_status.status.creation_datetime,time_zone_rfx) /> + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt_status.physical_depot?json_string}${carrier_apt_status.appointment_year_number?json_string}${carrier_apt_status.appointment_number?json_string}", + + "RefDate": { + "DateTime": "${ref_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + "Payload":{ + "ActorID": "${RFXtoRPprefixDepot(carrier_apt_status.physical_depot?json_string)}" + } + } +] \ No newline at end of file diff --git a/RFXtoRP_HsaLstCarSta_UnloadingCompleted.ftl b/RFXtoRP_HsaLstCarSta_UnloadingCompleted.ftl new file mode 100644 index 0000000..c39c0c3 --- /dev/null +++ b/RFXtoRP_HsaLstCarSta_UnloadingCompleted.ftl @@ -0,0 +1,22 @@ +[ + <#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt_status.status.creation_datetime,time_zone_rfx) /> + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt_status.physical_depot?json_string}${carrier_apt_status.appointment_year_number?json_string}${carrier_apt_status.appointment_number?json_string}", + + "RefDate": { + "DateTime": "${ref_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + "Payload":{ + "ActorID": "${RFXtoRPprefixDepot(carrier_apt_status.physical_depot?json_string)}" + } + } +] \ No newline at end of file diff --git a/RFXtoRP_HsaLstCarSta_UnloadingStarted.ftl b/RFXtoRP_HsaLstCarSta_UnloadingStarted.ftl new file mode 100644 index 0000000..c39c0c3 --- /dev/null +++ b/RFXtoRP_HsaLstCarSta_UnloadingStarted.ftl @@ -0,0 +1,22 @@ +[ + <#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt_status.status.creation_datetime,time_zone_rfx) /> + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if carrier_apt_status.appointment_reference?? && carrier_apt_status.appointment_reference !=""> + "RefID": "${carrier_apt_status.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt_status.physical_depot?json_string}${carrier_apt_status.appointment_year_number?json_string}${carrier_apt_status.appointment_number?json_string}", + + "RefDate": { + "DateTime": "${ref_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + "Payload":{ + "ActorID": "${RFXtoRPprefixDepot(carrier_apt_status.physical_depot?json_string)}" + } + } +] \ No newline at end of file diff --git a/RFXtoRP_HsaProStatus.ftl b/RFXtoRP_HsaProStatus.ftl index 5151b52..a98ce7c 100644 --- a/RFXtoRP_HsaProStatus.ftl +++ b/RFXtoRP_HsaProStatus.ftl @@ -16,56 +16,60 @@ <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> <#assign preparationStatusInterface = JsonUtil.jsonToMap(dataRfx) /> [ + <#if preparationStatusInterface.preparation_type_code=="010" || preparationStatusInterface.preparation_type_code=="030"> <#--**Pick batch runned (200) **--> - <#if preparationStatusInterface.preparation_order_originator_reference?? && preparationStatusInterface.preparation_order_originator_reference!=""> - <#if preparationStatusInterface.preparation_status_type == "100" && preparationStatusInterface.preparation_status_code == "200" > - { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowPreparationExpected> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_HsaProStatus_PreparationExpected.ftl"> - } - <#else> - <#-- ** Collection started (300) and Preparation in progress (400)** --> - <#if preparationStatusInterface.preparation_status_type == "100" && (preparationStatusInterface.preparation_status_code == "300" || preparationStatusInterface.preparation_status_code == "400") > + <#if preparationStatusInterface.preparation_order_originator_reference?? && preparationStatusInterface.preparation_order_originator_reference!=""> + <#if preparationStatusInterface.preparation_status_type == "100" && preparationStatusInterface.preparation_status_code == "200" > { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowPreparationStarted> + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowPreparationExpected> "apiReflexPlatformID" : "${apiReflexPlatformID}", "datas" : - <#include "RFXtoRP_HsaProStatus_PreparationStarted.ftl"> + <#include "RFXtoRP_HsaProStatus_PreparationExpected.ftl"> } <#else> - <#-- ****Preparation dispatched (600)** --> - <#if preparationStatusInterface.preparation_status_type == "100" && preparationStatusInterface.preparation_status_code == "600" > - { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowPreparationCompleted> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_HsaProStatus_PreparationCompleted.ftl"> - }, - { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowTransportStarted> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_HsaProStatus_TransportStarted.ftl"> - } + <#-- ** Collection started (300) and Preparation in progress (400)** --> + <#if preparationStatusInterface.preparation_status_type == "100" && (preparationStatusInterface.preparation_status_code == "300" || preparationStatusInterface.preparation_status_code == "400") > + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowPreparationStarted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaProStatus_PreparationStarted.ftl"> + } <#else> - <#-- ****Preparation cancelled (650)**** --> - <#if preparationStatusInterface.preparation_status_type == "100" && preparationStatusInterface.preparation_status_code == "650" > + <#-- ****Preparation dispatched (600)** --> + <#if preparationStatusInterface.preparation_status_type == "100" && preparationStatusInterface.preparation_status_code == "600" > { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowCancelled> + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowPreparationCompleted> "apiReflexPlatformID" : "${apiReflexPlatformID}", "datas" : - <#include "RFXtoRP_HsaProStatus_ExecutionflowCancelled.ftl"> + <#include "RFXtoRP_HsaProStatus_PreparationCompleted.ftl"> + }, + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowTransportStarted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaProStatus_TransportStarted.ftl"> } <#else> - <#stop> + <#-- ****Preparation cancelled (650)**** --> + <#if preparationStatusInterface.preparation_status_type == "100" && preparationStatusInterface.preparation_status_code == "650" > + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowCancelled> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaProStatus_ExecutionflowCancelled.ftl"> + } + <#else> + <#stop> + + <#else> + <#--PRO reference is empty--> + <#stop > <#else> - <#--PRO reference is empty--> <#stop > ] diff --git a/RFXtoRP_HsaSup_ActorCreated_Metadata.ftl b/RFXtoRP_HsaSup_ActorCreated_Metadata.ftl index 80b9a11..ca3c87a 100644 --- a/RFXtoRP_HsaSup_ActorCreated_Metadata.ftl +++ b/RFXtoRP_HsaSup_ActorCreated_Metadata.ftl @@ -1,4 +1,10 @@ <#-- use protobuf of class HsaSup 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_HsrCarrierApt.ftl b/RFXtoRP_HsrCarrierApt.ftl index 1e7ac8c..562f5f3 100644 --- a/RFXtoRP_HsrCarrierApt.ftl +++ b/RFXtoRP_HsrCarrierApt.ftl @@ -1,7 +1,10 @@ <#-- **** input parameters ***** --> -<#-- input : message HARDIS WMS --> -<#-- project : projectId in HARDIS SC NETWORK --> -<#-- organisation : organisationtId in HARDIS SC NETWORK --> +<#-- input : message HARDIS-WMS --> +<#-- project : projectId in ReflexPlatform --> +<#-- organisation : organisationtId in ReflexPlatform --> +<#include "ActorPrefix.ftl"> +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> <#assign cloudEventMsg = JsonUtil.jsonToMap(input)> <#assign projectRP = project> @@ -9,32 +12,156 @@ <#assign aDateTime = .now> -<#stop> - <#switch cloudEventMsg.action> <#case "C"> - <#case "U"> <#-- *********************************************** Action = CREATE or UPDATE ******************** --> <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign depot = JsonUtil.jsonToMap(dataRfx)> + <#assign carrier_apt = JsonUtil.jsonToMap(dataRfx)> [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.SiteForceBookAppointment> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrCarrierApt_SiteForceBookAppointment.ftl"> + }, + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentCarrierExpected> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrCarrierApt_AppointmentCarrierExpected.ftl"> + }, + { + <#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> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrCarrierApt_AppointmentCustomFieldsUpdated.ftl"> + }, + <#if carrier_apt.status?? && carrier_apt.status.status_code=="999"> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.SiteCancelAppointment> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrCarrierApt_SiteCancelAppointment.ftl"> + } + ] + <#else> + <#if carrier_apt.status?? && carrier_apt.status.status_code=="100"> <#--Carrier Arrived--> + [ { - + <#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentCarrierArrived> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrCarrierApt_CarrierArrived.ftl"> } - ] - <#break> - - <#case "D"> - <#-- *********************************************** Action = DELETE *************************** --> - <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign depot = JsonUtil.jsonToMap(dataRfx)> + ] + <#else> + <#if carrier_apt.status?? && carrier_apt.status.status_code=="210"> <#--Unloading Started --> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentUnloadingStarted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrCarrierApt_UnloadingStarted.ftl"> + } + ] + <#else> + <#if carrier_apt.status?? && carrier_apt.status.status_code=="290"><#--Unloading Completed--> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentUnloadingCompleted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrCarrierApt_UnloadingCompleted.ftl"> + } + ] + <#else> + <#if carrier_apt.status?? && carrier_apt.status.status_code=="310"><#--Loading Started--> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentLoadingStarted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrCarrierApt_LoadingStarted.ftl"> + } + ] + <#else> + <#if carrier_apt.status?? && carrier_apt.status.status_code=="390"><#--Loading Completed--> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentLoadingCompleted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrCarrierApt_LoadingCompleted.ftl"> + } + ] + <#else> + <#if carrier_apt.status?? && carrier_apt.status.status_code=="500"><#--Carrier Departed--> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.AppointmentCarrierDeparted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrCarrierApt_CarrierDeparted.ftl"> + } + ] + <#else> + <#if carrier_apt.physical_receipt_list?? && (carrier_apt.physical_receipt_list?filter(l ->l??)?size != 0)> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.SiteWMSUpdateAppointment> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrCarrierApt_UpdateAppointment.ftl"> + } + ] + <#else> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.SiteForceRescheduleAppointment> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrCarrierApt_UpdateSlotAppointment.ftl"> + } + ] + + + + + + + + + ] + <#break> +<#case "D"> + <#-- *********************************************** Action = Delete ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign carrier_apt = JsonUtil.jsonToMap(dataRfx)> [ - { - - } + <#-- Ajout des lignes--> + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.SiteCancelAppointment> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrCarrierApt_SiteCancelAppointment.ftl"> + } ] - <#break> - + <#break> <#default> <#stop > - \ No newline at end of file + + diff --git a/RFXtoRP_HsrCarrierApt_AppointmentCarrierExpected.ftl b/RFXtoRP_HsrCarrierApt_AppointmentCarrierExpected.ftl new file mode 100644 index 0000000..13bc369 --- /dev/null +++ b/RFXtoRP_HsrCarrierApt_AppointmentCarrierExpected.ftl @@ -0,0 +1,26 @@ +[ + <#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.metadata.creation_datetime,time_zone_rfx) /> + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if carrier_apt.appointment_reference?? && carrier_apt.appointment_reference!=""> + "RefID": "${carrier_apt.appointment_reference?json_string}", + <#else> + <#if carrier_apt.constant_appointment?? && carrier_apt.constant_appointment== "true"> + "RefID": "${carrier_apt.appointment_reference?json_string}${carrier_apt.physical_depot?json_string}${carrier_apt.year_number}${carrier_apt.appointment_number}", + <#else> + "RefID": "${carrier_apt.physical_depot?json_string}${carrier_apt.year_number}${carrier_apt.appointment_number}", + + + "RefDate": { + "DateTime": "${ref_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + "Payload":{ + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}" + } + } +] \ No newline at end of file diff --git a/RFXtoRP_HsrCarrierApt_AppointmentCustomFieldsUpdated.ftl b/RFXtoRP_HsrCarrierApt_AppointmentCustomFieldsUpdated.ftl new file mode 100644 index 0000000..4cd5972 --- /dev/null +++ b/RFXtoRP_HsrCarrierApt_AppointmentCustomFieldsUpdated.ftl @@ -0,0 +1,48 @@ +[ + <#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.metadata.creation_datetime,time_zone_rfx) /> + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if carrier_apt.appointment_reference?? && carrier_apt.appointment_reference!=""> + "RefID": "${carrier_apt.appointment_reference?json_string}", + <#else> + <#if carrier_apt.constant_appointment?? && carrier_apt.constant_appointment== "true"> + "RefID": "${carrier_apt.appointment_reference?json_string}${carrier_apt.physical_depot?json_string}${carrier_apt.year_number}${carrier_apt.appointment_number}", + <#else> + "RefID": "${carrier_apt.physical_depot?json_string}${carrier_apt.year_number}${carrier_apt.appointment_number}", + + + "RefDate": { + "DateTime": "${ref_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + }, + "CustomFields": [ + { + "Key": "depot", + "Value": "${carrier_apt.physical_depot?json_string}" + }, + { + "Key": "year", + "Value": "${carrier_apt.year_number?json_string}" + }, + { + "Key": "number", + "Value": "${carrier_apt.appointment_number?json_string}" + }, + { + "Key": "reference", + "Value": "${carrier_apt.appointment_reference?json_string}" + }, + { + "Key": "carrier", + "Value": "${carrier_apt.planned_carrier?json_string}" + } + ] + }, + "Payload":{ + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}" + } + } +] \ No newline at end of file diff --git a/RFXtoRP_HsrCarrierApt_CarrierArrived.ftl b/RFXtoRP_HsrCarrierApt_CarrierArrived.ftl new file mode 100644 index 0000000..afdefe6 --- /dev/null +++ b/RFXtoRP_HsrCarrierApt_CarrierArrived.ftl @@ -0,0 +1,22 @@ +[ + <#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.metadata.last_update_datetime,time_zone_rfx) /> + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if carrier_apt.appointment_reference?? && carrier_apt.appointment_reference !=""> + "RefID": "${carrier_apt.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt.physical_depot?json_string}${carrier_apt.year_number?json_string}${carrier_apt.appointment_number?json_string}", + + "RefDate": { + "DateTime": "${ref_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + "Payload":{ + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}" + } + } +] \ No newline at end of file diff --git a/RFXtoRP_HsrCarrierApt_CarrierDeparted.ftl b/RFXtoRP_HsrCarrierApt_CarrierDeparted.ftl new file mode 100644 index 0000000..afdefe6 --- /dev/null +++ b/RFXtoRP_HsrCarrierApt_CarrierDeparted.ftl @@ -0,0 +1,22 @@ +[ + <#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.metadata.last_update_datetime,time_zone_rfx) /> + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if carrier_apt.appointment_reference?? && carrier_apt.appointment_reference !=""> + "RefID": "${carrier_apt.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt.physical_depot?json_string}${carrier_apt.year_number?json_string}${carrier_apt.appointment_number?json_string}", + + "RefDate": { + "DateTime": "${ref_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + "Payload":{ + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}" + } + } +] \ No newline at end of file diff --git a/RFXtoRP_HsrCarrierApt_CarrierInformation.ftl b/RFXtoRP_HsrCarrierApt_CarrierInformation.ftl new file mode 100644 index 0000000..df7f552 --- /dev/null +++ b/RFXtoRP_HsrCarrierApt_CarrierInformation.ftl @@ -0,0 +1,3 @@ +"CarrierInformation": [ + + ] \ No newline at end of file diff --git a/RFXtoRP_HsrCarrierApt_LoadingCompleted.ftl b/RFXtoRP_HsrCarrierApt_LoadingCompleted.ftl new file mode 100644 index 0000000..afdefe6 --- /dev/null +++ b/RFXtoRP_HsrCarrierApt_LoadingCompleted.ftl @@ -0,0 +1,22 @@ +[ + <#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.metadata.last_update_datetime,time_zone_rfx) /> + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if carrier_apt.appointment_reference?? && carrier_apt.appointment_reference !=""> + "RefID": "${carrier_apt.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt.physical_depot?json_string}${carrier_apt.year_number?json_string}${carrier_apt.appointment_number?json_string}", + + "RefDate": { + "DateTime": "${ref_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + "Payload":{ + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}" + } + } +] \ No newline at end of file diff --git a/RFXtoRP_HsrCarrierApt_LoadingStarted.ftl b/RFXtoRP_HsrCarrierApt_LoadingStarted.ftl new file mode 100644 index 0000000..afdefe6 --- /dev/null +++ b/RFXtoRP_HsrCarrierApt_LoadingStarted.ftl @@ -0,0 +1,22 @@ +[ + <#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.metadata.last_update_datetime,time_zone_rfx) /> + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if carrier_apt.appointment_reference?? && carrier_apt.appointment_reference !=""> + "RefID": "${carrier_apt.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt.physical_depot?json_string}${carrier_apt.year_number?json_string}${carrier_apt.appointment_number?json_string}", + + "RefDate": { + "DateTime": "${ref_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + "Payload":{ + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}" + } + } +] \ No newline at end of file diff --git a/RFXtoRP_HsrCarrierApt_MetadataAppointment.ftl b/RFXtoRP_HsrCarrierApt_MetadataAppointment.ftl new file mode 100644 index 0000000..cdc9ee0 --- /dev/null +++ b/RFXtoRP_HsrCarrierApt_MetadataAppointment.ftl @@ -0,0 +1,5 @@ + +"MetaData": [ +] + + diff --git a/RFXtoRP_HsrCarrierApt_Quantities.ftl b/RFXtoRP_HsrCarrierApt_Quantities.ftl new file mode 100644 index 0000000..22b0ec5 --- /dev/null +++ b/RFXtoRP_HsrCarrierApt_Quantities.ftl @@ -0,0 +1,5 @@ +"Quantities": [ + + ] + + diff --git a/RFXtoRP_HsrCarrierApt_SegmentationSelections.ftl b/RFXtoRP_HsrCarrierApt_SegmentationSelections.ftl new file mode 100644 index 0000000..79553d0 --- /dev/null +++ b/RFXtoRP_HsrCarrierApt_SegmentationSelections.ftl @@ -0,0 +1,6 @@ + + +"SegmentationSelections": [ + ] + + diff --git a/RFXtoRP_HsrCarrierApt_SiteCancelAppointment.ftl b/RFXtoRP_HsrCarrierApt_SiteCancelAppointment.ftl new file mode 100644 index 0000000..0d7a7e1 --- /dev/null +++ b/RFXtoRP_HsrCarrierApt_SiteCancelAppointment.ftl @@ -0,0 +1,18 @@ +<#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.metadata.last_update_datetime,time_zone_rfx) /> +[ + { + <#if carrier_apt.appointment_reference?? && carrier_apt.appointment_reference!=""> + "AppointmentID": "${carrier_apt.appointment_reference?json_string}", + <#else> + <#if carrier_apt.constant_appointment?? && carrier_apt.constant_appointment== "true"> + "AppointmentID": "${carrier_apt.appointment_reference?json_string}${carrier_apt.physical_depot?json_string}${carrier_apt.year_number}${carrier_apt.appointment_number}", + <#else> + "AppointmentID": "${carrier_apt.physical_depot?json_string}${carrier_apt.year_number}${carrier_apt.appointment_number}", + + + "Header": { + "ProjectID": "${projectRP}" + }, + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}" + } +] \ No newline at end of file diff --git a/RFXtoRP_HsrCarrierApt_SiteForceBookAppointment.ftl b/RFXtoRP_HsrCarrierApt_SiteForceBookAppointment.ftl new file mode 100644 index 0000000..34a0b14 --- /dev/null +++ b/RFXtoRP_HsrCarrierApt_SiteForceBookAppointment.ftl @@ -0,0 +1,124 @@ +[ + { + "Header":{ + "ProjectID": "${projectRP}" + }, + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}", + <#if carrier_apt.appointment_reference?? && carrier_apt.appointment_reference!=""> + "AppointmentID": "${carrier_apt.appointment_reference?json_string}", + <#else> + <#if carrier_apt.constant_appointment?? && carrier_apt.constant_appointment== "true"> + "AppointmentID": "${carrier_apt.appointment_reference?json_string}${carrier_apt.physical_depot?json_string}${carrier_apt.year_number}${carrier_apt.appointment_number}", + <#else> + "AppointmentID": "${carrier_apt.physical_depot?json_string}${carrier_apt.year_number}${carrier_apt.appointment_number}", + + + "TimeZone":"${time_zone_rfx}", + <#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "false"> + <#if 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-")> + <#stop "planned_unloading_start_datetime or planned_unloading_end_datetime field of appointmend is not initialized" > + + <#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_UNLOADING> + <#assign duration = DurationBetweenTwoDatetimeInSeconds(carrier_apt.planned_unloading_start_datetime?datetime.iso,carrier_apt.planned_unloading_end_datetime?datetime.iso) /> + <#if (duration <= 0)> + <#stop "planned_unloading_start_datetime or planned_unloading_end_datetime field of appointmend are not valid" > + + <#else> + <#if carrier_apt.unloading_appointment == "false" && carrier_apt.load_appointment == "true" > + <#if 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-")> + <#stop "planned_load_start_datetime or planned_load_end_datetime field of appointmend is not initialized" > + + <#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_LOADING> + <#assign duration = DurationBetweenTwoDatetimeInSeconds(carrier_apt.planned_load_start_datetime?datetime.iso,carrier_apt.planned_load_end_datetime?datetime.iso) /> + <#if (duration <= 0)> + <#stop "planned_unloading_start_datetime or planned_unloading_end_datetime field of appointmend are not valid" > + + <#else> + <#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "true"> + <#stop "Not managed"> + <#else> + <#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_UNKNOWN> + <#assign duration = 0 /> <#-- à confirmer --> + + + + "AppointmentType": "${appointmentType}", + "Emails": ["${carrier_apt.creation_user_email?json_string}"], + "CustomFields": [ + { + "Key": "depot", + "Value": "${carrier_apt.physical_depot?json_string}" + }, + { + "Key": "year", + "Value": "${carrier_apt.year_number?json_string}" + }, + { + "Key": "number", + "Value": "${carrier_apt.appointment_number?json_string}" + }, + { + "Key": "reference", + "Value": "${carrier_apt.appointment_reference?json_string}" + }, + { + "Key": "carrier", + "Value": "${carrier_apt.planned_carrier?json_string}" + } + ], + <#include "RFXtoRP_HsrCarrierApt_SegmentationSelections.ftl">, + <#include "RFXtoRP_HsrCarrierApt_CarrierInformation.ftl">, + <#include "RFXtoRP_HsrCarrierApt_MetadataAppointment.ftl">, + <#if carrier_apt.physical_receipt_list?? && (carrier_apt.physical_receipt_list?filter(l ->l??)?size != 0)> + "Commissions": [ + <#list carrier_apt.physical_receipt_list?filter(l ->l??) as physical_receipt> + { + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}", + <#if physical_receipt.physical_receipt_reference?? && physical_receipt.physical_receipt_reference!=""> + "OrderID": "${physical_receipt.physical_receipt_reference?json_string}", + "ExecutionflowID":"${physical_receipt.physical_receipt_reference?json_string}", + <#else> + "OrderID": "${carrier_apt.physical_depot?json_string}${physical_receipt.receipt_activity?json_string}${physical_receipt.originator_code?json_string}${physical_receipt.receipt_year}${physical_receipt.receipt_number}", + "ExecutionflowID": "${carrier_apt.physical_depot?json_string}${physical_receipt.receipt_activity?json_string}${physical_receipt.originator_code?json_string}${physical_receipt.receipt_year?json_string}${physical_receipt.receipt_number?json_string}", + + "ProjectID": "${projectRP}", + <#include "RFXtoRP_HsrCarrierApt_Quantities.ftl"> + }<#sep>, + + ], + <#else> + "Commissions": [ + { + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}", + "ProjectID": "${projectRP}", + <#include "RFXtoRP_HsrCarrierApt_Quantities.ftl"> + } + ], + <#if carrier_apt.appointment_designation?? && carrier_apt.appointment_designation!=""> + "Reason": "${carrier_apt.appointment_designation?json_string}", + <#else> + "Reason": "No commission", + + + "Slots": [{ + <#-- calcul de de la durée en fonction des start et end time--> + "DurationInSeconds": "${duration}", + <#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "false" > + <#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> + <#if carrier_apt.unloading_appointment == "false" && carrier_apt.load_appointment == "true"> + <#if carrier_apt.planned_load_start_datetime?starts_with("00") || carrier_apt.planned_load_start_datetime?contains("-00-")> + <#stop "planned_load_start_datetime field of appointmend is not initialized" > + + "StartDateTime": "${carrier_apt.planned_load_start_datetime}" + <#else> + <#stop "Not managed"> + + + }] + } +] \ No newline at end of file diff --git a/RFXtoRP_HsrCarrierApt_UnloadingCompleted.ftl b/RFXtoRP_HsrCarrierApt_UnloadingCompleted.ftl new file mode 100644 index 0000000..afdefe6 --- /dev/null +++ b/RFXtoRP_HsrCarrierApt_UnloadingCompleted.ftl @@ -0,0 +1,22 @@ +[ + <#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.metadata.last_update_datetime,time_zone_rfx) /> + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if carrier_apt.appointment_reference?? && carrier_apt.appointment_reference !=""> + "RefID": "${carrier_apt.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt.physical_depot?json_string}${carrier_apt.year_number?json_string}${carrier_apt.appointment_number?json_string}", + + "RefDate": { + "DateTime": "${ref_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + "Payload":{ + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}" + } + } +] \ No newline at end of file diff --git a/RFXtoRP_HsrCarrierApt_UnloadingStarted.ftl b/RFXtoRP_HsrCarrierApt_UnloadingStarted.ftl new file mode 100644 index 0000000..afdefe6 --- /dev/null +++ b/RFXtoRP_HsrCarrierApt_UnloadingStarted.ftl @@ -0,0 +1,22 @@ +[ + <#assign ref_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.metadata.last_update_datetime,time_zone_rfx) /> + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if carrier_apt.appointment_reference?? && carrier_apt.appointment_reference !=""> + "RefID": "${carrier_apt.appointment_reference?json_string}", + <#else> + "RefID": "${carrier_apt.physical_depot?json_string}${carrier_apt.year_number?json_string}${carrier_apt.appointment_number?json_string}", + + "RefDate": { + "DateTime": "${ref_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + "Payload":{ + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}" + } + } +] \ No newline at end of file diff --git a/RFXtoRP_HsrCarrierApt_UpdateAppointment.ftl b/RFXtoRP_HsrCarrierApt_UpdateAppointment.ftl new file mode 100644 index 0000000..0517881 --- /dev/null +++ b/RFXtoRP_HsrCarrierApt_UpdateAppointment.ftl @@ -0,0 +1,111 @@ +[ + { + <#assign creation_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.metadata.creation_datetime,time_zone_rfx) /> + + "Header":{ + "ProjectID": "${projectRP}" + }, + <#if carrier_apt.appointment_reference?? && carrier_apt.appointment_reference!=""> + "AppointmentID": "${carrier_apt.appointment_reference?json_string}", + <#else> + <#if carrier_apt.constant_appointment?? && carrier_apt.constant_appointment== "true"> + "AppointmentID": "${carrier_apt.appointment_reference?json_string}${carrier_apt.physical_depot?json_string}${carrier_apt.year_number}${carrier_apt.appointment_number}", + <#else> + "AppointmentID": "${carrier_apt.physical_depot?json_string}${carrier_apt.year_number}${carrier_apt.appointment_number}", + + + <#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "false"> + <#if 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-")> + <#stop "planned_unloading_start_datetime or planned_unloading_end_datetime field of appointmend is not initialized" > + + <#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_UNLOADING> + <#assign duration = DurationBetweenTwoDatetimeInSeconds(carrier_apt.planned_unloading_start_datetime?datetime.iso,carrier_apt.planned_unloading_end_datetime?datetime.iso) /> + <#if (duration <= 0)> + <#stop "planned_unloading_start_datetime or planned_unloading_end_datetime field of appointmend are not valid" > + + <#else> + <#if carrier_apt.unloading_appointment == "false" && carrier_apt.load_appointment == "true" > + <#if 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-")> + <#stop "planned_load_start_datetime or planned_load_end_datetime field of appointmend is not initialized" > + + <#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_LOADING> + <#assign duration = DurationBetweenTwoDatetimeInSeconds(carrier_apt.planned_load_start_datetime?datetime.iso,carrier_apt.planned_load_end_datetime?datetime.iso) /> + <#if (duration <= 0)> + <#stop "planned_unloading_start_datetime or planned_unloading_end_datetime field of appointmend are not valid" > + + <#else> + <#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "true"> + <#stop "Not managed"> + <#else> + <#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_UNKNOWN> + <#assign duration = 0 /> <#-- à confirmer --> + + + + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}", + "CustomFields": [ + { + "Key": "depot", + "Value": "${carrier_apt.physical_depot?json_string}" + }, + { + "Key": "year", + "Value": "${carrier_apt.year_number?json_string}" + }, + { + "Key": "number", + "Value": "${carrier_apt.appointment_number?json_string}" + }, + { + "Key": "reference", + "Value": "${carrier_apt.appointment_reference?json_string}" + }, + { + "Key": "carrier", + "Value": "${carrier_apt.planned_carrier?json_string}" + } + ], + <#if carrier_apt.physical_receipt_list?? && (carrier_apt.physical_receipt_list?filter(l ->l??)?size != 0)> + "Commissions": [ + <#list carrier_apt.physical_receipt_list?filter(l ->l??) as physical_receipt> + { + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}", + <#if physical_receipt.physical_receipt_reference?? && physical_receipt.physical_receipt_reference!=""> + "OrderID": "${physical_receipt.physical_receipt_reference?json_string}", + "ExecutionflowID":"${physical_receipt.physical_receipt_reference?json_string}", + <#else> + "OrderID": "${carrier_apt.physical_depot?json_string}${physical_receipt.receipt_activity?json_string}${physical_receipt.originator_code?json_string}${physical_receipt.receipt_year?json_string}${physical_receipt.receipt_number?json_string}", + "ExecutionflowID": "${carrier_apt.physical_depot?json_string}${physical_receipt.receipt_activity?json_string}${physical_receipt.originator_code?json_string}${physical_receipt.receipt_year?json_string}${physical_receipt.receipt_number?json_string}", + + "ProjectID": "${projectRP}" + }<#sep>, + + ], + <#else> + <#stop> + + "Slots": [{ + <#-- calcul de de la durée en fonction des start et end time--> + "DurationInSeconds": "${duration}", + <#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "false" > + <#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> + <#if carrier_apt.unloading_appointment == "false" && carrier_apt.load_appointment == "true"> + <#if carrier_apt.planned_load_start_datetime?starts_with("00") || carrier_apt.planned_load_start_datetime?contains("-00-")> + <#stop "planned_load_start_datetime field of appointmend is not initialized" > + + "StartDateTime": "${carrier_apt.planned_load_start_datetime}" + <#else> + <#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "true"> + <#stop "Not managed"> + + + + }] + + } +] \ No newline at end of file diff --git a/RFXtoRP_HsrCarrierApt_UpdateSlotAppointment.ftl b/RFXtoRP_HsrCarrierApt_UpdateSlotAppointment.ftl new file mode 100644 index 0000000..ba02b47 --- /dev/null +++ b/RFXtoRP_HsrCarrierApt_UpdateSlotAppointment.ftl @@ -0,0 +1,68 @@ +[ + { + <#assign creation_datetime = RfxDateTimetoUTCWithTimezone(carrier_apt.metadata.creation_datetime,time_zone_rfx) /> + "Header":{ + "ProjectID": "${projectRP}" + }, + <#if carrier_apt.appointment_reference?? && carrier_apt.appointment_reference!=""> + "AppointmentID": "${carrier_apt.appointment_reference?json_string}", + <#else> + <#if carrier_apt.constant_appointment?? && carrier_apt.constant_appointment== "true"> + "AppointmentID": "${carrier_apt.appointment_reference?json_string}${carrier_apt.physical_depot?json_string}${carrier_apt.year_number}${carrier_apt.appointment_number}", + <#else> + "AppointmentID": "${carrier_apt.physical_depot?json_string}${carrier_apt.year_number}${carrier_apt.appointment_number}", + + + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}", + <#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "false"> + <#if 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-")> + <#stop "planned_unloading_start_datetime or planned_unloading_end_datetime field of appointmend is not initialized" > + + <#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_UNLOADING> + <#assign duration = DurationBetweenTwoDatetimeInSeconds(carrier_apt.planned_unloading_start_datetime?datetime.iso,carrier_apt.planned_unloading_end_datetime?datetime.iso) /> + <#if (duration <= 0)> + <#stop "planned_unloading_start_datetime or planned_unloading_end_datetime field of appointmend are not valid" > + + <#else> + <#if carrier_apt.unloading_appointment == "false" && carrier_apt.load_appointment == "true" > + <#if 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-")> + <#stop "planned_load_start_datetime or planned_load_end_datetime field of appointmend is not initialized" > + + <#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_LOADING> + <#assign duration = DurationBetweenTwoDatetimeInSeconds(carrier_apt.planned_load_start_datetime?datetime.iso,carrier_apt.planned_load_end_datetime?datetime.iso) /> + <#if (duration <= 0)> + <#stop "planned_unloading_start_datetime or planned_unloading_end_datetime field of appointmend are not valid" > + + <#else> + <#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "true"> + <#stop "Not managed"> + <#else> + <#assign appointmentType = AppointmentType.APPOINTMENT_TYPE_UNKNOWN> + <#assign duration = 0 /> <#-- à confirmer --> + + + + "Slots": [{ + <#-- calcul de de la durée en fonction des start et end time--> + "DurationInSeconds": "${duration}", + <#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "false" > + <#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> + <#if carrier_apt.unloading_appointment == "false" && carrier_apt.load_appointment == "true"> + <#if carrier_apt.planned_load_start_datetime?starts_with("00") || carrier_apt.planned_load_start_datetime?contains("-00-")> + <#stop "planned_load_start_datetime field of appointmend is not initialized" > + + "StartDateTime": "${carrier_apt.planned_load_start_datetime}" + <#else> + <#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "true"> + <#stop "Not managed"> + + + + }] + + } +] \ No newline at end of file diff --git a/RFXtoRP_HsrDepot_ActorCreated_Metadata.ftl b/RFXtoRP_HsrDepot_ActorCreated_Metadata.ftl index dc02b6c..61ffd4c 100644 --- a/RFXtoRP_HsrDepot_ActorCreated_Metadata.ftl +++ b/RFXtoRP_HsrDepot_ActorCreated_Metadata.ftl @@ -1,4 +1,10 @@ <#-- use protobuf of class HsrDepot 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_HsrPrepa_GoodsPrepared_HandlingUnitMetadata.ftl b/RFXtoRP_HsrPrepa_GoodsPrepared_HandlingUnitMetadata.ftl index dde74cb..220b470 100644 --- a/RFXtoRP_HsrPrepa_GoodsPrepared_HandlingUnitMetadata.ftl +++ b/RFXtoRP_HsrPrepa_GoodsPrepared_HandlingUnitMetadata.ftl @@ -1,7 +1,10 @@ <#-- use protobuf of class HsrPrepa to find HARDIS WMS fields names --> -<#-- -"MetaData" :[ -] ---> +<#-- 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_HsrPrepa_GoodsPrepared_SegmentationKeys.ftl b/RFXtoRP_HsrPrepa_GoodsPrepared_SegmentationKeys.ftl index 60d6334..0d23b62 100644 --- a/RFXtoRP_HsrPrepa_GoodsPrepared_SegmentationKeys.ftl +++ b/RFXtoRP_HsrPrepa_GoodsPrepared_SegmentationKeys.ftl @@ -1,5 +1,11 @@ <#-- use protobuf of class Hsrprepa 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", diff --git a/RFXtoRP_HsrPrepa_HUsAdded_Metadata.ftl b/RFXtoRP_HsrPrepa_HUsAdded_Metadata.ftl index e6d07b1..220b470 100644 --- a/RFXtoRP_HsrPrepa_HUsAdded_Metadata.ftl +++ b/RFXtoRP_HsrPrepa_HUsAdded_Metadata.ftl @@ -1,9 +1,10 @@ <#-- use protobuf of class HsrPrepa to find HARDIS WMS fields names --> -<#-- -"MetaData" :[ +<#-- 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_HsrPro.ftl b/RFXtoRP_HsrPro.ftl index bdc7f26..ab7b170 100644 --- a/RFXtoRP_HsrPro.ftl +++ b/RFXtoRP_HsrPro.ftl @@ -25,6 +25,12 @@ "apiReflexPlatformID" : "${apiReflexPlatformID}", "datas" : <#include "RFXtoRP_HsrPro_ExecutionflowDetected.ftl"> + }, + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowCustomFieldsUpdated> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrPro_ExecutionflowCustomFieldsUpdated.ftl"> } <#else> <#-- No line --> diff --git a/RFXtoRP_HsrPro_ExecutionflowCustomFieldsUpdated.ftl b/RFXtoRP_HsrPro_ExecutionflowCustomFieldsUpdated.ftl new file mode 100644 index 0000000..73a441b --- /dev/null +++ b/RFXtoRP_HsrPro_ExecutionflowCustomFieldsUpdated.ftl @@ -0,0 +1,40 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> +<#include "ActorPrefix.ftl"> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "Payload" :{}, + "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}" + } + ], + "RefID": "${preparation_order.originator_reference?trim?json_string}" + } + } +] \ No newline at end of file diff --git a/RFXtoRP_HsrPro_ExecutionflowDetected_HeaderMetadata.ftl b/RFXtoRP_HsrPro_ExecutionflowDetected_HeaderMetadata.ftl index 8506511..1c64c55 100644 --- a/RFXtoRP_HsrPro_ExecutionflowDetected_HeaderMetadata.ftl +++ b/RFXtoRP_HsrPro_ExecutionflowDetected_HeaderMetadata.ftl @@ -1,6 +1,12 @@ <#-- use protobuf of class HsrPro 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": [ { diff --git a/RFXtoRP_HsrPro_ExecutionflowDetected_LineMetadata.ftl b/RFXtoRP_HsrPro_ExecutionflowDetected_LineMetadata.ftl index f0de72a..dcc2bc7 100644 --- a/RFXtoRP_HsrPro_ExecutionflowDetected_LineMetadata.ftl +++ b/RFXtoRP_HsrPro_ExecutionflowDetected_LineMetadata.ftl @@ -1,4 +1,10 @@ <#-- use protobuf of class HsrPro 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_HsrPro_ExecutionflowDetected_SegmentationKeys.ftl b/RFXtoRP_HsrPro_ExecutionflowDetected_SegmentationKeys.ftl index 9cd8bc9..3518792 100644 --- a/RFXtoRP_HsrPro_ExecutionflowDetected_SegmentationKeys.ftl +++ b/RFXtoRP_HsrPro_ExecutionflowDetected_SegmentationKeys.ftl @@ -1,5 +1,11 @@ <#-- use protobuf of class HsrPro 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": [ { diff --git a/RFXtoRP_HsrReceiptList.ftl b/RFXtoRP_HsrReceiptList.ftl index 792be9a..7c96c29 100644 --- a/RFXtoRP_HsrReceiptList.ftl +++ b/RFXtoRP_HsrReceiptList.ftl @@ -32,7 +32,12 @@ "apiReflexPlatformID" : "${apiReflexPlatformID}", "datas" : <#include "RFXtoRP_HsrReceiptList_ReceiptExpected.ftl"> - + }, + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowCustomFieldsUpdated> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrReceiptList_CustomFieldsUpdated.ftl"> } ] <#else> diff --git a/RFXtoRP_HsrReceiptList_CustomFieldsUpdated.ftl b/RFXtoRP_HsrReceiptList_CustomFieldsUpdated.ftl new file mode 100644 index 0000000..141794d --- /dev/null +++ b/RFXtoRP_HsrReceiptList_CustomFieldsUpdated.ftl @@ -0,0 +1,44 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> +<#include "ActorPrefix.ftl"> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "Payload" :{}, + "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}" + } + ], + <#if receipt.receipt_reference?? && receipt.receipt_reference!=""> + "RefID": "${receipt.receipt_reference?trim?json_string}" + <#else> + "RefID": "${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}" + + } + } +] \ No newline at end of file diff --git a/RFXtoRP_HsrReceiptList_ExecutionflowDetected_HeaderMetadata.ftl b/RFXtoRP_HsrReceiptList_ExecutionflowDetected_HeaderMetadata.ftl index 079640d..be70907 100644 --- a/RFXtoRP_HsrReceiptList_ExecutionflowDetected_HeaderMetadata.ftl +++ b/RFXtoRP_HsrReceiptList_ExecutionflowDetected_HeaderMetadata.ftl @@ -1,6 +1,12 @@ <#-- 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": [ { diff --git a/RFXtoRP_HsrReceiptList_ExecutionflowDetected_LineMetadata.ftl b/RFXtoRP_HsrReceiptList_ExecutionflowDetected_LineMetadata.ftl index d77c54e..06f715b 100644 --- a/RFXtoRP_HsrReceiptList_ExecutionflowDetected_LineMetadata.ftl +++ b/RFXtoRP_HsrReceiptList_ExecutionflowDetected_LineMetadata.ftl @@ -1,4 +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_HsrReceiptList_ExecutionflowDetected_SegmentationKeys.ftl b/RFXtoRP_HsrReceiptList_ExecutionflowDetected_SegmentationKeys.ftl index d39b703..aa5d6c2 100644 --- a/RFXtoRP_HsrReceiptList_ExecutionflowDetected_SegmentationKeys.ftl +++ b/RFXtoRP_HsrReceiptList_ExecutionflowDetected_SegmentationKeys.ftl @@ -1,6 +1,13 @@ <#-- 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", diff --git a/RFXtoRP_RestResponse.ftl b/RFXtoRP_RestResponse.ftl index 8eba90d..e5c8aa1 100644 --- a/RFXtoRP_RestResponse.ftl +++ b/RFXtoRP_RestResponse.ftl @@ -10,197 +10,492 @@ <#assign aDateTime = .now> -<#assign no_apiRestReflexID = "no apiRestReflexID"> -<#assign no_status = -99999> +<#assign no_apiRestReflexID = "no apiRestReflexID"> +<#assign no_status = -99999> <#switch id.apiRestReflexID!no_apiRestReflexID> - <#case no_apiRestReflexID> - [ - { - <#if restResponsetMsg.body?? > - <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> - <#else> - <#assign restResponseBody = "${restResponsetMsg?trim?json_string}" /> - - <#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_PlatformLogCreate.ftl"> - } - ] - <#break> - - <#case "preparation_orders_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}" /> - - <#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 = preparation_orders_post ******************** --> - <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> - <#assign preparationOrderPostResponse = JsonUtil.jsonToMap(restResponseBody)> - <#if preparationOrderPostResponse.status?? && preparationOrderPostResponse.status == "SUCCESS" > - [ - { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowShipFromAcked> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_PrepOrder_ShipFromAcked.ftl"> - } - ] + <#case no_apiRestReflexID> + [ + { + <#if restResponsetMsg.body?? > + <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> + <#else> + <#assign restResponseBody = "${restResponsetMsg?trim?json_string}" /> + + <#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_PlatformLogCreate.ftl"> + } + ] + <#break> +<#-- *********************************************** ApiRestID = preparation_orders_post ******************** --> + <#case "preparation_orders_post"> + <#switch restResponsetMsg.status!no_status> + <#case no_status> + [ + { + <#if restResponsetMsg.body?? > + <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> <#else> - <#if preparationOrderPostResponse.status?? && preparationOrderPostResponse.status == "WARN"> - [ - { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowShipFromAcked> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_PrepOrder_ShipFromAcked.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"> - } - ] - - - <#break> - <#default> - [ - { - <#if restResponsetMsg.body?? > - <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> - <#else> - <#assign restResponseBody = "${restResponsetMsg?trim?json_string}}" /> - - <#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_PlatformLogCreate.ftl"> - }, - { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowAllocationError> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_RestResponseAllocationError.ftl"> - } - ] - - <#break> - - <#case "receipts_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}" /> - - <#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" > - [ - { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowShipToAcked> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_Receipt_ShipToAcked.ftl"> - } - ] + <#assign restResponseBody = "${restResponsetMsg?trim?json_string}" /> + + <#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> + <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> + <#assign preparationOrderPostResponse = JsonUtil.jsonToMap(restResponseBody)> + <#if preparationOrderPostResponse.status?? && preparationOrderPostResponse.status == "SUCCESS" > + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowShipFromAcked> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_PrepOrder_ShipFromAcked.ftl"> + } + ] + <#else> + <#if preparationOrderPostResponse.status?? && preparationOrderPostResponse.status == "WARN"> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowShipFromAcked> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_PrepOrder_ShipFromAcked.ftl"> + } + ] <#else> - [ - { - <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> - <#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : + [ + { + <#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"> - } - ] - - - <#break> + <#include "RFXtoRP_RestResponseAllocationError.ftl"> + } + ] + + + <#break> + <#default> + [ + { + <#if restResponsetMsg.body?? > + <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> + <#else> + <#assign restResponseBody = "${restResponsetMsg?trim?json_string}" /> + + <#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_PlatformLogCreate.ftl"> + }, + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowAllocationError> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_RestResponseAllocationError.ftl"> + } + ] + + <#break> +<#-- *********************************************** ApiRestID = receipts_post ******************** --> + <#case "receipts_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}" /> + + <#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> + <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> + <#assign preparationOrderPostResponse = JsonUtil.jsonToMap(restResponseBody)> + <#if preparationOrderPostResponse.status?? && (preparationOrderPostResponse.status == "SUCCESS" || preparationOrderPostResponse.status == "WARN") > + [ + { + <#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"> + } + ] + + <#break> <#default> - [ - { + [ + { <#if restResponsetMsg.body?? > - <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> - <#else> - <#assign restResponseBody = "${restResponsetMsg?trim?json_string}" /> - - <#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_PlatformLogCreate.ftl"> - }, - { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowAllocationError> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_RestResponseAllocationError.ftl"> - } - ] + <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> + <#else> + <#assign restResponseBody = "${restResponsetMsg?trim?json_string}" /> + + <#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_PlatformLogCreate.ftl"> + }, + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowAllocationError> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_RestResponseAllocationError.ftl"> + } + ] <#break> - <#default> - <#stop> + <#-- *********************************************** Appointment_post_create ******************** --> + <#case "appointment_post_create"> + <#switch restResponsetMsg.status!no_status> + <#case no_status> + [ + { + <#if restResponsetMsg.body?? > + <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> + <#else> + <#assign restResponseBody = "${restResponsetMsg?trim?json_string}" /> + + <#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> + <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> + <#assign preparationOrderPostResponse = JsonUtil.jsonToMap(restResponseBody)> + <#if preparationOrderPostResponse.status?? && (preparationOrderPostResponse.status == "SUCCESS" || preparationOrderPostResponse.status == "WARN") > + [ + { + <#stop > + } + ] + <#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"> + } + ] + + <#break> + <#default> + [ + { + <#if restResponsetMsg.body?? > + <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> + <#else> + <#assign restResponseBody = "${restResponsetMsg?trim?json_string}" /> + + <#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_PlatformLogCreate.ftl"> + }, + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowAllocationError> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_RestResponseAllocationError.ftl"> + } + ] + + <#break> + <#-- *********************************************** ApiRestID = appointment_put_update_ref ******************** --> + <#case "appointment_put_update_by_ref"> + <#case "appointment_put_update_by_number"> + <#switch restResponsetMsg.status!no_status> + <#case no_status> + [ + { + <#if restResponsetMsg.body?? > + <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> + <#else> + <#assign restResponseBody = "${restResponsetMsg?trim?json_string}" /> + + <#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> + <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> + <#assign preparationOrderPostResponse = JsonUtil.jsonToMap(restResponseBody)> + <#if preparationOrderPostResponse.status?? && (preparationOrderPostResponse.status == "SUCCESS" || preparationOrderPostResponse.status == "WARN") > + [ + { + <#stop > + } + ] + <#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"> + } + ] + + <#break> + <#default> + [ + { + <#if restResponsetMsg.body?? > + <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> + <#else> + <#assign restResponseBody = "${restResponsetMsg?trim?json_string}" /> + + <#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_PlatformLogCreate.ftl"> + }, + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowAllocationError> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_RestResponseAllocationError.ftl"> + } + ] + + <#break> + <#-- *********************************************** ApiRestID = canceled ******************** --> + <#case "status_appointment_put_update_by_ref"> + <#case "status_appointment_put_update_by_number"> + <#switch restResponsetMsg.status!no_status> + <#case no_status> + [ + { + <#if restResponsetMsg.body?? > + <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> + <#else> + <#assign restResponseBody = "${restResponsetMsg?trim?json_string}" /> + + <#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> + <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> + <#assign preparationOrderPostResponse = JsonUtil.jsonToMap(restResponseBody)> + <#if preparationOrderPostResponse.status?? && (preparationOrderPostResponse.status == "SUCCESS" || preparationOrderPostResponse.status == "WARN") > + [ + { + <#stop > + } + ] + <#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"> + } + ] + + <#break> + <#default> + [ + { + <#if restResponsetMsg.body?? > + <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> + <#else> + <#assign restResponseBody = "${restResponsetMsg?trim?json_string}" /> + + <#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_PlatformLogCreate.ftl"> + }, + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowAllocationError> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_RestResponseAllocationError.ftl"> + } + ] + + <#break> + <#-- *********************************************** ApiRestID = appointment_post_physical_receipt_associations ******************** --> + <#case "appointment_post_physical_receipt_associations_by_ref"> + <#case "appointment_post_physical_receipt_associations_by_number"> + <#switch restResponsetMsg.status!no_status> + <#case no_status> + [ + { + <#if restResponsetMsg.body?? > + <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> + <#else> + <#assign restResponseBody = "${restResponsetMsg?trim?json_string}" /> + + <#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> + <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> + <#assign preparationOrderPostResponse = JsonUtil.jsonToMap(restResponseBody)> + <#if preparationOrderPostResponse.status?? && (preparationOrderPostResponse.status == "SUCCESS" || preparationOrderPostResponse.status == "WARN") > + [ + { + <#stop > + } + ] + <#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"> + } + ] + + <#break> + <#default> + [ + { + <#if restResponsetMsg.body?? > + <#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) /> + <#else> + <#assign restResponseBody = "${restResponsetMsg?trim?json_string}" /> + + <#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_PlatformLogCreate.ftl"> + }, + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowAllocationError> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_RestResponseAllocationError.ftl"> + } + ] + + <#break> +<#-- *********************************************** default ******************** --> + <#default> + <#stop> diff --git a/RPtoRFX_AppointmentEvent.ftl b/RPtoRFX_AppointmentEvent.ftl new file mode 100644 index 0000000..21be0c7 --- /dev/null +++ b/RPtoRFX_AppointmentEvent.ftl @@ -0,0 +1,93 @@ +<#-- **** input parameters ***** --> +<#-- input : message HARDIS WMS --> +<#-- project : projectId in HARDIS SC NETWORK --> +<#-- organisation : organisationtId in HARDIS SC NETWORK --> +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> +<#include "ActorPrefix.ftl"> + +<#assign eventRP = JsonUtil.jsonToMap(input)> +<#assign projectRP = project> +<#assign organisationRP = organisation> + +<#switch eventRP.event> +<#-- *********************************************** Action = CREATE or UPDATE ******************** --> + <#case "Created"> + <#assign appointment = eventRP.data /> + [ + { + <#assign apiRestReflexID = ApiRestReflexID.appointment_post_create> + "apiRestReflexID" : "${apiRestReflexID}", + "datas" : + <#include "RPtoRFX_CarrierAppointmentCreated.ftl"> + } + ] + <#break> +<#-- *********************************************** Action = CommissionsUpdated ******************** --> + <#case "CommissionsUpdated"> + <#assign appointment = eventRP.data /> + [ + <#if eventRP.appointmentCustomFields?has_content> + { + <#assign apiRestReflexID = ApiRestReflexID.appointment_post_physical_receipt_associations_by_number> + "apiRestReflexID" : "${apiRestReflexID}", + "datas" : + <#include "RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByNumber.ftl"> + } + <#else> + { + <#assign apiRestReflexID = ApiRestReflexID.appointment_post_physical_receipt_associations_by_ref> + "apiRestReflexID" : "${apiRestReflexID}", + "datas" : + <#include "RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByRef.ftl"> + } + + ] + <#break> +<#-- *********************************************** Action = SlotUpdated ******************** --> + <#case "SlotUpdated"> + <#assign appointment = eventRP.data /> + [ + <#if eventRP.appointmentCustomFields?has_content> + { + <#assign apiRestReflexID = ApiRestReflexID.appointment_put_update_by_number> + "apiRestReflexID" : "${apiRestReflexID}", + "datas" : + <#include "RPtoRFX_CarrierAppointmentSlotUpdatedByNumber.ftl"> + } + <#else> + { + <#assign apiRestReflexID = ApiRestReflexID.appointment_put_update_by_ref> + "apiRestReflexID" : "${apiRestReflexID}", + "datas" : + <#include "RPtoRFX_CarrierAppointmentSlotUpdatedByRef.ftl"> + } + + ] + <#break> +<#-- *********************************************** Action = SlotUpdated ******************** --> + <#case "Canceled"> + <#assign appointment = eventRP.data /> + [ + <#if eventRP.appointmentCustomFields?has_content> + { + <#assign apiRestReflexID = ApiRestReflexID.status_appointment_put_update_by_number> + "apiRestReflexID" : "${apiRestReflexID}", + "datas" : + <#include "RPtoRFX_CarrierAppointmentCanceledByNumber.ftl"> + } + <#else> + { + <#assign apiRestReflexID = ApiRestReflexID.status_appointment_put_update_by_ref> + "apiRestReflexID" : "${apiRestReflexID}", + "datas" : + <#include "RPtoRFX_CarrierAppointmentCanceledByRef.ftl"> + } + + ] + <#break> +<#default> + <#stop > + + + diff --git a/RPtoRFX_CarrierAppointmentCanceledByNumber.ftl b/RPtoRFX_CarrierAppointmentCanceledByNumber.ftl new file mode 100644 index 0000000..4431a3b --- /dev/null +++ b/RPtoRFX_CarrierAppointmentCanceledByNumber.ftl @@ -0,0 +1,15 @@ +{ + "id" : {"refid" : "${eventRP.refid?json_string}"}, + "route" : "rest/public/v1/physical_depots/{physical_depot_code}/appointment_years/{appointment_year}/appointment_numbers/{appointment_number}/status", + "method" : "PUT", + "uri_substitutions": { + "physical_depot_code": "${RPtoRFXprefixDepot(eventRP.actor)}", + "appointment_year":"${eventRP.appointmentCustomFields.year?json_string}", + "appointment_number":"${eventRP.appointmentCustomFields.number?json_string}" + }, + "payload" : + { + "status_code": "999", + <#include "RPtoRFX_CarrierAppointmentCancellationCode.ftl"> + } + } \ No newline at end of file diff --git a/RPtoRFX_CarrierAppointmentCanceledByRef.ftl b/RPtoRFX_CarrierAppointmentCanceledByRef.ftl new file mode 100644 index 0000000..74d5a4e --- /dev/null +++ b/RPtoRFX_CarrierAppointmentCanceledByRef.ftl @@ -0,0 +1,14 @@ +{ + "id" : {"refid" : "${eventRP.refid?json_string}"}, + "route" : "rest/public/v1/physical_depots/{physical_depot_code}/carrier_appointments/{appointment_reference}/status", + "method" : "PUT", + "uri_substitutions": { + "physical_depot_code": "${RPtoRFXprefixDepot(eventRP.actor)}", + "appointment_reference":"${eventRP.refid?json_string}" + }, + "payload" : + { + "status_code": "999", + <#include "RPtoRFX_CarrierAppointmentCancellationCode.ftl"> + } + } \ No newline at end of file diff --git a/RPtoRFX_CarrierAppointmentCancellationCode.ftl b/RPtoRFX_CarrierAppointmentCancellationCode.ftl new file mode 100644 index 0000000..79d6747 --- /dev/null +++ b/RPtoRFX_CarrierAppointmentCancellationCode.ftl @@ -0,0 +1,2 @@ +<#-- To custom with cancellation reason code--> +"cancellation_reason_code": "" \ No newline at end of file diff --git a/RPtoRFX_CarrierAppointmentCreated.ftl b/RPtoRFX_CarrierAppointmentCreated.ftl new file mode 100644 index 0000000..017cee7 --- /dev/null +++ b/RPtoRFX_CarrierAppointmentCreated.ftl @@ -0,0 +1,59 @@ +{ + "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(eventRP.actor)}" + }, + "payload" : + { + "appointment_reference": "${eventRP.refid?json_string}", + <#switch appointment.AppointmentType> + <#case "APPOINTMENT_TYPE_LOADING"> + "unloading_appointment" : "false", + "load_appointment" : "true", + "planned_load_start_datetime" : "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.StartDateTime,appointment.TimeZone),time_zone_rfx)}", + "planned_load_end_datetime": "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.EndDateTime,appointment.TimeZone),time_zone_rfx)}", + <#break> + <#case "APPOINTMENT_TYPE_UNLOADING"> + "unloading_appointment" : "true", + "load_appointment" : "false", + "planned_unloading_start_datetime" : "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.StartDateTime,time_zone_rfx),time_zone_rfx)}", + "planned_unloading_end_datetime" : "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.EndDateTime,appointment.TimeZone),time_zone_rfx)}", + <#break> + <#default> + <#stop "appointment.AppointmentType not implemented" > + + <#include "RPtoRFX_CarrierAppointmentDefaultData.ftl"> + <#if appointment.Commissions??> + <#if appointment.AppointmentType == "APPOINTMENT_TYPE_UNLOADING"> + <#if appointment.Commissions[0].OrderID?? && appointment.Commissions[0].OrderID!=""> + "physical_receipt_list": [ + <#list eventRP.executionflowCustomFields.entrySet()?filter(l ->l.value?? && l.value?has_content) as custom> + { + "receipt_activity": "${custom.value.activity_code?json_string}", + "originator_code": "${custom.value.originator_code?json_string}", + "physical_receipt_reference": "${custom.value.reference?json_string}", + "receipt_year": "${custom.value.order_year?json_string}", + "receipt_number": "${custom.value.order_number?json_string}" + + } + <#sep>, + + ], + <#else> + "appointment_designation":"${(appointment.Reason!"")!?json_string}", + + <#else> + <#if appointment.AppointmentType == "APPOINTMENT_TYPE_LOADING"> + <#if appointment.Commissions[0].OrderID ?? && appointment.Commissions[0].OrderID!=""> + "appointment_designation":"LOADING", + <#else> + "appointment_designation":"${(appointment.Reason!"")?json_string}", + + + + + "constant_appointment": "false" + } + } diff --git a/RPtoRFX_CarrierAppointmentDefaultData.ftl b/RPtoRFX_CarrierAppointmentDefaultData.ftl new file mode 100644 index 0000000..b773333 --- /dev/null +++ b/RPtoRFX_CarrierAppointmentDefaultData.ftl @@ -0,0 +1,14 @@ +<#-- Note : you can use Order Line Metadata, using the define map : Line_MetaData_Map --> +<#-- Note : you can use Order Line Segmentation keys, using the define map : SegmentationKeys_Map --> + +<#-- How to use MD or SK map + Example : + <#assign owner_code = SegmentationKeys_Map["Owner"].String!""/> + + If your SK is : + Boolean : .Bool + Float : .Float + Timestamp : .Timestamp.DateTime or .Timestamp.AuthorTimeZone + Int : .Int + String : .String +--> \ No newline at end of file diff --git a/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByNumber.ftl b/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByNumber.ftl new file mode 100644 index 0000000..3a6ba80 --- /dev/null +++ b/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByNumber.ftl @@ -0,0 +1,33 @@ +{ + "id" : {"refid" : "${eventRP.refid?json_string}"}, + "route" : "rest/public/v1/physical_depots/{physical_depot_code}/appointment_years/{appointment_year}/appointment_numbers/{appointment_number}/physical_receipt_associations", + "method" : "POST", + "uri_substitutions": { + "physical_depot_code": "${RPtoRFXprefixDepot(eventRP.actor)}", + "appointment_year":"${eventRP.appointmentCustomFields.year?json_string}", + "appointment_number":"${eventRP.appointmentCustomFields.number?json_string}" + }, + "payload" : + { + <#if appointment.Commissions??> + <#if appointment.AppointmentType == "APPOINTMENT_TYPE_UNLOADING"> + "physical_receipt_list": [ + <#list eventRP.executionflowCustomFields.entrySet()?filter(l ->l.value?? && l.value?has_content) as custom> + { + "receipt_activity": "${custom.value.activity_code?json_string}", + "originator_code": "${custom.value.originator_code?json_string}", + "physical_receipt_reference": "${custom.value.reference?json_string}", + "receipt_year": "${custom.value.order_year?json_string}", + "receipt_number": "${custom.value.order_number?json_string}" + } + <#sep>, + + ] + <#else> + <#if appointment.AppointmentType == "APPOINTMENT_TYPE_LOADING"> + "appointment_designation":"LOADING" + + + + } + } diff --git a/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByRef.ftl b/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByRef.ftl new file mode 100644 index 0000000..e5b91cf --- /dev/null +++ b/RPtoRFX_CarrierAppointmentPhysicalReceiptAssociationByRef.ftl @@ -0,0 +1,32 @@ +{ + "id" : {"refid" : "${eventRP.refid?json_string}"}, + "route" : "rest/public/v1/physical_depots/{physical_depot_code}/carrier_appointments/{appointment_reference}/physical_receipt_associations", + "method" : "POST", + "uri_substitutions": { + "physical_depot_code": "${RPtoRFXprefixDepot(eventRP.actor)}", + "appointment_reference":"${eventRP.refid?json_string}" + }, + "payload" : + { + <#if appointment.Commissions??> + <#if appointment.AppointmentType == "APPOINTMENT_TYPE_UNLOADING"> + "physical_receipt_list": [ + <#list eventRP.executionflowCustomFields.entrySet()?filter(l ->l.value?? && l.value?has_content) as custom> + { + "receipt_activity": "${custom.value.activity_code?json_string}", + "originator_code": "${custom.value.originator_code?json_string}", + "physical_receipt_reference": "${custom.value.reference?json_string}", + "receipt_year": "${custom.value.order_year?json_string}", + "receipt_number": "${custom.value.order_number?json_string}" + } + <#sep>, + + ] + <#else> + <#if appointment.AppointmentType == "APPOINTMENT_TYPE_LOADING"> + "appointment_designation":"LOADING" + + + + } + } diff --git a/RPtoRFX_CarrierAppointmentSlotUpdatedByNumber.ftl b/RPtoRFX_CarrierAppointmentSlotUpdatedByNumber.ftl new file mode 100644 index 0000000..efd5dfc --- /dev/null +++ b/RPtoRFX_CarrierAppointmentSlotUpdatedByNumber.ftl @@ -0,0 +1,30 @@ +{ + "id" : {"refid" : "${eventRP.refid?json_string}"}, + "route" : "rest/public/v1/physical_depots/{physical_depot_code}/appointment_years/{appointment_year}/appointment_numbers/{appointment_number}", + "method" : "PUT", + "uri_substitutions": { + "physical_depot_code": "${RPtoRFXprefixDepot(eventRP.actor)}", + "appointment_year":"${eventRP.appointmentCustomFields.year?json_string}", + "appointment_number":"${eventRP.appointmentCustomFields.number?json_string}" + }, + "payload" : + { + <#switch appointment.AppointmentType> + <#case "APPOINTMENT_TYPE_LOADING"> + "unloading_appointment" : "false", + "load_appointment" : "true", + "planned_load_start_datetime" : "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.StartDateTime,appointment.TimeZone),time_zone_rfx)}", + "planned_load_end_datetime": "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.EndDateTime,appointment.TimeZone),time_zone_rfx)}", + <#break> + <#case "APPOINTMENT_TYPE_UNLOADING"> + "unloading_appointment" : "true", + "load_appointment" : "false", + "planned_unloading_start_datetime":"${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.StartDateTime,appointment.TimeZone),time_zone_rfx)}", + "planned_unloading_end_datetime" : "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.EndDateTime,appointment.TimeZone),time_zone_rfx)}", + <#break> + <#default> + <#stop "appointment.AppointmentType not implemented" > + + "appointment_designation":"${(appointment.Reason!"")!?json_string}" + } + } diff --git a/RPtoRFX_CarrierAppointmentSlotUpdatedByRef.ftl b/RPtoRFX_CarrierAppointmentSlotUpdatedByRef.ftl new file mode 100644 index 0000000..b7f102d --- /dev/null +++ b/RPtoRFX_CarrierAppointmentSlotUpdatedByRef.ftl @@ -0,0 +1,29 @@ +{ + "id" : {"refid" : "${eventRP.refid?json_string}"}, + "route" : "rest/public/v1/physical_depots/{physical_depot_code}/carrier_appointments/{appointment_reference}", + "method" : "PUT", + "uri_substitutions": { + "physical_depot_code": "${RPtoRFXprefixDepot(eventRP.actor)}", + "appointment_reference":"${eventRP.refid?json_string}" + }, + "payload" : + { + <#switch appointment.AppointmentType> + <#case "APPOINTMENT_TYPE_LOADING"> + "unloading_appointment" : "false", + "load_appointment" : "true", + "planned_load_start_datetime" : "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.StartDateTime,appointment.TimeZone),time_zone_rfx)}", + "planned_load_end_datetime": "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.EndDateTime,appointment.TimeZone),time_zone_rfx)}", + <#break> + <#case "APPOINTMENT_TYPE_UNLOADING"> + "unloading_appointment" : "true", + "load_appointment" : "false", + "planned_unloading_start_datetime":"${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.StartDateTime,appointment.TimeZone),time_zone_rfx)}", + "planned_unloading_end_datetime": "${DateTimeUTCtoRfxLocale(RfxDateTimetoUTCWithTimezone(appointment.Slot.EndDateTime,appointment.TimeZone),time_zone_rfx)}", + <#break> + <#default> + <#stop "appointment.AppointmentType not implemented" > + + "appointment_designation":"${(appointment.Reason!"")!?json_string}" + } + } diff --git a/VERSION b/VERSION index afcbd5b..d22fa2b 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.2.50+1 +1.2.51+1