From 8e573a519745e8a098519afff405249121c277ef Mon Sep 17 00:00:00 2001 From: Francis Reat Date: Thu, 5 Nov 2026 12:54:57 +0000 Subject: [PATCH] release2.0-SCPN1-11488 into release2.0 --- RFXtoRP_HfDtlStockLs_StockSnapshotted.ftl | 8 +--- ...P_HliReceiptLr_ExecutionflowLinesAdded.ftl | 8 ++-- ...iptLr_TransfertExecutionflowLinesAdded.ftl | 22 ++++------ RFXtoRP_HsaIpgMove_GoodsReceived.ftl | 9 +--- RFXtoRP_HsaIpgMove_StockMoved.ftl | 7 +-- ...oRP_HsrPrepa_HandlingunitGoodsPrepared.ftl | 44 ++++++++----------- ...P_HsrReceiptList_ExecutionflowDetected.ftl | 8 ++-- ...iptList_TransfertExecutionflowDetected.ftl | 12 +++-- ReflexUtils.ftl | 25 +++++++++++ 9 files changed, 68 insertions(+), 75 deletions(-) diff --git a/RFXtoRP_HfDtlStockLs_StockSnapshotted.ftl b/RFXtoRP_HfDtlStockLs_StockSnapshotted.ftl index 4914bac..2740bb9 100644 --- a/RFXtoRP_HfDtlStockLs_StockSnapshotted.ftl +++ b/RFXtoRP_HfDtlStockLs_StockSnapshotted.ftl @@ -26,13 +26,7 @@ "Goods": { "ItemID": "${stock.item_code?trim?json_string}", "LVBranchID": "${stock.item_logistical_variant_code}", - <#assign priority_date = stock.priority_date?datetime(rfx_date_format_default)?iso_utc /> - <#if (stock.priority_date!="") && (stock.priority_date?starts_with("00")== false) > - "PriorityDate" : "${priority_date}", - <#else> - "PriorityDate": "1970-01-01T00:00:00Z", - - + "PriorityDate": "${RfxDatetoTimestampUTC(stock.priority_date,rfx_date_format_default)}", <#-- Segmentation keys inclusion --> <#include "RFXtoRP_HfDtlStockLs_StockSnapshotted_SegmentationKeys.ftl"> } diff --git a/RFXtoRP_HliReceiptLr_ExecutionflowLinesAdded.ftl b/RFXtoRP_HliReceiptLr_ExecutionflowLinesAdded.ftl index d75f65a..2d1c653 100644 --- a/RFXtoRP_HliReceiptLr_ExecutionflowLinesAdded.ftl +++ b/RFXtoRP_HliReceiptLr_ExecutionflowLinesAdded.ftl @@ -30,14 +30,12 @@ "ItemID": "${line.item_code?trim?json_string!"0"}", "LVBranchID": "${line.item_lv_code?json_string!"0"}", <#if (line.line_without_detail?? && 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}", + "PriorityDate": "${RfxDatetoTimestampUTC(line.line_without_detail.priority_date,rfx_date_format_default)}", <#else> <#if (line.line_detail?? && line.line_detail?size == 1 && line.line_detail[0].priority_date?length != 0) && (line.line_detail[0].priority_date?starts_with("00") == false)> - <#assign line_detail_priority_date = line.line_detail[0].priority_date?datetime(rfx_date_format_default)?iso_utc /> - "PriorityDate": "${line_detail_priority_date}", + "PriorityDate": "${RfxDatetoTimestampUTC(line.line_detail[0].priority_date,rfx_date_format_default)}", <#else> - "PriorityDate": "1970-01-01T00:00:00Z", + "PriorityDate": "${DEFAULT_TIMESTAMP}", <#-- Segmentation Keys inclusion --> diff --git a/RFXtoRP_HliReceiptLr_TransfertExecutionflowLinesAdded.ftl b/RFXtoRP_HliReceiptLr_TransfertExecutionflowLinesAdded.ftl index 889fdf7..ae943db 100644 --- a/RFXtoRP_HliReceiptLr_TransfertExecutionflowLinesAdded.ftl +++ b/RFXtoRP_HliReceiptLr_TransfertExecutionflowLinesAdded.ftl @@ -34,14 +34,12 @@ "ItemID": "${line.item_code?trim?json_string!"0"}", "LVBranchID": "${line.item_lv_code?json_string!"0"}", <#if (line.line_without_detail?? && 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}", + "PriorityDate": "${RfxDatetoTimestampUTC(line.line_without_detail.priority_date,rfx_date_format_default)}", <#else> <#if (line.line_detail?? && line.line_detail?size == 1 && line.line_detail[0].priority_date?length != 0) && (line.line_detail[0].priority_date?starts_with("00") == false)> - <#assign line_detail_priority_date = line.line_detail[0].priority_date?datetime(rfx_date_format_default)?iso_utc /> - "PriorityDate": "${line_detail_priority_date}", + "PriorityDate": "${RfxDatetoTimestampUTC(line.line_detail[0].priority_date,rfx_date_format_default)}", <#else> - "PriorityDate": "1970-01-01T00:00:00Z", + "PriorityDate": "${DEFAULT_TIMESTAMP}", <#-- Segmentation Keys inclusion --> @@ -101,15 +99,13 @@ { "ItemID": "${line.item_code?trim?json_string!"0"}", "LVBranchID": "${line.item_lv_code?json_string!"0"}", - <#if (line.line_without_detail?? && 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}", + <#if (line.line_without_detail?? && line.line_without_detail.priority_date?length != 0) > + "PriorityDate": "${RfxDatetoTimestampUTC(line.line_without_detail.priority_date,rfx_date_format_default)}", <#else> - <#if (line.line_detail?? && line.line_detail?size == 1 && line.line_detail[0].priority_date?length != 0) && (line.line_detail[0].priority_date?starts_with("00") == false)> - <#assign line_detail_priority_date = line.line_detail[0].priority_date?datetime(rfx_date_format_default)?iso_utc /> - "PriorityDate": "${line_detail_priority_date}", + <#if (line.line_detail?? && line.line_detail?size == 1 && line.line_detail[0].priority_date?length != 0)> + "PriorityDate": "${RfxDatetoTimestampUTC(line.line_detail[0].priority_date,rfx_date_format_default)}", <#else> - "PriorityDate": "1970-01-01T00:00:00Z", + "PriorityDate": "${DEFAULT_TIMESTAMP}", <#-- Segmentation Keys inclusion --> @@ -166,7 +162,7 @@ <#assign line_detail_priority_date = line.line_detail[0].priority_date?datetime(rfx_date_format_default)?iso_utc /> "PriorityDate": "${line_detail_priority_date}", <#else> - "PriorityDate": "1970-01-01T00:00:00Z", + "PriorityDate": "${DEFAULT_TIMESTAMP}", <#-- Segmentation Keys inclusion --> diff --git a/RFXtoRP_HsaIpgMove_GoodsReceived.ftl b/RFXtoRP_HsaIpgMove_GoodsReceived.ftl index a1c3d39..45231f2 100644 --- a/RFXtoRP_HsaIpgMove_GoodsReceived.ftl +++ b/RFXtoRP_HsaIpgMove_GoodsReceived.ftl @@ -3,8 +3,7 @@ <#include "ActorPrefix.ftl"> [ <#assign receipt_confirmation_datetime = RfxDateTimetoUTCWithTimezone(reflexMvtStockInterface.ipg_move_creation_datetime,time_zone_rfx) /> - <#assign priority_date = reflexMvtStockInterface.ipg_priority_date?datetime(rfx_date_format_default)?iso_utc /> - { + { "Header": { "ProjectID": "${projectRP}" }, @@ -22,11 +21,7 @@ "Goods": { "ItemID": "${reflexMvtStockInterface.item_code?trim?json_string}", "LVBranchID": "${reflexMvtStockInterface.lv_code?json_string}", - <#if (priority_date!="") && (priority_date?starts_with("00")== false) > - "PriorityDate": "${priority_date}", - <#else> - "PriorityDate": "1970-01-01T00:00:00Z", - + "PriorityDate": "${RfxDatetoTimestampUTC(reflexMvtStockInterface.ipg_priority_date,rfx_date_format_default)}", <#-- Goods received Segmentation Keys inclusion --> <#include "RFXtoRP_HsaIpgMove_GoodsReceived_SegmentationKeys.ftl"> }, diff --git a/RFXtoRP_HsaIpgMove_StockMoved.ftl b/RFXtoRP_HsaIpgMove_StockMoved.ftl index cf652f0..be9773a 100644 --- a/RFXtoRP_HsaIpgMove_StockMoved.ftl +++ b/RFXtoRP_HsaIpgMove_StockMoved.ftl @@ -22,7 +22,6 @@ "520":"STOCK_MOVEMENT_TYPE_OUTBOUND" }> <#assign generation_date = RfxDateTimetoUTCWithTimezone(reflexMvtStockInterface.ipg_move_creation_datetime,time_zone_rfx) /> -<#assign ipg_priority_datetime = reflexMvtStockInterface.ipg_priority_date?datetime(rfx_date_format_default)?iso_utc /> [ { "Header": { @@ -31,11 +30,7 @@ "Payload": { "Goods": { "ItemID": "${reflexMvtStockInterface.item_code?trim?json_string}", - <#if (reflexMvtStockInterface.ipg_priority_date!="") && (reflexMvtStockInterface.ipg_priority_date?starts_with("00")== false) > - "PriorityDate": "${ipg_priority_datetime}", - <#else> - "PriorityDate": "1970-01-01T00:00:00Z", - + "PriorityDate": "${RfxDatetoTimestampUTC(reflexMvtStockInterface.ipg_priority_date,rfx_date_format_default)}", <#-- Segmentation keys inclusions --> <#include "RFXtoRP_HsaIpgMove_StockMoved_SegmentationKeys.ftl">, diff --git a/RFXtoRP_HsrPrepa_HandlingunitGoodsPrepared.ftl b/RFXtoRP_HsrPrepa_HandlingunitGoodsPrepared.ftl index c0892b4..5dd2a43 100644 --- a/RFXtoRP_HsrPrepa_HandlingunitGoodsPrepared.ftl +++ b/RFXtoRP_HsrPrepa_HandlingunitGoodsPrepared.ftl @@ -82,37 +82,31 @@ "ItemID": "${preparation_line.item_code?trim?json_string}", "LVBranchID": "${preparation_line.item_lv_code?json_string}", - <#if (despatched_ipg.ipg_use_by_date?length != 0) && (despatched_ipg.ipg_use_by_date?starts_with("00")== false)> - <#assign priority_date = despatched_ipg.ipg_use_by_date?datetime(rfx_date_format_default)?iso_utc /> - "PriorityDate": "${priority_date}", + <#if despatched_ipg.ipg_use_by_date?? && despatched_ipg.ipg_use_by_date?length != 0 && (despatched_ipg.ipg_use_by_date?starts_with("00")== false)> + "PriorityDate": "${RfxDatetoTimestampUTC(despatched_ipg.ipg_use_by_date,rfx_date_format_default)}", <#else> - <#if (despatched_ipg.ipg_best_before_date?length != 0) && (despatched_ipg.ipg_best_before_date?starts_with("00")== false)> - <#assign priority_date = despatched_ipg.ipg_best_before_date?datetime(rfx_date_format_default)?iso_utc /> - "PriorityDate": "${priority_date}", + <#if despatched_ipg.ipg_best_before_date?? && despatched_ipg.ipg_best_before_date?length != 0 && (despatched_ipg.ipg_best_before_date?starts_with("00")== false)> + "PriorityDate": "${RfxDatetoTimestampUTC(despatched_ipg.ipg_best_before_date,rfx_date_format_default)}", <#else> - <#if (despatched_ipg.ipg_sell_by_date?length != 0) && (despatched_ipg.ipg_sell_by_date?starts_with("00")== false)> - <#assign priority_date = despatched_ipg.ipg_sell_by_date?datetime(rfx_date_format_default)?iso_utc /> - "PriorityDate": "${priority_date}", + <#if despatched_ipg.ipg_sell_by_date?? && (despatched_ipg.ipg_sell_by_date?length != 0) && (despatched_ipg.ipg_sell_by_date?starts_with("00")== false)> + "PriorityDate": "${RfxDatetoTimestampUTC(despatched_ipg.ipg_sell_by_date,rfx_date_format_default)}", <#else> - <#if (despatched_ipg.ipg_manufacture_date?length != 0) && (despatched_ipg.ipg_manufacture_date?starts_with("00") == false)> - <#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 = despatched_ipg.ipg_receipt_date?datetime(rfx_date_format_default)?iso_utc /> - "PriorityDate": "${priority_date}", - <#else> - <#if (preparationOrder.stock_despatch_at_preparation_datetime?length != 0) && (preparationOrder.stock_despatch_at_preparation_datetime?starts_with("00")== false)> - <#assign priority_date = preparationOrder.stock_despatch_at_preparation_datetime?datetime(rfx_date_format_default)?iso_utc /> - "PriorityDate": "${priority_date}", - <#else> - "PriorityDate": "1970-01-01T00:00:00Z", - - + <#if despatched_ipg.ipg_manufacture_date?? && (despatched_ipg.ipg_manufacture_date?length != 0) && (despatched_ipg.ipg_manufacture_date?starts_with("00")== false)> + "PriorityDate": "${RfxDatetoTimestampUTC(despatched_ipg.ipg_manufacture_date,rfx_date_format_default)}", + <#else> + <#if despatched_ipg.ipg_receipt_date?? && (despatched_ipg.ipg_receipt_date?length != 0) && (despatched_ipg.ipg_receipt_date?starts_with("00")== false)> + "PriorityDate": "${RfxDatetoTimestampUTC(despatched_ipg.ipg_receipt_date,rfx_date_format_default)}", + <#else> + <#if preparationOrder.stock_despatch_at_preparation_datetime?? && (preparationOrder.stock_despatch_at_preparation_datetime?length != 0) && (preparationOrder.stock_despatch_at_preparation_datetime?starts_with("00")== false)> + "PriorityDate": "${RfxDatetoTimestampUTC(preparationOrder.stock_despatch_at_preparation_datetime,rfx_date_format_default)}", + <#else> + "PriorityDate": "${DEFAULT_TIMESTAMP}", + - + + <#-- Segmentation Keys inclusion --> <#include "RFXtoRP_HsrPrepa_GoodsPrepared_SegmentationKeys.ftl"> diff --git a/RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl b/RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl index 0568206..8b7dc58 100644 --- a/RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl +++ b/RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl @@ -108,14 +108,12 @@ "ItemID": "${line.item_code?trim?json_string!"0"}", "LVBranchID": "${line.item_lv_code?json_string!"0"}", <#if (line.line_without_detail?? && 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}", + "PriorityDate": "${RfxDatetoTimestampUTC(line.line_without_detail.priority_date,rfx_date_format_default)}", <#else> <#if (line.line_detail?? && line.line_detail?size == 1 && line.line_detail[0].priority_date?length != 0) && (line.line_detail[0].priority_date?starts_with("00") == false)> - <#assign line_detail_priority_date = line.line_detail[0].priority_date?datetime(rfx_date_format_default)?iso_utc /> - "PriorityDate": "${line_detail_priority_date}", + "PriorityDate": "${RfxDatetoTimestampUTC(line.line_detail[0].priority_date,rfx_date_format_default)}", <#else> - "PriorityDate": "1970-01-01T00:00:00Z", + "PriorityDate": "${DEFAULT_TIMESTAMP}", <#-- Segmentation Keys inclusion --> diff --git a/RFXtoRP_HsrReceiptList_TransfertExecutionflowDetected.ftl b/RFXtoRP_HsrReceiptList_TransfertExecutionflowDetected.ftl index aa9c16b..eb97ff7 100644 --- a/RFXtoRP_HsrReceiptList_TransfertExecutionflowDetected.ftl +++ b/RFXtoRP_HsrReceiptList_TransfertExecutionflowDetected.ftl @@ -105,14 +105,12 @@ "ItemID": "${line.item_code?trim?json_string!"0"}", "LVBranchID": "${line.item_lv_code?json_string!"0"}", <#if (line.line_without_detail?? && 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}", + "PriorityDate": "${RfxDatetoTimestampUTC(line.line_without_detail.priority_date,rfx_date_format_default)}", <#else> <#if (line.line_detail?? && line.line_detail?size == 1 && line.line_detail[0].priority_date?length != 0) && (line.line_detail[0].priority_date?starts_with("00") == false)> - <#assign line_detail_priority_date = line.line_detail[0].priority_date?datetime(rfx_date_format_default)?iso_utc /> - "PriorityDate": "${line_detail_priority_date}", + "PriorityDate": "${RfxDatetoTimestampUTC(line.line_detail[0].priority_date,rfx_date_format_default)}", <#else> - "PriorityDate": "1970-01-01T00:00:00Z", + "PriorityDate": "${DEFAULT_TIMESTAMP}", <#-- Segmentation Keys inclusion --> @@ -246,7 +244,7 @@ <#assign line_detail_priority_date = line.line_detail[0].priority_date?datetime(rfx_date_format_default)?iso_utc /> "PriorityDate": "${line_detail_priority_date}", <#else> - "PriorityDate": "1970-01-01T00:00:00Z", + "PriorityDate": "${DEFAULT_TIMESTAMP}", <#-- Segmentation Keys inclusion --> @@ -369,7 +367,7 @@ <#assign line_detail_priority_date = line.line_detail[0].priority_date?datetime(rfx_date_format_default)?iso_utc /> "PriorityDate": "${line_detail_priority_date}", <#else> - "PriorityDate": "1970-01-01T00:00:00Z", + "PriorityDate": "${DEFAULT_TIMESTAMP}", <#-- Segmentation Keys inclusion --> diff --git a/ReflexUtils.ftl b/ReflexUtils.ftl index 4e183d5..e2f14fc 100644 --- a/ReflexUtils.ftl +++ b/ReflexUtils.ftl @@ -44,4 +44,29 @@ <#local str += "]"> <#return (str)> + + +<#-- --------------------------------------------------------------------------------------- --> +<#-- validate and convert HARDIS WMS date field into UTC timestamp --> +<#-- Example : RfxDatetoTimestampUTC("2025-11-00", "yyyy-MM-dd) --> +<#-- return "2025-11-00T00:00:00Z" --> +<#-- --------------------------------------------------------------------------------------- --> +<#-- Default timestamp to use in case of invalid date --> +<#assign DEFAULT_TIMESTAMP = "1970-01-01T00:00:00Z"> +<#function RfxDatetoTimestampUTC rfxdate rfx_date_format > + <#local fallback = DEFAULT_TIMESTAMP> + + <#if !rfxdate?matches("[0-9]*-[0-9]*-[0-9]*")> + <#return fallback> + + + <#attempt> + <#if rfxdate?? && rfxdate == rfxdate?date(rfx_date_format)?string(rfx_date_format) > + <#return rfxdate?datetime(rfx_date_format)?iso_utc>, + <#else> + <#return fallback> + + <#recover> + <#return fallback> + \ No newline at end of file