| Quintiq file version 2.0 | 
| #parent: #root | 
| StaticMethod Archive ( | 
|   JSON respJSON, | 
|   Archive archive, | 
|   String archiveType, | 
|   BinaryValue ppaBinaryValue, | 
|   String curveFileName, | 
|   BinaryValue curveBinaryValue | 
| ) | 
| { | 
|   TextBody: | 
|   [* | 
|     code             := respJSON.Get( "code" ).GetNumber(); | 
|     archiveFileJSONs := respJSON.Get( "archiveFiles" ); | 
|     //info( archiveFileJSONs.AsString() ); | 
|      | 
|     if ( code = 200 or code = 201 ) { | 
|       for ( i := 0; i < archiveFileJSONs.Size(); i++ ) { | 
|         archiveFileJSON := archiveFileJSONs.Get( i ); | 
|          | 
|         fileName        := archiveFileJSON.Get( "fileName" ).GetString(); | 
|         filePath        := archiveFileJSON.Get( "fileFullPath" ).GetString(); | 
|          | 
|         if ( archiveType = "PR" ) { | 
|           apr := select( archive, ArchivePR, tempAPR, tempAPR.Name() = fileName ); | 
|           if ( not isnull( apr ) ) { | 
|             apr.FilePath( filePath ); | 
|           } else { | 
|             archive.ArchivePR( relnew, Name := fileName, FilePath := filePath ); | 
|           } | 
|         } else if ( archiveType = "PP" ) { | 
|           app := select( archive, ArchivePP, tempAPP, tempAPP.Name() = fileName ); | 
|           if ( not isnull( app ) ) { | 
|             app.FilePath( filePath ); | 
|           } else { | 
|             archive.ArchivePP( relnew, Name := fileName, FilePath := filePath ); | 
|           } | 
|         } else if ( archiveType = "Budget" ) { | 
|           ab := select( archive, ArchiveBudget, tempAB, tempAB.Name() = fileName ); | 
|           if ( not isnull( ab ) ) { | 
|             ab.FilePath( filePath ); | 
|           } else { | 
|             archive.ArchiveBudget( relnew, Name := fileName, FilePath := filePath ); | 
|           } | 
|         } else if ( archiveType = "PPA" ) { | 
|           // 存档PPA | 
|           appa := select( archive, ArchivePPA, tempAPPA, tempAPPA.Name() = fileName ); | 
|           if ( not isnull( appa ) ) { | 
|             appa.FilePath( filePath ); | 
|             appa.SourceFileBinaryValue( ppaBinaryValue ); | 
|           } else { | 
|             archive.ArchivePPA( relnew, Name := fileName, FilePath := filePath, SourceFileBinaryValue := ppaBinaryValue ); | 
|           } | 
|            | 
|           // 存档Curve | 
|           ac := select( archive, ArchiveCurve, tempAC, true ); | 
|           if ( not isnull( ac ) ) { | 
|             ac.Delete(); | 
|           } | 
|           archive.ArchiveCurve( relnew, Name := "始终只存一版.xlsx", FilePath := curveFileName, SourceFileBinaryValue := curveBinaryValue ); | 
|         } | 
|       } | 
|     } | 
|   *] | 
| } |