reflex-wms-connector/RPtoRFX_PrepOrder.ftl
2023-10-18 15:15:14 +02:00

84 lines
3.5 KiB
Java

<#include "RPtoRFX_PrepOrder_DefaultHeaderData.ftl">
<#assign aDateTime = .now>
{
"id" : {"refid" : "${executionflow.OrderID}"},
"route" : "rest/public/v1/activities/{activity_code}/physical_depots/{physical_depot_code}/originators/{originator_code}/preparation_orders",
"method" : "POST",
"uri_substitutions": {
"activity_code": "${activity_code}",
"physical_depot_code": "${executionflow.ShipFrom.ActorID}",
"originator_code": "${originator_code}"
},
"payload" :
{
"originator_reference": "${executionflow.OrderID}",
"preparation_type_code": "${preparation_type_code}",
"end_consignee_code": "${executionflow.ShipTo.ActorID!""}",
<#if executionflow.RequestedMilestones?? && executionflow.RequestedMilestones.RequestedDeliveryDateTime??>
"requested_delivery_start_datetime": "${executionflow.RequestedMilestones.RequestedDeliveryDateTime.DateTime}",
<#else>
"requested_delivery_start_datetime": "${aDateTime?iso_utc}",
</#if>
"requested_delivery_date_type": "${requested_delivery_date_type}",
"consolidated_delivery": "${consolidated_delivery_flag}",
"pick_sequence_code": "${pick_sequence_code}",
"intermediate_consignee": "false",
"protected": "${protected_flag}",
"automatic_generation": "${automatic_generation_flag}",
"optional_attributes": {
"apt_with_end_consignee": "${apt_with_end_consignee_flag}",
"apt_with_intermediate": "false",
"load_grouping": "${load_grouping}"
},
<#if executionflow.ShipTo.ActorID == "">
"address": {
"first_name": "${executionflow.ShipTo.Contact.FirstName!""}",
"last_name" :"${executionflow.ShipTo.Contact.Lastname!""}",
"mail_address": "${executionflow.ShipTo.Actor.Emails[0]!""}",
"mobile_phone_number": "${executionflow.ShipTo.Actor.Phones[0]!""}",
"street_and_number_and_po_box": "${executionflow.ShipTo.Actor.Address.StreetAddressOne?json_string!""}",
"additional_address_data_1": "${executionflow.ShipTo.Actor.Address.StreetAddressTwo?json_string!""}",
"additional_address_data_2": "${executionflow.ShipTo.Actor.Address.StreetAddressThree?json_string!""}",
"postal_code": "${executionflow.ShipTo.Actor.Address.PostalCode!""}",
"iso_country_code": "${executionflow.ShipTo.Actor.Address.CountryCode!""}"
},
</#if>
<#if executionflow.Lines??>
"line_list": [
<#list executionflow.Lines as line>
<#-- ******* line MetaData and Segmentationkeys to maps ******** -->
<#if line.MetaData??>
<#assign Line_MetaData_Map = JsonUtil.sequenceToMap(line.MetaData, "Key", "Value") />
</#if>
<#assign SegmentationKeys_Map = JsonUtil.sequenceToMap(line.RequestedContent.Goods.SegmentationKeys, "Key", "Value") />
<#include "RPtoRFX_PrepOrder_DefaultLineData.ftl">
{
"originator_reference_line_number": ${line.LineID?number},
"item_code": "${line.RequestedContent.Goods.ItemID!""}",
"item_lv_code": "${line.RequestedContent.Goods.LVBranchID!""}",
"base_lv_quantity_to_prepare": ${line.RequestedMetrics.QuantityInBaseLV.Value!0},
"owner_code_to_prepare" :"${owner_code_to_prepare}",
"grade_code_to_prepare" :"${grade_code_to_prepare}",
"input_order_data": "false",
"batch_1": "${batch_1}",
"any_lv": "false"
<#--
"stock_reservation": "false",
"forced_priority_date_min_lead_time": "false",
"temp_substitution_possible": "false",
"substitution_possible": "false",
"base_lv_quantity": "true",
-->
}<#sep>,</#sep>
</#list>
</#if>
]
}
}