Quintiq file version 2.0
|
#parent: #root
|
MethodOverride SyncSubsetProduct (
|
OptimizerPuzzleBase target
|
)
|
{
|
TextBody:
|
[*
|
// Copy subset product from WIP to OP
|
optimizerpuzzle := target.astype( OptimizerPuzzle );
|
isfromdb := false;
|
|
currentList := selectset( optimizerpuzzle, SubsetProductInOptimizerPuzzle, sub , true );
|
newList := construct( SubsetProductInOptimizerPuzzles );
|
|
// Copy or update isuserAction and GetIsSystem subsets
|
// Not taking into consideration Product without Parent if Include because of default behaviour
|
traverse( this, SubsetProductInOptimizerPuzzleWip, subsource, subsource.IsUserAction() )
|
{
|
targetSubset := SubsetProductInOptimizerPuzzle::FindSubsetProductOptimizerPuzzleTypeIndices( optimizerpuzzle.Name(), subsource.ProductID() );
|
// Case create a new OptimizerPuzzle
|
if( isnull( targetSubset ) )
|
{
|
// Create a SubsetProduct for OptimizerPuzzle.
|
targetSubset := SubsetProductInOptimizerPuzzle::Create( optimizerpuzzle, subsource.Product_MP(), isfromdb );
|
}
|
// Case edit
|
else
|
{
|
if( targetSubset.OptimizerPuzzleName() <> this.Name() )
|
{
|
// Update OptimizerPuzzleID and ProductID
|
SubsetProductInOptimizerPuzzle::ChangeKeySubsetProductOptimizerPuzzleTypeIndices( targetSubset, this.Name(), targetSubset.ProductID() );
|
}
|
}
|
|
// Update IsInclude and IsUserAction
|
targetSubset.IsIncluded( subsource.IsIncluded() );
|
targetSubset.IsUserAction( subsource.IsUserAction() );
|
newList.Add( targetSubset );
|
}
|
|
toBeDeleted := currentList.Difference( newList );
|
SubsetProductInOptimizerPuzzle::Delete( toBeDeleted );
|
*]
|
}
|