ajout des FTL liés à la création de commande (SCPN1-5019) à valider par Laure
This commit is contained in:
parent
717cd294eb
commit
b50d2573f3
43
RFXtoRP_PlatformLogCreate.ftl
Normal file
43
RFXtoRP_PlatformLogCreate.ftl
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
<#include "HfRpConfig.ftl">
|
||||||
|
[
|
||||||
|
<#assign UUID = UUID.randomUUID()>
|
||||||
|
<#assign strJsonBody = JsonUtil.espaceQuoteInJsonString(restResponseBody)>
|
||||||
|
{
|
||||||
|
"Header": {
|
||||||
|
"ProjectID": "${projectRP}"
|
||||||
|
},
|
||||||
|
"ID": {
|
||||||
|
"RefID": "${UUID}",
|
||||||
|
"RefDate": {
|
||||||
|
"DateTime": "${aDateTime?iso_utc}",
|
||||||
|
"AuthorTimeZone": "${time_zone_rfx}"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"Payload": {
|
||||||
|
<#assign severity = SeverityLevel.ERROR>
|
||||||
|
"Severity": "${severity}",
|
||||||
|
"Namespace": "ReflexIntegration",
|
||||||
|
"DateTime": {
|
||||||
|
"DateTime": "${aDateTime?iso_utc}",
|
||||||
|
"AuthorTimeZone": "${time_zone_rfx}"
|
||||||
|
},
|
||||||
|
"TechMessage": {
|
||||||
|
"Code": "${restResponsetMsg.status}",
|
||||||
|
"Label": ${strJsonBody}
|
||||||
|
},
|
||||||
|
"UserMessage": {
|
||||||
|
"Code": "${restResponsetMsg.status}",
|
||||||
|
"Label": ${strJsonBody},
|
||||||
|
"Params": []
|
||||||
|
},
|
||||||
|
"DetailElements": [],
|
||||||
|
"CorrelationID": "${id.correlationid}",
|
||||||
|
"ContextPayload": "rfxresponse",
|
||||||
|
"Type": "RP_EXECUTIONFLOW_EVENT",
|
||||||
|
"Task": "${id.apiRestReflexID}",
|
||||||
|
"OriginalID": "${id.refid}",
|
||||||
|
"StackTrace": ""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
15
RFXtoRP_PrepOrder-ShipFromAcked.ftl
Normal file
15
RFXtoRP_PrepOrder-ShipFromAcked.ftl
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"Header": {
|
||||||
|
"ProjectID": "${projectRP}"
|
||||||
|
},
|
||||||
|
"ID": {
|
||||||
|
"RefID": "${id.refid}"
|
||||||
|
},
|
||||||
|
|
||||||
|
"Payload": {
|
||||||
|
"ShipFromAcked": true
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
]
|
||||||
15
RFXtoRP_Receipt-ShipToAcked.ftl
Normal file
15
RFXtoRP_Receipt-ShipToAcked.ftl
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
[
|
||||||
|
{
|
||||||
|
"Header": {
|
||||||
|
"ProjectID": "${projectRP}"
|
||||||
|
},
|
||||||
|
"ID": {
|
||||||
|
"RefID": "${id.refid}"
|
||||||
|
},
|
||||||
|
|
||||||
|
"Payload": {
|
||||||
|
"ShipToAcked": true
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
]
|
||||||
101
RFXtoRP_RestResponse.ftl
Normal file
101
RFXtoRP_RestResponse.ftl
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
<#-- **** input parameters ***** -->
|
||||||
|
<#-- input : Response message from Reflex -->
|
||||||
|
<#-- project : projectId in ReflexPlatform -->
|
||||||
|
<#-- organisation : organisationtId in ReflexPlatform -->
|
||||||
|
|
||||||
|
<#assign restResponsetMsg = JsonUtil.jsonToMap(input)>
|
||||||
|
<#assign id = JsonUtil.jsonToMap(restResponsetMsg.id)>
|
||||||
|
<#assign projectRP = project>
|
||||||
|
<#assign organisationRP = organisation>
|
||||||
|
|
||||||
|
|
||||||
|
<#assign aDateTime = .now>
|
||||||
|
|
||||||
|
<#switch id.apiRestReflexID>
|
||||||
|
<#case "preparation_orders_post">
|
||||||
|
<#switch restResponsetMsg.status>
|
||||||
|
<#case 200>
|
||||||
|
<#case 201>
|
||||||
|
<#-- *********************************************** ApiRestID = preparation_orders_post ******************** -->
|
||||||
|
<#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) />
|
||||||
|
<#assign preparationOrderPostResponse = JsonUtil.jsonToMap(restResponseBody)>
|
||||||
|
<#if preparationOrderPostResponse.status?? && preparationOrderPostResponse.status == "SUCCESS" >
|
||||||
|
[
|
||||||
|
{
|
||||||
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowShipFromAcked>
|
||||||
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
||||||
|
"datas" :
|
||||||
|
<#include "RFXtoRP_PrepOrder-ShipFromAcked.ftl">
|
||||||
|
}
|
||||||
|
]
|
||||||
|
<#else>
|
||||||
|
[
|
||||||
|
{
|
||||||
|
<#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) />
|
||||||
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate>
|
||||||
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
||||||
|
"datas" :
|
||||||
|
<#include "RFXtoRP_PlatformLogCreate.ftl">
|
||||||
|
}
|
||||||
|
]
|
||||||
|
</#if>
|
||||||
|
<#break>
|
||||||
|
<#default>
|
||||||
|
[
|
||||||
|
{
|
||||||
|
<#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) />
|
||||||
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate>
|
||||||
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
||||||
|
"datas" :
|
||||||
|
<#include "RFXtoRP_PlatformLogCreate.ftl">
|
||||||
|
}
|
||||||
|
]
|
||||||
|
</#switch>
|
||||||
|
<#break>
|
||||||
|
|
||||||
|
<#case "receipts_post">
|
||||||
|
<#switch restResponsetMsg.status>
|
||||||
|
<#case 200>
|
||||||
|
<#case 201>
|
||||||
|
<#-- *********************************************** ApiRestID = preparation_orders_post ******************** -->
|
||||||
|
<#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) />
|
||||||
|
<#assign preparationOrderPostResponse = JsonUtil.jsonToMap(restResponseBody)>
|
||||||
|
<#if preparationOrderPostResponse.status?? && preparationOrderPostResponse.status == "SUCCESS" >
|
||||||
|
[
|
||||||
|
{
|
||||||
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.ExecutionflowShipToAcked>
|
||||||
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
||||||
|
"datas" :
|
||||||
|
<#include "RFXtoRP_Receipt-ShipToAcked.ftl">
|
||||||
|
}
|
||||||
|
]
|
||||||
|
<#else>
|
||||||
|
[
|
||||||
|
{
|
||||||
|
<#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) />
|
||||||
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate>
|
||||||
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
||||||
|
"datas" :
|
||||||
|
<#include "RFXtoRP_PlatformLogCreate.ftl">
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
</#if>
|
||||||
|
<#break>
|
||||||
|
<#default>
|
||||||
|
[
|
||||||
|
{
|
||||||
|
<#assign restResponseBody = JsonUtil.decodeBase64(restResponsetMsg.body) />
|
||||||
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.PlatformLogCreate>
|
||||||
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
||||||
|
"datas" :
|
||||||
|
<#include "RFXtoRP_PlatformLogCreate.ftl">
|
||||||
|
}
|
||||||
|
]
|
||||||
|
</#switch>
|
||||||
|
<#break>
|
||||||
|
|
||||||
|
<#default>
|
||||||
|
<#stop>
|
||||||
|
</#switch>
|
||||||
|
|
||||||
37
RPtoRFX_ExecutionflowEvent.ftl
Normal file
37
RPtoRFX_ExecutionflowEvent.ftl
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<#-- **** input parameters ***** -->
|
||||||
|
<#-- input : message RFX -->
|
||||||
|
<#-- project : projectId in ReflexPlatform -->
|
||||||
|
<#-- organisation : organisationtId in ReflexPlatform -->
|
||||||
|
|
||||||
|
<#assign eventRP = JsonUtil.jsonToMap(input)>
|
||||||
|
<#assign projectRP = project>
|
||||||
|
<#assign organisationRP = organisation>
|
||||||
|
|
||||||
|
<#switch eventRP.event>
|
||||||
|
<#case "Created">
|
||||||
|
<#-- *********************************************** Action = CREATE or UPDATE ******************** -->
|
||||||
|
<#assign executionflow = eventRP.data />
|
||||||
|
[
|
||||||
|
<#if eventRP.partnerAppRole == "ShipFrom" && executionflow.ShipFrom.ActorID != "" && executionflow.ShipFrom.Actor.IsShipFromConnected?? && executionflow.ShipFrom.Actor.IsShipFromConnected>
|
||||||
|
{
|
||||||
|
<#assign apiRestReflexID = ApiRestReflexID.preparation_orders_post>
|
||||||
|
"apiRestReflexID" : "${apiRestReflexID}",
|
||||||
|
"datas" :
|
||||||
|
<#include "RPtoRFX_Preparation_orders_post.ftl">
|
||||||
|
}
|
||||||
|
</#if>
|
||||||
|
<#if eventRP.partnerAppRole == "ShipTo" && executionflow.ShipTo.ActorID != "" && executionflow.ShipTo.Actor.IsShipToConnected?? && executionflow.ShipTo.Actor.IsShipToConnected>
|
||||||
|
{
|
||||||
|
<#assign apiRestReflexID = ApiRestReflexID.receipts_post>
|
||||||
|
"apiRestReflexID" : "${apiRestReflexID}",
|
||||||
|
"datas" :
|
||||||
|
<#include "RPtoRFX_Receipts_post.ftl">
|
||||||
|
}
|
||||||
|
</#if>
|
||||||
|
|
||||||
|
]
|
||||||
|
<#break>
|
||||||
|
<#default>
|
||||||
|
<#stop "Event not process">
|
||||||
|
</#switch>
|
||||||
|
|
||||||
83
RPtoRFX_Preparation_orders_post.ftl
Normal file
83
RPtoRFX_Preparation_orders_post.ftl
Normal file
@ -0,0 +1,83 @@
|
|||||||
|
<#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"}/>
|
||||||
|
<#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}"
|
||||||
|
},
|
||||||
|
"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!""}"
|
||||||
|
},
|
||||||
|
</#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>
|
||||||
|
"optional_attributes": {
|
||||||
|
"apt_with_end_consignee": "false",
|
||||||
|
"apt_with_intermediate": "false",
|
||||||
|
<#-- "load_grouping": "${executionflow.Carrier.ActorID!""}" -->
|
||||||
|
"load_grouping": "${load_grouping}"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
68
RPtoRFX_Receipts_post.ftl
Normal file
68
RPtoRFX_Receipts_post.ftl
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
<#assign Default_Value_Owner_SegmentationKey = "PEN"/>
|
||||||
|
<#assign Default_Value_Grade_SegmentationKey = "STD"/>
|
||||||
|
<#assign Reflex_Originator = "STANDARD"/>
|
||||||
|
<#assign work_mode_code = "LPA"/>
|
||||||
|
<#assign activity_code = "PEN"/>
|
||||||
|
<#assign receipt_reason_code = "REC"/>
|
||||||
|
<#assign receipt_type = "010"/>
|
||||||
|
<#assign ActorID_RPtoRFX = {"J001":"J01","J002":"J02","J003":"J03","J004":"J04","J005":"J05"} >
|
||||||
|
<#assign SegmentationKeys_RPtoRFX = {"Sales":"SAL","Standard":"STD","Unsaleable":"UNS"}/>
|
||||||
|
<#assign aDateTime = .now>
|
||||||
|
{
|
||||||
|
"id" : {"refid" : "${executionflow.OrderID}"},
|
||||||
|
"route" : "rest/public/v1/activities/{activity_code}/physical_depots/{physical_depot_code}/originators/{originator_code}/receipts",
|
||||||
|
"method" : "POST",
|
||||||
|
"uri_substitutions": {
|
||||||
|
"activity_code": "${activity_code}",
|
||||||
|
"physical_depot_code": "${ActorID_RPtoRFX[executionflow.ShipTo.ActorID]!executionflow.ShipTo.ActorID}",
|
||||||
|
"originator_code": "${Reflex_Originator}"
|
||||||
|
},
|
||||||
|
"payload" :
|
||||||
|
{
|
||||||
|
"receipt_reference": "${executionflow.OrderID}",
|
||||||
|
"receipt_type": "${receipt_type}",
|
||||||
|
"receipt_reason_code": "${receipt_reason_code}",
|
||||||
|
"work_mode_code" : "${work_mode_code}",
|
||||||
|
"original_code" : "${ActorID_RPtoRFX[executionflow.ShipFrom.ActorID]!executionflow.ShipFrom.ActorID}",
|
||||||
|
"carrier_code" : "${ActorID_RPtoRFX[executionflow.Carrier.ActorID]!executionflow.Carrier.ActorID}",
|
||||||
|
<#if executionflow.RequestedMilestones?? && executionflow.RequestedMilestones.RequestedDeliveryDateTime??>
|
||||||
|
"carrier_appointment_start_datetime": "${executionflow.RequestedMilestones.RequestedDeliveryDateTime.DateTime}",
|
||||||
|
<#else>
|
||||||
|
"carrier_appointment_start_datetime": "${aDateTime?iso_utc}",
|
||||||
|
</#if>
|
||||||
|
"carrier_appointment_made": "false",
|
||||||
|
"receipt_in_cross_docking": "false",
|
||||||
|
"dock_occupation_duration": 10,
|
||||||
|
|
||||||
|
<#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": "${ic_map.Owner.String!"${Default_Value_Owner_SegmentationKey}"}",
|
||||||
|
"grade_code": "${SegmentationKeys_RPtoRFX[ic_map.Grade.String!""]!"${Default_Value_Grade_SegmentationKey}"}",
|
||||||
|
"batch_1": "${ic_map.BatchNumber!""}",
|
||||||
|
</#if>
|
||||||
|
"receipt_reference_line_no": ${line.LineID?number},
|
||||||
|
"item_code": "${line.RequestedContent.Goods.ItemID!""}",
|
||||||
|
"item_lv_code": "${line.RequestedContent.Goods.LVBranchID!""}",
|
||||||
|
"level_1_quantity": ${line.RequestedMetrics.QuantityInBaseLV.Value!0}
|
||||||
|
|
||||||
|
}<#sep>,</#sep>
|
||||||
|
</#list>
|
||||||
|
],
|
||||||
|
</#if>
|
||||||
|
"optional_attributes": {
|
||||||
|
"held_for_check": "false",
|
||||||
|
"held _for_repacking": "false",
|
||||||
|
"hold_for_specific_code": "false",
|
||||||
|
"hold_code": "false"
|
||||||
|
},
|
||||||
|
"quality_control_attributes": {
|
||||||
|
"qcf_to_create_for_receipt_line": "false",
|
||||||
|
"exclude_item_from_inspection": "false"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user