Quintiq file version 2.0 
 | 
#parent: #root 
 | 
Method SynchronizeOutputPISP ( 
 | 
  Boolean isfromdb 
 | 
) 
 | 
{ 
 | 
  Description: 'Synchronize output pisp, create if it is not exist yet.' 
 | 
  TextBody: 
 | 
  [* 
 | 
    // DWE2 Feb-2-2016 (created) 
 | 
     
 | 
    sourceunit := this.AsSourceOperation().Unit(); 
 | 
    macroplan := this.MacroPlan(); 
 | 
     
 | 
    // Create WIP stocking point 
 | 
    // E.g WIP - Unit 1 
 | 
    step := this.AsSourceOperation().RoutingStep(); 
 | 
    routing := step.Routing(); 
 | 
     
 | 
    spid := macroplan.IDHolder().GetWIPStockingPointID( sourceunit.ID() ); 
 | 
    stockingpoint := StockingPoint_MP::FindCreateUpdate( macroplan, 
 | 
                                                         spid, 
 | 
                                                         sourceunit, 
 | 
                                                         routing, 
 | 
                                                         isfromdb ); 
 | 
     
 | 
    // Set stocking point as system created 
 | 
    stockingpoint.SetAsSystemCreated(); 
 | 
     
 | 
     
 | 
    // Link SP to Units I/O 
 | 
    stockingpoint.LinkToUnit( sourceunit, false ); 
 | 
     
 | 
    // Crete WIP product 
 | 
    // E.g Routing - Step 1 - Unit 
 | 
    productid := this.MacroPlan().IDHolder().GetWIPProductID( routing.ID(), 
 | 
                                                              step.Name(), 
 | 
                                                              sourceunit.ID(), 
 | 
                                                              this.SourceGroupID() ); 
 | 
     
 | 
    product := Product_MP::FindCreateUpdate( macroplan, 
 | 
                                             productid, 
 | 
                                             sourceunit, 
 | 
                                             isfromdb ); 
 | 
     
 | 
    // Set product as system created 
 | 
    product.SetAsSystemCreated(); 
 | 
     
 | 
    // Assign product to stocking point 
 | 
    pisp := product.AddToStockingPoint( stockingpoint ); 
 | 
     
 | 
    // Update the product & stocking point id to be derrive by operation output 
 | 
    this.UpdateProductInStockingPoint( pisp.ProductID(), pisp.StockingPointID() ); 
 | 
  *] 
 | 
} 
 |