76 lines
2.9 KiB
Java
76 lines
2.9 KiB
Java
<#assign cloudEventMsg = JsonUtil.jsonToMap(input)>
|
|
<#assign projectRP = project>
|
|
<#assign organisationRP = organisation>
|
|
|
|
<#assign aDateTime = .now>
|
|
|
|
<#switch cloudEventMsg.action>
|
|
<#case "C">
|
|
<#case "U">
|
|
<#-- *********************************************** Action = CREATE or UPDATE ******************** -->
|
|
<#assign dataRfx = JsonUtil.decodeBase64(cloudEventMsg.data) />
|
|
<#assign reflexMvtStockInterface = JsonUtil.jsonToMap(dataRfx)>
|
|
|
|
<#-- exclusion of the cases of an IPG move with quantity = 0 (weight modification) -->
|
|
<#if reflexMvtStockInterface.ipg_move_quantity_in_base_lvs != 0>
|
|
|
|
<#-- IPG moves translated into Stock moves -->
|
|
<#if reflexMvtStockInterface.ipg_move_type == "130" ||
|
|
reflexMvtStockInterface.ipg_move_type == "200" ||
|
|
reflexMvtStockInterface.ipg_move_type == "210" ||
|
|
reflexMvtStockInterface.ipg_move_type == "220" ||
|
|
reflexMvtStockInterface.ipg_move_type == "230" ||
|
|
reflexMvtStockInterface.ipg_move_type == "240" ||
|
|
reflexMvtStockInterface.ipg_move_type == "260" ||
|
|
reflexMvtStockInterface.ipg_move_type == "290" ||
|
|
reflexMvtStockInterface.ipg_move_type == "300" ||
|
|
reflexMvtStockInterface.ipg_move_type == "400" ||
|
|
reflexMvtStockInterface.ipg_move_type == "410" ||
|
|
reflexMvtStockInterface.ipg_move_type == "420"
|
|
>
|
|
[
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.StockMoved>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsaIpgMove_StockMoved.ftl">
|
|
|
|
}
|
|
]
|
|
<#else>
|
|
<#-- IPG moves translated into goods received (all type of receipt) -->
|
|
<#if reflexMvtStockInterface.ipg_move_type == "100" ||
|
|
reflexMvtStockInterface.ipg_move_type == "110" ||
|
|
reflexMvtStockInterface.ipg_move_type == "120"
|
|
>
|
|
[
|
|
{
|
|
<#assign apiReflexPlatformID = ApiReflexPlatformID.HandlingunitGoodsReceived>
|
|
"apiReflexPlatformID" : "${apiReflexPlatformID}",
|
|
"datas" :
|
|
<#include "RFXtoRP_HsaIpgMove_GoodsReceived.ftl">
|
|
|
|
}
|
|
]
|
|
<#else>
|
|
<#-- Case of IPG move type volontarilly ignored-->
|
|
<#stop "Move type not supported">
|
|
</#if>
|
|
</#if>
|
|
<#else>
|
|
<#-- cases of an IPG move with quantity = 0 (weight modification)-->
|
|
<#stop "move ignored quantity = 0">
|
|
</#if>
|
|
<#break>
|
|
|
|
<#case "D">
|
|
<#-- *********************************************** Action = DELETE ******************** -->
|
|
<#stop "event not supported - Case D ">
|
|
<#break>
|
|
|
|
|
|
<#default>
|
|
<#stop "event not supported">
|
|
</#switch>
|
|
|