| | |
| | | #parent: #root |
| | | StaticMethod GenerateData ( |
| | | InterfaceDataset interface, |
| | | const MacroPlan macroplan, |
| | | MacroPlan macroplan, |
| | | RecycleBin recycle, |
| | | const Archive archive |
| | | ) |
| | |
| | | //interface.CustomerDemandIDSSearch( relflush ); |
| | | info( '-------------------------Start---------------------'); |
| | | allunit := CustomerDemandIDS::GetDefaultAllUnit(); |
| | | if( isnull( interface.CustomerDemandIDSSearch() ) ){ |
| | | interface.CustomerDemandIDSSearch( relnew, Generation := allunit, MqbMlb := allunit, Power := allunit, TimeUnit := Translations::MP_GlobalParameters_Day(), Unit := allunit ); |
| | | } |
| | | idstable := selectobject( interface, CustomerDemandIDS, idstable, idstable.ID() = '客户需求' ); |
| | | search := interface.CustomerDemandIDSSearch( relnew, Product := allunit, StartDate := Date::MinDate(), EndDate := Date::MaxDate(), TimeUnit := Translations::MP_GlobalParameters_Day(), Unit := allunit ); |
| | | name := '客户需求'; |
| | | idstable := selectobject( interface, CustomerDemandIDS, idstable, idstable.ID() = name ); |
| | | if( isnull( idstable ) ){ |
| | | idstable := interface.CustomerDemandIDS( relnew, ID := '客户需求', Name := '客户需求' ); |
| | | idstable := interface.CustomerDemandIDS( relnew, ID := name, Name := name ); |
| | | } |
| | | showtable := selectobject( interface, CustomerDemandIDS, version, version.IsShow() ); |
| | | if( isnull( showtable ) ){ |
| | | showtable := interface.CustomerDemandIDS( relnew, ID := name + 'Show', Name := name, IsShow := true ); |
| | | } |
| | | binaryValue := TemplateManager::GetIDSFullTable( archive, Date::ActualDate().Year() ); |
| | | source := GeneralExcelImportAndExportDataSource::Upload( recycle, binaryValue, OS::TempPath() + "template.xlsx" ); |
| | |
| | | periods := idsdates.Union( ppadates ); |
| | | periods := selectuniquevalues( periods, Elements, e, not exists( idstable, Column, column, column.StartDate() = e ), e ); |
| | | if( periods.Size() > 0 ){ |
| | | idstable.GenerateColumn( periods.Sort() ); |
| | | idstable.GenerateColumn( periods.Sort(), false ); |
| | | } |
| | | traverse( recycle, GeneralExcelImportAndExportDataSource.GeneralExcelImportAndExportDataTable, table ){ |
| | | traverse( table, GeneralExcelImportAndExportDataRow, row ){ |
| | |
| | | } |
| | | } |
| | | traverse ( macroplan, SalesDemand.astype( Forecast ), forecast, not isnull( forecast.Product_MP() ) and forecast.Origin() = 'PPA' ){ |
| | | unitname := ifexpr( forecast.SalesSegment_MP().Name().StartsWith( 'Changchun' ) |
| | | or exists( forecast.SalesSegment_MP().GetAllParent(), Elements, psalessegment, psalessegment.Name().StartsWith( 'Changchun' ) ) |
| | | , FinancialProductionReport::GetDefaultCCUnit() |
| | | , FinancialProductionReport::GetDefaultDLUnit() ); |
| | | traverse( forecast, PlanningSalesDemandInPeriod, sdip ){ |
| | | idsrow := idstable.GetRowByUnit( forecast.ProductID(), forecast.SalesSegmentName() ); |
| | | idsrow := idstable.GetRowByUnit( forecast.ProductID(), unitname ); |
| | | daycolumn := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Day(), sdip.StartDate() ); |
| | | weekcolumn := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Week(), sdip.StartDate() ); |
| | | monthcolumn := idstable.GetColumnByTimeUnit( Translations::MP_GlobalParameters_Month(), sdip.StartDate() ); |
| | |
| | | |
| | | source.Delete(); |
| | | info( '-------------------------End---------------------'); |
| | | showtable.Generate( search ); |
| | | *] |
| | | } |