admin
2025-01-22 7e31442f0e9b07764e9c6a9680d3d4aeba5fe1de
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
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 := guard( respJSON.Get( "archiveFiles" ),JSON::Array().Build() );
    //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, ArchiveFile.astype( ArchivePR ), tempAPR, tempAPR.Name() = fileName );
          if ( not isnull( apr ) ) {
            apr.FilePath( filePath );
          } else {
            archive.ArchiveFile( relnew,ArchivePR, Name := fileName, FilePath := filePath );
          }
        } else if ( archiveType = "PP" ) {
          app := select( archive, ArchiveFile.astype( ArchivePP ), tempAPP, tempAPP.Name() = fileName );
          if ( not isnull( app ) ) {
            app.FilePath( filePath );
          } else {
            archive.ArchiveFile( relnew,ArchivePP, Name := fileName, FilePath := filePath );
          }
        } else if ( archiveType = "Budget" ) {
          ab := select( archive, ArchiveFile.astype( ArchiveBudget ), tempAB, tempAB.Name() = fileName );
          if ( not isnull( ab ) ) {
            ab.FilePath( filePath );
          } else {
            archive.ArchiveFile( relnew,ArchiveBudget, Name := fileName, FilePath := filePath );
          }
        } else if ( archiveType = "PPA" ) {
          // 存档PPA
          appa := select( archive, ArchiveFile.astype( ArchivePPA ), tempAPPA, tempAPPA.Name() = fileName );
          if ( not isnull( appa ) ) {
            appa.FilePath( filePath );
            appa.SourceFileBinaryValue( ppaBinaryValue );
          } else {
            archive.ArchiveFile( relnew,ArchivePPA, Name := fileName, FilePath := filePath, SourceFileBinaryValue := ppaBinaryValue );
          }
        }
      }
      if ( archiveType = "PPA" ) {
          // 存档Curve
          ac := select( archive, ArchiveFile.astype( ArchiveCurve ), tempAC, true );
          if ( not isnull( ac ) ) {
            ac.Delete();
          }
          archive.ArchiveFile( relnew,ArchiveCurve, Name := "始终只存一版.xlsx", FilePath := curveFileName, SourceFileBinaryValue := curveBinaryValue );
      }
    }
  *]
}