lazhen
2024-10-29 4419b51e5cfed824ca592ae5cba7654994ee005d
_Main/BL/Type_AOnlineAndMOfflinePlanPIR/StaticMethod_GenerateData.qbl
@@ -51,25 +51,25 @@
      }
    }
    
    //traverse( version, OfflinePlanTable, table ){
    //  traverse( table, OfflinePlanColumn, column, column.ColumnDate() >= startdate and column.ColumnDate() <= enddate ){
    //    traverse( column, OfflinePlanCell, cell, ( werk = 'All' or cell.OfflinePlanRow().ProductionLine().FindString( werk, 0 ) > -1 )
    //              and ( cell.OfflinePlanRow().ProductionLine() <> 'DL_MOMO' or cell.OfflinePlanRow().ProductionLine() <> 'CC_MOMO' )
    //              and cell.OfflinePlanRow().Type() = '1' ){
    //      row              := cell.OfflinePlanRow();
    //      if( not exists( productids, Elements, e, e = row.ProductID() ) ){
    //        productids.Add( row.ProductID() );
    //      }
    //      pirdata          := selectobject(  pir, PIRData, pirdata, pirdata.Product() = row.ProductID() and pirdata.PlanningDate() = column.ColumnDate() );
    //      if( isnull( pirdata ) ){
    //        pirdata          := pir.PIRData( relnew, Product         := row.ProductID()
    //                                         , PlanningDate            := column.ColumnDate()
    //                                         , PlanningQty             := 0 );
    //      }
    //      pirdata.PlanningQty( pirdata.PlanningQty() + [Number]cell.Value() );
    //    }
    //  }
    //}
    traverse( owner, OfflinePlanArchiveVersion, table ){
      traverse( table, Column, column, column.StartDate() >= startdate and column.StartDate() <= enddate ){
        traverse( column, Cell, cell, ( werk = 'All' or cell.Row().ProductionLine().FindString( werk, 0 ) > -1 )
                  and ( cell.Row().ProductionLine() <> 'DL_MOMO' or cell.Row().ProductionLine() <> 'CC_MOMO' )
                  and cell.Row().Type() = '1' ){
          row              := cell.Row();
          if( not exists( productids, Elements, e, e = row.ProductID() ) ){
            productids.Add( row.ProductID() );
          }
          pirdata          := selectobject(  pir, PIRData, pirdata, pirdata.Product() = row.ProductID() and pirdata.PlanningDate() = column.StartDate() );
          if( isnull( pirdata ) ){
            pirdata          := pir.PIRData( relnew, Product           := row.ProductID()
                                             , PlanningDate            := column.StartDate()
                                             , PlanningQty             := 0 );
          }
          pirdata.PlanningQty( pirdata.PlanningQty() + [Number]cell.Value() );
        }
      }
    }
    traverse( productids, Elements, e ){
      for( date := startdate.StartOfWeek(); date <= enddate; date := ( date + Duration::Days( 1 ) ).Date() ){
        if( not exists( pir, PIRData, pirdata, pirdata.Product() = e and pirdata.PlanningDate() = date ) ){