Quintiq file version 2.0
|
#parent: #root
|
StaticMethod Send (
|
MacroPlan macroPlan,
|
Scenario scenario,
|
String businessType,
|
String address
|
)
|
{
|
TextBody:
|
[*
|
info( "版本号:", scenario.Name(), " 事业部:", businessType );
|
|
jsonBuilder := JSON::Object();
|
|
jsonBuilder.Add( "releaseDate", DateTime::ActualTime().Format( "Y-M2-D2 H2:m:s" ) );
|
jsonBuilder.Add( "businessType", businessType );
|
jsonBuilder.Add( "scenarioName", scenario.Name() );
|
|
jsonBuilderPanelMaterials := JSON::Array();
|
traverse ( macroPlan, PanelMaterial, pm, true ) {
|
jsonBuilderPanelMaterial := JSON::Object();
|
|
jsonBuilderPanelMaterial.Add( "productID", pm.PanelModel() );
|
jsonBuilderPanelMaterial.Add( "productDescription", pm.MaterialDescription() );
|
jsonBuilderPanelMaterial.Add( "startDate", pm.StartDate().Format( "Y-M2-D2" ) );
|
jsonBuilderPanelMaterial.Add( "quantity", pm.DemandQuantity() );
|
|
jsonBuilderPanelMaterials.Add( jsonBuilderPanelMaterial );
|
}
|
jsonBuilder.Add( "panelMaterials", jsonBuilderPanelMaterials );
|
|
json := jsonBuilder.Build();
|
|
//url := "/panelMaterial/send";
|
|
// for HTTPS requests:
|
//i := HTTPInterface::Create( address, 8080 );
|
//i.URL( url );
|
i := HTTPInterface::Create( address, 8080 );
|
i.MediaType( "application/json" );
|
i.URL( "/panelMaterial/send" );
|
i.PostMethod( true ); //it's not a POST method
|
//postrequestbody := '{
|
// "releaseDate": "2023-09-15 17:47:29",
|
// "businessType": "车载",
|
// "scenarioName": "1.0 Base",
|
// "panelMaterials": [
|
// {
|
// "productID": "Body side left - E series",
|
// "productDescription": "测试A",
|
// "startDate": "2023-09-13",
|
// "quantity": 100.0
|
// },
|
// {
|
// "productID": "Body side left - E series",
|
// "productDescription": "测试B",
|
// "startDate": "2023-09-22",
|
// "quantity": 200.0
|
// }
|
// ]
|
//}';
|
postrequestbody := json.AsString();
|
|
i.Call( postrequestbody ); // Call's argument is for POST method's content.
|
htmlresult := i.Result();
|
|
info( "-----------------------发送方--------------------------------" );
|
info( htmlresult.AsQUILL() );
|
*]
|
}
|