lazhen
2024-11-07 7a55464720fcef69fc4362dcb570dff763ff026b
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
Quintiq file version 2.0
#parent: #root
StaticMethod CallInterfaceForDataCenter (
  InterfaceDataset owner,
  InterfaceLoginfo loginfo
) as owning JSON
{
  Description: '调用数据中台接口'
  TextBody:
  [*
    // 甄兰鸽 Jul-22-2024 (created)
    address       := Translations::InterfaceDataset_DataCenter_Address(); 
    httpinterface := HTTPInterface::Create( address,80);
    httpinterface.PostMethod( true ); 
    httpinterface.MediaType( Translations::InterfaceDataset_ContentType() );
    httpinterface.AddHeader( "clientId", Translations::InterfaceDataset_DataCenter_ClientId() );
    httpinterface.AddHeader( "clientSecret", Translations::InterfaceDataset_DataCenter_ClientSecret() );
    try{
      if( loginfo.Name() = Translations::InterfaceDataset_CustomerDemandPPAIDS_Name() ){//客户需求
        httpinterface.URL( Translations::InterfaceDataset_CustomerDemandPPAIDS_URL() );
      } else if( loginfo.Name() = Translations::InterfaceDataset_AssemblyOnlinePlanPPPSPush_Name() ){//装配上线计划
        httpinterface.URL( Translations::InterfaceDataset_AssemblyOnlinePlanPPPSPush_URL() );
      } else if( loginfo.Name() = Translations::InterfaceDataset_CustomerDemandPPAIDS_Name() ){//客户需求
        httpinterface.URL( Translations::InterfaceDataset_CustomerDemandPPAIDS_URL() );
      } 
      httpinterface.Call( loginfo.RequestBody() );
      result := httpinterface.Result();
      loginfo.Response( result );
      loginfo.Success( true );
    }onerror{
      loginfo.ReturnMsg( e.GeneralInformation() );
    }
    
    //后续公共处理
    loginfo.FinishTime( DateTime::ActualTime() );
    data             := JSON::Null().Build();
    
    if( loginfo.Success() ){
      resultJson     := JSON::Parse( loginfo.Response() );
      code           := resultJson.Get( "code" ).GetNumber();
      msg            := resultJson.Get( "message" ).GetString();
      data           := resultJson.Get( "data" );
      
      loginfo.ReturnMsg( msg );
      if( code = 200 ){
    //    total        := resultJson.Get( "dataSize" ).GetNumber();
        loginfo.ReturnSuccess( true );
    //    loginfo.TotalRow( total );
        loginfo.UpdateLast();
      }
    }
    
    return &data;
  *]
}