Files
reflex-wms-connector/RFXtoRP_HsrAntRec_Created.ftl
2026-06-15 17:45:10 +02:00

116 lines
4.2 KiB
Java

<#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}"
</#if>
},
"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}",
</#if>
<#-- 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>,</#sep>
</#list>
]
<#if AncReceipt.planned_receipt_datetime?? && AncReceipt.planned_receipt_datetime!="0000-00-00T00:00:00">
,
"RequestedMilestones" :
{
"RequestedDeliveryDateTime" :
{
"DateTime": "${receipt_datetime}",
"AuthorTimeZone": "${time_zone_rfx}"
}
}
</#if>
<#if AncReceipt.carrier_code?? && AncReceipt.carrier_code != "">
,
"Carrier":
{
"ActorID":"${RFXtoRPprefixCarrier(AncReceipt.carrier_code?trim?json_string)}"
}
</#if>
}
}
]