xiaoding721
2024-11-22 d47b2a6610c16b6db7fa991f6064d990085b65f3
_Main/BL/Type_InventoryPlanArchiveVersion/StaticMethod_GenerateData.qbl
@@ -13,16 +13,16 @@
    machineproductparent   := MachiningPipelineReport::GetDefaultProductParent();
    engineproductparent    := EnginePipelineReport::GetDefaultProductParent();
    allunit                := AssemblyOnlinePlanVersion::GetDefaultAllUnit();
    name                   := InventoryPlanArchiveVersion::GetDefaultName();
    search                 := interfaceDataset.InventoryPlanArchiveVersionSearch( relnew, Product := allunit, Unit := allunit, StartDate := Date::MinDate(), EndDate := Date::MaxDate() );//, TimeUnit := Translations::MP_GlobalParameters_Day()
    name                   := InventoryPlanArchiveVersion::GetDefaultName();//search                 :=
    interfaceDataset.InventoryPlanArchiveVersionSearch( relnew, Product := allunit, Unit := allunit, StartDate := Date::MinDate(), EndDate := Date::MaxDate() );//, TimeUnit := Translations::MP_GlobalParameters_Day()
    table                  := selectobject( interfaceDataset, InventoryPlanArchiveVersion, version, not version.IsShow() );
    if( isnull( table ) ){
      table                := interfaceDataset.InventoryPlanArchiveVersion( relnew, ID := name, Name := name );
    }
    showtable              := selectobject( interfaceDataset, InventoryPlanArchiveVersion, version, version.IsShow() );
    if( isnull( showtable ) ){
      showtable               := interfaceDataset.InventoryPlanArchiveVersion( relnew, ID := name, Name := name, IsShow := true );
    }
    //showtable              := selectobject( interfaceDataset, InventoryPlanArchiveVersion, version, version.IsShow() );
    //if( isnull( showtable ) ){
    //  showtable               := interfaceDataset.InventoryPlanArchiveVersion( relnew, ID := name, Name := name, IsShow := true );
    //}
    periods                := selectuniquevalues(  macroPlan, Period_MP, period, not period.IsHistorical() and period.TimeUnit() = Translations::MP_GlobalParameters_Day()
                                                   and not exists( table, Column, column, column.StartDate() = period.StartDate() ), period.StartDate() );//column.TimeUnit() = Translations::MP_GlobalParameters_Day() and 
    if( periods.Size() > 0 ){
@@ -55,8 +55,8 @@
        traverse ( pispmp, ProductInStockingPointInPeriodPlanning.astype( ProductInStockingPointInPeriodPlanningLeaf ), pispippl, not pispippl.IsPeriodFrozen() ) {
          startdate          := pispippl.Start().Date();
          daycolumn          := table.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Day(), startdate );
          weekcolumn         := table.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Week(), startdate );
          monthcolumn        := table.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Month(), startdate );
    //      weekcolumn         := table.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Week(), startdate );
    //      monthcolumn        := table.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Month(), startdate );
          actinventoryKey    := pispmp.ProductID() + startdate.AsQUILL();
          actinventoryhandle := actinventorytree.GetHandle( actinventoryKey );
          actinventoryindex  := guard( actinventorytree.Root().Child( actinventoryhandle ),null( NamedValue ));
@@ -66,16 +66,16 @@
            actinventoryqty  := inventoryqrys.Element( actinventoryindex.GetValueAsNumber() );
          }
          inventoryrow.SetQuantity( daycolumn, pispippl.InventoryLevelEnd(), actinventoryqty );
          inventoryrow.SetQuantity( weekcolumn, pispippl.InventoryLevelEnd(), actinventoryqty );
          inventoryrow.SetQuantity( monthcolumn, pispippl.InventoryLevelEnd(), actinventoryqty );
    //      inventoryrow.SetQuantity( weekcolumn, pispippl.InventoryLevelEnd(), actinventoryqty );
    //      inventoryrow.SetQuantity( monthcolumn, pispippl.InventoryLevelEnd(), actinventoryqty );
      
        }
      }
    }
    
    info( '-------------------------End---------------------');
    productids             := selectuniquevalues( table, Row, row, row.Name() );
    productlines           := selectuniquevalues( table, Row, row, row.Unit() );
    showtable.Generate( search, productids, productlines );
    //productids             := selectuniquevalues( table, Row, row, row.Name() );
    //productlines           := selectuniquevalues( table, Row, row, row.Unit() );
    //showtable.Generate( search, productids, productlines );
  *]
}