Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method SetIsLinkedWithFinishedGoodAttributes 
 | 
{ 
 | 
  Description: 'Method to traverse the supply chain to determine if there are any products that are not used to produce finished goods.' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // Reset IsLinkedWithFinishedGood 
 | 
    traverse( this, Global_MappingProduct_MP, instance ) 
 | 
    { 
 | 
      instance.IsLinkedWithFinishedGood( false ); 
 | 
    } 
 | 
     
 | 
    traverse( this, Global_MappingOperation, instance ) 
 | 
    { 
 | 
      instance.IsLinkedWithFinishedGood( false ); 
 | 
    } 
 | 
     
 | 
    traverse( this, Global_MappingOperationBOM, instance ) 
 | 
    { 
 | 
      instance.IsLinkedWithFinishedGood( false ); 
 | 
    } 
 | 
     
 | 
    productspool := selectset( this, Global_MappingProduct_MP, product, 
 | 
                               product.ProductMajorType() <> "成品" ); 
 | 
    operationspool := this.Global_MappingOperation( relget ); 
 | 
    operationbomspool := this.Global_MappingOperationBOM( relget ); 
 | 
     
 | 
    // Traverse each finished good and search for linked products/operations/lanes 
 | 
    traverse( this, Global_MappingProduct_MP, product, 
 | 
              product.ProductMajorType() = "成品" ) 
 | 
    { 
 | 
      uniquebomids := construct( Strings ); 
 | 
      product.IsLinkedWithFinishedGood( false ); 
 | 
      product.SetIsLinkedWithFinishedGoodAttributes_Recursive( 0, // depth 
 | 
                                                               100, // maxdepth 
 | 
                                                               productspool, 
 | 
                                                               operationspool, 
 | 
                                                               operationbomspool, 
 | 
                                                               uniquebomids ); 
 | 
      uniquebomids := uniquebomids.Unique(); 
 | 
      product.BOMCount( uniquebomids.Size() ); 
 | 
    } 
 | 
  *] 
 | 
} 
 |