Quintiq file version 2.0 
 | 
#parent: #root 
 | 
StaticMethod RefreshData ( 
 | 
  InterfaceDataset interface, 
 | 
  MacroPlan macroPlan, 
 | 
  const Archive archive 
 | 
) 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    //根据当前版本的下线计划 
 | 
    allunit                := OfflinePlanArchiveVersion::GetDefaultAllUnit(); 
 | 
    name                   := OfflinePlanArchiveVersion::GetDefaultName();//search                 :=  
 | 
    interface.OfflinePlanArchiveSearch( relnew, Product := allunit, ProductionLine := allunit, Unit := allunit, StartDate := Date::MinDate(), EndDate := Date::MaxDate() );//, TimeUnit := Translations::MP_GlobalParameters_Day() 
 | 
    table                  := selectobject( interface, OfflinePlanArchiveVersion, version, not version.IsShow() ); 
 | 
    if( isnull( table ) ){ 
 | 
      table                := interface.OfflinePlanArchiveVersion( relnew, ID := name, Name := name ); 
 | 
    } 
 | 
    //showtable              := selectobject( interface, OfflinePlanArchiveVersion, version, version.IsShow() ); 
 | 
    //if( isnull( showtable ) ){ 
 | 
    //  showtable               := interface.OfflinePlanArchiveVersion( relnew, ID := name, Name := name, IsShow := true ); 
 | 
    //} 
 | 
    nopcolumns             := selectuniquevalues(  macroPlan, NewOfflinePlanTable.NewOfflinePlanColumn, nopcolumn, not exists( table, Column, column, column.StartDate() = nopcolumn.StartDate() ), nopcolumn.StartDate() );//column.TimeUnit() = Translations::MP_GlobalParameters_Day() and  
 | 
    if( nopcolumns.Size() > 0 ){ 
 | 
      table.GenerateColumn( nopcolumns, false ); 
 | 
    } 
 | 
    noptable               := maxobject( macroPlan, NewOfflinePlanTable, noptable, noptable.SaveDateTime() ); 
 | 
    actproductiondatas     := selectset( archive,ActualDailyProductionData,data,true ); 
 | 
    actproductiontree      := NamedValueTree::Create(); 
 | 
    for( i := 0; i< actproductiondatas.Size(); i++ ){ 
 | 
      actproduction        := actproductiondatas.Element( i ); 
 | 
      linename             := actproduction.Fac().Concat( ' ' ); 
 | 
      if( actproduction.LineName().FindString( '/', 0 ) > -1 ){ 
 | 
        linenames          := actproduction.LineName().Tokenize( '/' ); 
 | 
        traverse( linenames, Elements, e ){ 
 | 
          actproductionKey     := actproduction.ProductNo() + linename + e + actproduction.ProductionDate().AsQUILL(); 
 | 
          actproductionhandle  := actproductiontree.GetHandle( actproductionKey ); 
 | 
          actproductiontree.Root().AddChild( actproductionhandle,i );  
 | 
        } 
 | 
      }else{ 
 | 
        actproductionKey     := actproduction.ProductNo() + linename + actproduction.LineName() + actproduction.ProductionDate().AsQUILL(); 
 | 
        actproductionhandle  := actproductiontree.GetHandle( actproductionKey ); 
 | 
        actproductiontree.Root().AddChild( actproductionhandle,i );  
 | 
      } 
 | 
    } 
 | 
     
 | 
    traverse( noptable, NewOfflinePlanRow, noprow, noprow.Type() = '1' ){ 
 | 
      row                  := table.GetRow( noprow ); 
 | 
      if( not isnull( row ) ){ 
 | 
        traverse( noprow, NewOfflinePlanCell, nopcell ){ 
 | 
          column             := selectobject( table, Column, column, column.StartDate() = nopcell.NewOfflinePlanColumn().StartDate() );//column.TimeUnit() = Translations::MP_GlobalParameters_Day() and  
 | 
          cell               := selectobject( row, Cell, cell, cell.Column() = column ); 
 | 
          actproductionKey   := noprow.ProductID() + noprow.ProductionLine() + column.StartDate().AsQUILL(); 
 | 
          actproductionhandle:= actproductiontree.GetHandle( actproductionKey ); 
 | 
          actproductionindex := guard( actproductiontree.Root().Child( actproductionhandle ),null( NamedValue )); 
 | 
          actproductionqty       := 0.0; 
 | 
          if( not isnull( actproductionindex )){ 
 | 
            actproduction        := actproductiondatas.Element( actproductionindex.GetValueAsNumber() ); 
 | 
            actproductionqty     := actproduction.ActualOut(); 
 | 
          } 
 | 
          if( isnull( cell ) ){ 
 | 
            cell             := row.Cell( relnew, InventoryWeight := 0, ProductionSerialNumber := 0, Quantity := 0, Shift := '', Value := '' ); 
 | 
            column.Cell( relinsert, cell ); 
 | 
          } 
 | 
          cell.ActualProductionQty( actproductionqty ); 
 | 
          cell.InventoryWeight( nopcell.InventoryWeight() ); 
 | 
          cell.Order( nopcell.Order() ); 
 | 
          cell.OrderNr( nopcell.OrderNr() ); 
 | 
          cell.Note( nopcell.Note() ); 
 | 
      //      cell.ProductionSerialNumber( nopcell.ProductionSerialNumber() ); 
 | 
          cell.Quantity( nopcell.Quantity() ); 
 | 
      //      cell.Shift( nopcell.Shift() ); 
 | 
      //      cell.Value( nopcell.Value() ); 
 | 
        } 
 | 
      } 
 | 
    } 
 | 
    //productids             := selectuniquevalues( table, Row, row, row.Name() ); 
 | 
    //productlines           := selectuniquevalues( table, Row, row, row.ProductionLine() ); 
 | 
    //showtable.Generate( search, productids, productlines ); 
 | 
  *] 
 | 
} 
 |