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"> <#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}"}, "id" : {"refid" : "${executionflow.OrderID}"},
@ -13,11 +27,11 @@
{ {
"originator_reference": "${executionflow.OrderID}", "originator_reference": "${executionflow.OrderID}",
"preparation_type_code": "${preparation_type_code}", "preparation_type_code": "${preparation_type_code}",
"end_consignee_code": "${executionflow.ShipTo.ActorID!""}", "end_consignee_code": "${actorID}",
<#if executionflow.RequestedMilestones?? && executionflow.RequestedMilestones.RequestedDeliveryDateTime??> <#if executionflow.RequestedMilestones?? && executionflow.RequestedMilestones.RequestedDeliveryDateTime??>
"requested_delivery_start_datetime": "${DateTimeUTCtoRfxLocale(executionflow.RequestedMilestones.RequestedDeliveryDateTime.DateTime,time_zone_rfx)}", "requested_delivery_start_datetime": "${DateTimeUTCtoRfxLocale(executionflow.RequestedMilestones.RequestedDeliveryDateTime.DateTime,time_zone_rfx)}",
<#else> <#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> </#if>
"requested_delivery_date_type": "${requested_delivery_date_type}", "requested_delivery_date_type": "${requested_delivery_date_type}",
"consolidated_delivery": "${consolidated_delivery_flag}", "consolidated_delivery": "${consolidated_delivery_flag}",
@ -31,52 +45,62 @@
"apt_with_intermediate": "false", "apt_with_intermediate": "false",
"load_grouping": "${load_grouping}" "load_grouping": "${load_grouping}"
}, },
<#if executionflow.ShipTo.ActorID == ""> <#if actorID == defaultactor >
"address": { "address": {
"type_code": "${typecode}",
"title_code" : "${titlecode}",
"contact_type_code" : "${contacttypecode}",
"address_type_code" : "${adresstypecode}",
"first_name": "${executionflow.ShipTo.Contact.FirstName!""?json_string}", "first_name": "${executionflow.ShipTo.Contact.FirstName!""?json_string}",
"last_name" :"${executionflow.ShipTo.Contact.Lastname!""?json_string}", "last_name" :"${executionflow.ShipTo.Contact.LastName!""?json_string}",
"mail_address": "${executionflow.ShipTo.Actor.Emails[0]!""}", "name_or_company_name" : "${executionflow.ShipTo.Contact.FirstName!""?json_string} ${executionflow.ShipTo.Contact.LastName!""?json_string}",
"mobile_phone_number": "${executionflow.ShipTo.Actor.Phones[0]!""}", <#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}", "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_1": "${executionflow.ShipTo.Actor.Address.StreetAddressTwo!""?json_string}",
"additional_address_data_2": "${executionflow.ShipTo.Actor.Address.StreetAddressThree!""?json_string}", "additional_address_data_2": "${executionflow.ShipTo.Actor.Address.StreetAddressThree!""?json_string}",
"postal_code": "${executionflow.ShipTo.Actor.Address.PostalCode!""}", "postal_code": "${executionflow.ShipTo.Actor.Address.PostalCode!""}",
"post_code_area_name" : "${executionflow.ShipTo.Actor.Address.City!""}",
"iso_country_code": "${executionflow.ShipTo.Actor.Address.CountryCode!""}" "iso_country_code": "${executionflow.ShipTo.Actor.Address.CountryCode!""}"
}, },
</#if> </#if>
<#if executionflow.Lines??> <#if executionflow.Lines??>
"line_list": [ "line_list": [
<#list executionflow.Lines as line> <#list executionflow.Lines as line>
<#-- ******* line MetaData and Segmentationkeys to maps ******** --> <#-- ******* line MetaData and Segmentationkeys to maps ******** -->
<#if line.MetaData??> <#if line.MetaData??>
<#assign Line_MetaData_Map = JsonUtil.sequenceToMap(line.MetaData, "Key", "Value") /> <#assign Line_MetaData_Map = JsonUtil.sequenceToMap(line.MetaData, "Key", "Value") />
</#if> </#if>
<#if line.RequestedContent.Goods.SegmentationKeys??> <#if line.RequestedContent.Goods.SegmentationKeys??>
<#assign SegmentationKeys_Map = JsonUtil.sequenceToMap(line.RequestedContent.Goods.SegmentationKeys, "Key", "Value") /> <#assign SegmentationKeys_Map = JsonUtil.sequenceToMap(line.RequestedContent.Goods.SegmentationKeys, "Key", "Value") />
</#if> </#if>
<#include "RPtoRFX_PrepOrder_DefaultLineData.ftl"> <#include "RPtoRFX_PrepOrder_DefaultLineData.ftl">
{ {
"originator_reference_line_number": ${line.LineID?number}, "originator_reference_line_number": ${line.LineID?number},
"item_code": "${line.RequestedContent.Goods.ItemID!""}", "item_code": "${line.RequestedContent.Goods.ItemID!""}",
"item_lv_code": "${line.RequestedContent.Goods.LVBranchID!""}", "item_lv_code": "${line.RequestedContent.Goods.LVBranchID!""}",
"base_lv_quantity_to_prepare": ${line.RequestedMetrics.QuantityInBaseLV.Value!0}, "base_lv_quantity_to_prepare": ${line.RequestedMetrics.QuantityInBaseLV.Value!0},
"owner_code_to_prepare" :"${owner_code_to_prepare}", "owner_code_to_prepare" :"${owner_code_to_prepare}",
"grade_code_to_prepare" :"${grade_code_to_prepare}", "grade_code_to_prepare" :"${grade_code_to_prepare}",
"input_order_data": "false", "input_order_data": "false",
"batch_1": "${batch_1}", "batch_1": "${batch_1}",
"base_lv_quantity": "true", "base_lv_quantity": "true",
"any_lv": "false" "any_lv": "false"
<#-- <#--
"stock_reservation": "false", "stock_reservation": "false",
"forced_priority_date_min_lead_time": "false", "forced_priority_date_min_lead_time": "false",
"temp_substitution_possible": "false", "temp_substitution_possible": "false",
"substitution_possible": "false" "substitution_possible": "false"
--> -->
}<#sep>,</#sep> }
</#list> <#sep>,</#sep>
</#list>
</#if> </#if>
] ]
} }
} }

View File

@ -23,8 +23,22 @@
<#assign protected_flag ="false"/> <#assign protected_flag ="false"/>
<#assign automatic_generation_flag ="false"/> <#assign automatic_generation_flag ="false"/>
<#assign apt_with_end_consignee_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>-->