Commit 29c57257 authored by Omar Fantazi's avatar Omar Fantazi

Modifications apportées suites aux tests chez INEO ES

parent 7b584c52
......@@ -8,6 +8,7 @@ using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
//using System.Xml;
......@@ -15,6 +16,7 @@ using System.Threading.Tasks;
namespace InterfaceScadaToIN4RM.Caller.Callers
{
[ClassInterface(ClassInterfaceType.None)]
public class SCADACaller : ISCADACaller
{
......@@ -23,7 +25,7 @@ namespace InterfaceScadaToIN4RM.Caller.Callers
private RestClient restClient;
/// <summary>
/// Gets or sets the base URL.
......@@ -42,7 +44,7 @@ namespace InterfaceScadaToIN4RM.Caller.Callers
/// Gets or sets the password (HTTP basic authentication).
/// </summary>
/// <value>The password.</value>
public String Password { get; set; }
public String Password { get; set; }
/// <summary>
......@@ -52,14 +54,14 @@ namespace InterfaceScadaToIN4RM.Caller.Callers
/// <param name="username"></param>
/// <param name="password"></param>
public SCADACaller(string baseUrl, string username, string password)
{
{
BaseUrl = baseUrl;
Username = username;
Password = password;
}
......@@ -71,19 +73,40 @@ namespace InterfaceScadaToIN4RM.Caller.Callers
restClient = new RestClient(BaseUrl)
{
Authenticator = new HttpBasicAuthenticator(Username, Password)
};
};
var request = new RestRequest("/Workshop/WorkorderSVC.svc/WORESTService/SaveWorkOrder", Method.POST);
request.AddHeader("Content-Type", "application/xml");
var woxml = Util.Helper.Serialize(workOrder);
logger.Info("woxml : {0} ", woxml.ToString());
request.AddParameter("text/xml", woxml, ParameterType.RequestBody);
IRestResponse<InvocationResults> response = restClient.Execute<InvocationResults>(request);
if (response != null)
{
logger.Info("Call WorkOrderCreation : response.IsSuccessful : {0}", response.IsSuccessful);
logger.Info("Call WorkOrderCreation : response.StatusDescription : {0}", response.StatusDescription);
}
else
{
logger.Info("response is NULLLLL !!! ");
}
return response.Data;
}
......
......@@ -29,6 +29,12 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>keyScada.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
<HintPath>..\packages\NLog.4.6.5\lib\net45\NLog.dll</HintPath>
......@@ -64,6 +70,7 @@
<Compile Include="Util\Helper.cs" />
</ItemGroup>
<ItemGroup>
<None Include="keyScada.snk" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup />
......
......@@ -32,5 +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.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.1")]
[assembly: AssemblyFileVersion("1.0.0.1")]
[assembly: AssemblyKeyFile(@"keyScada.snk")]
......@@ -20,13 +20,25 @@ namespace InterfaceScadaToIN4RM.Caller.Util
}
try
{
var xmlserializer = new XmlSerializer(typeof(T));
var stringWriter = new StringWriter();
using (var writer = XmlWriter.Create(stringWriter))
var serializer = new XmlSerializer(typeof(T));
string utf8;
using (StringWriter writer = new Utf8StringWriter())
{
xmlserializer.Serialize(writer, value);
return stringWriter.ToString();
serializer.Serialize(writer, value);
utf8 = writer.ToString();
return utf8;
}
//var xmlserializer = new XmlSerializer(typeof(T));
//var stringWriter = new StringWriter();
//using (var writer = XmlWriter.Create(stringWriter))
//{
// xmlserializer.Serialize(writer, value);
// return stringWriter.ToString();
//}
}
catch (Exception ex)
{
......@@ -36,4 +48,9 @@ namespace InterfaceScadaToIN4RM.Caller.Util
}
public class Utf8StringWriter : StringWriter
{
public override Encoding Encoding => Encoding.UTF8;
}
}
......@@ -31,7 +31,10 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<SignAssembly>false</SignAssembly>
<SignAssembly>true</SignAssembly>
</PropertyGroup>
<PropertyGroup>
<AssemblyOriginatorKeyFile>keyScada.snk</AssemblyOriginatorKeyFile>
</PropertyGroup>
<ItemGroup>
<Reference Include="NLog, Version=4.0.0.0, Culture=neutral, PublicKeyToken=5120e14c03d0593c, processorArchitecture=MSIL">
......@@ -62,6 +65,7 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<None Include="keyScada.snk" />
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
......
......@@ -14,6 +14,7 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// L'affectation de la valeur false à ComVisible rend les types invisibles dans cet assembly
// aux composants COM. Si vous devez accéder à un type dans cet assembly à partir de
// COM, affectez la valeur true à l'attribut ComVisible sur ce type.
......@@ -32,5 +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.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.0.0.2")]
[assembly: AssemblyFileVersion("1.0.0.2")]
[assembly: AssemblyKeyFile(@"keyScada.snk")]
......@@ -6,12 +6,39 @@ using NLog.Targets;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
namespace InterfaceScadaToIN4RM
{
public class ScadaToIN4RM
[InterfaceType(ComInterfaceType.InterfaceIsIDispatch)]
public interface IScadaToIN4RM
{
//public IScadaToIN4RM();
[DispId(1)]
void ConfigureAuthentication(string url, string login, string password);
[DispId(2)]
string HandlingUnitsCreation(string handlingUnitCodeLine, string handlingUnits);
[DispId(3)]
string LineStatusCreation(string slLine, string statuses);
[DispId(4)]
string ScrapConveyorDetailCreation(string scrapConveyorCodeLine, string scrapConveyorPositions);
[DispId(5)]
string SpeedChangeDetailCreation(string speedChangeCodeLine, string speedChanges);
[DispId(6)]
string WorkOrderCreation(string woLine, string woHeader, string woPosts);
}
[ClassInterface(ClassInterfaceType.None)]
public class ScadaToIN4RM : IScadaToIN4RM
{
......@@ -313,12 +340,16 @@ namespace InterfaceScadaToIN4RM
else
{
invocResutlCode = "invocationResult.Result is Null";
logger.Info("getInvocationResultCode :: invocationResult.Result is Null");
}
}
else
{
invocResutlCode = "invocationResult is Null";
logger.Info("getInvocationResultCode :: invocationResult is Null");
}
return invocResutlCode;
......
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm" /codebase "C:\Program Files\Ineo\Setup_InterfaceScadaToIN4RM\InterfaceScadaToIN4RM.dll"
\ No newline at end of file
--"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm" /codebase "C:\Program Files\Ineo\Setup_InterfaceScadaToIN4RM\InterfaceScadaToIN4RM.dll"
--"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm" /codebase /tlb "C:\Program Files\Ineo\Setup_InterfaceScadaToIN4RM\InterfaceScadaToIN4RM.dll"
--System 64 - AspenPlus version 32 bits -- regsiter avec l'exe 32 bits --> rempalcer Framework64 par Framework
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm" /codebase /tlb "C:\Program Files\Ineo\Setup_InterfaceScadaToIN4RM\InterfaceScadaToIN4RM.dll"
--"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\regasm" /unregister "C:\Program Files\Ineo\Setup_InterfaceScadaToIN4RM\InterfaceScadaToIN4RM.dll"
--System 64 - AspenPlus version 32 bits -- regsiter avec l'exe 32 bits --> rempalcer Framework64 par Framework
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\regasm" /unregister "C:\Program Files\Ineo\Setup_InterfaceScadaToIN4RM\InterfaceScadaToIN4RM.dll"
\ No newline at end of file
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