| | |
| | | [* |
| | | // 甄兰鸽 Nov-22-2024 (created) |
| | | info( '-------------------------Start---------------------'); |
| | | 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( "yyyy/MM/dd" ); |
| | | |
| | | traverse( recycle, GeneralExcelImportAndExportDataSource.GeneralExcelImportAndExportDataTable, table ){ |
| | | traverse( table, GeneralExcelImportAndExportDataRow, row ){ |
| | | productcell := selectobject( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 2 ); |
| | | factorycell := selectobject( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 0 ); |
| | | unitname := ifexpr( factorycell.Value().StartsWith( '长春' ), FinancialProductionReport::GetDefaultCCUnit(), FinancialProductionReport::GetDefaultDLUnit() ); |
| | | // idsrow := idstable.GetRowByUnit( productcell.Value(), unitname ); |
| | | traverse( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() > 2 ){ |
| | | period := cnv2.Convert( cell.GeneralExcelImportAndExportDataColumn().Name() ); |
| | | archivedata := selectobject( interface, CustomerDemandArchive, archivedata, archivedata.Factory() = factorycell.Value() |
| | | and archivedata.Product() = productcell.Value() |
| | | and archivedata.StartDate() = period |
| | | and archivedata.Origin() = 'IDS' ); |
| | | if( isnull( archivedata ) ){ |
| | | archivedata := interface.CustomerDemandArchive( relnew, Factory := factorycell.Value(), Product := productcell.Value(), StartDate := period, Origin := 'IDS', FactoryName := unitname ); |
| | | } |
| | | archivedata.Quantity( [Real]cell.Value() ); |
| | | } |
| | | } |
| | | } |
| | | traverse ( macroplan, SalesDemand.astype( Forecast ), forecast, not isnull( forecast.Product_MP() ) and forecast.Origin() = 'PPA' ){ |
| | | //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( "yyyy/MM/dd" ); |
| | | // |
| | | //traverse( recycle, GeneralExcelImportAndExportDataSource.GeneralExcelImportAndExportDataTable, table ){ |
| | | // traverse( table, GeneralExcelImportAndExportDataRow, row ){ |
| | | // productcell := selectobject( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 2 ); |
| | | // factorycell := selectobject( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() = 0 ); |
| | | // unitname := ifexpr( factorycell.Value().StartsWith( '长春' ), FinancialProductionReport::GetDefaultCCUnit(), FinancialProductionReport::GetDefaultDLUnit() ); |
| | | //// idsrow := idstable.GetRowByUnit( productcell.Value(), unitname ); |
| | | // traverse( row, GeneralExcelImportAndExportDataCell, cell, cell.GeneralExcelImportAndExportDataColumn().ColumnIndex() > 2 ){ |
| | | // period := cnv2.Convert( cell.GeneralExcelImportAndExportDataColumn().Name() ); |
| | | // archivedata := selectobject( interface, CustomerDemandArchive, archivedata, archivedata.Factory() = factorycell.Value() |
| | | // and archivedata.Product() = productcell.Value() |
| | | // and archivedata.StartDate() = period |
| | | // and archivedata.Origin() = 'IDS' ); |
| | | // if( isnull( archivedata ) ){ |
| | | // archivedata := interface.CustomerDemandArchive( relnew, Factory := factorycell.Value(), Product := productcell.Value(), StartDate := period, Origin := 'IDS', FactoryName := unitname ); |
| | | // } |
| | | // archivedata.Quantity( [Real]cell.Value() ); |
| | | // } |
| | | // } |
| | | //} |
| | | traverse ( macroplan, SalesDemand.astype( Forecast ), forecast, not isnull( forecast.Product_MP() ) and ( forecast.Origin() = 'PPA' or forecast.Origin() = 'IDS' ) ){ |
| | | |
| | | unitname := ifexpr( forecast.StockingPointID().StartsWith( '长春' ) , FinancialProductionReport::GetDefaultCCUnit(), FinancialProductionReport::GetDefaultDLUnit() );/*ifexpr( forecast.SalesSegment_MP().Name().StartsWith( 'Changchun' ) |
| | | or exists( forecast.SalesSegment_MP().GetAllParent(), Elements, psalessegment, psalessegment.Name().StartsWith( 'Changchun' ) ) |
| | |
| | | } |
| | | } |
| | | |
| | | source.Delete(); |
| | | //source.Delete(); |
| | | info( '-------------------------End---------------------'); |
| | | *] |
| | | } |
| | |
| | | ] |
| | | Properties: |
| | | [ |
| | | Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"SalesSegment","title":"SalesSegment","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"SalesSegment"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"StockingPointID","title":"StockingPointID","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"StockingPointID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Factory","title":"Factory","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Factory"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"FactoryName","title":"FactoryName","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"FactoryName"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Product","title":"Product","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Product"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Origin","title":"Origin","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Origin"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"StartDate","title":"StartDate","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"StartDate"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"EndDate","title":"EndDate","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"EndDate"}}]' |
| | | Columns: '[{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"SalesSegment","title":"SalesSegment","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"SalesSegment"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"StockingPointID","title":"StockingPointID","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"StockingPointID"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"FactoryName","title":"FactoryName","subtotals":"","tooltip":"","width":-1,"display":"hidden","editable":false,"attribute":"FactoryName"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Product","title":"Product","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Product"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Origin","title":"Origin","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Origin"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"StartDate","title":"StartDate","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"StartDate"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"EndDate","title":"EndDate","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"EndDate"}},{"attribute":{"classtype":"WebApiDefinitionAttributeDataMember","columnid":"Quantity","title":"Quantity","subtotals":"","tooltip":"","width":-1,"display":"shown","editable":false,"attribute":"Quantity"}}]' |
| | | ContextMenu: 'listContextMenuCustomerDemandArchive' |
| | | SortCriteria: 'desc:StartDate' |
| | | Taborder: 2 |
| | |
| | | subtotals: '' |
| | | width: 150 |
| | | } |
| | | column_Factory |
| | | { |
| | | columnId: 'Factory' |
| | | dataPath: 'Factory' |
| | | dataType: 'string' |
| | | index: 2 |
| | | subtotals: '' |
| | | width: 150 |
| | | } |
| | | column_FactoryName |
| | | { |
| | | columnId: 'FactoryName' |
| | | dataPath: 'FactoryName' |
| | | dataType: 'string' |
| | | index: 3 |
| | | subtotals: '' |
| | | width: 150 |
| | | } |
| | | column_Product |
| | | { |
| | | columnId: 'Product' |
| | | dataPath: 'Product' |
| | | dataType: 'string' |
| | | index: 4 |
| | | index: 2 |
| | | subtotals: '' |
| | | width: 150 |
| | | } |
| | |
| | | columnId: 'Origin' |
| | | dataPath: 'Origin' |
| | | dataType: 'string' |
| | | index: 5 |
| | | index: 3 |
| | | subtotals: '' |
| | | width: 150 |
| | | } |
| | |
| | | columnId: 'StartDate' |
| | | dataPath: 'StartDate' |
| | | dataType: 'date' |
| | | index: 6 |
| | | index: 4 |
| | | subtotals: '' |
| | | width: 150 |
| | | } |
| | |
| | | columnId: 'EndDate' |
| | | dataPath: 'EndDate' |
| | | dataType: 'date' |
| | | index: 7 |
| | | index: 5 |
| | | subtotals: '' |
| | | width: 150 |
| | | } |
| | | column_Quantity |
| | | { |
| | | columnId: 'Quantity' |
| | | dataPath: 'Quantity' |
| | | dataType: 'real' |
| | | index: 6 |
| | | subtotals: '' |
| | | width: 150 |
| | | } |