Quintiq file version 2.0 
 | 
#parent: #root 
 | 
StaticMethod Compared ( 
 | 
  RecycleBin recycleBin, 
 | 
  String baseVersionPath, 
 | 
  String compareVersionPath, 
 | 
  String baseVersionName, 
 | 
  String compareVersionName 
 | 
) as LocalTable 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    // rislai Jun-20-2024 (created) 
 | 
    localTable := recycleBin.LocalTable( relnew,Name := baseVersionName + "__" + compareVersionName ); 
 | 
     
 | 
    baseVersionFile := OSFile::Construct(); 
 | 
    compareVersionFile := OSFile::Construct(); 
 | 
     
 | 
    try { 
 | 
      baseVersionFile.Open( baseVersionPath, "Read", false ); 
 | 
      baseVersionDataSource := GeneralExcelImportAndExportDataSource::Upload( recycleBin, baseVersionFile.ReadBinary(), baseVersionPath ); 
 | 
      baseVersionDataSource.ReadStructure(); 
 | 
       
 | 
      compareVersionFile.Open( compareVersionPath, "Read", false ); 
 | 
      compareVersionDataSource := GeneralExcelImportAndExportDataSource::Upload( recycleBin, compareVersionFile.ReadBinary(), compareVersionPath ); 
 | 
      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); 
 | 
        LocalCell_DemandComparison::FillRows( baseVersionTable,rowKeys,baseVersionRowTree,baseVersionRows ); 
 | 
        LocalCell_DemandComparison::FillRows( compareVersionTable,rowKeys,compareVersionRowTree,compareVersionRows ); 
 | 
         
 | 
        // 生成列数据 
 | 
        columnTree := NamedValueTree::Create(); 
 | 
        columns := construct( LocalColumns ); 
 | 
        LocalCell_DemandComparison::GenerateColumnIndex( baseVersionTable,localTable,columnTree,columns ); 
 | 
        LocalCell_DemandComparison::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); 
 | 
           
 | 
          LocalCell_DemandComparison::FillCells( rowKey,baseVersionRowTree,baseVersionRows,baseVersionCellTree,baseVersionCells ); 
 | 
          LocalCell_DemandComparison::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 localTable; 
 | 
  *] 
 | 
} 
 |