Commit 2b4c6664 authored by Omar Fantazi's avatar Omar Fantazi

Traiter et tracer le code retour de l'appel des WebServices.

parent 8c6e9b60
......@@ -22,7 +22,7 @@ namespace InterfaceScadaToIN4RM.Caller.Callers
InvocationResults ScrapConveyorDetailCreation(ScrapsConveyorDetails scrapconveyorDetails);
ArrayOfInterface_ScrapConveyorCreationResultDC ScrapConveyorDetailCreation(ScrapsConveyorDetails scrapconveyorDetails);
InvocationResults HandlingUnitsCreation(HandlingUnitDetails handlingUnitdetails);
......
......@@ -11,6 +11,7 @@ using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Xml.Serialization;
//using System.Xml;
//using System.Xml.Serialization;
......@@ -26,6 +27,11 @@ namespace InterfaceScadaToIN4RM.Caller.Callers
private RestClient restClient;
private XmlSerializer serializer = new XmlSerializer(typeof(InvocationResults));
private InvocationResults invocationResult;
/// <summary>
/// Gets or sets the base URL.
......@@ -93,12 +99,20 @@ namespace InterfaceScadaToIN4RM.Caller.Callers
IRestResponse<InvocationResults> response = restClient.Execute<InvocationResults>(request);
if (response != null)
{
logger.Info("Call WorkOrderCreation : response.Content : {0}", response.Content);
logger.Info("Call WorkOrderCreation : response.StatusCode : {0}", response.StatusCode);
logger.Info("Call WorkOrderCreation : response.IsSuccessful : {0}", response.IsSuccessful);
logger.Info("Call WorkOrderCreation : response.StatusDescription : {0}", response.StatusDescription);
using (TextReader reader = new StringReader(response.Content))
{
invocationResult = (InvocationResults)serializer.Deserialize(reader);
}
}
else
{
......@@ -107,7 +121,7 @@ namespace InterfaceScadaToIN4RM.Caller.Callers
return response.Data;
return invocationResult;
}
......@@ -190,7 +204,7 @@ namespace InterfaceScadaToIN4RM.Caller.Callers
public InvocationResults ScrapConveyorDetailCreation(ScrapsConveyorDetails scrapconveyorDetails)
public ArrayOfInterface_ScrapConveyorCreationResultDC ScrapConveyorDetailCreation(ScrapsConveyorDetails scrapconveyorDetails)
{
logger.Info("Call ScrapConveyorDetailCreation");
......@@ -208,7 +222,7 @@ namespace InterfaceScadaToIN4RM.Caller.Callers
request.AddParameter("text/xml", scdxml, ParameterType.RequestBody);
IRestResponse<InvocationResults> response = restClient.Execute<InvocationResults>(request);
IRestResponse<ArrayOfInterface_ScrapConveyorCreationResultDC> response = restClient.Execute<ArrayOfInterface_ScrapConveyorCreationResultDC>(request);
if (response != null)
{
......
......@@ -60,6 +60,7 @@
<ItemGroup>
<Compile Include="Callers\ISCADACaller.cs" />
<Compile Include="Callers\SCADACaller.cs" />
<Compile Include="Models\ArrayOfInterface_ScrapConveyorCreationResultDC.cs" />
<Compile Include="Models\InvocationResults.cs" />
<Compile Include="Models\HandlingUnitDetails.cs" />
<Compile Include="Models\LineStatus.cs" />
......
......@@ -32,8 +32,8 @@ using System.Runtime.InteropServices;
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.1")]
[assembly: AssemblyFileVersion("1.0.0.1")]
[assembly: AssemblyVersion("1.0.0.3")]
[assembly: AssemblyFileVersion("1.0.0.3")]
[assembly: AssemblyKeyFile(@"keyScada.snk")]
......@@ -33,7 +33,7 @@ using System.Runtime.InteropServices;
// Vous pouvez spécifier toutes les valeurs ou indiquer les numéros de build et de révision par défaut
// en utilisant '*', comme indiqué ci-dessous :
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.2")]
[assembly: AssemblyFileVersion("1.0.0.2")]
[assembly: AssemblyVersion("1.0.0.3")]
[assembly: AssemblyFileVersion("1.0.0.3")]
[assembly: AssemblyKeyFile(@"keyScada.snk")]
......@@ -196,15 +196,15 @@ namespace InterfaceScadaToIN4RM
string invocResutlCode = string.Empty;
InvocationResults invocationResult;
ArrayOfInterface_ScrapConveyorCreationResultDC scrapConveyorCreationResult;
if (scadaCaller != null)
{
ScrapsConveyorDetails scrapConveyorDetail = new ScrapsConveyorDetails(scrapConveyorCodeLine, scrapConveyorPositions);
invocationResult = scadaCaller.ScrapConveyorDetailCreation(scrapConveyorDetail);
scrapConveyorCreationResult = scadaCaller.ScrapConveyorDetailCreation(scrapConveyorDetail);
invocResutlCode = getInvocationResultCode("ScrapConveyorDetailCreation", invocationResult);
invocResutlCode = getScrapConveyorCreationResultCode("ScrapConveyorDetailCreation", scrapConveyorCreationResult);
//récupérer la réponse et l'affichée
//invocationResult.Result.Code
......@@ -322,8 +322,43 @@ namespace InterfaceScadaToIN4RM
/// Retour le code reponse du WebService
/// </summary>
/// <param name="serviceCaller"></param>
/// <param name="invocationResult"></param>
/// <param name="scrapConveyorCreationResult"></param>
/// <returns></returns>
private string getScrapConveyorCreationResultCode(string serviceCaller, ArrayOfInterface_ScrapConveyorCreationResultDC scrapConveyorCreationResult)
{
logger.Info("getScrapConveyorCreationResultCode : {0}", serviceCaller);
string invocResutlCode = string.Empty;
if (scrapConveyorCreationResult != null)
{
if (scrapConveyorCreationResult.Interface_ScrapConveyorCreationResultDC != null)
{
logger.Info("Result Interface_ScrapConveyorCreationResultDC :: Code : {0}, Message : {1}", scrapConveyorCreationResult.Interface_ScrapConveyorCreationResultDC.Code, scrapConveyorCreationResult.Interface_ScrapConveyorCreationResultDC.Message);
invocResutlCode = scrapConveyorCreationResult.Interface_ScrapConveyorCreationResultDC.Code;
}
else
{
invocResutlCode = "scrapConveyorCreationResult.Interface_ScrapConveyorCreationResultDC is Null";
logger.Info("getScrapConveyorCreationResultCode :: scrapConveyorCreationResult.Interface_ScrapConveyorCreationResultDC is Null");
}
}
else
{
invocResutlCode = "scrapConveyorCreationResult is Null";
logger.Info("getScrapConveyorCreationResultCode :: scrapConveyorCreationResult is Null");
}
return invocResutlCode;
}
private string getInvocationResultCode(string serviceCaller, InvocationResults invocationResult)
{
logger.Info("getInvocationResultCode : {0}", serviceCaller);
......@@ -356,6 +391,5 @@ namespace InterfaceScadaToIN4RM
}
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment