Quintiq file version 2.0 
 | 
#parent: #root 
 | 
StaticMethod SplitUsingCurve ( 
 | 
  SalesSegment_MP salesSegment, 
 | 
  Product_MP product, 
 | 
  StockingPoint_MP stockingPoint, 
 | 
  Date startDate, 
 | 
  Date endDate, 
 | 
  Real quantity, 
 | 
  String curve, 
 | 
  const Archive archive, 
 | 
  ArchiveExecutionStatus archiveExecutionStatus 
 | 
) 
 | 
{ 
 | 
  TextBody: 
 | 
  [* 
 | 
    // Akari Sep-11-2024 (created) 
 | 
    filePath := archive.FileArchivePath() + "\" + "temp" + "\"; 
 | 
    OS::CreateDirectory( filePath ); 
 | 
     
 | 
    macroPlan := salesSegment.MacroPlan(); 
 | 
    ac := select( archive, ArchiveFile.astype( ArchiveCurve ), tempAC, true ); 
 | 
     
 | 
    pathCurve     := filePath + ac.Name(); 
 | 
    Archive::WriteTempFile( pathCurve, ac.SourceFileBinaryValue() ); 
 | 
     
 | 
    // 请求参数 
 | 
    json          := JSON::Object() 
 | 
                     .Add( "salesSegment", salesSegment.Name() ) 
 | 
                     .Add( "productID", product.ID() ) 
 | 
                     .Add( "stockingPointID", stockingPoint.ID() ) 
 | 
                     .Add( "startDate", startDate.Format( "Y-M2-D2") ) 
 | 
                     .Add( "endDate", endDate.Format( "Y-M2-D2") ) 
 | 
                     .Add( "quantity", quantity ) 
 | 
                     .Add( "curve", curve ) 
 | 
                     .Add( "pathCurve", pathCurve ).Build().AsString(); 
 | 
     
 | 
    // 调用接口 
 | 
    url := "/IDSPPACurve/ImportCurveIncremental"; 
 | 
     
 | 
    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 ); 
 | 
     
 | 
    code    := respJSON.Get( "code" ).GetNumber(); 
 | 
    message := respJSON.Get( "message" ).GetString(); 
 | 
     
 | 
    if( code = 200 ){ 
 | 
        // 获取需求 
 | 
      archiveExecutionStatus.AES_TemporaryDemandData().Execute(); 
 | 
       
 | 
      // 生成Forecast 
 | 
      Archive::GenerateForecast( archiveExecutionStatus, macroPlan ,false ); 
 | 
       
 | 
      // 清空临时数据库 
 | 
      archiveExecutionStatus.AES_TemporaryDemandData().Source().FlatQuery( "truncate table A_Forecasts" ); 
 | 
    }else{ 
 | 
      error( message );  
 | 
    } 
 | 
  *] 
 | 
} 
 |