reflex-wms-connector/RPtoRFX_PrepOrder.ftl
2024-10-15 16:56:15 +02:00

115 lines
5.1 KiB
Java

<#include "RPtoRFX_PrepOrder_DefaultHeaderData.ftl">
<#include "ActorPrefix.ftl">
<#-- Valeurs par défaut Adresse -->
<#-- Default values -->
<#assign typecode ="010">
<#assign titlecode ="1">
<#assign contacttypecode ="010">
<#assign adresstypecode ="010">
<#-- Si vous utilisez des acteurs non référencés, il faudra créer un destinataire "VIZ" dans Reflex WMS pour utiliser cette fonctionnalité -->
<#-- If you are using unreferenced actors, you will need to create a "VIZ" consignee in Reflex WMS to use this feature -->
<#assign defaultactor ="VIZ">
<#if executionflow.ShipTo.ActorID?? && executionflow.ShipTo.ActorID!="">
<#assign actorID = "${RPtoRFXprefixConsignee(executionflow.ShipTo.ActorID)}" >
<#else>
<#assign actorID = defaultactor >
</#if>
{
"id" : {"refid" : "${executionflow.OrderID?json_string}"},
"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": "${RPtoRFXprefixDepot(executionflow.ShipFrom.ActorID)}",
"originator_code": "${originator_code}"
},
"payload" :
{
"originator_reference": "${executionflow.OrderID?json_string}",
"preparation_type_code": "${preparation_type_code}",
"end_consignee_code": "${actorID}",
<#if executionflow.RequestedMilestones?? && executionflow.RequestedMilestones.RequestedDeliveryDateTime??>
"requested_delivery_start_datetime": "${DateTimeUTCtoRfxLocale(executionflow.RequestedMilestones.RequestedDeliveryDateTime.DateTime,time_zone_rfx)}",
<#else>
"requested_delivery_start_datetime": "${DateTimeUTCtoRfxLocale(.now?iso_utc?string,time_zone_rfx)}",
</#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}",
"deactivate": "false",
"optional_attributes": {
"apt_with_end_consignee": "${apt_with_end_consignee_flag}",
"apt_with_intermediate": "false",
"load_grouping": "${load_grouping}"
}
<#if actorID == defaultactor >
,
"address": {
"type_code": "${typecode}",
"title_code" : "${titlecode}",
"contact_type_code" : "${contacttypecode}",
"address_type_code" : "${adresstypecode}",
"first_name": "${(executionflow.ShipTo.Contact.FirstName!"")?json_string}",
"last_name" :"${(executionflow.ShipTo.Contact.LastName!"")?json_string}",
<#if executionflow.ShipTo.Actor.Adresse.Name?? && executionflow.ShipTo.Actor.Adresse.Name!="">
"name_or_company_name" : "${(executionflow.ShipTo.Actor.Adresse.Name!"")?json_string}",
<#else>
"name_or_company_name" : "${(executionflow.ShipTo.Contact.FirstName!"")?json_string}${(executionflow.ShipTo.Contact.LastName!"")?json_string}"
</#if>
<#if executionflow.ShipTo.Contact.Emails?? && executionflow.ShipTo.Contact.Emails[0]!="">
"mail_address": "${executionflow.ShipTo.Contact.Emails[0]}",
</#if>
<#if executionflow.ShipTo.Contact.Phones?? && executionflow.ShipTo.Contact.Phones[0]!="">
"mobile_phone_number": "${executionflow.ShipTo.Contact.Phones[0]}",
</#if>
"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!"")?json_string}",
"post_code_area_name" : "${(executionflow.ShipTo.Actor.Address.City!"")?json_string}",
"iso_country_code": "${(executionflow.ShipTo.Actor.Address.CountryCode!"")?json_string}"
}
</#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>
<#if line.RequestedContent.Goods.SegmentationKeys??>
<#assign SegmentationKeys_Map = JsonUtil.sequenceToMap(line.RequestedContent.Goods.SegmentationKeys, "Key", "Value") />
</#if>
<#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?json_string}",
"base_lv_quantity": "true",
"any_lv": "false"
<#--
"stock_reservation": "false",
"forced_priority_date_min_lead_time": "false",
"temp_substitution_possible": "false",
"substitution_possible": "false"
-->
}
<#sep>,</#sep>
</#list>
]
</#if>
}
}