reflex-wms-connector/RFXtoRP_RestResponse.ftl

102 lines
3.7 KiB
Java

<#-- **** 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>