¶Ô±ÈÐÂÎļþ |
| | |
| | | Quintiq file version 2.0 |
| | | #parent: #root |
| | | StaticMethod GenerateData ( |
| | | const MacroPlan macroplan, |
| | | RecycleBin recycle, |
| | | const Archive archive, |
| | | InterfaceDataset interfaceDataset, |
| | | String executor, |
| | | Boolean versionflag |
| | | ) |
| | | { |
| | | Description: 'çæå¯ä»¥ä¸åç客æ·éæ±ï¼PPA+IDSï¼æ°æ®' |
| | | TextBody: |
| | | [* |
| | | // çå
°é¸½ Aug-20-2024 (created) |
| | | loginfo := maxobject( interfaceDataset, InterfaceLoginfo, loginfo, loginfo.Name() = Translations::InterfaceDataset_CustomerDemandPPAIDS_Name(), loginfo.InterfaceDateTime() ); |
| | | if( not isnull( loginfo ) ){ |
| | | if( not loginfo.IsShow() ){ |
| | | loginfo.Delete(); |
| | | }else{ |
| | | loginfo.Last( false ); |
| | | } |
| | | interfaceDataset.CustomerDemandPPAIDS( relflush ); |
| | | } |
| | | nowdate := DateTime::ActualTime(); |
| | | loginfo := interfaceDataset.InterfaceLoginfo( relnew, ExecuteUser := executor |
| | | , Name := Translations::InterfaceDataset_CustomerDemandPPAIDS_Name() |
| | | , InterfaceDateTime := nowdate |
| | | , Message := '客æ·éæ±ï¼PPA+IDSï¼æ°æ®æ¨é' |
| | | , Last := true |
| | | , IsShow := false |
| | | , ReturnSuccess := true |
| | | , ReturnMsg := 'Success' |
| | | , Success := true |
| | | ); |
| | | traverse( macroplan, SalesDemand.astype( Forecast ), forecast, forecast.Origin() = 'PPA' ){ |
| | | info( forecast.ProductID() ); |
| | | cd :=interfaceDataset.CustomerDemandPPAIDS( relnew, Product := forecast.ProductID() |
| | | , DemandDate := forecast.StartDate() |
| | | , DemandQty := [Number]forecast.Quantity() |
| | | , VersionName := macroplan.ScenarioName() |
| | | , InterfaceTime := nowdate |
| | | , VersionFlag := versionflag |
| | | ); |
| | | loginfo.CustomerDemandPPAIDS( relinsert, cd ); |
| | | } |
| | | binaryValue := TemplateManager::GetIDSFullTable( archive, Date::ActualDate().Year() ); |
| | | source := GeneralExcelImportAndExportDataSource::Upload( recycle, binaryValue, OS::TempPath() + "template.xlsx" ); |
| | | source.ReadStructure(); |
| | | Transaction::Transaction().Propagate( attribute( GeneralExcelImportAndExportDataColumn, ColumnIndex ) ); |
| | | cnv2 := StringToDate::StandardConverter(); |
| | | cnv2.SetCustomConversion(); |
| | | cnv2.CustomFormatString( "dd/MM/yyyy" ); |
| | | traverse( recycle, GeneralExcelImportAndExportDataSource.GeneralExcelImportAndExportDataTable, table ){ |
| | | traverse( table, GeneralExcelImportAndExportDataRow, row ){ |
| | | product := selectobject( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 2 ); |
| | | traverse( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() > 2 ){ |
| | | info( cell.GeneralExcelImportAndExportDataColumn().ColumnIndex(), cell.Value(), product.Value() ); |
| | | period := cnv2.Convert( cell.GeneralExcelImportAndExportDataColumn().Name() ); |
| | | cd :=interfaceDataset.CustomerDemandPPAIDS( relnew, Product := product.Value() |
| | | , DemandDate := period |
| | | , DemandQty := [Number]cell.Value() |
| | | , VersionName := macroplan.ScenarioName() |
| | | , InterfaceTime := nowdate |
| | | , VersionFlag := versionflag |
| | | ); |
| | | loginfo.CustomerDemandPPAIDS( relinsert, cd ); |
| | | } |
| | | } |
| | | } |
| | | source.Delete(); |
| | | loginfo.TotalRow( loginfo.CustomerDemandPPAIDS( relsize ) ); |
| | | *] |
| | | } |
| | |
| | | #parent: #root |
| | | StaticMethod GenerateData ( |
| | | const MacroPlan macroplan, |
| | | RecycleBin recycle, |
| | | const Archive archive, |
| | | InterfaceDataset interfaceDataset, |
| | | String executor, |
| | |
| | | , Success := true |
| | | ); |
| | | traverse( macroplan, SalesDemand.astype( Forecast ), forecast, forecast.Origin() = 'PPA' ){ |
| | | info( forecast.ProductID() ); |
| | | cd :=interfaceDataset.CustomerDemandPPAIDS( relnew, Product := forecast.ProductID() |
| | | , DemandDate := forecast.StartDate() |
| | | , DemandQty := [Number]forecast.Quantity() |
| | |
| | | loginfo.CustomerDemandPPAIDS( relinsert, cd ); |
| | | } |
| | | binaryValue := TemplateManager::GetIDSFullTable( archive, Date::ActualDate().Year() ); |
| | | CustomerDemandIDS::ReadStructure( binaryValue, interfaceDataset ); |
| | | productcolumn := select( interfaceDataset, CustomerDemandIDS.Column, column, column.Index() = 1 ); |
| | | source := GeneralExcelImportAndExportDataSource::Upload( recycle, binaryValue, OS::TempPath() + "template.xlsx" ); |
| | | source.ReadStructure(); |
| | | Transaction::Transaction().Propagate( attribute( GeneralExcelImportAndExportDataColumn, ColumnIndex ) ); |
| | | cnv2 := StringToDate::StandardConverter(); |
| | | cnv2.SetCustomConversion(); |
| | | cnv2.CustomFormatString( "dd/MM/yyyy" ); |
| | | traverse( interfaceDataset, CustomerDemandIDS.Row, row ){ |
| | | product := selectobject( row, Cell, cell, cell.Column() = productcolumn ); |
| | | traverse( row, Cell, cell, cell.Column().Index() > 3 ){ |
| | | period := cnv2.Convert( cell.Column().Name() ); |
| | | traverse( recycle, GeneralExcelImportAndExportDataSource.GeneralExcelImportAndExportDataTable, table ){ |
| | | traverse( table, GeneralExcelImportAndExportDataRow, row ){ |
| | | product := selectobject( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 2 ); |
| | | traverse( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() > 2 ){ |
| | | info( cell.GeneralExcelImportAndExportDataColumn().ColumnIndex(), cell.Value(), product.Value() ); |
| | | period := cnv2.Convert( cell.GeneralExcelImportAndExportDataColumn().Name() ); |
| | | cd :=interfaceDataset.CustomerDemandPPAIDS( relnew, Product := product.Value() |
| | | , DemandDate := period |
| | | , DemandQty := [Number]cell.Value() |
| | |
| | | loginfo.CustomerDemandPPAIDS( relinsert, cd ); |
| | | } |
| | | } |
| | | } |
| | | source.Delete(); |
| | | loginfo.TotalRow( loginfo.CustomerDemandPPAIDS( relsize ) ); |
| | | *] |
| | | } |