diff --git a/ActorPrefix.ftl b/ActorPrefix.ftl index 4756b31..d995203 100644 --- a/ActorPrefix.ftl +++ b/ActorPrefix.ftl @@ -38,7 +38,7 @@ <#local depot = actor> <#else> <#if actor?length gt 4> - <#local depot = actor[4..]> + <#local depot = actor[4..]> <#else> <#local depot = actor> @@ -83,7 +83,7 @@ <#local supplier = actor> <#else> <#if actor?length gt 4> - <#local supplier = actor[4..]> + <#local supplier = actor[4..]> <#else> <#local supplier = actor> @@ -126,7 +126,7 @@ <#local carrier = actor> <#else> <#if actor?length gt 4> - <#local carrier = actor[4..]> + <#local carrier = actor[4..]> <#else> <#local carrier = actor> @@ -169,7 +169,7 @@ <#local consignee = actor> <#else> <#if actor?length gt 4> - <#local consignee = actor[4..]> + <#local consignee = actor[4..]> <#else> <#local consignee = actor> diff --git a/InternalSettings.ftl b/InternalSettings.ftl index 7e2101a..8fc1a3f 100644 --- a/InternalSettings.ftl +++ b/InternalSettings.ftl @@ -2,10 +2,10 @@ <#-- --------------------------------------------------------------------------------------- --> <#-- DeleteEF est un paramètre qui permet de déterminer si l’exécution logistique doit être supprimée lors de la création d’une commande.--> <#-- Attention : si vous choisissez de la supprimer, toutes les métadonnées associées à cette exécution logistique seront également supprimées. --> -<#-- Si DeleteEF_Creation = true, nous ne supprimons pas l'exécution logistique, Si DeleteEF_Creation = false, nous supprimons l'exécution logistique.--> +<#-- Si DeleteEF_Creation = true, nous supprimons l'exécution logistique, Si DeleteEF_Creation = false, nous ne supprimons pas l'exécution logistique.--> <#-- --------------------------------------------------------------------------------------- --> <#-- DeleteEF is a parameter used to determine whether the logistics execution should be deleted when creating an order.--> <#-- Warning: if deletion is selected, all metadata related to the logistics execution will also be removed. --> -<#-- If DeleteEF_Creation = true, we do not delete the logistics execution. If DeleteEF_Creation = false, we delete the logistics execution. --> +<#-- If DeleteEF_Creation = true, we delete the logistics execution. If DeleteEF_Creation = false, we do not delete the logistics execution. --> <#-- --------------------------------------------------------------------------------------- --> <#assign DeleteEF_Creation = true> \ No newline at end of file diff --git a/RFXtoRP_HliAntRecLr.ftl b/RFXtoRP_HliAntRecLr.ftl index 295e220..e119dee 100644 --- a/RFXtoRP_HliAntRecLr.ftl +++ b/RFXtoRP_HliAntRecLr.ftl @@ -11,38 +11,43 @@ <#switch cloudEventMsg.action> <#case "C"> - <#-- *********************************************** Action = CREATE ******************** --> + <#-- *********************************************** Action = CREATE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign ancReceiptLine = JsonUtil.jsonToMap(dataRfx)> - [ + <#assign AncReceipt = JsonUtil.jsonToMap(dataRfx)> + [ + <#if AncReceipt.line_list?? && AncReceipt.line_list[0]??> { - <#stop "create anticipated receipt line"> + <#assign apiReflexPlatformID = ApiReflexPlatformID.OrderLinesAdded> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HliAntRecLr_OrderLinesAdded.ftl"> + }, + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.OrderReceiptExpected> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrAntRec_ReceiptExpected.ftl"> } ] - <#break> + <#else> + <#stop> + + <#break> + <#case "U"> <#-- *********************************************** Action = UPDATE ******************** --> <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign ancReceiptLine = JsonUtil.jsonToMap(dataRfx)> - [ - { - <#stop "update anticipated receipt line"> - } - ] - <#break> - + <#assign AncReceipt = JsonUtil.jsonToMap(dataRfx)> + <#stop> + <#break> <#case "D"> - <#-- *********************************************** Action = DELETE ******************** --> - <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign ancReceiptLine = JsonUtil.jsonToMap(dataRfx)> - [ - { - <#stop "delete anticipated receipt line"> - } - ] - <#break> - - + <#-- *********************************************** Action = DELETE ******************** --> + <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> + <#assign AncReceipt = JsonUtil.jsonToMap(dataRfx)> + <#stop> + <#break> + <#default> <#stop > diff --git a/RFXtoRP_HliAntRecLr_OrderLinesAdded.ftl b/RFXtoRP_HliAntRecLr_OrderLinesAdded.ftl new file mode 100644 index 0000000..4c533a1 --- /dev/null +++ b/RFXtoRP_HliAntRecLr_OrderLinesAdded.ftl @@ -0,0 +1,47 @@ +<#include "ReflexUtils.ftl"> +<#include "HfRpConfig.ftl"> +<#include "ActorPrefix.ftl"> + +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if AncReceipt.anticipated_receipt_reference?? && AncReceipt.anticipated_receipt_reference!=""> + "RefID": "${AncReceipt.anticipated_receipt_reference?json_string}" + <#else> + "RefID": "AR-${AncReceipt.physical_depot_code?trim?json_string}${AncReceipt.activity_code?trim?json_string}${AncReceipt.originator_code?trim?json_string}${AncReceipt.anticipated_receipt_year?json_string}${AncReceipt.anticipated_receipt_number?json_string}" + + }, + "Payload": { + "Lines": [ + <#-- Lines iteration --> + <#list AncReceipt.line_list?filter(l -> l??) as line> + { + <#if line.anticipated_receipt_reference_line_no?? && line.anticipated_receipt_reference_line_no!=0> + "LineID": "${line.anticipated_receipt_reference_line_no}", + <#else> + "LineID": "${line.anticipated_receipt_line_number}", + + <#-- Line Metadata inclusion --> + <#include "RFXtoRP_HsrAntRec_Created_LineMetadata.ftl">, + "RequestedContent":{ + "Goods":{ + "ItemID":"${line.item_code?trim?json_string!"0"}", + "LVBranchID":"${line.item_lv_code?trim?json_string!"0"}", + <#-- Segmentation Keys inclusion --> + <#include "RFXtoRP_HsrAntRec_Created_SegmentationKeys.ftl"> + }, + "Quantity" : + { + "LVID": "${quantity_in_base_lv_RP_Cst}", + "Value": ${line.planned_quantity_in_base_lv!0} + } + } + }<#sep>, + + ] + } +} +] diff --git a/RFXtoRP_HsaDispute_Created.ftl b/RFXtoRP_HsaDispute_Created.ftl index bcb8dfd..2930282 100644 --- a/RFXtoRP_HsaDispute_Created.ftl +++ b/RFXtoRP_HsaDispute_Created.ftl @@ -7,6 +7,7 @@ "ProjectID": "${projectRP}" }, "ID": { + <#-- for Claim on preparation --> <#if dispute.dispute_preparation??> <#if dispute.dispute_preparation.preparation_order_list?? && dispute.dispute_preparation.preparation_order_list?size != 0> "RefID": "${dispute.dispute_preparation.preparation_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_preparation.preparation_activity_code?replace(" ","")?json_string}${dispute.dispute_preparation.preparation_order_list[0].preparation_order_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" @@ -14,8 +15,14 @@ <#stop "preparation order list is empty" > <#else> + <#-- for Claim on reception --> <#if dispute.dispute_reception??> - "RefID": "${dispute.dispute_reception.reception_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_activity_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" + "RefID": "${dispute.dispute_reception.reception_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_activity_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" + <#else> + <#-- for Claim on anticipated receipt --> + <#if dispute.dispute_anticipated_receipt??> + "RefID": "${dispute.dispute_anticipated_receipt.anticipated_receipt_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_activity_code?replace(" ","")?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" + }, @@ -43,7 +50,8 @@ <#include "RFXtoRP_HsaDispute_ClaimMetadata.ftl">, <#-- To configure --> <#include "RFXtoRP_HsaDispute_TableReasonCodeToClaimTypeID.ftl"> - <#if dispute.dispute_type_code=="050" > <#-- Preparation --> + <#-- for Claim on preparation --> + <#if dispute.dispute_type_code=="050" > <#if dispute.dispute_preparation.preparation_order_list[0].preparation_order_contractor_reference?? && dispute.dispute_preparation.preparation_order_list[0].preparation_order_contractor_reference!=""> "EntityID":"${dispute.dispute_preparation.preparation_order_list[0].preparation_order_physical_depot_code?trim?json_string}${dispute.dispute_preparation.preparation_order_list[0].preparation_order_activity_code?trim?json_string}${dispute.dispute_preparation.preparation_order_list[0].preparation_order_contractor_code?trim?json_string}${dispute.dispute_preparation.preparation_order_list[0].preparation_order_contractor_reference?trim?json_string}", "DisplayID":"${dispute.dispute_preparation.preparation_order_list[0].preparation_order_contractor_reference?trim?json_string}", @@ -52,6 +60,7 @@ "DisplayID":"O${dispute.dispute_preparation.preparation_order_list[0].preparation_order_physical_depot_code?trim?json_string}${dispute.dispute_preparation.preparation_order_list[0].preparation_order_activity_code?trim?json_string}${dispute.dispute_preparation.preparation_order_list[0].preparation_order_contractor_code?trim?json_string}${dispute.dispute_preparation.preparation_order_list[0].preparation_order_year_number?trim?json_string}${dispute.dispute_preparation.preparation_order_list[0].preparation_order_number?trim?json_string}", <#else> + <#-- for Claim on receipt --> <#if dispute.dispute_type_code=="030" || dispute.dispute_type_code=="070" > <#if dispute.dispute_reception.reception_type_code=="030"> <#-- Receipt transfer type --> <#if dispute.dispute_reception.reception_supplier.supplier_transfer_physical_depot?? && dispute.dispute_reception.reception_supplier.supplier_transfer_physical_depot!="" > @@ -74,11 +83,26 @@ <#stop "WMS type code not supported"> + <#-- for Claim on anticipated receipt --> + <#else> + <#if dispute.dispute_type_code=="020" > + <#if dispute.dispute_anticipated_receipt.anticipated_receipt_reference?? && dispute.dispute_anticipated_receipt.anticipated_receipt_reference!=""> + "EntityID":"${dispute.dispute_anticipated_receipt.anticipated_receipt_reference?json_string}", + "DisplayID":"${dispute.dispute_anticipated_receipt.anticipated_receipt_reference?json_string}", + <#else> + "EntityID":"AR-${dispute.dispute_anticipated_receipt.anticipated_receipt_physical_depot_code?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_activity_code?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_contractor_code?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_year_number?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_number?json_string}", + "DisplayID":"AR-${dispute.dispute_anticipated_receipt.anticipated_receipt_physical_depot_code?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_activity_code?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_contractor_code?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_year_number?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_number?json_string}", + + <#if TableReasonCode[dispute.dispute_reason_code]??> - "ClaimTypeID":"CLAIMTYPE_${projectRP}_EXECUTIONFLOW_${TableReasonCode[dispute.dispute_reason_code]}" + <#if dispute.dispute_type_code=="020" > + "ClaimTypeID":"CLAIMTYPE_${projectRP}_ORDER_${TableReasonCode[dispute.dispute_reason_code]}" + <#else> + "ClaimTypeID":"CLAIMTYPE_${projectRP}_EXECUTIONFLOW_${TableReasonCode[dispute.dispute_reason_code]}" + <#else> <#stop "Claim reason code not supported" > diff --git a/RFXtoRP_HsaDispute_MessageSent.ftl b/RFXtoRP_HsaDispute_MessageSent.ftl index 6b59ba0..312a186 100644 --- a/RFXtoRP_HsaDispute_MessageSent.ftl +++ b/RFXtoRP_HsaDispute_MessageSent.ftl @@ -6,15 +6,23 @@ "ProjectID": "${projectRP}" }, "ID": { - <#if dispute.dispute_preparation??> - <#if dispute.dispute_preparation.preparation_order_list?? && dispute.dispute_preparation.preparation_order_list?size != 0> + <#-- for Claim on preparation --> + <#-- for Claim on preparation --> + <#if dispute.dispute_preparation??> + <#if dispute.dispute_preparation.preparation_order_list?? && dispute.dispute_preparation.preparation_order_list?size != 0> "RefID": "${dispute.dispute_preparation.preparation_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_preparation.preparation_activity_code?replace(" ","")?json_string}${dispute.dispute_preparation.preparation_order_list[0].preparation_order_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" <#else> <#stop "preparation order list is empty" > <#else> + <#-- for Claim on reception --> <#if dispute.dispute_reception??> - "RefID": "${dispute.dispute_reception.reception_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_activity_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" + "RefID": "${dispute.dispute_reception.reception_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_activity_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" + <#else> + <#-- for Claim on anticipated receipt --> + <#if dispute.dispute_anticipated_receipt??> + "RefID": "${dispute.dispute_anticipated_receipt.anticipated_receipt_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_activity_code?replace(" ","")?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" + }, @@ -25,6 +33,10 @@ <#else> <#if dispute.dispute_reception??> "Message": "${dispute.dispute_reception.reception_reference?trim?json_string}" + <#else> + <#if dispute.dispute_anticipated_receipt??> + "Message": "${dispute.dispute_anticipated_receipt.anticipated_receipt_reference?trim?json_string}" + @@ -36,15 +48,22 @@ "ProjectID": "${projectRP}" }, "ID": { + <#-- for Claim on preparation --> <#if dispute.dispute_preparation??> - <#if dispute.dispute_preparation.preparation_order_list?? && dispute.dispute_preparation.preparation_order_list?size != 0> + <#if dispute.dispute_preparation.preparation_order_list?? && dispute.dispute_preparation.preparation_order_list?size != 0> "RefID": "${dispute.dispute_preparation.preparation_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_preparation.preparation_activity_code?replace(" ","")?json_string}${dispute.dispute_preparation.preparation_order_list[0].preparation_order_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" <#else> <#stop "preparation order list is empty" > <#else> + <#-- for Claim on reception --> <#if dispute.dispute_reception??> - "RefID": "${dispute.dispute_reception.reception_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_activity_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" + "RefID": "${dispute.dispute_reception.reception_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_activity_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" + <#else> + <#-- for Claim on anticipated receipt --> + <#if dispute.dispute_anticipated_receipt??> + "RefID": "${dispute.dispute_anticipated_receipt.anticipated_receipt_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_activity_code?replace(" ","")?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" + }, @@ -58,15 +77,22 @@ "ProjectID": "${projectRP}" }, "ID": { + <#-- for Claim on preparation --> <#if dispute.dispute_preparation??> - <#if dispute.dispute_preparation.preparation_order_list?? && dispute.dispute_preparation.preparation_order_list?size != 0> + <#if dispute.dispute_preparation.preparation_order_list?? && dispute.dispute_preparation.preparation_order_list?size != 0> "RefID": "${dispute.dispute_preparation.preparation_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_preparation.preparation_activity_code?replace(" ","")?json_string}${dispute.dispute_preparation.preparation_order_list[0].preparation_order_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" <#else> <#stop "preparation order list is empty" > <#else> + <#-- for Claim on reception --> <#if dispute.dispute_reception??> - "RefID": "${dispute.dispute_reception.reception_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_activity_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" + "RefID": "${dispute.dispute_reception.reception_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_activity_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" + <#else> + <#-- for Claim on anticipated receipt --> + <#if dispute.dispute_anticipated_receipt??> + "RefID": "${dispute.dispute_anticipated_receipt.anticipated_receipt_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_activity_code?replace(" ","")?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" + }, @@ -80,15 +106,22 @@ "ProjectID": "${projectRP}" }, "ID": { + <#-- for Claim on preparation --> <#if dispute.dispute_preparation??> - <#if dispute.dispute_preparation.preparation_order_list?? && dispute.dispute_preparation.preparation_order_list?size != 0> + <#if dispute.dispute_preparation.preparation_order_list?? && dispute.dispute_preparation.preparation_order_list?size != 0> "RefID": "${dispute.dispute_preparation.preparation_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_preparation.preparation_activity_code?replace(" ","")?json_string}${dispute.dispute_preparation.preparation_order_list[0].preparation_order_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" <#else> <#stop "preparation order list is empty" > <#else> + <#-- for Claim on reception --> <#if dispute.dispute_reception??> - "RefID": "${dispute.dispute_reception.reception_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_activity_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" + "RefID": "${dispute.dispute_reception.reception_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_activity_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" + <#else> + <#-- for Claim on anticipated receipt --> + <#if dispute.dispute_anticipated_receipt??> + "RefID": "${dispute.dispute_anticipated_receipt.anticipated_receipt_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_activity_code?replace(" ","")?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" + }, @@ -102,15 +135,22 @@ "ProjectID": "${projectRP}" }, "ID": { + <#-- for Claim on preparation --> <#if dispute.dispute_preparation??> - <#if dispute.dispute_preparation.preparation_order_list?? && dispute.dispute_preparation.preparation_order_list?size != 0> + <#if dispute.dispute_preparation.preparation_order_list?? && dispute.dispute_preparation.preparation_order_list?size != 0> "RefID": "${dispute.dispute_preparation.preparation_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_preparation.preparation_activity_code?replace(" ","")?json_string}${dispute.dispute_preparation.preparation_order_list[0].preparation_order_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" <#else> <#stop "preparation order list is empty" > <#else> + <#-- for Claim on reception --> <#if dispute.dispute_reception??> - "RefID": "${dispute.dispute_reception.reception_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_activity_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" + "RefID": "${dispute.dispute_reception.reception_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_activity_code?replace(" ","")?json_string}${dispute.dispute_reception.reception_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" + <#else> + <#-- for Claim on anticipated receipt --> + <#if dispute.dispute_anticipated_receipt??> + "RefID": "${dispute.dispute_anticipated_receipt.anticipated_receipt_physical_depot_code?replace(" ","")?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_activity_code?replace(" ","")?json_string}${dispute.dispute_anticipated_receipt.anticipated_receipt_contractor_code?replace(" ","")?json_string}${dispute.dispute_year_number?replace(" ","")?json_string}${dispute.dispute_number?replace(" ","")?json_string}" + }, diff --git a/RFXtoRP_HsaIpgMove_GoodsReceived.ftl b/RFXtoRP_HsaIpgMove_GoodsReceived.ftl index c0d861b..eebe3e3 100644 --- a/RFXtoRP_HsaIpgMove_GoodsReceived.ftl +++ b/RFXtoRP_HsaIpgMove_GoodsReceived.ftl @@ -29,32 +29,27 @@ <#-- Goods received Segmentation Keys inclusion --> <#include "RFXtoRP_HsaIpgMove_GoodsReceived_SegmentationKeys.ftl"> }, - <#if reflexMvtStockInterface.ipg_move_type?? & reflexMvtStockInterface.ipg_move_type=="120"> <#-- if it is a transfer-type movement --> + <#if reflexMvtStockInterface.ipg_move_type?? && reflexMvtStockInterface.ipg_move_type=="120"> <#-- if it is a transfer-type movement --> <#if reflexMvtStockInterface.origin_order_line_reference?? && reflexMvtStockInterface.origin_order_line_reference!=""> "ExecutionflowID": "${reflexMvtStockInterface.original_receipt_physical_depot_code}${reflexMvtStockInterface.activity_code}${reflexMvtStockInterface.originator_code}${reflexMvtStockInterface.origin_order_line_reference?trim?json_string}", - "OrderID": "${reflexMvtStockInterface.origin_order_line_reference?trim?json_string}", <#else> <#if reflexMvtStockInterface.receipt_reference?? && reflexMvtStockInterface.receipt_reference!="" && !reflexMvtStockInterface.receipt_reference?starts_with(reflexMvtStockInterface.original_receipt_physical_depot_code + reflexMvtStockInterface.activity_code + reflexMvtStockInterface.receipt_year_number)> "ExecutionflowID": "${reflexMvtStockInterface.original_receipt_physical_depot_code}${reflexMvtStockInterface.activity_code}${reflexMvtStockInterface.originator_code}${reflexMvtStockInterface.receipt_reference?trim?json_string}", - "OrderID": "${reflexMvtStockInterface.receipt_reference?trim?json_string}", <#else> "ExecutionflowID": "R${reflexMvtStockInterface.physical_depot_code}${reflexMvtStockInterface.activity_code}${reflexMvtStockInterface.originator_code}${reflexMvtStockInterface.receipt_year_number}${reflexMvtStockInterface.receipt_number}", - "OrderID": "R${reflexMvtStockInterface.physical_depot_code}${reflexMvtStockInterface.activity_code}${reflexMvtStockInterface.originator_code}${reflexMvtStockInterface.receipt_year_number}${reflexMvtStockInterface.receipt_number}", <#else> - <#if reflexMvtStockInterface.receipt_reference?? && reflexMvtStockInterface.receipt_reference!=""> "ExecutionflowID": "R${reflexMvtStockInterface.physical_depot_code}${reflexMvtStockInterface.activity_code}${reflexMvtStockInterface.originator_code}${reflexMvtStockInterface.receipt_year_number}${reflexMvtStockInterface.receipt_number}", - "OrderID": "${reflexMvtStockInterface.receipt_reference?trim?json_string}", - <#else> - "ExecutionflowID": "R${reflexMvtStockInterface.physical_depot_code}${reflexMvtStockInterface.activity_code}${reflexMvtStockInterface.originator_code}${reflexMvtStockInterface.receipt_year_number}${reflexMvtStockInterface.receipt_number}", - "OrderID": "R${reflexMvtStockInterface.physical_depot_code}${reflexMvtStockInterface.activity_code}${reflexMvtStockInterface.originator_code}${reflexMvtStockInterface.receipt_year_number}${reflexMvtStockInterface.receipt_number}", - - <#if reflexMvtStockInterface.origin_order_line_number_reference?? && reflexMvtStockInterface.origin_order_line_number_reference!=0> + <#if reflexMvtStockInterface.origin_order_line_number_reference?? && reflexMvtStockInterface.origin_order_line_number_reference!=0 && reflexMvtStockInterface.ipg_move_type=="120"> "LineID": "${reflexMvtStockInterface.origin_order_line_number_reference}", <#else> - "LineID": "${reflexMvtStockInterface.receipt_line_number}", + <#if reflexMvtStockInterface.line_number_reference?? && reflexMvtStockInterface.line_number_reference!=0> + "LineID": "${reflexMvtStockInterface.line_number_reference}", + <#else> + "LineID": "${reflexMvtStockInterface.receipt_line_number}", + "ActorID": "${RFXtoRPprefixDepot(reflexMvtStockInterface.physical_depot_code?trim?json_string)}", "Quantity": { diff --git a/RFXtoRP_HsrAntRec.ftl b/RFXtoRP_HsrAntRec.ftl index 976149f..1c578e2 100644 --- a/RFXtoRP_HsrAntRec.ftl +++ b/RFXtoRP_HsrAntRec.ftl @@ -1,5 +1,5 @@ <#-- **** input parameters ***** --> -<#-- input : message HARDIS WMS --> +<#-- input : message HARDIS WMS for anticipated receipt --> <#-- project : projectId in HARDIS SC NETWORK --> <#-- organisation : organisationtId in HARDIS SC NETWORK --> @@ -14,31 +14,67 @@ <#-- *********************************************** Action = CREATE ******************** --> <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign ancReceipt = JsonUtil.jsonToMap(dataRfx)> - [ + <#assign AncReceipt = JsonUtil.jsonToMap(dataRfx)> + [ + <#if AncReceipt.line_list?? && AncReceipt.line_list[0]??> { - <#stop > - } + <#assign apiReflexPlatformID = ApiReflexPlatformID.OrderCreated> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrAntRec_Created.ftl"> + }, + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.OrderReceiptExpected> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrAntRec_ReceiptExpected.ftl"> + } ] + <#else> + <#stop> + <#break> <#case "U"> <#-- *********************************************** Action = UPDATE ******************** --> <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign ancReceipt = JsonUtil.jsonToMap(dataRfx)> + <#assign AncReceipt = JsonUtil.jsonToMap(dataRfx)> [ - { - <#stop > - } + <#if AncReceipt.generated?? && AncReceipt.generated.total_level_1_quantity==0 && AncReceipt.generated.total_level_2_quantity==0 && AncReceipt.generated.total_level_3_quantity==0 && AncReceipt.anticipated_receipt_closed == "true" > + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.OrderCancelled> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrAntRec_Cancelled.ftl"> + } + <#else> + <#if AncReceipt.anticipated_receipt_closed == "true" > + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.OrderAppointmentBookingDisabled> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrAntRec_AppointmentBookingDisabled.ftl"> + }, + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.OrderAnticipatedClosed> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrAntRec_AnticipatedClosed.ftl"> + } + + ] <#break> <#case "D"> <#-- *********************************************** Action = DELETE ******************** --> <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> - <#assign ancReceipt = JsonUtil.jsonToMap(dataRfx)> + <#assign AncReceipt = JsonUtil.jsonToMap(dataRfx)> [ - { - <#stop > + { + <#assign apiReflexPlatformID = ApiReflexPlatformID.OrderCancelled> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_HsrAntRec_Cancelled.ftl"> } ] <#break> diff --git a/RFXtoRP_HsrAntRec_AnticipatedClosed.ftl b/RFXtoRP_HsrAntRec_AnticipatedClosed.ftl new file mode 100644 index 0000000..79bd122 --- /dev/null +++ b/RFXtoRP_HsrAntRec_AnticipatedClosed.ftl @@ -0,0 +1,25 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> +<#--<#assign receipt_status_datetime = RfxDateTimetoUTCWithTimezone(receipt.creation_datetime,time_zone_rfx) /> --> +<#assign now = .now?string("yyyy-MM-dd'T'HH:mm:ss'Z'") /> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if AncReceipt.anticipated_receipt_reference?? && AncReceipt.anticipated_receipt_reference!=""> + "RefID": "${AncReceipt.anticipated_receipt_reference?json_string}", + <#else> + "RefID": "AR-${AncReceipt.physical_depot_code?json_string}${AncReceipt.activity_code?json_string}${AncReceipt.originator_code?json_string}${AncReceipt.anticipated_receipt_year?json_string}${AncReceipt.anticipated_receipt_number?json_string}", + + "RefDate": { + "DateTime": "${now}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + + "Payload": {} + + } +] \ No newline at end of file diff --git a/RFXtoRP_HsrAntRec_AppointmentBookingDisabled.ftl b/RFXtoRP_HsrAntRec_AppointmentBookingDisabled.ftl new file mode 100644 index 0000000..79bd122 --- /dev/null +++ b/RFXtoRP_HsrAntRec_AppointmentBookingDisabled.ftl @@ -0,0 +1,25 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> +<#--<#assign receipt_status_datetime = RfxDateTimetoUTCWithTimezone(receipt.creation_datetime,time_zone_rfx) /> --> +<#assign now = .now?string("yyyy-MM-dd'T'HH:mm:ss'Z'") /> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if AncReceipt.anticipated_receipt_reference?? && AncReceipt.anticipated_receipt_reference!=""> + "RefID": "${AncReceipt.anticipated_receipt_reference?json_string}", + <#else> + "RefID": "AR-${AncReceipt.physical_depot_code?json_string}${AncReceipt.activity_code?json_string}${AncReceipt.originator_code?json_string}${AncReceipt.anticipated_receipt_year?json_string}${AncReceipt.anticipated_receipt_number?json_string}", + + "RefDate": { + "DateTime": "${now}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + + "Payload": {} + + } +] \ No newline at end of file diff --git a/RFXtoRP_HsrAntRec_Cancelled.ftl b/RFXtoRP_HsrAntRec_Cancelled.ftl new file mode 100644 index 0000000..274abdd --- /dev/null +++ b/RFXtoRP_HsrAntRec_Cancelled.ftl @@ -0,0 +1,25 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> +<#--<#assign receipt_status_datetime = RfxDateTimetoUTCWithTimezone(receipt.creation_datetime,time_zone_rfx) /> --> +<#assign now = .now?string("yyyy-MM-dd'T'HH:mm:ss'Z'") /> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if AncReceipt.anticipated_receipt_reference?? && AncReceipt.anticipated_receipt_reference!=""> + "RefID": "${AncReceipt.anticipated_receipt_reference?json_string}", + <#else> + "RefID": "AR-${AncReceipt.physical_depot_code?json_string}${AncReceipt.activity_code?json_string}${AncReceipt.originator_code?json_string}${AncReceipt.anticipated_receipt_year?json_string}${AncReceipt.anticipated_receipt_number?json_string}", + + "RefDate": { + "DateTime": "${now}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + + "Payload": {} + + } +] diff --git a/RFXtoRP_HsrAntRec_Created.ftl b/RFXtoRP_HsrAntRec_Created.ftl new file mode 100644 index 0000000..b7f0b78 --- /dev/null +++ b/RFXtoRP_HsrAntRec_Created.ftl @@ -0,0 +1,115 @@ +<#include "ReflexUtils.ftl"> +<#include "HfRpConfig.ftl"> +<#include "ActorPrefix.ftl"> + +[ + { + <#assign receipt_datetime = RfxDateTimetoUTCWithTimezone(AncReceipt.planned_receipt_datetime,time_zone_rfx) /> + <#assign now = .now?string("yyyy-MM-dd'T'HH:mm:ss'Z'") /> + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + "CustomFields": [ + { + "Key": "anticipated_receipt_reference", + "Value": "${AncReceipt.anticipated_receipt_reference?json_string}" + }, + { + "Key": "anticipated_receipt_year", + "Value": "${AncReceipt.anticipated_receipt_year?json_string}" + }, + { + "Key": "anticipated_receipt_number", + "Value": "${AncReceipt.anticipated_receipt_number?json_string}" + }, + { + "Key": "originator_code", + "Value": "${AncReceipt.originator_code?json_string}" + }, + { + "Key": "activity_code", + "Value": "${AncReceipt.activity_code?json_string}" + }, + { + "Key": "depot_code", + "Value": "${AncReceipt.physical_depot_code?json_string}" + }, + { + "Key": "anticipated", + "Value": "true" + }, + { + "Key": "planned_receipt_datetime", + "Value": "${AncReceipt.planned_receipt_datetime?substring(0,10)?json_string}" + } + ], + <#if AncReceipt.anticipated_receipt_reference?? && AncReceipt.anticipated_receipt_reference!=""> + "RefID": "${AncReceipt.anticipated_receipt_reference?json_string}" + <#else> + "RefID": "AR-${AncReceipt.physical_depot_code?trim?json_string}${AncReceipt.activity_code?trim?json_string}${AncReceipt.originator_code?trim?json_string}${AncReceipt.anticipated_receipt_year?json_string}${AncReceipt.anticipated_receipt_number?json_string}" + + }, + "Payload": { + "ShipFrom": { + "ActorID": "${RFXtoRPprefixSupplier(AncReceipt.original_code?json_string)}" + }, + "ShipTo": { + "ActorID": "${RFXtoRPprefixDepot(AncReceipt.physical_depot_code?json_string)}" + }, + "CreationDateTime": { + "DateTime": "${now}", + "AuthorTimeZone": "${time_zone_rfx}" + }, + "LanguageCodeISO6391":"fr", + "Anticipated": true, + <#-- Header Metadata inclusion --> + <#include "RFXtoRP_HsrAntRec_Created_HeaderMetadata.ftl">, + "Lines": [ + <#-- Lines iteration --> + <#list AncReceipt.line_list?filter(l -> l??) as line> + { + <#if line.anticipated_receipt_reference_line_no?? && line.anticipated_receipt_reference_line_no!=0> + "LineID": "${line.anticipated_receipt_reference_line_no}", + <#else> + "LineID": "${line.anticipated_receipt_line_number}", + + <#-- Line Metadata inclusion --> + <#include "RFXtoRP_HsrAntRec_Created_LineMetadata.ftl">, + "RequestedContent":{ + "Goods":{ + "ItemID":"${line.item_code?trim?json_string!"0"}", + "LVBranchID":"${line.item_lv_code?trim?json_string!"0"}", + <#-- Segmentation Keys inclusion --> + <#include "RFXtoRP_HsrAntRec_Created_SegmentationKeys.ftl"> + }, + "Quantity" : + { + "LVID": "${quantity_in_base_lv_RP_Cst}", + "Value": ${line.planned_quantity_in_base_lv!0} + } + } + }<#sep>, + + ] + <#if AncReceipt.planned_receipt_datetime?? && AncReceipt.planned_receipt_datetime!="0000-00-00T00:00:00"> + , + "RequestedMilestones" : + { + "RequestedDeliveryDateTime" : + { + "DateTime": "${receipt_datetime}", + "AuthorTimeZone": "${time_zone_rfx}" + } + } + + <#if AncReceipt.carrier_code?? && AncReceipt.carrier_code != ""> + , + "Carrier": + { + "ActorID":"${RFXtoRPprefixCarrier(AncReceipt.carrier_code?trim?json_string)}" + } + + } +} +] diff --git a/RFXtoRP_HsrAntRec_Created_HeaderMetadata.ftl b/RFXtoRP_HsrAntRec_Created_HeaderMetadata.ftl new file mode 100644 index 0000000..40f44a9 --- /dev/null +++ b/RFXtoRP_HsrAntRec_Created_HeaderMetadata.ftl @@ -0,0 +1,19 @@ +<#-- use protobuf of class HsrReceiptList to find HARDIS WMS fields names --> + +<#-- +<#-- Best practices: + If the SK is of type: + - string: add ?json_string (e.g. "${stock.batch_1?json_string}") + - boolean: possible values: true and false + - datetime: expected format: 2025-10-30T10:12:10.000Z + - decimal number: the separator is a point (e.g. 10.5) +"MetaData": [ + { + "Key": "OrderType", + "Value": { "String" : "${order.optional_attributes.reason_code}"} + } + ], +--> + + +"MetaData": [ ] \ No newline at end of file diff --git a/RFXtoRP_HsrAntRec_Created_LineMetadata.ftl b/RFXtoRP_HsrAntRec_Created_LineMetadata.ftl new file mode 100644 index 0000000..b920b69 --- /dev/null +++ b/RFXtoRP_HsrAntRec_Created_LineMetadata.ftl @@ -0,0 +1,10 @@ +<#-- use protobuf of class HsrReceiptList to find HARDIS WMS fields names --> + +<#-- Best practices: + If the SK is of type: + - string: add ?json_string (e.g. "${stock.batch_1?json_string}") + - boolean: possible values: true and false + - datetime: expected format: 2025-10-30T10:12:10.000Z + - decimal number: the separator is a point (e.g. 10.5)--> + +"MetaData": [ ] \ No newline at end of file diff --git a/RFXtoRP_HsrAntRec_Created_SegmentationKeys.ftl b/RFXtoRP_HsrAntRec_Created_SegmentationKeys.ftl new file mode 100644 index 0000000..de24f8b --- /dev/null +++ b/RFXtoRP_HsrAntRec_Created_SegmentationKeys.ftl @@ -0,0 +1,47 @@ +<#-- use protobuf of class HsrReceiptList to find HARDIS WMS fields names --> + +<#-- +<#-- Best practices: + If the SK is of type: + - string: add ?json_string (e.g. "${stock.batch_1?json_string}") + - boolean: possible values: true and false + - datetime: expected format: 2025-10-30T10:12:10.000Z + - decimal number: the separator is a point (e.g. 10.5) +"SegmentationKeys": [ + { + "Key": "Grade", + "Value": { "String" : "${line.grade_code}"} + }, + { + "Key": "Owner", + "Value": { "String" : "${line.owner_code}"} + }, + { + "Key": "BatchNumber", + <#if reflexMvtStockInterface.batch_1 == ""> + "Value": { "String" : "no batch"} + <#else> + "Value": { "String" : "${line_without_detail.batch_1}"} + + }, + { + "Key": "HeldForSpecificCode", + <#if line_without_detail.hold_for_specific_code == "true"> + "Value": { "Bool" : "True"} + <#else> + "Value": { "Bool" : "False"} + }, + + { + <#assign manufacturing_date = line_without_detail.ipg_date_of_manufacture_date?datetime(rfx_date_format_default)?iso_utc /> + "Key": "ManufacturingDate", + "Value": "Timestamp": { + "AuthorTimeZone": "${time_zone_rfx}", + "DateTime": "${manufacturing_date}" + } + } + + ] + +--> +"SegmentationKeys": [ ] \ No newline at end of file diff --git a/RFXtoRP_HsrAntRec_ReceiptCompleted.ftl b/RFXtoRP_HsrAntRec_ReceiptCompleted.ftl new file mode 100644 index 0000000..aa64359 --- /dev/null +++ b/RFXtoRP_HsrAntRec_ReceiptCompleted.ftl @@ -0,0 +1,25 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> +<#--<#assign receipt_status_datetime = RfxDateTimetoUTCWithTimezone(receipt.creation_datetime,time_zone_rfx) /> --> +<#assign now = .now?string("yyyy-MM-dd'T'HH:mm:ss'Z'") /> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if AncReceipt.anticipated_receipt_reference?? && AncReceipt.anticipated_receipt_reference!=""> + "RefID": "${AncReceipt.anticipated_receipt_reference?json_string}", + <#else> + "RefID": "AR-${AncReceipt.physical_depot_code?trim?json_string}${AncReceipt.activity_code?trim?json_string}${AncReceipt.originator_code?trim?json_string}${AncReceipt.anticipated_receipt_year?json_string}${AncReceipt.anticipated_receipt_number?json_string}", + + "RefDate": { + "DateTime": "${now}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + + "Payload": {} + + } +] diff --git a/RFXtoRP_HsrAntRec_ReceiptExpected.ftl b/RFXtoRP_HsrAntRec_ReceiptExpected.ftl new file mode 100644 index 0000000..fcbc6eb --- /dev/null +++ b/RFXtoRP_HsrAntRec_ReceiptExpected.ftl @@ -0,0 +1,25 @@ +<#include "HfRpConfig.ftl"> +<#include "ReflexUtils.ftl"> +<#--<#assign receipt_status_datetime = RfxDateTimetoUTCWithTimezone(receipt.creation_datetime,time_zone_rfx) /> --> +<#assign now = .now?string("yyyy-MM-dd'T'HH:mm:ss'Z'") /> +[ + { + "Header": { + "ProjectID": "${projectRP}" + }, + "ID": { + <#if AncReceipt.anticipated_receipt_reference?? && AncReceipt.anticipated_receipt_reference!=""> + "RefID": "${AncReceipt.anticipated_receipt_reference?json_string}", + <#else> + "RefID": "AR-${AncReceipt.physical_depot_code?trim?json_string}${AncReceipt.activity_code?trim?json_string}${AncReceipt.originator_code?trim?json_string}${AncReceipt.anticipated_receipt_year?json_string}${AncReceipt.anticipated_receipt_number?json_string}", + + "RefDate": { + "DateTime": "${now}", + "AuthorTimeZone": "${time_zone_rfx}" + } + }, + + "Payload": {} + + } +] diff --git a/RFXtoRP_HsrCarrierApt_BookingForceBookAppointment.ftl b/RFXtoRP_HsrCarrierApt_BookingForceBookAppointment.ftl index b45dee9..f52f7fe 100644 --- a/RFXtoRP_HsrCarrierApt_BookingForceBookAppointment.ftl +++ b/RFXtoRP_HsrCarrierApt_BookingForceBookAppointment.ftl @@ -107,60 +107,85 @@ <#include "RFXtoRP_HsrCarrierApt_SegmentationSelections.ftl">, <#include "RFXtoRP_HsrCarrierApt_CarrierInformation.ftl">, <#include "RFXtoRP_HsrCarrierApt_MetadataAppointment.ftl">, - <#if carrier_apt.physical_receipt_list?? && (carrier_apt.physical_receipt_list?filter(l ->l??)?size != 0)> - "Unloading" : - { - "Projects" : [{ - "Commissions": [ - <#list carrier_apt.physical_receipt_list?filter(l ->l??) as physical_receipt> - { - "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}", - <#if physical_receipt.physical_receipt_reference?? && physical_receipt.physical_receipt_reference!=""> - "OrderID": "${physical_receipt.physical_receipt_reference?json_string}", - <#else> - "OrderID": "R${carrier_apt.physical_depot?json_string}${physical_receipt.receipt_activity?json_string}${physical_receipt.originator_code?json_string}${physical_receipt.receipt_year}${physical_receipt.receipt_number}", - - "ExecutionflowID": "R${carrier_apt.physical_depot?json_string}${physical_receipt.receipt_activity?json_string}${physical_receipt.originator_code?json_string}${physical_receipt.receipt_year?json_string}${physical_receipt.receipt_number?json_string}", - "ProjectID": "${projectRP}", - "PartnerAppID": "${partnerApplicationRP}", - "OrganisationID": "${organisationRP}" - }<#sep>, - - ], - "ProjectID" : "${projectRP}" - }] - }, - <#else> - <#if appointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING> - "Unloading" : - <#else> - "Loading" : - - { - "Projects" : [{ - "Commissions": [{ - "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}", - "ProjectID": "${projectRP}", - "PartnerAppID": "${partnerApplicationRP}", - "OrganisationID": "${organisationRP}" - }], - "ProjectID" : "${projectRP}" - }] - }, - <#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "true"> - "Reason": "UNLOADING AND LOADING / ${carrier_apt.appointment_designation?json_string}", - <#else> - <#if carrier_apt.appointment_designation?? && carrier_apt.appointment_designation!=""> - "Reason": "${carrier_apt.appointment_designation?json_string}", - <#else> - <#if carrier_apt.appointment_reference?? && carrier_apt.appointment_reference!=""> - "Reason": "${carrier_apt.appointment_reference?json_string}", - <#else> - "Reason": "${carrier_apt.year_number}-${carrier_apt.appointment_number}", + <#-- Add commissions for anticipated and physical receipts if they exist --> + <#if ( (carrier_apt.anticipated_receipt_list?? && (carrier_apt.anticipated_receipt_list?filter(l ->l??)?size != 0)) || (carrier_apt.physical_receipt_list?? && (carrier_apt.physical_receipt_list?filter(l ->l??)?size != 0))) > + <#assign AddComma = false /> + "Unloading" : + { + "Projects" : [ + { + "Commissions": [ + <#list (carrier_apt.physical_receipt_list![])?filter(l -> l??) as physical_receipt> + { + <#assign AddComma = true /> + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}", + <#if physical_receipt.physical_receipt_reference?? && physical_receipt.physical_receipt_reference!=""> + "OrderID": "${physical_receipt.physical_receipt_reference?json_string}", + <#else> + "OrderID": "R${carrier_apt.physical_depot?json_string}${physical_receipt.receipt_activity?json_string}${physical_receipt.originator_code?json_string}${physical_receipt.receipt_year}${physical_receipt.receipt_number}", + + "ExecutionflowID": "R${carrier_apt.physical_depot?json_string}${physical_receipt.receipt_activity?json_string}${physical_receipt.originator_code?json_string}${physical_receipt.receipt_year?json_string}${physical_receipt.receipt_number?json_string}", + "ProjectID": "${projectRP}", + "PartnerAppID": "${partnerApplicationRP}", + "OrganisationID": "${organisationRP}" + }<#sep>, + + + <#list (carrier_apt.anticipated_receipt_list![])?filter(l -> l??) as anticipated_receipt> + <#if AddComma == true> + , + <#assign AddComma = false /> + { + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}", + <#if anticipated_receipt.anticipated_receipt_reference?? && anticipated_receipt.anticipated_receipt_reference!=""> + "OrderID": "${anticipated_receipt.anticipated_receipt_reference?json_string}", + <#else> + "OrderID": "AR${carrier_apt.physical_depot?json_string}${anticipated_receipt.activity?json_string}${anticipated_receipt.originator_code?json_string}${anticipated_receipt.anticipated_receipt_year}${anticipated_receipt.anticipated_receipt_number}", + + "ProjectID": "${projectRP}", + "PartnerAppID": "${partnerApplicationRP}", + "OrganisationID": "${organisationRP}" + }<#sep>, + + ], + "ProjectID" : "${projectRP}" + }] + }, + <#else> + <#if appointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING> + "Unloading" : + <#else> + "Loading" : + + { + "Projects" : [ + { + "Commissions": [ + { + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}", + "ProjectID": "${projectRP}", + "PartnerAppID": "${partnerApplicationRP}", + "OrganisationID": "${organisationRP}" + } + ], + "ProjectID" : "${projectRP}" + }] + }, + <#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "true"> + "Reason": "UNLOADING AND LOADING / ${carrier_apt.appointment_designation?json_string}", + <#else> + <#if carrier_apt.appointment_designation?? && carrier_apt.appointment_designation!=""> + "Reason": "${carrier_apt.appointment_designation?json_string}", + <#else> + <#if carrier_apt.appointment_reference?? && carrier_apt.appointment_reference!=""> + "Reason": "${carrier_apt.appointment_reference?json_string}", + <#else> + "Reason": "${carrier_apt.year_number}-${carrier_apt.appointment_number}", + "Slot": { <#-- calcul de de la durée en fonction des start et end time--> "DurationInSeconds": "${duration}", diff --git a/RFXtoRP_HsrCarrierApt_BookingWMSUpdateAppointment.ftl b/RFXtoRP_HsrCarrierApt_BookingWMSUpdateAppointment.ftl index f834ed9..e7e0f9a 100644 --- a/RFXtoRP_HsrCarrierApt_BookingWMSUpdateAppointment.ftl +++ b/RFXtoRP_HsrCarrierApt_BookingWMSUpdateAppointment.ftl @@ -90,34 +90,56 @@ "TimeZone":"${time_zone_rfx}", - <#if carrier_apt.physical_receipt_list?? && (carrier_apt.physical_receipt_list?filter(l ->l??)?size != 0) && ((carrier_apt.unloading_appointment =="true" && carrier_apt.load_appointment =="false") || (carrier_apt.unloading_appointment =="false" && carrier_apt.load_appointment =="true"))> + <#-- Add commissions for anticipated and physical receipts if they exist --> + <#if ( (carrier_apt.anticipated_receipt_list?? && (carrier_apt.anticipated_receipt_list?filter(l ->l??)?size != 0)) || (carrier_apt.physical_receipt_list?? && (carrier_apt.physical_receipt_list?filter(l ->l??)?size != 0))) > + <#assign AddComma = false /> "Unloading" : { "Projects" : [ { "Commissions": [ - <#list carrier_apt.physical_receipt_list?filter(l ->l??) as physical_receipt> - { - "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}", - <#if physical_receipt.physical_receipt_reference?? && physical_receipt.physical_receipt_reference!=""> - "OrderID": "${physical_receipt.physical_receipt_reference?json_string}", - <#else> - "OrderID": "R${carrier_apt.physical_depot?json_string}${physical_receipt.receipt_activity?json_string}${physical_receipt.originator_code?json_string}${physical_receipt.receipt_year}${physical_receipt.receipt_number}", + <#list (carrier_apt.physical_receipt_list![])?filter(l -> l??) as physical_receipt> + { + <#assign AddComma = true /> + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}", + <#if physical_receipt.physical_receipt_reference?? && physical_receipt.physical_receipt_reference!=""> + "OrderID": "${physical_receipt.physical_receipt_reference?json_string}", + <#else> + "OrderID": "R${carrier_apt.physical_depot?json_string}${physical_receipt.receipt_activity?json_string}${physical_receipt.originator_code?json_string}${physical_receipt.receipt_year}${physical_receipt.receipt_number}", + + "ExecutionflowID": "R${carrier_apt.physical_depot?json_string}${physical_receipt.receipt_activity?json_string}${physical_receipt.originator_code?json_string}${physical_receipt.receipt_year?json_string}${physical_receipt.receipt_number?json_string}", + "ProjectID": "${projectRP}", + "PartnerAppID": "${partnerApplicationRP}", + "OrganisationID": "${organisationRP}" + }<#sep>, + + <#list (carrier_apt.anticipated_receipt_list![])?filter(l -> l??) as anticipated_receipt> + <#if AddComma == true> + , + <#assign AddComma = false /> - "ExecutionflowID": "R${carrier_apt.physical_depot?json_string}${physical_receipt.receipt_activity?json_string}${physical_receipt.originator_code?json_string}${physical_receipt.receipt_year?json_string}${physical_receipt.receipt_number?json_string}", - "ProjectID": "${projectRP}", - "PartnerAppID": "${partnerApplicationRP}", - "OrganisationID": "${organisationRP}" - }<#sep>, - + { + "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}", + <#if anticipated_receipt.anticipated_receipt_reference?? && anticipated_receipt.anticipated_receipt_reference!=""> + "OrderID": "${anticipated_receipt.anticipated_receipt_reference?json_string}", + <#else> + "OrderID": "AR${carrier_apt.physical_depot?json_string}${anticipated_receipt.activity?json_string}${anticipated_receipt.originator_code?json_string}${anticipated_receipt.anticipated_receipt_year}${anticipated_receipt.anticipated_receipt_number}", + + "ProjectID": "${projectRP}", + "PartnerAppID": "${partnerApplicationRP}", + "OrganisationID": "${organisationRP}" + }<#sep>, + ], "ProjectID" : "${projectRP}" }] }, - "Reason": "", <#else> - <#if appointmentType == AppointmentType.APPOINTMENT_TYPE_LOADING> - "Loading" : + <#if appointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING> + "Unloading" : + <#else> + "Loading" : + { "Projects" : [ { @@ -132,25 +154,7 @@ "ProjectID" : "${projectRP}" }] }, - <#else> - <#if appointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING> - "Unloading" : - { - "Projects" : [ - { - "Commissions": [ - { - "ActorID": "${RFXtoRPprefixDepot(carrier_apt.physical_depot?json_string)}", - "ProjectID": "${projectRP}", - "PartnerAppID": "${partnerApplicationRP}", - "OrganisationID": "${organisationRP}" - } - ], - "ProjectID" : "${projectRP}" - }] - }, - - + <#if carrier_apt.unloading_appointment == "true" && carrier_apt.load_appointment == "true"> "Reason": "UNLOADING AND LOADING / ${carrier_apt.appointment_designation?json_string}", <#else> diff --git a/RFXtoRP_HsrLoadInfo.ftl b/RFXtoRP_HsrLoadInfo.ftl index 2f21d47..1f92412 100644 --- a/RFXtoRP_HsrLoadInfo.ftl +++ b/RFXtoRP_HsrLoadInfo.ftl @@ -25,7 +25,7 @@ <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> <#assign depot = JsonUtil.jsonToMap(dataRfx)> <#stop > - <#break> + <#break> <#default> <#stop > diff --git a/RFXtoRP_HsrReceiptList.ftl b/RFXtoRP_HsrReceiptList.ftl index 05c2863..edeec2c 100644 --- a/RFXtoRP_HsrReceiptList.ftl +++ b/RFXtoRP_HsrReceiptList.ftl @@ -38,7 +38,7 @@ } ] <#else> - <#if receipt.line_list ?? && receipt.line_list[0]??> + <#if receipt.line_list ?? && receipt.line_list[0]??> <#-- if receipt contains at least one line --> [ { <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDetected> @@ -70,6 +70,7 @@ <#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) /> <#assign receipt = JsonUtil.jsonToMap(dataRfx)> [ + <#-- if receipt is a transfer and confirmed and all lines are cancelled --> <#if receipt.receipt_type?? && receipt.receipt_type == "030" && receipt.receipt_confirmed == "true" && receipt.confirmation_total_level_1==0 && receipt.confirmation_total_level_2==0 && receipt.confirmation_total_level_3==0> { <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowCancelled> @@ -78,6 +79,7 @@ <#include "RFXtoRP_HsrReceiptList_TransfertExecutionflowCancelled.ftl"> } <#else> + <#-- if lines receipt are created when the user treats the receipt --> <#if receipt.receipt_type?? && receipt.receipt_type == "030" && receipt.receipt_confirmed == "true"> <#if receipt.origin_order_line_depot?? && receipt.origin_order_line_depot!="" && receipt.receipt_reference?? && receipt.receipt_reference!=""> <#assign ID = "${receipt.origin_order_line_depot?trim?json_string}${receipt.activity_code?trim?json_string}${receipt.originator_code?trim?json_string}${receipt.receipt_reference?trim?json_string}"/> diff --git a/RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl b/RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl index d340648..eca0f87 100644 --- a/RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl +++ b/RFXtoRP_HsrReceiptList_ExecutionflowDetected.ftl @@ -33,7 +33,18 @@ { "Key": "order_number", "Value": "${receipt.receipt_number}" + }, + <#if receipt.line_list[0]?? && receipt.line_list[0].line_anticipated?? && receipt.line_list[0].line_anticipated.anticipated_receipt_year!=0 && receipt.line_list[0].line_anticipated.anticipated_receipt_number!=0 > + { + "Key": "anticipated", + "Value": "true" } + <#else> + { + "Key": "anticipated", + "Value": "false" + } + ], "RefID": "R${receipt.physical_depot_code?trim?json_string}${receipt.activity_code?trim?json_string}${receipt.originator_code?trim?json_string}${receipt.receipt_year}${receipt.receipt_number}", "RefDate": { @@ -63,10 +74,14 @@ "ActorID": "${RFXtoRPprefixDepot(receipt.physical_depot_code?trim?json_string)}" }, "ShipToAcked": true, - <#if receipt.receipt_reference?? && receipt.receipt_reference!=""> - "OrderID":"${receipt.receipt_reference?trim?json_string}", + <#if receipt.line_list[0]?? && receipt.line_list[0].line_anticipated?? && receipt.line_list[0].line_anticipated.anticipated_receipt_year!=0 && receipt.line_list[0].line_anticipated.anticipated_receipt_reference?? && receipt.line_list[0].line_anticipated.anticipated_receipt_reference=="" > + "OrderID":"AR-${receipt.line_list[0].line_anticipated.anticipated_receipt_depot_code?trim?json_string}${receipt.line_list[0].line_anticipated.anticipated_receipt_activity_code?trim?json_string}${receipt.line_list[0].line_anticipated.anticipated_receipt_originator_code?trim?json_string}${receipt.line_list[0].line_anticipated.anticipated_receipt_year}${receipt.line_list[0].line_anticipated.anticipated_receipt_number}", <#else> - "OrderID":"R${receipt.physical_depot_code?trim?json_string}${receipt.activity_code?trim?json_string}${receipt.originator_code?trim?json_string}${receipt.receipt_year}${receipt.receipt_number}", + <#if receipt.receipt_reference?? && receipt.receipt_reference!=""> + "OrderID":"${receipt.receipt_reference?trim?json_string}", + <#else> + "OrderID":"R${receipt.physical_depot_code?trim?json_string}${receipt.activity_code?trim?json_string}${receipt.originator_code?trim?json_string}${receipt.receipt_year}${receipt.receipt_number}", + <#if receipt.carrier_informations.carrier_code != ""> "Carrier": @@ -79,7 +94,11 @@ "Lines" : [ <#list receipt.line_list as line> { - "LineID": "${line.receipt_line_number}", + <#if line.receipt_reference_line_no?? && line.receipt_reference_line_no!=0> + "LineID": "${line.receipt_reference_line_no}", + <#else> + "LineID": "${line.receipt_line_number}", + <#-- Line Metadata inclusion --> <#include "RFXtoRP_HsrReceiptList_ExecutionflowDetected_LineMetadata.ftl">, "RequestedContent": diff --git a/RFXtoRP_RestResponse.ftl b/RFXtoRP_RestResponse.ftl index 5a4e3bd..4788e02 100644 --- a/RFXtoRP_RestResponse.ftl +++ b/RFXtoRP_RestResponse.ftl @@ -74,10 +74,10 @@ <#else> [ { - <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowShipFromAcked> - "apiReflexPlatformID" : "${apiReflexPlatformID}", - "datas" : - <#include "RFXtoRP_PrepOrder_ShipFromAcked.ftl"> + <#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowDeleted> + "apiReflexPlatformID" : "${apiReflexPlatformID}", + "datas" : + <#include "RFXtoRP_ExecutionflowDeleted.ftl"> } ] @@ -441,6 +441,8 @@ <#case "appointment_post_physical_receipt_associations_by_number"> <#case "appointment_post_physical_receipt_dissociations_by_ref"> <#case "appointment_post_physical_receipt_dissociations_by_number"> + <#case "appointment_post_anticipated_receipt_associations_by_ref"> + <#case "appointment_post_anticipated_receipt_dissociations_by_number"> <#switch restResponsetMsg.status!no_status> <#case no_status> [ diff --git a/RPtoRFX_AppointmentEvent.ftl b/RPtoRFX_AppointmentEvent.ftl index c83464d..01b428a 100644 --- a/RPtoRFX_AppointmentEvent.ftl +++ b/RPtoRFX_AppointmentEvent.ftl @@ -27,6 +27,10 @@ <#case "Updated"> <#assign AddComma = false /> <#assign appointment = eventRP.data /> + + <#if !eventRP.commissionsUpdated!false && !eventRP.reasonUpdated!false && !eventRP.slotUpdated!false && !eventRP.carrierInformationUpdated!false> + <#stop> + [ <#if appointment?? && (!(appointment.WMSCreated??) || !appointment.WMSCreated) && appointment.Status?? && appointment.Status.Current?? && appointment.Status.Current.StatusCode?? && appointment.Status.Current.StatusCode == AppointmentStatusCode.APPOINTMENT_0150_ALLOCATION_ERROR> { @@ -37,7 +41,7 @@ } <#else> <#if eventRP.commissionsUpdated> - <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING && eventRP.addedUnloadCommissions?? && eventRP.addedUnloadCommissions != ""> + <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING && eventRP.addedUnloadCommissions?? && eventRP.addedUnloadCommissions != "" && eventRP.addedUnloadCommissions?filter(x -> x.ExecutionflowID != "")?size != 0> <#if eventRP.appointmentCustomFields?has_content> { <#assign apiRestReflexID = ApiRestReflexID.appointment_post_physical_receipt_associations_by_number> @@ -55,7 +59,7 @@ <#assign AddComma = true /> - <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING && eventRP.removedUnloadCommissions?? && eventRP.removedUnloadCommissions!=""> + <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING && eventRP.removedUnloadCommissions?? && eventRP.removedUnloadCommissions!="" && eventRP.removedUnloadCommissions?filter(x -> x.ExecutionflowID != "")?size != 0> <#if AddComma == true> , @@ -77,6 +81,36 @@ <#assign AddComma = true /> + + <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING && eventRP.addedUnloadCommissions?? && eventRP.addedUnloadCommissions != "" && eventRP.addedUnloadCommissions?filter(x -> x.ExecutionflowID == "")?size != 0> + <#if AddComma == true> + , + + <#if eventRP.appointmentCustomFields?has_content> + { + <#assign apiRestReflexID = ApiRestReflexID.appointment_post_anticipated_receipt_associations_by_number> + "apiRestReflexID" : "${apiRestReflexID}", + "datas" : + <#include "RPtoRFX_CarrierAppointmentAnticipatedReceiptAssociationByNumber.ftl"> + } + + <#assign AddComma = true /> + + <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING && eventRP.removedUnloadCommissions?? && eventRP.removedUnloadCommissions!="" && eventRP.removedUnloadCommissions?filter(x -> x.ExecutionflowID == "")?size != 0> + <#if AddComma == true> + , + + + <#if eventRP.appointmentCustomFields?has_content> + { + <#assign apiRestReflexID = ApiRestReflexID.appointment_post_anticipated_receipt_dissociations_by_number> + "apiRestReflexID" : "${apiRestReflexID}", + "datas" : + <#include "RPtoRFX_CarrierAppointmentAnticipatedReceiptDissociationByNumber.ftl"> + } + + <#assign AddComma = true /> + <#-- *********************************************** Action = reasonUpdated or slotUpdated ******************** --> <#if eventRP.reasonUpdated || eventRP.slotUpdated || eventRP.carrierInformationUpdated> diff --git a/RPtoRFX_CarrierAppointmentAnticipatedReceiptAssociationByNumber.ftl b/RPtoRFX_CarrierAppointmentAnticipatedReceiptAssociationByNumber.ftl new file mode 100644 index 0000000..a387efd --- /dev/null +++ b/RPtoRFX_CarrierAppointmentAnticipatedReceiptAssociationByNumber.ftl @@ -0,0 +1,33 @@ +{ + "id" : {"refid" : "${eventRP.refid?json_string}","actorID":"${RPtoRFXprefixDepot(eventRP.actor)}"}, + "route" : "rest/public/v1/physical_depots/{physical_depot_code}/appointment_years/{appointment_year}/appointment_numbers/{appointment_number}/anticipated_receipt_associations", + "method" : "POST", + "uri_substitutions": { + "physical_depot_code": "${RPtoRFXprefixDepot(eventRP.actor)}", + "appointment_year":"${eventRP.appointmentCustomFields.year?json_string}", + "appointment_number":"${eventRP.appointmentCustomFields.number?json_string}" + }, + "payload" : + { + <#assign orderCustomFields = eventRP.orderCustomFields > + <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING> + <#assign addedCommissions = eventRP.addedUnloadCommissions /> + <#else> + <#assign addedCommissions = eventRP.addedLoadCommissions /> + + + "anticipated_receipt_list": [ + <#list addedCommissions?filter(l -> l.OrderID??) as addedCommission> + { + "activity": "${orderCustomFields[addedCommission.OrderID].activity_code?json_string}", + "originator_code": "${orderCustomFields[addedCommission.OrderID].originator_code?json_string}", + "anticipated_receipt_reference": "${orderCustomFields[addedCommission.OrderID].anticipated_receipt_reference?json_string}", + "planned_receipt_date": "${orderCustomFields[addedCommission.OrderID].planned_receipt_datetime?json_string}", + "anticipated_receipt_year": "${orderCustomFields[addedCommission.OrderID].anticipated_receipt_year?json_string}", + "anticipated_receipt_number": "${orderCustomFields[addedCommission.OrderID].anticipated_receipt_number?json_string}" + } + <#sep>, + + ] + } + } diff --git a/RPtoRFX_CarrierAppointmentAnticipatedReceiptDissociationByNumber.ftl b/RPtoRFX_CarrierAppointmentAnticipatedReceiptDissociationByNumber.ftl new file mode 100644 index 0000000..17a4dd6 --- /dev/null +++ b/RPtoRFX_CarrierAppointmentAnticipatedReceiptDissociationByNumber.ftl @@ -0,0 +1,33 @@ +{ + "id" : {"refid" : "${eventRP.refid?json_string}","actorID":"${RPtoRFXprefixDepot(eventRP.actor)}"}, + "route" : "rest/public/v1/physical_depots/{physical_depot_code}/appointment_years/{appointment_year}/appointment_numbers/{appointment_number}/anticipated_receipt_dissociations", + "method" : "POST", + "uri_substitutions": { + "physical_depot_code": "${RPtoRFXprefixDepot(eventRP.actor)}", + "appointment_year":"${eventRP.appointmentCustomFields.year?json_string}", + "appointment_number":"${eventRP.appointmentCustomFields.number?json_string}" + }, + "payload" : + { + <#assign orderCustomFields = eventRP.orderCustomFields > + <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING> + <#assign removedCommissions = eventRP.removedUnloadCommissions /> + <#else> + <#assign removedCommissions = eventRP.removedLoadCommissions /> + + + "anticipated_receipt_list": [ + <#list removedCommissions?filter(l -> l.OrderID??) as removedCommission> + { + "activity": "${orderCustomFields[removedCommission.OrderID].activity_code?json_string}", + "originator_code": "${orderCustomFields[removedCommission.OrderID].originator_code?json_string}", + "anticipated_receipt_reference": "${orderCustomFields[removedCommission.OrderID].anticipated_receipt_reference?json_string}", + "planned_receipt_date": "${orderCustomFields[removedCommission.OrderID].planned_receipt_datetime?json_string}", + "anticipated_receipt_year": "${orderCustomFields[removedCommission.OrderID].anticipated_receipt_year?json_string}", + "anticipated_receipt_number": "${orderCustomFields[removedCommission.OrderID].anticipated_receipt_number?json_string}" + } + <#sep>, + + ] + } + } diff --git a/RPtoRFX_CarrierAppointmentCreated.ftl b/RPtoRFX_CarrierAppointmentCreated.ftl index a81a0e9..b1a4c5c 100644 --- a/RPtoRFX_CarrierAppointmentCreated.ftl +++ b/RPtoRFX_CarrierAppointmentCreated.ftl @@ -36,10 +36,10 @@ <#include "RPtoRFX_CarrierAppointmentDefaultData.ftl"> <#if appointment.AppointmentType == AppointmentType.APPOINTMENT_TYPE_UNLOADING > - <#if appointment.Unloading?? && appointment.Unloading.Projects?? && appointment.Unloading.Projects[0]?? && - appointment.Unloading.Projects[0].Commissions?? && - appointment.Unloading.Projects[0].Commissions[0]?? && appointment.Unloading.Projects[0].Commissions[0].ExecutionflowID?? && appointment.Unloading.Projects[0].Commissions[0].ExecutionflowID!="" > - "physical_receipt_list": [ + <#if appointment.Unloading?? && appointment.Unloading.Projects?? && + appointment.Unloading.Projects[0]?? && + appointment.Unloading.Projects[0].Commissions??> + "physical_receipt_list": [ <#list appointment.Unloading.Projects[0].Commissions?filter(l ->l.ExecutionflowID?? && l.ExecutionflowID !="") as commission> <#list eventRP.executionflowCustomFields.entrySet()?filter(l ->l.key == commission.ExecutionflowID && l.value?? && l.value?has_content) as custom> { @@ -54,6 +54,22 @@ <#sep>, ], + "anticipated_receipt_list": [ + <#list appointment.Unloading.Projects[0].Commissions?filter(l -> (!(l.ExecutionflowID??) || l.ExecutionflowID =="") && (l.OrderID?? && l.OrderID !="")) as commission> + <#list eventRP.orderCustomFields.entrySet()?filter(l ->l.key == commission.OrderID && l.value?? && l.value?has_content) as custom> + { + "activity": "${custom.value.activity_code?json_string}", + "originator_code": "${custom.value.originator_code?json_string}", + "anticipated_receipt_reference": "${custom.value.anticipated_receipt_reference?json_string}", + "planned_receipt_date": "${custom.value.planned_receipt_datetime?json_string}", + "anticipated_receipt_year": "${custom.value.anticipated_receipt_year?json_string}", + "anticipated_receipt_number": "${custom.value.anticipated_receipt_number?json_string}" + } + <#sep>, + + <#sep>, + + ], <#else> "appointment_designation":"${(appointment.Reason!"")!?json_string}", diff --git a/RPtoRFX_PrepOrder.ftl b/RPtoRFX_PrepOrder.ftl index aa1e6ec..cd22c80 100644 --- a/RPtoRFX_PrepOrder.ftl +++ b/RPtoRFX_PrepOrder.ftl @@ -37,15 +37,15 @@ "requested_delivery_start_datetime": "${DateTimeUTCtoRfxLocale(.now?iso_utc?string,time_zone_rfx)}", "requested_delivery_date_type": "${requested_delivery_date_type}", - "consolidated_delivery": "${consolidated_delivery_flag}", + "consolidated_delivery": "false", "pick_sequence_code": "${pick_sequence_code}", "intermediate_consignee": "false", - "protected": "${protected_flag}", - "automatic_generation": "${automatic_generation_flag}", + "protected": "false", + "automatic_generation": "true", "deactivate": "false", "optional_attributes": { <#include "RPtoRFX_PrepOrder_OptionalAttributes.ftl"> - "apt_with_end_consignee": "${apt_with_end_consignee_flag}", + "apt_with_end_consignee": "false", "apt_with_intermediate": "false", "load_grouping": "${load_grouping}" } diff --git a/RPtoRFX_PrepOrder_DefaultHeaderData.ftl b/RPtoRFX_PrepOrder_DefaultHeaderData.ftl index bed878f..f93f19d 100644 --- a/RPtoRFX_PrepOrder_DefaultHeaderData.ftl +++ b/RPtoRFX_PrepOrder_DefaultHeaderData.ftl @@ -18,11 +18,7 @@ <#assign originator_code = ""/> <#assign preparation_type_code = "010"/> <#assign requested_delivery_date_type = "010"/> -<#assign consolidated_delivery_flag ="false"/> <#assign pick_sequence_code = ""/> -<#assign protected_flag ="false"/> -<#assign automatic_generation_flag ="false"/> -<#assign apt_with_end_consignee_flag="false"/> <#-- A supprimer si utilisation de la table de correspondance--> <#--To be deleted if using the correspondence table--> diff --git a/VERSION b/VERSION index cd6a343..6d57fcc 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -2.0.22+4 +2.0.23+1