Quintiq file version 2.0
|
#parent: #root
|
StaticMethod Initialize (
|
MacroPlan owner
|
)
|
{
|
TextBody:
|
[*
|
// 甄兰鸽 Jun-24-2024 (created)
|
owner.FinancialProductionSource( relflush );
|
ccunit := EnginePipelineReport::GetDefaultCCUnit();
|
dlunit := EnginePipelineReport::GetDefaultDLUnit();
|
//allunit := EnginePipelineReport::GetDefaultAllUnit();
|
source := owner.EnginePipelineSource( relnew, Name := EnginePipelineReport::GetDefaultName() );
|
table := source.Report( relnew, ID := source.Name(), Name := source.Name() );
|
showtable := source.Report( relnew, ID := source.Name() + 'Show', Name := source.Name(), IsShow := true );
|
|
search := source.Search( relnew, StartDate := Date::MinDate(), EndDate := Date::MaxDate(), TimeUnit := Translations::MP_GlobalParameters_Day() );
|
|
products := construct( Product_MPs );
|
//初始化列
|
table.GenerateColumn( owner, 'All', search.StartDate(), search.EndDate() );
|
|
//生成生产和库存数据
|
traverse( owner, Product_MP.ProductInStockingPoint_MP, pisp, pisp.IsLeaf() and not pisp.IsSystem() ){
|
unit := pisp.StockingPoint_MP().UnitID();
|
// info( unit, pisp.ProductID() );
|
//初始化行
|
row := table.GetRow( pisp.ProductID() );
|
|
traverse( pisp, ProductInStockingPointInPeriod, pispip, not pispip.Period_MP().IsHistorical()
|
and ( pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Day()
|
or pispip.Period_MP().TimeUnit() = Translations::MP_GlobalParameters_Week() ) ){
|
periodtime := pispip.Period_MP().StartDate();
|
periodname := periodtime.Format( "M2/D2/Y" );
|
// info( '---------------------------------', periodtime, table.Column( relsize ), pispip.Period_MP().TimeUnit() );
|
column := selectobject( table, Column, column, column.Name() = periodname and column.Period() = periodtime and column.TimeUnit() = pispip.Period_MP().TimeUnit() );
|
// info( '---------------------------------', isnull( column ), isnull( row ) );
|
// info( '---------------------------------', column.Name(), row.Name() );
|
if( unit = ccunit or unit = dlunit ){
|
row.SetCellProductionValue( column, unit, pispip.NewSupplyProductionQuantity() );
|
}
|
row.SetCellInventoryValue( column, pispip.PlannedInventoryLevelEnd() );
|
}
|
}
|
|
//生成需求数据
|
traverse( owner, SalesDemand.astype( Forecast ), forecast, ( forecast.EndDate() - forecast.StartDate() ) < 8){
|
row := table.GetRow( forecast.ProductID() );
|
weekdate := ( forecast.StartDate() - Duration::Days( 7 ) ).Date();
|
periodtime := forecast.StartDate();
|
periodname := periodtime.Format( "M2/D2/Y" );
|
|
column := selectobject( table, Column, column, column.Name() = periodname and column.Period() = periodtime and column.TimeUnit() = Translations::MP_GlobalParameters_Day() );
|
weekcolumn := minobject( table, Column, wcolumn, wcolumn.Period() <= weekdate and wcolumn.TimeUnit() = Translations::MP_GlobalParameters_Week(), wcolumn.Period() );
|
|
if( not isnull( column ) ){
|
row.SetCellDemandValue( column, forecast.SalesSegmentName(), forecast.Quantity() );
|
}
|
|
if( not isnull( weekcolumn ) ){
|
row.SetCellDemandValue( weekcolumn, forecast.SalesSegmentName(), forecast.Quantity() );
|
}
|
}
|
rows := selectsortedset( table, Row, row, row.Name() );
|
i := 0;
|
traverse( rows, Elements, e ){
|
e.RowNr( i );
|
i := i + 1;
|
}
|
showtable.Generate( search, products );
|
*]
|
}
|