Quintiq file version 2.0
|
#parent: #root
|
StaticMethod GetDestinationGroupID (
|
Operation sourceoperation,
|
Operation destinationoperation
|
) as Number
|
{
|
Description: 'Return the incremental destination group id.'
|
TextBody:
|
[*
|
// DWE2 Feb-1-2016 (created)
|
id := 1;
|
|
// If already have input, we need to increment the group id
|
if( destinationoperation.OperationInput( relsize ) > 0 )
|
{
|
/* We need to propagate the Systems attribute and relations
|
During the creation of operation link, Product/SP/OI/OO/OIG will be created
|
Operation have SystemXXX relation to OI/OO/OIG, we need these relation to get new operation link id
|
while creating new operation link */
|
// To ensure the SystemXXX attribute/relation is propagated in batch creation
|
Transaction::Transaction().Propagate();
|
|
// Get all operation input with the same uom
|
sysinputwithsameuom := selectset( destinationoperation, SystemOperationInput, soi,
|
soi.PISPUnitOfMeasurement() = sourceoperation.Unit().UnitOfMeasure_MP() );
|
|
// Get all operation input group with the same uom
|
sysgroupwithsameuom := selectset( destinationoperation, SystemOperationInputGroup, soig,
|
soig.UnitOfMeasure_MP() = sourceoperation.Unit().UnitOfMeasure_MP() );
|
|
// If there is only one input with same uom, we will re use it
|
// 99% of the case people will want it to be an alternative resource instead of other resource.
|
if( sysinputwithsameuom.Size() = 1 )
|
{
|
id := sysinputwithsameuom.Element( 0 ).OperationLinkGroupID();
|
}
|
// If there is on;y one input group with the same uom, we will add to the group
|
// 99% of the case people will want it to be an alternative resource instead of other resource.
|
else if( sysgroupwithsameuom.Size() = 1 )
|
{
|
id := sysgroupwithsameuom.Element( 0 ).InputGroupID();
|
}
|
else
|
{
|
id := BaseOperationLink::GetGroupID( destinationoperation, true, true );
|
}
|
}
|
|
return id;
|
*]
|
}
|