diff --git a/HfRpConfig.ftl b/HfRpConfig.ftl new file mode 100644 index 0000000..f68da52 --- /dev/null +++ b/HfRpConfig.ftl @@ -0,0 +1,35 @@ + + + +<#-- Warning the file is generated, if you modify it manually, do not enable automatic update via the pipeline --> +<#-- Date of last generation : Jul 10, 2023 2:39:59 PM --> + +<#-- if LVID is egal to **quantity_in_base_lv** keyword then LVID is egal to base VL of the item --> + <#assign quantity_in_base_lv_RP_Cst = "**quantity_in_base_lv**" > + <#assign rfx_date_format_default = "yyyy-MM-dd" > + + + <#assign length_unit_KV_rfx = {"MET":"MILLIMETER","CM":"CENTIMETER","MM":"METER","DM":"DECIMETER","KM":"KILOMETER","MIL":"MILE","YAR":"YARD","INC":"INCH","FT":"FOOT"}> + <#assign weight_unit_KV_rfx = {"GR":"GRAMME","DG":"DECIGRAM","KG":"KILOGRAM","TON":"TONNE","OCE":"ONCE","LTO":"LONG_TON","STO":"SHORT_TON","PND":"POUND"}> + <#assign area_unit_KV_rfx = {"MM²":"SQUARE_MILLIMETER","CM²":"SQUARE_CENTIMETER","DM²":"SQUARE_DECIMETER","M²":"SQUARE_METER","SQI":"SQUARE_INCH","SQF":"SQUARE_FOOT","SQY":"SQUARE_YARD"}> + <#assign volume_unit_KV_rfx = {"MM³":"CUBIC_MILLIMETER","CM³":"CUBIC_CENTIMETER","DM³":"CUBIC_DECIMETER","M³":"CUBIC_METER","CI":"CUBIC_INCH","CF":"CUBIC_FOOT","CY":"CUBIC_YARD","ML":"MILLI_LITER","CL":"CENTI_LITER","DL":"DECI_LITER","LIT":"LITER","HL":"HECTO_LITER","FT":"US_FLUID_OUNCE","USG":"US_GAL","PI":"IMPERIAL_PINT","GL":"IMPERIAL_GAL"}> + <#assign temperature_unit_KV_rfx = {"° C":"CELSIUS","° F":"FAHRENHEIT"}> + + + <#assign length_unit_rfx = length_unit_KV_rfx["CM"]!"CENTIMETER"> + <#assign distance_unit_rfx = length_unit_KV_rfx["MET"]!"CENTIMETER"> + <#assign transport_distance_unit_rfx = length_unit_KV_rfx["KM"]!"CENTIMETER"> + <#assign weight_unit_rfx = weight_unit_KV_rfx["KG"]!"KILOGRAM"> + <#assign area_unit_rfx = area_unit_KV_rfx["M²"]!"SQUARE_METER"> + <#assign volume_unit_rfx = volume_unit_KV_rfx["DM³"]!"CUBIC_DECIMETER"> + <#assign number_of_litres_unit_rfx = volume_unit_KV_rfx["LIT"]!"CUBIC_DECIMETER"> + + + + <#assign time_zone_rfx = "Europe/Paris"!"UTC"> + <#assign time_zone_offset_rfx = "+02:00"!"+00:00"> + + <#assign text_language_rfx = "fr"!"en"> + + + diff --git a/RFXtoRP_HfDtlStockLs.ftl b/RFXtoRP_HfDtlStockLs.ftl new file mode 100644 index 0000000..cbb8250 --- /dev/null +++ b/RFXtoRP_HfDtlStockLs.ftl @@ -0,0 +1,60 @@ +<#-- **** input parameters ***** --> +<#-- input : message RFX --> +<#-- project : projectId in ReflexPlatform --> +<#-- organisation : organisationtId in ReflexPlatform --> +<#-- sum_elt : nb element in snapshot (optional parameter) --> + +<#include "HfRpConfig.ftl"> + +<#assign cloudEventMsg = JsonUtil.jsonToMap(input)> +<#assign projectRP = project> +<#assign organisationRP = organisation> + +<#switch cloudEventMsg.action> + <#case "C"> + <#case "U"> + <#-- *********************************************** Action = CREATE or UPDATE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign reflexStockPicturesInterface = JsonUtil.jsonToMap(dataRfx)> + + <#-- idSnapshot MUST BE UNIQUE regardless of the number of messages in the stock image --> + <#if cloudEventMsg.messageSet??> + <#assign idSnapshot = cloudEventMsg.messageSet /> + <#else> + <#assign idSnapshot = cloudEventMsg.id /> + + + <#list reflexStockPicturesInterface.detailled_stock_list as stock> + <#if stock.stock_type_code != "200"> + <#stop "stock type different from 200"> + <#break> + + + [ + { + <#if sum_elt??> + <#assign apiReflexPlatformID = ApiReflexPlatformID.ActorSnapshotCompleted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HfDtlStockLs_ActorSnapshotCompleted.ftl"> + <#else> + <#assign apiReflexPlatformID = ApiReflexPlatformID.StockSnapshotted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HfDtlStockLs_StockSnapshotted.ftl"> + + } + ] + + <#break> + + <#case "D"> + <#-- *********************************************** Action = DELETE ******************** --> + <#stop "event not supported"> + <#break> + + + <#default> + <#stop "event not supported"> + + diff --git a/RFXtoRP_HfDtlStockLs_ActorSnapshotCompleted.ftl b/RFXtoRP_HfDtlStockLs_ActorSnapshotCompleted.ftl new file mode 100644 index 0000000..fd4107b --- /dev/null +++ b/RFXtoRP_HfDtlStockLs_ActorSnapshotCompleted.ftl @@ -0,0 +1,27 @@ +<#include "ReflexUtils.ftl"> +[ + <#list reflexStockPicturesInterface.detailled_stock_list as stock> + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${stock.physical_depot_code}" + }, + "Payload": { + <#assign generation_date = RfxDateTimetoUTC(stock.generation_date,time_zone_offset_rfx) /> + "Snapshot": { + "EndDateTime": { + "DateTime": "${generation_date}", + "AuthorTimeZone": "${time_zone_rfx}" + }, + "ID": "${stock.physical_depot_code}-${idSnapshot}", + "MessageNb": ${sum_elt} + } + + } + } + <#break> + +] + diff --git a/RFXtoRP_HfDtlStockLs_StockSnapshotted.ftl b/RFXtoRP_HfDtlStockLs_StockSnapshotted.ftl new file mode 100644 index 0000000..612b48d --- /dev/null +++ b/RFXtoRP_HfDtlStockLs_StockSnapshotted.ftl @@ -0,0 +1,38 @@ +<#include "ReflexUtils.ftl"> +[ + <#list reflexStockPicturesInterface.detailled_stock_list as stock> + { + "Header": { + "ProjectID": "${projectRP}" + }, + "Payload": { + "ActorID": "${stock.physical_depot_code}", + <#assign generation_date = RfxDateTimetoUTC(stock.generation_date,time_zone_offset_rfx) /> + "Snapshot": { + "DateTime": { + "DateTime": "${generation_date}", + "AuthorTimeZone": "${time_zone_rfx}" + }, + "ID": "${stock.physical_depot_code}-${idSnapshot}", + "Quantity": + { + "Value" : "${stock.quantity_in_base_lvs!"0"}", + "LVID": "${quantity_in_base_lv_RP_Cst}" + } + }, + + "Goods": { + "ItemID": "${stock.item_code}", + "LVBranchID": "${stock.item_logistical_variant_code}", + <#assign priority_date = stock.priority_date?datetime(rfx_date_format_default)?iso_utc /> + "PriorityDate" : "${priority_date}", + + <#-- Segmentation keys inclusion --> + <#include "RFXtoRP_HfDtlStockLs_StockSnapshotted_SegmentationKeys.ftl"> + } + + } + }<#sep>, + +] + diff --git a/RFXtoRP_HfDtlStockLs_StockSnapshotted_SegmentationKeys.ftl b/RFXtoRP_HfDtlStockLs_StockSnapshotted_SegmentationKeys.ftl new file mode 100644 index 0000000..e7a7bf4 --- /dev/null +++ b/RFXtoRP_HfDtlStockLs_StockSnapshotted_SegmentationKeys.ftl @@ -0,0 +1,24 @@ +<#-- **** file included in RFXtoRP_HsaItm_ItemCreated.ftl ***** --> +<#-- use protobuf of class HfDtlStockLs to find Reflex WMS fields names --> + +<#--"SegmentationKeys": [ + { + "Key": "BatchNumber", + <#if stock.batch_1 == ""> + "Value": { "String" : "no batch"} + <#else> + "Value": { "String" : "${stock.batch_1}"} + + }, + { + "Key": "Grade", + "Value": { "String" : "${SegmentationKeys_KV[stock.grade_code]!Default_Value_Grade_SegmentationKey}"} + }, + { + "Key": "Owner", + "Value": { "String" : "${stock.owner_code}"} + } + ], + +--> +"SegmentationKeys": [ ] \ No newline at end of file diff --git a/RFXtoRP_HfRpConfig.ftl b/RFXtoRP_HfRpConfig.ftl new file mode 100644 index 0000000..ed3522a --- /dev/null +++ b/RFXtoRP_HfRpConfig.ftl @@ -0,0 +1,33 @@ +<#-- **** +Reflex WMS provides some of their environment parameters through the class HfRpConfig +those parameters are stored in FTL file HfRpConfig.ftl for later use in some of the data ftl files +*** --> + +<#-- *********************************************** Parameter global ******************** --> +<#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 file = JsonUtil.jsonToMap(dataRfx)> + + <#include "RFXtoRP_RfxConfigurationRp.ftl"> + + <#break> + + <#case "D"> + <#-- *********************************************** Action = DELETE ******************** --> + <#stop "deletion of config not supported"> + <#break> + + + <#default> + <#stop "event not supported"> + + diff --git a/RFXtoRP_HsaCarrier.ftl b/RFXtoRP_HsaCarrier.ftl new file mode 100644 index 0000000..de52386 --- /dev/null +++ b/RFXtoRP_HsaCarrier.ftl @@ -0,0 +1,46 @@ +<#-- **** 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 carrier = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ActorCreated> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaCarrier_ActorCreated.ftl"> + } + ] + <#break> + + <#case "D"> + <#-- *********************************************** Action = DELETE ******************************* --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign carrier = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ActorDeleted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaCarrier_ActorDeleted.ftl"> + } + ] + <#break> + + + <#default> + <#stop "event not supported"> + + diff --git a/RFXtoRP_HsaCarrier_ActorCreated.ftl b/RFXtoRP_HsaCarrier_ActorCreated.ftl new file mode 100644 index 0000000..b7c6648 --- /dev/null +++ b/RFXtoRP_HsaCarrier_ActorCreated.ftl @@ -0,0 +1,40 @@ +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${carrier.carrier_code}" + }, + + "Payload": { + "Name": "${carrier.carrier_designation}", + "ManagedStock": false, + "IsCarrier": true, + <#-- ***Partner ID could be added here *** --> + <#-- "PartnerID": "${}", --> + + <#-- + <#include "RFXtoRP_HsaCarrier_ActorCreated_Metadata.ftl">, + --> + + "Address": + { + "StreetAddressOne" : "${carrier.address.address_1}", + "StreetAddressTwo" : "${carrier.address.address_2}", + + <#if carrier.address.address_3?length < 10> + "PostalCode" : "${carrier.address.address_3?trim}", + <#else> + "PostalCode" : "${carrier.address.address_3?substring(0,9)?trim}", + + <#if carrier.address.address_4?length < 14> + "CountryCode" : "" + <#else> + "CountryCode" : "${carrier.address.address_4?substring(10,13)?trim}" + + }, + "Typology": "TYPOLOGY_CARRIER" + } + } +] diff --git a/RFXtoRP_HsaCarrier_ActorCreated_Metadata.ftl b/RFXtoRP_HsaCarrier_ActorCreated_Metadata.ftl new file mode 100644 index 0000000..e855cdb --- /dev/null +++ b/RFXtoRP_HsaCarrier_ActorCreated_Metadata.ftl @@ -0,0 +1,5 @@ +<#-- **** file included in RFXtoRP_HsaItm_ItemCreated.ftl ***** --> +<#-- use protobuf of class HsaCarrier to find Reflex WMS fields names --> + + +"MetaData": [ ] \ No newline at end of file diff --git a/RFXtoRP_HsaCarrier_ActorDeleted.ftl b/RFXtoRP_HsaCarrier_ActorDeleted.ftl new file mode 100644 index 0000000..9e56348 --- /dev/null +++ b/RFXtoRP_HsaCarrier_ActorDeleted.ftl @@ -0,0 +1,12 @@ +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${carrier.carrier_code}" + }, + + "Payload": {} + } +] diff --git a/RFXtoRP_HsaCons.ftl b/RFXtoRP_HsaCons.ftl new file mode 100644 index 0000000..ec6677f --- /dev/null +++ b/RFXtoRP_HsaCons.ftl @@ -0,0 +1,46 @@ +<#-- **** 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 actor = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ActorCreated> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaCons_ActorCreated.ftl"> + } + ] + <#break> + + <#case "D"> + <#-- *********************************************** Action = DELETE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign actor = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ActorDeleted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaCons_ActorDeleted.ftl"> + } + ] + <#break> + + + <#default> + <#stop "event not supported"> + + diff --git a/RFXtoRP_HsaCons_ActorCreated.ftl b/RFXtoRP_HsaCons_ActorCreated.ftl new file mode 100644 index 0000000..efe7d5c --- /dev/null +++ b/RFXtoRP_HsaCons_ActorCreated.ftl @@ -0,0 +1,43 @@ +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${actor.code}" + }, + + "Payload": { + "Name": "${actor.designation}", + "ManagedStock": false, + "IsCarrier": false, + <#-- ***Partner ID could be added here *** --> + <#-- "PartnerID": "${}", --> + + <#-- + <#include "RFXtoRP_HsaCons_ActorCreated_Metadata.ftl"> + --> + + + "Address": + { + <#if actor.address.address_3?length > 10> + "City" : "${actor.address.address_3?substring(10)?trim}", + + "StreetAddressOne" : "${actor.address.address_1}", + "StreetAddressTwo" : "${actor.address.address_2}", + <#if actor.address.address_3?length < 10> + "PostalCode" : "${actor.address.address_3?trim}", + <#else> + "PostalCode" : "${actor.address.address_3?substring(0,9)?trim}", + + <#if actor.address.address_4?length < 14> + "CountryCode" : "" + <#else> + "CountryCode" : "${actor.address.address_4?substring(10,13)?trim}" + + }, + "Typology": "TYPOLOGY_UNKNOWN" + } + } +] diff --git a/RFXtoRP_HsaCons_ActorCreated_Metadata.ftl b/RFXtoRP_HsaCons_ActorCreated_Metadata.ftl new file mode 100644 index 0000000..dd94be0 --- /dev/null +++ b/RFXtoRP_HsaCons_ActorCreated_Metadata.ftl @@ -0,0 +1,5 @@ +<#-- **** file included in RFXtoRP_HsaItm_ItemCreated.ftl ***** --> +<#-- use protobuf of class HsaCons to find Reflex WMS fields names --> + + +"MetaData": [ ], \ No newline at end of file diff --git a/RFXtoRP_HsaCons_ActorDeleted.ftl b/RFXtoRP_HsaCons_ActorDeleted.ftl new file mode 100644 index 0000000..3b4343b --- /dev/null +++ b/RFXtoRP_HsaCons_ActorDeleted.ftl @@ -0,0 +1,12 @@ +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${actor.code}" + }, + + "Payload": {} + } +] diff --git a/RFXtoRP_HsaIpgMove.ftl b/RFXtoRP_HsaIpgMove.ftl new file mode 100644 index 0000000..a683c10 --- /dev/null +++ b/RFXtoRP_HsaIpgMove.ftl @@ -0,0 +1,74 @@ +<#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 reflexMvtStockInterface = JsonUtil.jsonToMap(dataRfx)> + + <#-- exclusion of the cases of an IPG move with quantity = 0 (weight modification) --> + <#if reflexMvtStockInterface.ipg_move_quantity_in_base_lvs != 0> + + <#-- IPG moves translated into Stock moves --> + <#if reflexMvtStockInterface.ipg_move_type == "130" || + reflexMvtStockInterface.ipg_move_type == "200" || + reflexMvtStockInterface.ipg_move_type == "210" || + reflexMvtStockInterface.ipg_move_type == "220" || + reflexMvtStockInterface.ipg_move_type == "230" || + reflexMvtStockInterface.ipg_move_type == "240" || + reflexMvtStockInterface.ipg_move_type == "260" || + reflexMvtStockInterface.ipg_move_type == "290" || + reflexMvtStockInterface.ipg_move_type == "300" || + reflexMvtStockInterface.ipg_move_type == "400" || + reflexMvtStockInterface.ipg_move_type == "410" || + reflexMvtStockInterface.ipg_move_type == "420" + > + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.StockMoved> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaIpgMove_StockMoved.ftl"> + + } + <#else> + <#-- IPG moves translated into goods received (all type of receipt) --> + <#if reflexMvtStockInterface.ipg_move_type == "100" || + reflexMvtStockInterface.ipg_move_type == "110" || + reflexMvtStockInterface.ipg_move_type == "120" + > + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.GoodsReceived> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaIpgMove_GoodsReceived.ftl"> + + } + ] + <#else> + <#-- Case of IPG move type volontarilly ignored--> + <#stop "Move type not supported"> + + + <#else> + <#-- cases of an IPG move with quantity = 0 (weight modification))--> + <#stop "move ingored quantity = 0"> + + <#break> + + <#case "D"> + <#-- *********************************************** Action = DELETE ******************** --> + <#stop "event not supported - Case D "> + <#break> + + + <#default> + <#stop "event not supported"> + + diff --git a/RFXtoRP_HsaIpgMove_GoodsReceived.ftl b/RFXtoRP_HsaIpgMove_GoodsReceived.ftl new file mode 100644 index 0000000..c09bead --- /dev/null +++ b/RFXtoRP_HsaIpgMove_GoodsReceived.ftl @@ -0,0 +1,43 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> +[ + <#assign receipt_confirmation_datetime = RfxDateTimetoUTC(reflexMvtStockInterface.ipg_move_creation_datetime,time_zone_offset_rfx) /> + + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${reflexMvtStockInterface.hd_number}" + }, + + "Payload": { + "ReceivedContents" :[ + { + "DateTime": { + "DateTime": "${receipt_confirmation_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + }, + "Goods": { + "ItemID": "${reflexMvtStockInterface.item_code}", + "LVBranchID": "${reflexMvtStockInterface.lv_code}", + <#assign priority_date = "${Default_date}"?datetime(rfx_date_format_default)?iso_utc /> + "PriorityDate": "${priority_date}", + + <#-- Goods received Segmentation Keys inclusion --> + <#include "RFXtoRP_HsaIpgMove_GoodsReceived_SegmentationKeys.ftl"> + + }, + "ExecutionflowID": "R-${reflexMvtStockInterface.receipt_year_number}-${reflexMvtStockInterface.receipt_number}", + "LineID": "${reflexMvtStockInterface.receipt_line_number}", + "ActorID": "${reflexMvtStockInterface.physical_depot_code}", + "Quantity": { + "LVID": "${quantity_in_base_lv_RP_Cst}", + "Value": ${reflexMvtStockInterface.ipg_move_quantity_in_base_lvs} + } + } + ] + } + } + +] diff --git a/RFXtoRP_HsaIpgMove_GoodsReceived_SegmentationKeys.ftl b/RFXtoRP_HsaIpgMove_GoodsReceived_SegmentationKeys.ftl new file mode 100644 index 0000000..92b4f0c --- /dev/null +++ b/RFXtoRP_HsaIpgMove_GoodsReceived_SegmentationKeys.ftl @@ -0,0 +1,24 @@ +<#-- use protobuf of class HsaIpgMove to find Reflex WMS fields names --> + +<#--"SegmentationKeys": + [ + { + "Key": "Grade", + "Value": {"String": "${reflexMvtStockInterface.grade_code}"} + }, + { + "Key": "Owner", + "Value": {"String": "${reflexMvtStockInterface.owner_code}"} + }, + { + "Key": "BatchNumber", + <#if reflexMvtStockInterface.batch_1 == ""> + "Value": { "String" : "no batch"} + <#else> + "Value": { "String" : "${reflexMvtStockInterface.batch_1}"} + + } + ], + +--> +"SegmentationKeys": [ ] \ No newline at end of file diff --git a/RFXtoRP_HsaIpgMove_StockMoved.ftl b/RFXtoRP_HsaIpgMove_StockMoved.ftl new file mode 100644 index 0000000..c0d1d16 --- /dev/null +++ b/RFXtoRP_HsaIpgMove_StockMoved.ftl @@ -0,0 +1,63 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> + +<#assign MoveType_KV = {"130":"STOCK_MOVEMENT_TYPE_PRODUCTION", + "200":"STOCK_MOVEMENT_TYPE_FIX", + "210":"STOCK_MOVEMENT_TYPE_FIX", + "220":"STOCK_MOVEMENT_TYPE_FIX", + "230":"STOCK_MOVEMENT_TYPE_REQUALIFICATION", + "240":"STOCK_MOVEMENT_TYPE_REQUALIFICATION", + "260":"STOCK_MOVEMENT_TYPE_REQUALIFICATION", + "290":"STOCK_MOVEMENT_TYPE_REQUALIFICATION", + "300":"STOCK_MOVEMENT_TYPE_REQUALIFICATION", + "400":"STOCK_MOVEMENT_TYPE_FIX", + "410":"STOCK_MOVEMENT_TYPE_FIX", + "420":"STOCK_MOVEMENT_TYPE_REQUALIFICATION"}> +<#assign generation_date = RfxDateTimetoUTC(reflexMvtStockInterface.ipg_move_creation_datetime,time_zone_offset_rfx) /> +<#assign ipg_priority_datetime = reflexMvtStockInterface.ipg_priority_date?datetime(rfx_date_format_default)?iso_utc /> + +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "Payload": { + "Goods": { + "ItemID": "${reflexMvtStockInterface.item_code}", + "PriorityDate": "${ipg_priority_datetime}", + + <#-- Segmentation keys inclusions --> + <#include "RFXtoRP_HsaIpgMove_StockMoved_SegmentationKeys.ftl"> + + + "LVBranchID": "${reflexMvtStockInterface.lv_code}" + }, + "ActorID": "${reflexMvtStockInterface.physical_depot_code}", + "Movement": { + + "DateTime": { + "DateTime": "${generation_date}", + "AuthorTimeZone": "${time_zone_rfx}" + }, + "Author": "ReflexWMS-${reflexMvtStockInterface.ipg_move_creation_user_code}", + "ExternalMoveRef" : "${reflexMvtStockInterface.ipg_move_year_number} - ${reflexMvtStockInterface.ipg_move_number}", + "Type": "${MoveType_KV[reflexMvtStockInterface.ipg_move_type]!reflexMvtStockInterface.ipg_move_type}", + "Reason": "${reflexMvtStockInterface.miscellaneous_receipts_despatches_code}", + "ExternalInfo" : "${reflexMvtStockInterface.stock_move_reference}", + <#if reflexMvtStockInterface.ipg_move_operation_year_number!= 0> + "OperationReference": "${reflexMvtStockInterface.ipg_move_operation_year_number} - ${reflexMvtStockInterface.ipg_move_operation_number}", + + + "Quantity": + { + "LVID": "${quantity_in_base_lv_RP_Cst}", + <#if reflexMvtStockInterface.move_sign == "+"> + "Value": ${reflexMvtStockInterface.ipg_move_quantity_in_base_lvs} + <#else> + "Value": -${reflexMvtStockInterface.ipg_move_quantity_in_base_lvs} + + } + } + } + } +] diff --git a/RFXtoRP_HsaIpgMove_StockMoved_SegmentationKeys.ftl b/RFXtoRP_HsaIpgMove_StockMoved_SegmentationKeys.ftl new file mode 100644 index 0000000..8d7662c --- /dev/null +++ b/RFXtoRP_HsaIpgMove_StockMoved_SegmentationKeys.ftl @@ -0,0 +1,25 @@ +<#-- **** file included in RFXtoRP_HsaItm_ItemCreated.ftl ***** --> +<#-- use protobuf of class HsaIpgMove to find Reflex WMS fields names --> + +<#--"SegmentationKeys": + [ + { + "Key": "Grade", + "Value": {"String": "${reflexMvtStockInterface.grade_code}"} + }, + { + "Key": "Owner", + "Value": {"String": "${reflexMvtStockInterface.owner_code}"} + }, + { + "Key": "BatchNumber", + <#if reflexMvtStockInterface.batch_1 == ""> + "Value": { "String" : "no batch"} + <#else> + "Value": { "String" : "${reflexMvtStockInterface.batch_1}"} + + } + ], + +--> +"SegmentationKeys": [ ], \ No newline at end of file diff --git a/RFXtoRP_HsaItm.ftl b/RFXtoRP_HsaItm.ftl new file mode 100644 index 0000000..041016d --- /dev/null +++ b/RFXtoRP_HsaItm.ftl @@ -0,0 +1,51 @@ +<#-- **** 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 item = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#if item.logistical_variant_list?? > + <#assign apiReflexPlatformID = ApiReflexPlatformID.ItemCreated> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaItm_ItemCreated.ftl"> + <#else> + <#stop "no LV for the item"> + + } + ] + <#break> + + <#case "D"> + <#-- *********************************************** Action = DELETE ******************************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign item = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ItemDeleted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaItm_ItemDeleted.ftl"> + } + ] + <#break> + + + <#default> + <#stop "event not supported"> + + diff --git a/RFXtoRP_HsaItmLv.ftl b/RFXtoRP_HsaItmLv.ftl new file mode 100644 index 0000000..b69fffb --- /dev/null +++ b/RFXtoRP_HsaItmLv.ftl @@ -0,0 +1,56 @@ +<#-- **** 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 lv = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.LVUpdated> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaItmLv_LVUpdated.ftl"> + } + ] + <#break> + + <#case "D"> + <#-- *********************************************** Action = DELETE ******************** --> + <#stop "LV deletion not supported" > + + <#-- supression LV a décommenter quand API ajouté au connecteur + + + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign item = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.LVDeleted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaItmLv_LVRemoved.ftl"> + } + ] + + + --> + + <#break> + + + <#default> + <#stop "event not supported"> + + diff --git a/RFXtoRP_HsaItmLv_LVRemoved.ftl b/RFXtoRP_HsaItmLv_LVRemoved.ftl new file mode 100644 index 0000000..44a0400 --- /dev/null +++ b/RFXtoRP_HsaItmLv_LVRemoved.ftl @@ -0,0 +1,14 @@ +<#include "HfRpConfig.ftl"> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${lv.item_code}" + }, + "Payload": { + "RemovedLogisticVariant": "${lv.logistical_variant_code} + } + } +] diff --git a/RFXtoRP_HsaItmLv_LVUpdated.ftl b/RFXtoRP_HsaItmLv_LVUpdated.ftl new file mode 100644 index 0000000..b897f61 --- /dev/null +++ b/RFXtoRP_HsaItmLv_LVUpdated.ftl @@ -0,0 +1,73 @@ +<#include "HfRpConfig.ftl"> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${lv.item_code}" + }, + "Payload": { + "LogisticVariants": [ + { + "LVID": "${lv.logistical_variant_code}", + "Name" : "${lv.lv_type_code}", + <#if lv.id_list??> + "Codes": [ + <#list lv.id_list as id> + { + "Key": "${id.logistical_variant_ID_type_code}", + "Value": "${id.logistical_variant_ID_code}" + }<#sep>, + + ], + + + <#-- LV Metadata inclusion --> + <#include "RFXtoRP_HsaItmLv_LVUpdated_Metadata.ftl"> + + "IsBaseLogisticVariant": ${lv.base_lv}, + + <#if lv.base_lv != "true"> + "RefLV": "${lv.subpackaging_lv_code}", + + + "QuantityInRefLV": ${lv.quantity_in_subpackaging_lv}, + + "NetWeight": { + "Value": ${lv.net_weight}, + "Unit": "${weight_unit_rfx}" + }, + "GrossWeight": { + "Value": ${lv.gross_weight}, + "Unit": "${weight_unit_rfx}" + }, + "Volume": { + "Value": ${lv.volume}, + "Unit": "${volume_unit_rfx}" + }, + "Height": { + "Value": ${lv.height}, + "Unit": "${length_unit_rfx}" + }, + "Width": { + "Value": ${lv.width}, + "Unit": "${length_unit_rfx}" + }, + "Length": { + "Value": ${lv.depth}, + "Unit": "${length_unit_rfx}" + }, + + <#if lv.packaging_lv == "true"> + "BranchIDs": ["${lv.logistical_variant_code}"] + <#else> + "BranchIDs": [] + + + + } + ] + } + } +] diff --git a/RFXtoRP_HsaItmLv_LVUpdated_Metadata.ftl b/RFXtoRP_HsaItmLv_LVUpdated_Metadata.ftl new file mode 100644 index 0000000..cc33334 --- /dev/null +++ b/RFXtoRP_HsaItmLv_LVUpdated_Metadata.ftl @@ -0,0 +1,4 @@ +<#-- use protobuf of class HsaItmLv to find Reflex Wms fields names --> + + +"MetaData": [ ], \ No newline at end of file diff --git a/RFXtoRP_HsaItm_ItemCreated.ftl b/RFXtoRP_HsaItm_ItemCreated.ftl new file mode 100644 index 0000000..d9c121b --- /dev/null +++ b/RFXtoRP_HsaItm_ItemCreated.ftl @@ -0,0 +1,104 @@ +<#include "HfRpConfig.ftl"> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${item.item_code}" + }, + "Payload": { + "DescriptionsByLanguage": [{ + "ShortDescription": "${item.short_designation?json_string}", + "LongDescription": "${item.designation?json_string}", + "TechnicalDetails": "${item.item_description?json_string}", + "LanguageCodeISO6391": "${text_language_rfx}" + } + ], +<#-- /!\ table de correspondance à faire disparaitre /!\ --> + <#assign ExpiryConstraint = {"REC":"PRODUCTION_DATE", "DDM":"BEST_BEFORE_DATE", "DLC":"USE_BY_DATE"}/> + "ExpiryConstraint": { + "Type": "${ExpiryConstraint[item.expiry_group_code]!"UNKNOWN_DATE"}" + }, + + <#-- Item metadata inclusion --> + <#include "RFXtoRP_HsaItm_ItemCreated_ItemMetadata.ftl"> + + <#-- Item Photo URI could be added here --> + <#--"PhotoURI": " ", --> + + <#-- Loop for the Logistical Variants - LV --> + <#if item.logistical_variant_list??> + "LogisticVariants": [ + + <#list item.logistical_variant_list as logistical_variant> + { + "LVID": "${logistical_variant.logistical_variant_code}", + "Name" : "${logistical_variant.lv_type_code}", + + <#if logistical_variant.id_list??> + "Codes": [ + <#list logistical_variant.id_list as id> + { + "Key": "${id.logistical_variant_ID_type_code}", + "Value": "${id.logistical_variant_ID_code}" + }<#sep>, + + ], + + + <#-- LV Metadata inclusion --> + <#include "RFXtoRP_HsaItm_ItemCreated_LVMetadata.ftl"> + + + "IsBaseLogisticVariant": ${logistical_variant.base_lv}, + + <#if logistical_variant.base_lv != "true"> + "RefLV": "${logistical_variant.subpackaging_lv_code}", + + + "QuantityInRefLV": ${logistical_variant.quantity_in_subpackaging_lv}, + + "NetWeight": { + "Value": ${logistical_variant.net_weight}, + "Unit": "${weight_unit_rfx}" + }, + "GrossWeight": { + "Value": ${logistical_variant.gross_weight}, + "Unit": "${weight_unit_rfx}" + }, + "Volume": { + "Value": ${logistical_variant.volume}, + "Unit": "${volume_unit_rfx}" + }, + "Height": { + "Value": ${logistical_variant.height}, + "Unit": "${length_unit_rfx}" + }, + "Width": { + "Value": ${logistical_variant.width}, + "Unit": "${length_unit_rfx}" + }, + "Length": { + "Value": ${logistical_variant.depth}, + "Unit": "${length_unit_rfx}" + }, + + + <#if logistical_variant.packaging_lv == "true"> + "BranchIDs": ["${logistical_variant.logistical_variant_code}"] + <#else> + "BranchIDs": [] + + + } + <#sep>, + + + ] + + <#-- End of LV loop --> + + } + } +] diff --git a/RFXtoRP_HsaItm_ItemCreated_ItemMetadata.ftl b/RFXtoRP_HsaItm_ItemCreated_ItemMetadata.ftl new file mode 100644 index 0000000..6bd2911 --- /dev/null +++ b/RFXtoRP_HsaItm_ItemCreated_ItemMetadata.ftl @@ -0,0 +1,5 @@ +<#-- **** file included in RFXtoRP_HsaItm_ItemCreated.ftl ***** --> +<#-- use protobuf of class HsaItm to find Reflex Wms fields names --> + + +"MetaData": [ ], \ No newline at end of file diff --git a/RFXtoRP_HsaItm_ItemCreated_LVMetadata.ftl b/RFXtoRP_HsaItm_ItemCreated_LVMetadata.ftl new file mode 100644 index 0000000..6bd2911 --- /dev/null +++ b/RFXtoRP_HsaItm_ItemCreated_LVMetadata.ftl @@ -0,0 +1,5 @@ +<#-- **** file included in RFXtoRP_HsaItm_ItemCreated.ftl ***** --> +<#-- use protobuf of class HsaItm to find Reflex Wms fields names --> + + +"MetaData": [ ], \ No newline at end of file diff --git a/RFXtoRP_HsaItm_ItemDeleted.ftl b/RFXtoRP_HsaItm_ItemDeleted.ftl new file mode 100644 index 0000000..c9ed2ac --- /dev/null +++ b/RFXtoRP_HsaItm_ItemDeleted.ftl @@ -0,0 +1,12 @@ +<#include "HfRpConfig.ftl"> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${item.item_code}" + }, + "Payload": {} + } +] diff --git a/RFXtoRP_HsaProStatus.ftl b/RFXtoRP_HsaProStatus.ftl new file mode 100644 index 0000000..d951148 --- /dev/null +++ b/RFXtoRP_HsaProStatus.ftl @@ -0,0 +1,97 @@ +<#-- **** 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 preparationStatusInterface = JsonUtil.jsonToMap(dataRfx)> + [ + + <#-- + **Pick batch runned (100) ** + <#if preparationStatusInterface.preparation_status_type == "100" && + (preparationStatusInterface.preparation_status_code == "200" > + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.PreparationStarted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaProStatus_PreparationExpecteded.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") > + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.PreparationStarted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaProStatus_PreparationStarted.ftl"> + } + <#else> + <#-- **Preparation to package (500) and preparationcompleted (550)** --> + <#if preparationStatusInterface.preparation_status_type == "100" && + (preparationStatusInterface.preparation_status_code == "500" || + preparationStatusInterface.preparation_status_code == "550")> + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.PreparationCompleted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaProStatus_PreparationCompleted.ftl"> + } + <#else> + <#-- ****Preparation dispatched (600)** --> + <#if preparationStatusInterface.preparation_status_type == "100" && + preparationStatusInterface.preparation_status_code == "600" > + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowTransportStarted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaProStatus_TransportStarted.ftl"> + } + <#else> + <#-- ****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 "Reflex WMS status not supported on Reflex Platform"> + + + + + + <#-- + + --> + ] + <#break> + + <#case "D"> + <#-- *********************************************** Action = DELETE ******************** --> + <#stop "event not supported (case D)"> + <#break> + + + <#default> + <#stop "event not supported"> + + diff --git a/RFXtoRP_HsaProStatus_ExecutionflowCancelled.ftl b/RFXtoRP_HsaProStatus_ExecutionflowCancelled.ftl new file mode 100644 index 0000000..951c05d --- /dev/null +++ b/RFXtoRP_HsaProStatus_ExecutionflowCancelled.ftl @@ -0,0 +1,20 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> + +<#assign preparation_status_datetime = preparationStatusInterface.preparation_status_datetime?datetime(rfx_date_format_default)?iso_utc /> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${preparationStatusInterface.preparation_order_originator_reference}", + "RefDate": { + "DateTime": "${preparation_status_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + "Payload": { + } + } +] diff --git a/RFXtoRP_HsaProStatus_PreparationCompleted.ftl b/RFXtoRP_HsaProStatus_PreparationCompleted.ftl new file mode 100644 index 0000000..50b546d --- /dev/null +++ b/RFXtoRP_HsaProStatus_PreparationCompleted.ftl @@ -0,0 +1,20 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> +<#assign preparation_status_datetime = preparationStatusInterface.preparation_status_datetime?datetime(rfx_date_format_default)?iso_utc /> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${preparationStatusInterface.preparation_order_originator_reference}", + "RefDate": { + "DateTime": "${preparation_status_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + + "Payload": {} + + } +] diff --git a/RFXtoRP_HsaProStatus_PreparationExpected.ftl b/RFXtoRP_HsaProStatus_PreparationExpected.ftl new file mode 100644 index 0000000..50b546d --- /dev/null +++ b/RFXtoRP_HsaProStatus_PreparationExpected.ftl @@ -0,0 +1,20 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> +<#assign preparation_status_datetime = preparationStatusInterface.preparation_status_datetime?datetime(rfx_date_format_default)?iso_utc /> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${preparationStatusInterface.preparation_order_originator_reference}", + "RefDate": { + "DateTime": "${preparation_status_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + + "Payload": {} + + } +] diff --git a/RFXtoRP_HsaProStatus_PreparationStarted.ftl b/RFXtoRP_HsaProStatus_PreparationStarted.ftl new file mode 100644 index 0000000..50b546d --- /dev/null +++ b/RFXtoRP_HsaProStatus_PreparationStarted.ftl @@ -0,0 +1,20 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> +<#assign preparation_status_datetime = preparationStatusInterface.preparation_status_datetime?datetime(rfx_date_format_default)?iso_utc /> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${preparationStatusInterface.preparation_order_originator_reference}", + "RefDate": { + "DateTime": "${preparation_status_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + + "Payload": {} + + } +] diff --git a/RFXtoRP_HsaProStatus_TransportStarted.ftl b/RFXtoRP_HsaProStatus_TransportStarted.ftl new file mode 100644 index 0000000..50b546d --- /dev/null +++ b/RFXtoRP_HsaProStatus_TransportStarted.ftl @@ -0,0 +1,20 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> +<#assign preparation_status_datetime = preparationStatusInterface.preparation_status_datetime?datetime(rfx_date_format_default)?iso_utc /> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${preparationStatusInterface.preparation_order_originator_reference}", + "RefDate": { + "DateTime": "${preparation_status_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + + "Payload": {} + + } +] diff --git a/RFXtoRP_HsaSup.ftl b/RFXtoRP_HsaSup.ftl new file mode 100644 index 0000000..cb060be --- /dev/null +++ b/RFXtoRP_HsaSup.ftl @@ -0,0 +1,46 @@ +<#-- **** 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 actor = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ActorCreated> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaSup_ActorCreated.ftl"> + } + ] + <#break> + + <#case "D"> + <#-- *********************************************** Action = DELETE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign actor = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ActorDeleted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsaSup_ActorDeleted.ftl"> + } + ] + <#break> + + + <#default> + <#stop "event not supported"> + + diff --git a/RFXtoRP_HsaSup_ActorCreated.ftl b/RFXtoRP_HsaSup_ActorCreated.ftl new file mode 100644 index 0000000..efa6398 --- /dev/null +++ b/RFXtoRP_HsaSup_ActorCreated.ftl @@ -0,0 +1,43 @@ +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${actor.code}" + }, + + "Payload": { + "Name": "${actor.designation}", + "ManagedStock": false, + "IsCarrier": false, + <#-- ***Partner ID could be added here *** --> + <#-- "PartnerID": "${}", --> + + <#-- + <#include "RFXtoRP_HsaSup_ActorCreated_Metadata.ftl"> + --> + + "Address": + { + <#if actor.optional_attributes.address_3?length > 10> + "City" : "${actor.optional_attributes.address_3?substring(10)?trim}", + + "StreetAddressOne" : "${actor.optional_attributes.address_1}", + "StreetAddressTwo" : "${actor.optional_attributes.address_2}", + + <#if actor.optional_attributes.address_3?length < 10> + "PostalCode" : "${actor.optional_attributes.address_3?trim}", + <#else> + "PostalCode" : "${actor.optional_attributes.address_3?substring(0,9)?trim}", + + <#if actor.optional_attributes.address_4?length < 14> + "CountryCode" : "" + <#else> + "CountryCode" : "${actor.optional_attributes.address_4?substring(10,13)?trim}" + + }, + "Typology": "TYPOLOGY_UNKNOWN" + } + } +] diff --git a/RFXtoRP_HsaSup_ActorCreated_Metadata.ftl b/RFXtoRP_HsaSup_ActorCreated_Metadata.ftl new file mode 100644 index 0000000..4192694 --- /dev/null +++ b/RFXtoRP_HsaSup_ActorCreated_Metadata.ftl @@ -0,0 +1,5 @@ +<#-- **** file included in RFXtoRP_HsaItm_ItemCreated.ftl ***** --> +<#-- use protobuf of class HsaSup to find Reflex WMS fields names --> + + +"MetaData": [ ], \ No newline at end of file diff --git a/RFXtoRP_HsaSup_ActorDeleted.ftl b/RFXtoRP_HsaSup_ActorDeleted.ftl new file mode 100644 index 0000000..dafa8f3 --- /dev/null +++ b/RFXtoRP_HsaSup_ActorDeleted.ftl @@ -0,0 +1,12 @@ +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${actor.code}" + }, + + "Payload": {} + } +] diff --git a/RFXtoRP_HsrDepot.ftl b/RFXtoRP_HsrDepot.ftl new file mode 100644 index 0000000..0d21195 --- /dev/null +++ b/RFXtoRP_HsrDepot.ftl @@ -0,0 +1,46 @@ +<#-- **** 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 depot = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ActorCreated> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrDepot_ActorCreated.ftl"> + } + ] + <#break> + + <#case "D"> + <#-- *********************************************** Action = DELETE *************************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign depot = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ActorDeleted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrDepot_ActorDeleted.ftl"> + } + ] + <#break> + + + <#default> + <#stop "event not supported"> + + diff --git a/RFXtoRP_HsrDepot_ActorCreated.ftl b/RFXtoRP_HsrDepot_ActorCreated.ftl new file mode 100644 index 0000000..36ced51 --- /dev/null +++ b/RFXtoRP_HsrDepot_ActorCreated.ftl @@ -0,0 +1,39 @@ +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${depot.physical_depot_code}" + }, + + "Payload": { + "Name": "${depot.physical_depot_designation}", + "ManagedStock": true, + "IsCarrier": false, + <#-- ***Partner ID could be added here *** --> + <#-- "PartnerID": "${}", --> + + <#-- + <#include "RFXtoRP_HsrDepot_ActorCreated_Metadata.ftl"> + --> + + "Address": + { + "StreetAddressOne" : "${depot.physical_depot_address.address_1}", + "StreetAddressTwo" : "${depot.physical_depot_address.address_2}", + + <#if depot.physical_depot_address.address_3?length < 10> + "PostalCode" : "${depot.physical_depot_address.address_3?trim}", + <#else> + "PostalCode" : "${depot.physical_depot_address.address_3?substring(0,9)?trim}", + + <#if depot.physical_depot_address.address_4?length < 14> + "CountryCode" : "" + <#else> + "CountryCode" : "${depot.physical_depot_address.address_4?substring(10,13)?trim}" + + } + } + } +] diff --git a/RFXtoRP_HsrDepot_ActorCreated_Metadata.ftl b/RFXtoRP_HsrDepot_ActorCreated_Metadata.ftl new file mode 100644 index 0000000..519c0a8 --- /dev/null +++ b/RFXtoRP_HsrDepot_ActorCreated_Metadata.ftl @@ -0,0 +1,5 @@ +<#-- **** file included in RFXtoRP_HsaItm_ItemCreated.ftl ***** --> +<#-- use protobuf of class HsrDepot to find Reflex WMS fields names --> + + +"MetaData": [ ], \ No newline at end of file diff --git a/RFXtoRP_HsrDepot_ActorDeleted.ftl b/RFXtoRP_HsrDepot_ActorDeleted.ftl new file mode 100644 index 0000000..4bfb3be --- /dev/null +++ b/RFXtoRP_HsrDepot_ActorDeleted.ftl @@ -0,0 +1,12 @@ +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${depot.physical_depot_code}" + }, + + "Payload": {} + } +] diff --git a/RFXtoRP_HsrPrepa.ftl b/RFXtoRP_HsrPrepa.ftl new file mode 100644 index 0000000..08883df --- /dev/null +++ b/RFXtoRP_HsrPrepa.ftl @@ -0,0 +1,49 @@ +<#-- **** 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 preparationOrder = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.GoodsPrepared> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrPrepa_GoodsPrepared.ftl"> + }, + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.HandlingunitDispatched> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrPrepa_HandlingUnitDispatched.ftl"> + }, + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowTransportStarted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_Hsrprepa_TransportStarted.ftl"> + } + ] + <#break> + + <#case "D"> + <#-- *********************************************** Action = DELETE ******************** --> + <#stop "event not supported (Case D)"> + <#break> + + + <#default> + <#stop "event not supported"> + + diff --git a/RFXtoRP_HsrPrepa_GoodsPrepared.ftl b/RFXtoRP_HsrPrepa_GoodsPrepared.ftl new file mode 100644 index 0000000..dffb29d --- /dev/null +++ b/RFXtoRP_HsrPrepa_GoodsPrepared.ftl @@ -0,0 +1,85 @@ +<#include "HfRpConfig.ftl"> + +[ + <#list preparationOrder.preparation_line_lst?filter(l ->l.despatched_ipg_list??) as preparation_line> + <#list preparation_line.despatched_ipg_list as despatched_ipg> + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if despatched_ipg.carton_number != "000000000000000000"> + "RefID": "${despatched_ipg.carton_number}" + <#else> + "RefID": "${despatched_ipg.hd_number}" + + }, + + "Payload": { + "Information" :{ + <#if despatched_ipg.carton_number != "000000000000000000"> + "ContainerType": "${despatched_ipg.carton_type_code}" + <#else> + "ContainerType": "${despatched_ipg.hd_type_code}" + + + }, + <#-- HU Metadata inclusin inclusion --> + <#include "RFXtoRP_HsrPrepa_GoodsPrepared_HUMetadata.ftl"> + , + "PreparedContents" :[ + { + "Goods": { + "ItemID": "${preparation_line.item_code}", + "LVBranchID": "${preparation_line.item_lv_code}", + <#if (despatched_ipg.ipg_manufacture_date?length != 0) && (despatched_ipg.ipg_manufacture_date?starts_with("00") == false)> + <#-- <#assign priority_date = JsonUtil.createUTCDateTime(despatched_ipg.ipg_manufacture_date) /> --> + <#assign priority_date = despatched_ipg.ipg_manufacture_date?datetime(rfx_date_format_default)?iso_utc /> + "PriorityDate": "${priority_date}", + <#else> + <#if (despatched_ipg.ipg_receipt_date?length != 0) && (despatched_ipg.ipg_receipt_date?starts_with("00")== false)> + <#-- <#assign priority_date = JsonUtil.createUTCDateTime(despatched_ipg.ipg_receipt_date) /> --> + <#assign priority_date = despatched_ipg.ipg_receipt_date?datetime(rfx_date_format_default)?iso_utc /> + "PriorityDate": "${priority_date}", + <#else> + <#if (despatched_ipg.ipg_best_before_date?length != 0) && (despatched_ipg.ipg_best_before_date?starts_with("00")== false)> + <#-- <#assign priority_date = JsonUtil.createUTCDateTime(despatched_ipg.ipg_best_before_date) /> --> + <#assign priority_date = despatched_ipg.ipg_best_before_date?datetime(rfx_date_format_default)?iso_utc /> + "PriorityDate": "${priority_date}", + <#else> + <#if (despatched_ipg.ipg_sell_by_date?length != 0) && (despatched_ipg.ipg_sell_by_date?starts_with("00")== false)> + <#-- <#assign priority_date = JsonUtil.createUTCDateTime(despatched_ipg.ipg_sell_by_date) /> --> + <#assign priority_date = despatched_ipg.ipg_sell_by_date?datetime(rfx_date_format_default)?iso_utc /> + "PriorityDate": "${priority_date}", + <#else> + <#if (despatched_ipg.ipg_use_by_date?length != 0) && (despatched_ipg.ipg_use_by_date?starts_with("00")== false)> + <#-- <#assign priority_date = JsonUtil.createUTCDateTime(despatched_ipg.ipg_use_by_date) /> --> + <#assign priority_date = despatched_ipg.ipg_use_by_date?datetime(rfx_date_format_default)?iso_utc /> + "PriorityDate": "${priority_date}", + <#else> + "PriorityDate": "error_date", + + + + + + + <#-- Segmentation Keys inclusion --> + <#include "RFXtoRP_HsrPrepa_GoodsPrepared_SegmentationKeys.ftl"> + }, + "ExecutionflowID": "${preparation_line.preparation_order_originator_reference}", + "LineID": "${preparation_line.pro_line_number}", + "ActorID": "${preparationOrder.physical_depot_code}", + "Quantity": { + "LVID": "${quantity_in_base_lv_RP_Cst}", + "Value": ${despatched_ipg.quantity_lvs} + } + } + ] + } + + }<#sep>, + + <#sep>, + +] diff --git a/RFXtoRP_HsrPrepa_GoodsPrepared_HuMetadata.ftl b/RFXtoRP_HsrPrepa_GoodsPrepared_HuMetadata.ftl new file mode 100644 index 0000000..4bac794 --- /dev/null +++ b/RFXtoRP_HsrPrepa_GoodsPrepared_HuMetadata.ftl @@ -0,0 +1,9 @@ +<#-- use protobuf of class HsrPrepa to find Reflex WMS fields names --> + +<#-- +"Metadata" :[ + + ] + +--> +"Metadata": [ ] \ No newline at end of file diff --git a/RFXtoRP_HsrPrepa_GoodsPrepared_SegmentationKeys.ftl b/RFXtoRP_HsrPrepa_GoodsPrepared_SegmentationKeys.ftl new file mode 100644 index 0000000..5732860 --- /dev/null +++ b/RFXtoRP_HsrPrepa_GoodsPrepared_SegmentationKeys.ftl @@ -0,0 +1,24 @@ +<#-- use protobuf of class Hsrprepa to find Reflex WMS fields names --> + +<#-- +"SegmentationKeys" :[ + { + "Key": "BatchNumber", + <#if despatched_ipg.batch_number == ""> + "Value": { "String" : "no batch"} + <#else> + "Value": { "String" : "${despatched_ipg.batch_number}"} + + }, + { + "Key": "Grade", + "Value": { "String" : "${preparation_line.grade_code}"} + }, + { + "Key": "Owner", + "Value": { "String" : "${preparation_line.owner_code}"} + } + ] + +--> +"SegmentationKeys": [ ] \ No newline at end of file diff --git a/RFXtoRP_HsrPrepa_HandlingUnitDispatched.ftl b/RFXtoRP_HsrPrepa_HandlingUnitDispatched.ftl new file mode 100644 index 0000000..dec88fb --- /dev/null +++ b/RFXtoRP_HsrPrepa_HandlingUnitDispatched.ftl @@ -0,0 +1,27 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> +[ + + <#list preparationOrder.preparation_line_lst?filter(l ->l.despatched_ipg_list??) as preparation_line> + <#assign preparationOrder_confirmation_datetime = RfxDateTimetoUTC(preparation_line.confirmation_datetime,time_zone_offset_rfx) /> + <#list preparation_line.despatched_ipg_list as despatched_ipg> + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if despatched_ipg.carton_number != "000000000000000000"> + "RefID": "${despatched_ipg.carton_number}" + <#else> + "RefID": "${despatched_ipg.hd_number}" + + + }, + "Payload": { + + } + }<#sep>, + + <#sep>, + +] diff --git a/RFXtoRP_HsrPrepa_TransportStarted.ftl b/RFXtoRP_HsrPrepa_TransportStarted.ftl new file mode 100644 index 0000000..be8f1d2 --- /dev/null +++ b/RFXtoRP_HsrPrepa_TransportStarted.ftl @@ -0,0 +1,21 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> +<#assign preparation_status_datetime = preparationOrder.stock_despatch_at_preparation_datetime?datetime(rfx_date_format_default)?iso_utc /> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${preparation_line.preparation_order_originator_reference}", + "RefDate": { + "DateTime": "${preparation_status_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + + "Payload": {} + + } +] +<#-- ajouter une boucle sur tous les ODP de la prepa - --> diff --git a/RFXtoRP_HsrPro.ftl b/RFXtoRP_HsrPro.ftl new file mode 100644 index 0000000..ba802a0 --- /dev/null +++ b/RFXtoRP_HsrPro.ftl @@ -0,0 +1,74 @@ +<#-- **** 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 order = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#-- check preparation type code (internal order and reservation are ignored) --> + <#if order.preparation_type_code == "010" || + order.preparation_type_code == "030"> + + <#-- Preparation order not confirmed --> + <#if order.preparation_order_confirmed == "false" > + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrPro_ExecutionflowDetected.ftl"> + + <#-- preparation expected a prendre en compte dans le connecteur + , + + <#assign apiReflexPlatformID = ApiReflexPlatformID.TransportExpected> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrPro_PreparationExpected.ftl"> + --> + + <#-- Preparation order confirmed --> + <#else> + <#assign apiReflexPlatformID = ApiReflexPlatformID.PreparationCompleted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrPro_PreparationCompleted.ftl"> + + <#else> + <#stop "preparation type not supported"> + + + } + + ] + <#break> + + <#case "D"> + <#-- *********************************************** Action = DELETE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign order = JsonUtil.jsonToMap(dataRfx)> + [ + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowCancelled> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrPro_ExecutionflowCancelled.ftl"> + } + ] + <#break> + + + <#default> + <#stop "event not supported"> + + diff --git a/RFXtoRP_HsrPro_ExecutionflowCancelled.ftl b/RFXtoRP_HsrPro_ExecutionflowCancelled.ftl new file mode 100644 index 0000000..068ec80 --- /dev/null +++ b/RFXtoRP_HsrPro_ExecutionflowCancelled.ftl @@ -0,0 +1,12 @@ +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${order.originator_reference}" + }, + "Payload": { + } + } +] diff --git a/RFXtoRP_HsrPro_ExecutionflowDetected.ftl b/RFXtoRP_HsrPro_ExecutionflowDetected.ftl new file mode 100644 index 0000000..f250888 --- /dev/null +++ b/RFXtoRP_HsrPro_ExecutionflowDetected.ftl @@ -0,0 +1,106 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> +[ + { + <#assign planned_final_delivery_start_datetime = RfxDateTimetoUTC(order.planned_final_delivery_start_datetime,time_zone_offset_rfx) /> + <#assign pro_creation_datetime = RfxDateTimetoUTC(order.creation_datetime,time_zone_offset_rfx) /> + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${order.originator_reference}", + "RefDate": { + "DateTime": "${pro_creation_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + "Payload": { + "CreationDateTime": { + "DateTime": "${pro_creation_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + }, + <#-- Header Metadata inclusion --> + <#include "RFXtoRP_HsrPro_ExecutionflowDetected_HeaderMetadata.ftl"> + + "ShipFrom": { + "ActorID": "${order.physical_depot_code}" + }, + "ShipFromAcked": true, + "ShipTo": { + <#if order.end_consignee_code != "ECOM"> + "ActorID": "${order.end_consignee_code}" + <#else> + <#if order.address != ""> + "Actor": + { + "Name" : "${order.address.name_or_company_name!""}", + "Address" : + { + "City" : "${order.address.post_code_area_name!""}", + "CountryCode" : "${order.address.iso_country_code!""}", + "PostalCode" : "${order.address.postal_code!""}", + "StreetAddressOne" : "${order.address.street_and_number_and_po_box!""}", + "StreetAddressTwo" : "${order.address.additional_address_data_1!""}", + "StreetAddressThree" : "${order.address.additional_address_data_2!""}" + } + }, + "Contact" : + { + "FirstName" : "${order.address.first_name!""}", + "LastName" : "${order.address.last_name!""}", + "Emails" : ["${order.address.mail_address!""}"], + "Phones" : ["${order.address.mobile_phone_number!""}"] + } + + + }, + + <#if order.line_list??> + "Lines" : [ + <#list order.line_list as line> + { + <#if (line.originator_reference_line_number!0) != 0> + "LineID": "${line.originator_reference_line_number}", + <#else> + "LineID": "${line.preparation_order_line_number!0}", + + <#-- Line Metadata inclusion --> + <#include "RFXtoRP_HsrPro_ExecutionflowDetected_LineMetadata.ftl"> + + "RequestedContent": + { + "Goods": + { + "ItemID": "${line.item_code!"0"}", + "LVBranchID": "${line.item_lv_code!"0"}", + <#if (line.optional_attributes.forced_priority_date?length != 0) && (line.optional_attributes.forced_priority_date?starts_with("00") == false)> + <#assign forced_priority_date = line.optional_attributes.forced_priority_date?datetime(rfx_date_format_default)?iso_utc /> + "PriorityDate": "${forced_priority_date}", + + + <#-- Line Segmentation Keys inclusion --> + <#include "RFXtoRP_HsrPro_ExecutionflowDetected_LineSegmentationKeys.ftl"> + + }, + "Quantity" : + { + "LVID": "${quantity_in_base_lv_RP_Cst}", + "Value": "${line.base_lv_quantity_to_prepare!0}" + } + } + }<#sep>, + + ], + + + "RequestedMilestones" : + { + "RequestedDeliveryDateTime" : + { + "DateTime": "${planned_final_delivery_start_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + } + } + } +] diff --git a/RFXtoRP_HsrPro_ExecutionflowDetected_HeaderMetadata.ftl b/RFXtoRP_HsrPro_ExecutionflowDetected_HeaderMetadata.ftl new file mode 100644 index 0000000..c97abe1 --- /dev/null +++ b/RFXtoRP_HsrPro_ExecutionflowDetected_HeaderMetadata.ftl @@ -0,0 +1,15 @@ +<#-- **** file included in RFXtoRP_HsaItm_ItemCreated.ftl ***** --> +<#-- use protobuf of class HsrPro to find Reflex Wms fields names --> + +<#-- + +"MetaData": [ + { + "Key": "OrderType", + "Value": { "String" : "${order.optional_attributes.reason_code}"} + } + ], +--> + + +"MetaData": [ ], \ No newline at end of file diff --git a/RFXtoRP_HsrPro_ExecutionflowDetected_LineMetadata.ftl b/RFXtoRP_HsrPro_ExecutionflowDetected_LineMetadata.ftl new file mode 100644 index 0000000..b72e0ed --- /dev/null +++ b/RFXtoRP_HsrPro_ExecutionflowDetected_LineMetadata.ftl @@ -0,0 +1,5 @@ +<#-- **** file included in RFXtoRP_HsaItm_ItemCreated.ftl ***** --> +<#-- use protobuf of class HsrPro to find Reflex Wms fields names --> + + +"MetaData": [ ], \ No newline at end of file diff --git a/RFXtoRP_HsrPro_ExecutionflowDetected_LineSegmentationKeys.ftl b/RFXtoRP_HsrPro_ExecutionflowDetected_LineSegmentationKeys.ftl new file mode 100644 index 0000000..7fba11b --- /dev/null +++ b/RFXtoRP_HsrPro_ExecutionflowDetected_LineSegmentationKeys.ftl @@ -0,0 +1,20 @@ +<#-- **** file included in RFXtoRP_HsaItm_ItemCreated.ftl ***** --> +<#-- use protobuf of class HsrPro to find Reflex WMS fields names --> + +<#-- +"SegmentationKeys": [ { + "Key": "BatchNumber", + <#if line.batch_1 == ""> + "Value": { "String" : "no batch"} + <#else> + "Value": { "String" : "${line.batch_1}"} + + }, + { + "Key": "Grade", + "Value": { "String" : "${SegmentationKeys_KV[line.grade_code_to_prepare]!Default_Value_Grade_SegmentationKey}"} + } + ] + +--> +"SegmentationKeys": [ ] \ No newline at end of file diff --git a/RFXtoRP_HsrPro_PreparationCompleted.ftl b/RFXtoRP_HsrPro_PreparationCompleted.ftl new file mode 100644 index 0000000..4ae7c8c --- /dev/null +++ b/RFXtoRP_HsrPro_PreparationCompleted.ftl @@ -0,0 +1,20 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> +<#assign preparation_status_datetime = order.confirmation_datetime?datetime(rfx_date_format_default)?iso_utc /> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${order.originator_reference}", + "RefDate": { + "DateTime": "${preparation_status_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + + "Payload": {} + + } +] diff --git a/RFXtoRP_HsrPro_PreparationExpected.ftl b/RFXtoRP_HsrPro_PreparationExpected.ftl new file mode 100644 index 0000000..dabb3a7 --- /dev/null +++ b/RFXtoRP_HsrPro_PreparationExpected.ftl @@ -0,0 +1,20 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> +<#assign preparation_status_datetime = order.creation_datetime?datetime(rfx_date_format_default)?iso_utc /> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${order.originator_reference}", + "RefDate": { + "DateTime": "${preparation_status_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + + "Payload": {} + + } +] diff --git a/RFXtoRP_HsrReceiptList.ftl b/RFXtoRP_HsrReceiptList.ftl new file mode 100644 index 0000000..423aaed --- /dev/null +++ b/RFXtoRP_HsrReceiptList.ftl @@ -0,0 +1,79 @@ +<#-- **** 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"> + <#-- *********************************************** Action = CREATE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign receipt = JsonUtil.jsonToMap(dataRfx)> + [ + <#if receipt.line_list?? > + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl"> + + } + <#else> + <#stop "Reception without lines"> + + + ] + <#break> + <#case "U"> + <#-- *********************************************** Action = UPDATE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign receipt = JsonUtil.jsonToMap(dataRfx)> + [ + <#if receipt.receipt_confirmed == "true" > + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ReceiptCompleted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrReceiptList_ReceiptCompleted.ftl"> + } + <#else> + <#if receipt.line_list?? > + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl"> + } + <#else> + <#stop "Reception without lines"> + + + ] + <#break> + + <#case "D"> + <#-- *********************************************** Action = DELETE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign receipt = JsonUtil.jsonToMap(dataRfx)> + [ + { + + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowCancelled> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrReceiptList_ExecutionflowCancelled.ftl"> + + } + ] + <#break> + + + <#default> + <#stop "event not supported"> + + diff --git a/RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl b/RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl new file mode 100644 index 0000000..f11919a --- /dev/null +++ b/RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl @@ -0,0 +1,144 @@ +<#include "HfRpConfig.ftl"> +<#include "actors.ftl"> +<#include "projectCst.ftl"> +<#include "ReflexUtils.ftl"> +[ + { + <#assign receipt_datetime = RfxDateTimetoUTC(receipt.receipt_datetime,time_zone_offset_rfx) /> + <#assign receipt_creation_datetime = RfxDateTimetoUTC(receipt.creation_datetime,time_zone_offset_rfx) /> + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${receipt.receipt_reference}" + }, + "Payload": { + "CreationDateTime": { + "DateTime": "${receipt_creation_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + + }, + + <#-- Metadta inclusion --> + "MetaData": [ + { + "Key": "OrderType", + "Value": { "String" : "${receipt.receipt_reason_code}"} + } + ], + "ShipFrom": + { + "ActorID": "${receipt.original_code}" + }, + "ShipTo" : + { + "ActorID": "${receipt.physical_depot_code}" + }, + "ShipToAcked": true, + + <#if receipt.carrier_informations.carrier_code != ""> + "Carrier" : {"ActorID": "${receipt.carrier_informations.carrier_code}"}, + + + <#if receipt.line_list??> + "Lines" : [ + <#list receipt.line_list as line> + + + <#if receipt.receipt_type = "030"> + <#-- Si réception retour, on a donc du détail --> + <#list line.line_detail as detail> + { + "LineID": "${line.receipt_line_number}${detail.receipt_detail_number}", + "RequestedContent": + { + "Goods": + { + "ItemID": "${line.item_code!"0"}", + "LVBranchID": "${line.item_lv_code!"0"}", + <#if (detail.priority_date?length != 0) && (detail.priority_date?starts_with("00") == false)> + <#-- <#assign line_detail_priority_date = JsonUtil.createDateTime(detail.priority_date,time_zone_rfx) /> --> + <#assign line_detail_priority_date = detail.priority_date?datetime(rfx_date_format_default)?iso_utc /> + "PriorityDate": "${line_detail_priority_date}", + + "SegmentationKeys": [ + { + "Key": "BatchNumber", + <#if detail.batch_1 == ""> + "Value": { "String" : "no batch"} + <#else> + "Value": { "String" : "${detail.batch_1}"} + + }, + { + "Key": "Grade", + "Value": { "String" : "${detail.grade_code}"} + } + ] + }, + "Quantity" : + { + "LVID": "${quantity_in_base_lv_RP_Cst}", + "Value": "${detail.confirmation_lv_quantity!0}" + } + } + }<#sep>, + + <#-- Réception non transfert --> + <#else> + { + "LineID": "${line.receipt_line_number}", + "RequestedContent": + { + "Goods": + { + "ItemID": "${line.item_code!"0"}", + "LVBranchID": "${line.item_lv_code!"0"}", + <#if line.line_without_detail??> + <#if (line.line_without_detail.priority_date?length != 0) && (line.line_without_detail.priority_date?starts_with("00") == false)> + <#assign line_without_detail_priority_date = line.line_without_detail.priority_date?datetime(rfx_date_format_default)?iso_utc /> + "PriorityDate": "${line_without_detail_priority_date}", + + "SegmentationKeys": [ + { + "Key": "BatchNumber", + <#if line.line_without_detail.batch_1 == ""> + "Value": { "String" : "no batch"} + <#else> + "Value": { "String" : "${line.line_without_detail.batch_1}"} + + }, + { + "Key": "Grade", + "Value": { "String" : "${SegmentationKeys_KV[line.grade_code]!Default_Value_Grade_SegmentationKey}"} + } + ] + <#else> + <#stop "Reception non transfert avec detail"> + + }, + "Quantity" : + { + "LVID": "${quantity_in_base_lv_RP_Cst}", + "Value": "${line.order_quantity_in_lv!0}" + } + } + + } + + <#sep>, + + ], + + + "RequestedMilestones" : + { + "RequestedDeliveryDateTime" : + { + "DateTime": "${receipt_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + } + } + } +] diff --git a/RFXtoRP_HsrReceiptList_ExecutionflowDetected_HeaderMetadata.ftl b/RFXtoRP_HsrReceiptList_ExecutionflowDetected_HeaderMetadata.ftl new file mode 100644 index 0000000..34f0fb2 --- /dev/null +++ b/RFXtoRP_HsrReceiptList_ExecutionflowDetected_HeaderMetadata.ftl @@ -0,0 +1,14 @@ +<#-- use protobuf of class HsrReceiptList to find Reflex Wms fields names --> + +<#-- + +"MetaData": [ + { + "Key": "OrderType", + "Value": { "String" : "${order.optional_attributes.reason_code}"} + } + ], +--> + + +"MetaData": [ ], \ No newline at end of file diff --git a/RFXtoRP_HsrReceiptList_ExecutionflowDetected_LineMetadata.ftl b/RFXtoRP_HsrReceiptList_ExecutionflowDetected_LineMetadata.ftl new file mode 100644 index 0000000..bd26485 --- /dev/null +++ b/RFXtoRP_HsrReceiptList_ExecutionflowDetected_LineMetadata.ftl @@ -0,0 +1,4 @@ +<#-- use protobuf of class HsrReceiptList to find Reflex Wms fields names --> + + +"MetaData": [ ], \ No newline at end of file diff --git a/RFXtoRP_HsrReceiptList_ExecutionflowDetected_LineSegmentationKeys.ftl b/RFXtoRP_HsrReceiptList_ExecutionflowDetected_LineSegmentationKeys.ftl new file mode 100644 index 0000000..669455e --- /dev/null +++ b/RFXtoRP_HsrReceiptList_ExecutionflowDetected_LineSegmentationKeys.ftl @@ -0,0 +1,19 @@ +<#-- use protobuf of class HsrReceiptList to find Reflex WMS fields names --> + +<#-- +"SegmentationKeys": [ { + "Key": "BatchNumber", + <#if line.batch_1 == ""> + "Value": { "String" : "no batch"} + <#else> + "Value": { "String" : "${line.batch_1}"} + + }, + { + "Key": "Grade", + "Value": { "String" : "${line.grade_code_to_prepare} + } + ] + +--> +"SegmentationKeys": [ ] \ No newline at end of file diff --git a/RFXtoRP_HsrReceiptList_OrderCancelled.ftl b/RFXtoRP_HsrReceiptList_OrderCancelled.ftl new file mode 100644 index 0000000..74b44c9 --- /dev/null +++ b/RFXtoRP_HsrReceiptList_OrderCancelled.ftl @@ -0,0 +1,12 @@ +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${receipt.receipt_reference}" + }, + "Payload": { + } + } +] diff --git a/RFXtoRP_HsrReceiptList_ReceiptExpected.ftl b/RFXtoRP_HsrReceiptList_ReceiptExpected.ftl new file mode 100644 index 0000000..dabb3a7 --- /dev/null +++ b/RFXtoRP_HsrReceiptList_ReceiptExpected.ftl @@ -0,0 +1,20 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> +<#assign preparation_status_datetime = order.creation_datetime?datetime(rfx_date_format_default)?iso_utc /> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${order.originator_reference}", + "RefDate": { + "DateTime": "${preparation_status_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + + "Payload": {} + + } +] diff --git a/RFXtoRP_HsrReceiptList_TransportCompleted.ftl b/RFXtoRP_HsrReceiptList_TransportCompleted.ftl new file mode 100644 index 0000000..d9a1296 --- /dev/null +++ b/RFXtoRP_HsrReceiptList_TransportCompleted.ftl @@ -0,0 +1,14 @@ +<#include "HfRpConfig.ftl"> +<#include "projectCst.ftl"> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${receipt.receipt_reference}" + }, + "Payload": { + } + } +] diff --git a/RFXtoRP_HsrReciptList_ExecutionflowCancelled.ftl b/RFXtoRP_HsrReciptList_ExecutionflowCancelled.ftl new file mode 100644 index 0000000..068ec80 --- /dev/null +++ b/RFXtoRP_HsrReciptList_ExecutionflowCancelled.ftl @@ -0,0 +1,12 @@ +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "RefID": "${order.originator_reference}" + }, + "Payload": { + } + } +] diff --git a/RFXtoRP_RfxConfigurationRp.ftl b/RFXtoRP_RfxConfigurationRp.ftl new file mode 100644 index 0000000..78abc62 --- /dev/null +++ b/RFXtoRP_RfxConfigurationRp.ftl @@ -0,0 +1,36 @@ + +<#noparse><#-- /!\ Warning the file is generated, if you modify it manually, do not enable automatic update via the pipeline --> +<#noparse><#-- Date of last generation : ${aDateTime}<#noparse> --> + +<#noparse> +<#-- if LVID is egal to **quantity_in_base_lv** keyword then LVID is egal to base VL of the item --> + <#assign quantity_in_base_lv_RP_Cst = "**quantity_in_base_lv**" > + <#assign rfx_date_format_default = "yyyy-MM-dd" > + + + <#assign length_unit_KV_rfx = {"MET":"MILLIMETER","CM":"CENTIMETER","MM":"METER","DM":"DECIMETER","KM":"KILOMETER","MIL":"MILE","YAR":"YARD","INC":"INCH","FT":"FOOT"}> + <#assign weight_unit_KV_rfx = {"GR":"GRAMME","DG":"DECIGRAM","KG":"KILOGRAM","TON":"TONNE","OCE":"ONCE","LTO":"LONG_TON","STO":"SHORT_TON","PND":"POUND"}> + <#assign area_unit_KV_rfx = {"MM²":"SQUARE_MILLIMETER","CM²":"SQUARE_CENTIMETER","DM²":"SQUARE_DECIMETER","M²":"SQUARE_METER","SQI":"SQUARE_INCH","SQF":"SQUARE_FOOT","SQY":"SQUARE_YARD"}> + <#assign volume_unit_KV_rfx = {"MM³":"CUBIC_MILLIMETER","CM³":"CUBIC_CENTIMETER","DM³":"CUBIC_DECIMETER","M³":"CUBIC_METER","CI":"CUBIC_INCH","CF":"CUBIC_FOOT","CY":"CUBIC_YARD","ML":"MILLI_LITER","CL":"CENTI_LITER","DL":"DECI_LITER","LIT":"LITER","HL":"HECTO_LITER","FT":"US_FLUID_OUNCE","USG":"US_GAL","PI":"IMPERIAL_PINT","GL":"IMPERIAL_GAL"}> + + + + <#noparse><#assign length_unit_rfx = length_unit_KV_rfx["${file.measurement_unit.length}"<#noparse>]!"CENTIMETER"> + <#noparse><#assign distance_unit_rfx = length_unit_KV_rfx["${file.measurement_unit.distance}"<#noparse>]!"CENTIMETER"> + <#noparse><#assign transport_distance_unit_rfx = length_unit_KV_rfx["${file.measurement_unit.transport_distance}"<#noparse>]!"CENTIMETER"> + <#noparse><#assign weight_unit_rfx = weight_unit_KV_rfx["${file.measurement_unit.weight}"<#noparse>]!"KILOGRAM"> + <#noparse><#assign area_unit_rfx = area_unit_KV_rfx["${file.measurement_unit.area}"<#noparse>]!"SQUARE_METER"> + <#noparse><#assign volume_unit_rfx = volume_unit_KV_rfx["${file.measurement_unit.volume}"<#noparse>]!"CUBIC_DECIMETER"> + <#noparse><#assign number_of_litres_unit_rfx = volume_unit_KV_rfx["${file.measurement_unit.litres_number}"<#noparse>]!"CUBIC_DECIMETER"> + + + + <#noparse><#assign time_zone_rfx = "${file.author_time_zone!"UTC"}<#noparse>"> + <#noparse><#assign time_zone_offset_rfx = "${file.time_zone_offset!"+00:00"}<#noparse>"> + + + <#list file.reflex_platform_project_list?filter(l -> l.name == projectRP) as reflex_platform_project> + <#noparse><#assign text_language_rfx = "${reflex_platform_project.text_language!"en"}<#noparse>"> + + + \ No newline at end of file diff --git a/ReflexUtils.ftl b/ReflexUtils.ftl new file mode 100644 index 0000000..5cc733f --- /dev/null +++ b/ReflexUtils.ftl @@ -0,0 +1,9 @@ +<#-- --------------------------------------------------------------------------------------- --> +<#-- Concat reflex timestamp with reflex time zone and format this date in ISO UTC format --> +<#-- --------------------------------------------------------------------------------------- --> +<#function RfxDateTimetoUTC rfxdatetime offset > + <#assign datetimeUTC = JsonUtil.createUTCDateTime(rfxdatetime,time_zone_rfx , "yyyy-MM-dd'T'HH:mm:ss") /> + <#return (datetimeUTC)> + + + \ No newline at end of file