Création de commande

This commit is contained in:
Laurie MONTANT 2024-04-24 15:09:45 +02:00
parent eda5fe4e07
commit 82dfc05cdb
2 changed files with 86 additions and 48 deletions

View File

@ -1,4 +1,18 @@
<#include "RPtoRFX_PrepOrder_DefaultHeaderData.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 = executionflow.ShipTo.ActorID >
<#else>
<#assign actorID = defaultactor >
</#if>
{
"id" : {"refid" : "${executionflow.OrderID}"},
@ -9,15 +23,15 @@
"physical_depot_code": "${executionflow.ShipFrom.ActorID}",
"originator_code": "${originator_code}"
},
"payload" :
"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": "${DateTimeUTCtoRfxLocale(executionflow.RequestedMilestones.RequestedDeliveryDateTime.DateTime,time_zone_rfx)}",
"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)}",
"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}",
@ -31,52 +45,62 @@
"apt_with_intermediate": "false",
"load_grouping": "${load_grouping}"
},
<#if executionflow.ShipTo.ActorID == "">
"address": {
<#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}",
"mail_address": "${executionflow.ShipTo.Actor.Emails[0]!""}",
"mobile_phone_number": "${executionflow.ShipTo.Actor.Phones[0]!""}",
"last_name" :"${executionflow.ShipTo.Contact.LastName!""?json_string}",
"name_or_company_name" : "${executionflow.ShipTo.Contact.FirstName!""?json_string} ${executionflow.ShipTo.Contact.LastName!""?json_string}",
<#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!""}",
"post_code_area_name" : "${executionflow.ShipTo.Actor.Address.City!""}",
"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>
<#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}",
"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>
]
<#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}",
"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>
]
}
}

View File

@ -1,7 +1,7 @@
<#-- Note : you can use Order Header Metadata, using the define map : Header_MetaData_Map -->
<#-- How to use MD Header map
Example :
Example :
<#assign pick_sequence_code = Header_MetaData_Map["OrderType"].String!""/>
If your MD is :
@ -23,8 +23,22 @@
<#assign protected_flag ="false"/>
<#assign automatic_generation_flag ="false"/>
<#assign apt_with_end_consignee_flag="false"/>
<#assign load_grouping = "DEFAUT"/>
<#-- A supprimer si utilisation de la table de correspondance-->
<#--To be deleted if using the correspondence table-->
<#assign load_grouping = "default">
<#-- Table de correspondance Transporteur/Code regroupement chargement,
affectation à un chargement si paramétrage regroupement chargement+plan de base distribution-->
<#--Carrier / Load Grouping Code Correspondence Table,
Assigning to a load if you set up Load Grouping+Distribution Master Plan-->
<#-- Example -->
<#--<#if executionflow.Carrier.ActorID == "TEST" >
<#assign load_grouping = "TEST">
<#else>
<#assign load_grouping = "default">
</#if>-->