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 projectRP = project>
<#assign organisationRP = organisation> <#assign organisationRP = organisation>
<#switch eventRP.event> <#switch eventRP.event>
<#case "Created"> <#case "Created">
<#-- *********************************************** Action = CREATE or UPDATE ******************** --> <#-- *********************************************** Action = CREATE or UPDATE ******************** -->
<#assign executionflow = eventRP.data /> <#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> <#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> <#assign aDateTime = .now>
{ {
"id" : {"refid" : "${executionflow.OrderID}"}, "id" : {"refid" : "${executionflow.OrderID}"},
"route" : "rest/public/v1/activities/{activity_code}/physical_depots/{physical_depot_code}/originators/{originator_code}/preparation_orders", "route" : "rest/public/v1/activities/{activity_code}/physical_depots/{physical_depot_code}/originators/{originator_code}/preparation_orders",
"method" : "POST", "method" : "POST",
"uri_substitutions": { "uri_substitutions": {
"activity_code": "${activity_code}", "activity_code": "${activity_code}",
"physical_depot_code": "${ActorID_RPtoRFX[executionflow.ShipFrom.ActorID]!executionflow.ShipFrom.ActorID}", "physical_depot_code": "${executionflow.ShipFrom.ActorID}",
"originator_code": "${Reflex_Originator}" "originator_code": "${originator_code}"
}, },
"payload" : "payload" :
{ {
"originator_reference": "${executionflow.OrderID}", "originator_reference": "${executionflow.OrderID}",
"preparation_type_code": "${preparation_type_code}", "preparation_type_code": "${preparation_type_code}",
"end_consignee_code": "${ActorID_RPtoRFX[executionflow.ShipTo.ActorID]!executionflow.ShipTo.ActorID}", "end_consignee_code": "${executionflow.ShipTo.ActorID!""}",
<#if executionflow.RequestedMilestones?? && executionflow.RequestedMilestones.RequestedDeliveryDateTime??> <#if executionflow.RequestedMilestones?? && executionflow.RequestedMilestones.RequestedDeliveryDateTime??>
"requested_delivery_start_datetime": "${executionflow.RequestedMilestones.RequestedDeliveryDateTime.DateTime}", "requested_delivery_start_datetime": "${executionflow.RequestedMilestones.RequestedDeliveryDateTime.DateTime}",
<#else> <#else>
"requested_delivery_start_datetime": "${aDateTime?iso_utc}", "requested_delivery_start_datetime": "${aDateTime?iso_utc}",
</#if> </#if>
"automatic_generation": "true", "requested_delivery_date_type": "${requested_delivery_date_type}",
"consolidated_delivery": "false", "consolidated_delivery": "${consolidated_delivery_flag}",
"pick_sequence_code": "${pick_sequence_code}",
"intermediate_consignee": "false", "intermediate_consignee": "false",
"print_deconsolidation_sheet": "false", "protected": "${protected_flag}",
"print_final_delivery_note": "false", "automatic_generation": "${automatic_generation_flag}",
"protected": "false", "optional_attributes": {
"automatic_generation": "false", "apt_with_end_consignee": "${apt_with_end_consignee_flag}",
"stock_despatch_at_preparation_confirmation": "false", "apt_with_intermediate": "false",
"deactivate": "false", "load_grouping": "${load_grouping}"
"requested_delivery_date_type": "010", },
<#if executionflow.ShipTo.ActorID == ""> <#if executionflow.ShipTo.ActorID == "">
"address": { "address": {
"mail_address": "${executionflow.Carrier.Actor.Emails[0]!""}", "first_name": "${executionflow.ShipTo.Contact.FirstName!""}",
"mobile_phone_number": "${executionflow.Carrier.Actor.Phones[0]!""}", "last_name" :"${executionflow.ShipTo.Contact.Lastname!""}",
"street_and_number_and_po_box": "${executionflow.Carrier.Actor.Address.StreetAddressOne!""}", "mail_address": "${executionflow.ShipTo.Actor.Emails[0]!""}",
"additional_address_data_1": "${executionflow.Carrier.Actor.Address.StreetAddressTwo!""}", "mobile_phone_number": "${executionflow.ShipTo.Actor.Phones[0]!""}",
"additional_address_data_2": "${executionflow.Carrier.Actor.Address.StreetAddressThree!""}", "street_and_number_and_po_box": "${executionflow.ShipTo.Actor.Address.StreetAddressOne?json_string!""}",
"postal_code": "${executionflow.Carrier.Actor.Address.PostalCode!""}", "additional_address_data_1": "${executionflow.ShipTo.Actor.Address.StreetAddressTwo?json_string!""}",
"iso_country_code": "${executionflow.Carrier.Actor.Address.CountryCode!""}" "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>
<#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 ******** -->
<#if executionflow.line.MetaData??>
<#if line.RequestedContent.Goods.SegmentationKeys??> <#assign Line_MetaData_Map = JsonUtil.sequenceToMap(executionflow.line.MetaData, "Key", "Value") />
<#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> </#if>
<#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}, "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}",
"grade_code_to_prepare" :"${grade_code_to_prepare}",
"input_order_data": "false", "input_order_data": "false",
"batch_1": "${batch_1}",
"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",
"base_lv_quantity": "true", "base_lv_quantity": "true",
"any_lv": "false" -->
}<#sep>,</#sep> }<#sep>,</#sep>
</#list> </#list>
],
</#if> </#if>
"optional_attributes": { ]
"apt_with_end_consignee": "false",
"apt_with_intermediate": "false",
<#-- "load_grouping": "${executionflow.Carrier.ActorID!""}" -->
"load_grouping": "${load_grouping}"
}
} }
} }

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 =""/>