Quintiq file version 2.0 
 | 
#parent: #root 
 | 
StaticMethod HandleBudget ( 
 | 
  Archive archive, 
 | 
  MacroPlan macroPlan, 
 | 
  String userName, 
 | 
  String budgetFileName, 
 | 
  BinaryValue budgetBinaryValue, 
 | 
  Boolean isBudgetArchive, 
 | 
  String filePath, 
 | 
  Boolean isOverwriteFile 
 | 
) as stream[JSON] 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    // 请求参数 
 | 
    pathBudget := filePath + budgetFileName; 
 | 
    isArchive  := ifexpr( isBudgetArchive, "true", "false" ); 
 | 
    isOverride := ifexpr( isOverwriteFile, "true", "false" ); 
 | 
    minorKey   := [String]macroPlan.MDSID().MinorKey(); 
 | 
    json       := JSON::Object() 
 | 
                  .Add( "path", pathBudget ) 
 | 
                  .Add( "isArchive", isArchive ) 
 | 
                  .Add( "isOverride", isOverride ) 
 | 
                  .Add( "minorKey", minorKey ).Build().AsString(); 
 | 
     
 | 
    // 写入临时文件 
 | 
    Archive::WriteTempFile( pathBudget, budgetBinaryValue ); 
 | 
     
 | 
    // 调用接口 
 | 
    url := "/PPBudget/Import"; 
 | 
     
 | 
    i := HTTPInterface::Create( archive.JavaInterfaceAddress(), archive.JavaInterfacePort() ); 
 | 
    i.URL( url ); 
 | 
    i.PostMethod( true ); 
 | 
    i.MediaType( "application/json" ); 
 | 
    i.TimeOut( Duration::Minutes( 5 ) ); 
 | 
     
 | 
    i.Call( json ); 
 | 
       
 | 
    htmlresult := i.Result(); 
 | 
       
 | 
    respJSON   := JSON::Parse( htmlresult ); 
 | 
     
 | 
    return emit( respJSON ); 
 | 
  *] 
 | 
} 
 |