General InformationThis computation type business rule is invoked when user executes the Replace by New Evolution action for Equipment, Cable, Piping and HVAC parts. Purpose of this business rule is to:
Input ObjectsInput objects must be of the following types:
Context Object Parameters
Note:
Optional, if the list is empty or does not have same size as input it is
ignored and the panel displays to choose accessories of physical item to evolve.
Sample
// ThisObject: <Unset>
/* Rule created by CVV 10/28/2024 */
let ListItems (List)
let ListCandidates (List)
let ListComputedCandidates (List)
let ListAccessories (List)
let ListDisplayPanel (List)
let index (Integer)
let l2pItem (L2PItem)
set index = 1
set ListItems = Parameters.GetAttributeObject("ListInputObjects")
set ListCandidates = Parameters.GetAttributeObject("ListCandidateObjects")
if(ListItems.Size() == ListCandidates.Size())
{
for index while index <= ListItems.Size()
{
let ListCurrentAccessories (List)
let listCurrentCandidates (List)
let occCandidate (ProductOccurrence)
let bDisplayPanel (Boolean)
set bDisplayPanel = true
set listCurrentCandidates = ListCandidates.GetItem(index)
set l2pItem = ListItems.GetItem(index)
if( (NULL <> l2pItem) and (1 <= listCurrentCandidates.Size()) )
{
// NOTE: This is sample rule which relies on reference description of the physical items and its children
// to identify the candidate and children to evolve
let currentOcc (ProductOccurrence)
if(listCurrentCandidates.Size() == 1)
{
set occCandidate = listCurrentCandidates.GetItem(1)
}
for currentOcc inside listCurrentCandidates
{
let prdRef (VPMReference)
set prdRef = currentOcc.Reference
if(prdRef.V_description == "ToEvolve")
{
set occCandidate = currentOcc
break
}
}
if(NULL <> occCandidate)
{
let listChildren (List)
set listChildren = occCandidate.Query("ProductOccurrence", "")
for currentOcc inside listChildren
{
let prdRef (VPMReference)
set prdRef = currentOcc.Reference
if(prdRef.V_description <> "Reusable")
{
ListCurrentAccessories.Append(currentOcc)
}
}
// NOTE: In this sample rule, panel is displayed based on number of children in the candidate physical to evolve
// If number of children is more than 3, then the panel should be displayed
if(3 >= listChildren.Size())
set bDisplayPanel = true
}
}
ListComputedCandidates.Append(occCandidate)
ListAccessories.Append(ListCurrentAccessories)
ListDisplayPanel.Append(bDisplayPanel)
}
Parameters.SetAttributeObject("ListPhysicalToEvolve", ListComputedCandidates )
Parameters.SetAttributeObject("ListAcessoriesToEvolve", ListAccessories )
Parameters.SetAttributeObject("ListOutputBoolean", ListDisplayPanel )
}
else
{
Notify("L2P_ComputePhysicalToEvolve: ERROR Invalid input lists")
}
| |||||||||||||||||||||||||||||||||||||||||||