RP to RFX prep order post

This commit is contained in:
Laure Pascal 2023-10-18 09:40:02 +02:00
parent 9e1c0fcaae
commit d067be597b
5 changed files with 104 additions and 71 deletions

View File

@ -7,10 +7,19 @@
<#assign projectRP = project>
<#assign organisationRP = organisation>
<#switch eventRP.event>
<#case "Created">
<#-- *********************************************** Action = CREATE or UPDATE ******************** -->
<#assign executionflow = eventRP.data />
<#-- ******* Header MetaData to maps ******** -->
<#if executionflow.MetaData??>
<#assign Header_MetaData_Map = JsonUtil.sequenceToMap(executionflow.MetaData, "Key", "Value") />
</#if>
[
<#if eventRP.partnerAppRole == "ShipFrom" && executionflow.ShipFrom.ActorID != "" && executionflow.ShipFrom.Actor.IsShipFromConnected?? && executionflow.ShipFrom.Actor.IsShipFromConnected>
{

View File

@ -1,78 +1,84 @@
<#include "RPtoRFX_PrepOrder_DefaultData.ftl">
<#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": "${ActorID_RPtoRFX[executionflow.ShipFrom.ActorID]!executionflow.ShipFrom.ActorID}",
"originator_code": "${Reflex_Originator}"
"physical_depot_code": "${executionflow.ShipFrom.ActorID}",
"originator_code": "${originator_code}"
},
"payload" :
{
"originator_reference": "${executionflow.OrderID}",
"preparation_type_code": "${preparation_type_code}",
"end_consignee_code": "${ActorID_RPtoRFX[executionflow.ShipTo.ActorID]!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>
"automatic_generation": "true",
"consolidated_delivery": "false",
"intermediate_consignee": "false",
"print_deconsolidation_sheet": "false",
"print_final_delivery_note": "false",
"protected": "false",
"automatic_generation": "false",
"stock_despatch_at_preparation_confirmation": "false",
"deactivate": "false",
"requested_delivery_date_type": "010",
<#if executionflow.ShipTo.ActorID == "">
"address": {
"mail_address": "${executionflow.Carrier.Actor.Emails[0]!""}",
"mobile_phone_number": "${executionflow.Carrier.Actor.Phones[0]!""}",
"street_and_number_and_po_box": "${executionflow.Carrier.Actor.Address.StreetAddressOne!""}",
"additional_address_data_1": "${executionflow.Carrier.Actor.Address.StreetAddressTwo!""}",
"additional_address_data_2": "${executionflow.Carrier.Actor.Address.StreetAddressThree!""}",
"postal_code": "${executionflow.Carrier.Actor.Address.PostalCode!""}",
"iso_country_code": "${executionflow.Carrier.Actor.Address.CountryCode!""}"
"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>
{
<#if line.RequestedContent.Goods.SegmentationKeys??>
<#assign ic_map = JsonUtil.sequenceToMap(line.RequestedContent.Goods.SegmentationKeys, "Key", "Value") />
"owner_code_to_prepare": "${ic_map.Owner.String!"${Default_Value_Owner_SegmentationKey}"}",
"grade_code_to_prepare": "${SegmentationKeys_RPtoRFX[ic_map.Grade.String!""]!"${Default_Value_Grade_SegmentationKey}"}",
"batch_1": "${ic_map.BatchNumber!""}",
</#if>
"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},
"input_order_data": "false",
"stock_reservation": "false",
"forced_priority_date_min_lead_time": "false",
"temp_substitution_possible": "false",
"substitution_possible": "false",
"base_lv_quantity": "true",
"any_lv": "false"
}<#sep>,</#sep>
</#list>
],
</#if>
<#if executionflow.Lines??>
"line_list": [
<#list executionflow.Lines as line>
<#-- ******* line MetaData and Segmentationkeys to maps ******** -->
<#if executionflow.line.MetaData??>
<#assign Line_MetaData_Map = JsonUtil.sequenceToMap(executionflow.line.MetaData, "Key", "Value") />
</#if>
"optional_attributes": {
"apt_with_end_consignee": "false",
"apt_with_intermediate": "false",
<#-- "load_grouping": "${executionflow.Carrier.ActorID!""}" -->
"load_grouping": "${load_grouping}"
}
<#if executionflow.line.RequestedContent.Goods.SegmentationKeys??>
<#assign SegmentationKeys_Map = JsonUtil.sequenceToMap(execution.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}",
"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>
]
}
}

View File

@ -1,9 +0,0 @@
<#assign Default_Value_Owner_SegmentationKey = ""/>
<#assign Default_Value_Grade_SegmentationKey = "STD"/>
<#assign Reflex_Originator = "50000189"/>
<#assign activity_code = "PEN"/>
<#assign preparation_type_code = "010"/>
<#assign load_grouping = "DEFAUT"/>
<#assign ActorID_RPtoRFX = {"J001":"J01","J002":"J02","J003":"J03","J004":"J04","J005":"J05"} >
<#assign SegmentationKeys_RPtoRFX = {"Sales":"SAL","Standard":"STD","Unsaleable":"UNS"}/>

View File

@ -0,0 +1,19 @@
<#-- Note : you can use Order Header Metadata, using the define map : Header_MetaData_Map -->
<#assign activity_code = "PEN"/>
<#assign originator_code = "50000189"/>
<#assign preparation_type_code = "010"/>
<#assign requested_delivery_date_type = "010"/>
<#assign consolidated_delivery_flag ="false"/>
<#assign pick_sequence_code = ""/>
<#assign protected_flag ="false"/>
<#assign automatic_generation_flag ="false"/>
<#assign apt_with_end_consignee_flag="false"/>
<#assign load_grouping = "DEFAUT"/>

View File

@ -0,0 +1,8 @@
<#-- Note : you can use Order Line Metadata, using the define map : Line_MetaData_Map -->
<#-- Note : you can use Order Line Segmentation keys, using the define map : SegmentationKeys_Map -->
<#assign owner_code_to_prepare = ${SegmentationKeys_Map["myOwner"]}/>
<#assign grade_code_to_prepare =""/>
<#assign batch_1 =""/>