| | |
| | | TextBody: |
| | | [* |
| | | // rislai Jun-20-2024 (created) |
| | | // archive := baseVersion.Archive(); // archive不可设置为只读 |
| | | localTable := recycleBin.LocalTable( relnew,Name := baseVersion.Name() + "__" + compareVersion.Name()); |
| | | |
| | | table := recycleBin.LocalTable( relnew ); |
| | | baseVersionFile := OSFile::Construct(); |
| | | compareVersionFile := OSFile::Construct(); |
| | | |
| | | baseVersion.Load( table ); |
| | | compareVersion.Load( table ); |
| | | try { |
| | | baseVersionFile.Open( baseVersion.FilePath(), "Read", false ); |
| | | baseVersionDataSource := GeneralExcelImportAndExportDataSource::Upload( recycleBin, baseVersionFile.ReadBinary(), baseVersion.FilePath() ); |
| | | baseVersionDataSource.ReadStructure(); |
| | | |
| | | compareVersionFile.Open( compareVersion.FilePath(), "Read", false ); |
| | | compareVersionDataSource := GeneralExcelImportAndExportDataSource::Upload( recycleBin, compareVersionFile.ReadBinary(), compareVersion.FilePath() ); |
| | | compareVersionDataSource.ReadStructure(); |
| | | |
| | | baseVersionTable := select( baseVersionDataSource, GeneralExcelImportAndExportDataTable, tempGEIAEDT, true ); |
| | | compareVersionTable := select( compareVersionDataSource, GeneralExcelImportAndExportDataTable, tempGEIAEDT, true ); |
| | | |
| | | if( not isnull( baseVersionTable ) and not isnull( compareVersionTable )){ |
| | | |
| | | //生成行数据 |
| | | rowKeys := construct( Strings ); |
| | | baseVersionRowTree := NamedValueTree::Create(); |
| | | baseVersionRows := construct( GeneralExcelImportAndExportDataRows ,constcontent); |
| | | compareVersionRowTree := NamedValueTree::Create(); |
| | | compareVersionRows := construct( GeneralExcelImportAndExportDataRows ,constcontent); |
| | | ArchivePR::FillRows( baseVersionTable,rowKeys,baseVersionRowTree,baseVersionRows ); |
| | | ArchivePR::FillRows( compareVersionTable,rowKeys,compareVersionRowTree,compareVersionRows ); |
| | | |
| | | // 生成列数据 |
| | | columnTree := NamedValueTree::Create(); |
| | | columns := construct( LocalColumns ); |
| | | ArchivePR::GenerateColumnIndex( baseVersionTable,localTable,columnTree,columns ); |
| | | ArchivePR::GenerateColumnIndex( compareVersionTable,localTable,columnTree,columns ); |
| | | columnNames := selectvalues( columns,Elements,column,true,column.Name() ); |
| | | |
| | | // 生成数据 |
| | | |
| | | for ( rowIndex := 0; rowIndex < rowKeys.Size(); rowIndex++ ) { |
| | | rowKey := rowKeys.Element( rowIndex ); |
| | | |
| | | baseVersionCellTree := NamedValueTree::Create(); |
| | | baseVersionCells := construct( GeneralExcelImportAndExportDataCells ,constcontent); |
| | | |
| | | compareVersionCellTree := NamedValueTree::Create(); |
| | | compareVersionCells := construct( GeneralExcelImportAndExportDataCells ,constcontent); |
| | | |
| | | ArchivePR::FillCells( rowKey,baseVersionRowTree,baseVersionRows,baseVersionCellTree,baseVersionCells ); |
| | | ArchivePR::FillCells( rowKey,compareVersionRowTree,compareVersionRows,compareVersionCellTree,compareVersionCells ); |
| | | |
| | | row := localTable.LocalRow( relnew,Index := localTable.GetRowIndexCache() ); |
| | | |
| | | traverse( columnNames,Elements,columnName ){ |
| | | columnHandle := columnTree.GetHandle( columnName ); |
| | | columnIndex := columnTree.Root().Child( columnHandle ).GetValueAsNumber(); |
| | | column := columns.Element( columnIndex ); |
| | | |
| | | baseVersionCell := constnull( GeneralExcelImportAndExportDataCell ); |
| | | baseVersionCellHandle := baseVersionCellTree.GetHandle( columnName ); |
| | | try{ |
| | | baseVersionCellIndex := baseVersionCellTree.Root().Child( baseVersionCellHandle ).GetValueAsNumber(); |
| | | baseVersionCell := baseVersionCells.Element( baseVersionCellIndex ); |
| | | }onerror{} |
| | | |
| | | compareVersionCell := constnull( GeneralExcelImportAndExportDataCell ); |
| | | compareVersionCellHandle := compareVersionCellTree.GetHandle( columnName ); |
| | | try{ |
| | | compareVersionCellIndex := compareVersionCellTree.Root().Child( compareVersionCellHandle ).GetValueAsNumber(); |
| | | compareVersionCell := compareVersionCells.Element( compareVersionCellIndex ); |
| | | }onerror{} |
| | | |
| | | if( columnName = "产地" or columnName = "车型" or columnName = "发动机零件号" or columnName = "发动机四位码" ){ |
| | | row.LocalCell( relnew,LocalCell_DemandComparison,LocalColumn := column, |
| | | BaseVersionValue := ifexpr( isnull( baseVersionCell ), "空", baseVersionCell.Value()), |
| | | CompareVersionValue := ifexpr( isnull( compareVersionCell ),"空",compareVersionCell.Value())); |
| | | column.IsAttrbuteColumn( true ); |
| | | if( columnName = "发动机零件号" ){ |
| | | row.CustomName( ifexpr( isnull( baseVersionCell ), ifexpr( isnull( compareVersionCell ),"空",compareVersionCell.Value()), baseVersionCell.Value()) ); |
| | | } |
| | | }else{ |
| | | row.LocalCell( relnew,LocalCell_DemandComparison,LocalColumn := column, |
| | | BaseVersion := ifexpr( isnull( baseVersionCell ),0,[Real]baseVersionCell.Value()), |
| | | CompareVersion := ifexpr( isnull( compareVersionCell ), 0 ,[Real]compareVersionCell.Value() )); |
| | | } |
| | | } |
| | | } |
| | | } |
| | | // 后续删除 |
| | | baseVersionDataSource.Delete(); |
| | | compareVersionDataSource.Delete(); |
| | | |
| | | baseVersionFile.Close(); |
| | | compareVersionFile.Close(); |
| | | } onerror { |
| | | if( not isnull( baseVersionFile )){ |
| | | baseVersionFile.Close(); |
| | | } |
| | | if( not isnull( compareVersionFile )){ |
| | | compareVersionFile.Close(); |
| | | } |
| | | error( e ); |
| | | } |
| | | |
| | | return table; |
| | | return localTable; |
| | | *] |
| | | } |