diff --git a/Icoel.Soap/Compac/CompacClient.cs b/Icoel.Soap/Compac/ComClient.cs similarity index 81% rename from Icoel.Soap/Compac/CompacClient.cs rename to Icoel.Soap/Compac/ComClient.cs index 97e4f85f..20b4ad29 100644 --- a/Icoel.Soap/Compac/CompacClient.cs +++ b/Icoel.Soap/Compac/ComClient.cs @@ -5,20 +5,21 @@ using System.ServiceModel; namespace Icoel.Soap.Compac { - public class CompacClient + public class ComClient { #region Public Constructors /// - /// Oggetto client comunicazione con sizer ICOEL per invio/recupero informazioni di produzione (batch) + /// Oggetto client comunicazione con sizer ICOEL per invio/recupero informazioni di + /// produzione (batch) /// /// Indirizzo IP del server SIZER /// Porta di connessione del sizer (def: 8001) - public CompacClient(string sizerIp, string port) + public ComClient(string sizerIp, string port) { var url = "http://" + sizerIp + ":" + port + "/SizerService/"; var epa = new EndpointAddress(new Uri(url)); - Client = new SizerServiceClient("WSHttpBinding_ISizerService", epa); + SSClient = new SizerServiceClient("WSHttpBinding_ISizerService", epa); } #endregion Public Constructors @@ -33,9 +34,9 @@ namespace Icoel.Soap.Compac get { bool answ = false; - if (Client != null) + if (SSClient != null) { - answ = Client.State == CommunicationState.Opened; + answ = SSClient.State == CommunicationState.Opened; } return answ; } @@ -43,19 +44,23 @@ namespace Icoel.Soap.Compac #endregion Public Properties - #region Internal Methods + #region Public Methods /// /// Effettua chiusura del proxy di comunicazione /// - internal void Close() + public void Close() { - if (Client.State != CommunicationState.Closed) + if (SSClient.State != CommunicationState.Closed) { - Client.Close(); + SSClient.Close(); } } + #endregion Public Methods + + #region Internal Methods + /// /// Elenco dei layout attivi della varietà /// @@ -63,7 +68,7 @@ namespace Icoel.Soap.Compac /// internal Layout GetActiveLayout(Guid VarietyId) { - return Client.GetActiveLayout(VarietyId); + return SSClient.GetActiveLayout(VarietyId); } /// @@ -72,7 +77,7 @@ namespace Icoel.Soap.Compac /// internal Variety[] GetActiveVarieties() { - return Client.GetActiveVarieties(); + return SSClient.GetActiveVarieties(); } /// @@ -81,7 +86,7 @@ namespace Icoel.Soap.Compac /// internal Batch GetCurrentBatch() { - return Client.GetCurrentBatch(); + return SSClient.GetCurrentBatch(); } /// @@ -91,7 +96,7 @@ namespace Icoel.Soap.Compac /// internal Batch GetCurrentBatchByLane(int lineNum) { - return Client.GetCurrentBatchByLane(lineNum); + return SSClient.GetCurrentBatchByLane(lineNum); } /// @@ -101,7 +106,7 @@ namespace Icoel.Soap.Compac /// internal Layout[] GetLayouts(Guid VarietyId) { - return Client.GetLayouts(VarietyId); + return SSClient.GetLayouts(VarietyId); } /// @@ -110,7 +115,7 @@ namespace Icoel.Soap.Compac /// Oggetto Batch completamente popolato da accodare in richiesta internal void MettiLottoInCoda(Batch batch) { - Client.AddBatch(batch); + SSClient.AddBatch(batch); } /// @@ -120,13 +125,13 @@ namespace Icoel.Soap.Compac /// Denominazione del produttore internal void VerificaEsistenzaGrower(string growerCode, string growerName) { - var grower = Client.GetGrower(growerCode); + var grower = SSClient.GetGrower(growerCode); if (grower == null) { var nuovo = new Grower() { Code = growerCode, Name = growerName }; - Client.AddGrower(nuovo); + SSClient.AddGrower(nuovo); } } @@ -137,7 +142,7 @@ namespace Icoel.Soap.Compac /// /// Client che inoltra le richieste al Sizer /// - private SizerServiceClient Client { get; set; } + private SizerServiceClient SSClient { get; set; } #endregion Private Properties } diff --git a/Icoel.Soap/Connector.cs b/Icoel.Soap/Connector.cs index 408ffed8..23279c61 100644 --- a/Icoel.Soap/Connector.cs +++ b/Icoel.Soap/Connector.cs @@ -14,7 +14,7 @@ namespace Icoel.Soap { if (Client == null || !Client.connected) { - Client = new CompacClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort); + Client = new ComClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort); } foreach (var item in varietiesList) { @@ -72,7 +72,7 @@ namespace Icoel.Soap public static void MettiLottoInCoda() { - Client = new CompacClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort); + Client = new ComClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort); Client.VerificaEsistenzaGrower(Details.GrowerCode, Details.GrowerName); @@ -111,7 +111,7 @@ namespace Icoel.Soap } if (Client == null || !Client.connected) { - Client = new CompacClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort); + Client = new ComClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort); } // recupero layout della varietà var layoutList = Client.GetLayouts(varGuid); // recupero layout x varietà @@ -145,7 +145,7 @@ namespace Icoel.Soap public static void MettiLottoInCodaDefault() { - Client = new CompacClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort); + Client = new ComClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort); Client.VerificaEsistenzaGrower(Details.GrowerCode, Details.GrowerName); @@ -159,7 +159,7 @@ namespace Icoel.Soap //Client = new CompacClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort); if (Client == null || !Client.connected) { - Client = new CompacClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort); + Client = new ComClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort); } Variety[] varietiesList; varietiesList = Client.GetActiveVarieties(); @@ -211,7 +211,7 @@ namespace Icoel.Soap public static void VerificaLottoCorrente() { - Client = new CompacClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort); + Client = new ComClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort); //Client.GetCurrentBatch(); var batch = Client.GetCurrentBatchByLane(1); @@ -227,8 +227,17 @@ namespace Icoel.Soap #region Internal Properties - internal static CompacClient Client { get; set; } + /// + /// Oggetto di connessione client + /// + internal static ComClient Client { get; set; } + /// + /// Dettaglio dei batch + /// internal static BatchDetails Details { get; set; } + /// + /// Parametri di setup + /// internal static Settaggi Settaggi { get; set; } #endregion Internal Properties diff --git a/Icoel.Soap/Icoel.Soap.csproj b/Icoel.Soap/Icoel.Soap.csproj index 32c69571..1dce2096 100644 --- a/Icoel.Soap/Icoel.Soap.csproj +++ b/Icoel.Soap/Icoel.Soap.csproj @@ -51,7 +51,7 @@ - + True True diff --git a/Icoel.Soap/api/index.md b/Icoel.Soap/api/index.md new file mode 100644 index 00000000..3fcdcb87 --- /dev/null +++ b/Icoel.Soap/api/index.md @@ -0,0 +1,3 @@ + +# PLACEHOLDER +TODO: Add .NET projects to *src* folder and run `docfx` to generate a **REAL** *API Documentation*! diff --git a/Icoel.Soap/articles/intro.md b/Icoel.Soap/articles/intro.md new file mode 100644 index 00000000..8d3f4fca --- /dev/null +++ b/Icoel.Soap/articles/intro.md @@ -0,0 +1,22 @@ + +# Logica di funzionamento impianto ICOEL: + +L'impianto Icoel prevede di comunicare in 3 modalità: +1. OPC-UA per dati RealTime di processo/automazione +2. SOAP API per informazioni scambiate riguardo al setup dei batch da produrre (messa in coda) ed in produzione +3. DB per dati produttivita "nrear-realtime" e tracciatura + +La presente libreria si occupa della modalità SOAP. + + +## Modalità impiego libreria + +La libreria va chiamata inizializzando un oggetto Connector, e poi invocando i suoi metodi messi a disposizione che si occupano di + - aprire canale di comunicazione + - effettuare chiamate + - chiudere canale + + +## Demo funzionamento + +Per un esempio di funzionamento si rimanda all'applicativo console Icoel.Test diff --git a/Icoel.Soap/articles/toc.md b/Icoel.Soap/articles/toc.md new file mode 100644 index 00000000..89dec33f --- /dev/null +++ b/Icoel.Soap/articles/toc.md @@ -0,0 +1 @@ +#[Introduction](intro.md) diff --git a/Icoel.Soap/index.md b/Icoel.Soap/index.md index 4c3c687f..89c92921 100644 --- a/Icoel.Soap/index.md +++ b/Icoel.Soap/index.md @@ -3,18 +3,13 @@ Documentazione relativa alla libreria di interfaccia con il Sizer di ICOEL per le operazioni di R/W dei dati di batch di produzione -## Logica di funzionamento impianto ICOEL: +Vedere la sezione Articles per maggiori informazioni sulle definizioni, l'impiego ed esempi. -L'impianto Icoel prevede di comunicare in 3 modalita'': -1. OPC-UA per dati RealTime di processo/automazione -2. SOAP API per informazioni scambiate riguardo al setup dei batch da produrre (messa in coda) ed in produzione -3. DB per dati produttivita "nrear-realtime" e tracciatura +## Articles -La presente libreria si occupa della modalità SOAP. +Per maggiori dettagli, definizioni e demo funzionamento si rimanda alla sezione Articles +@intro -## Modalita'' impiego libreria +## Api -La libreria va chiamata inizializzando un oggetto Connector, e poi invocando i suoi metodi messia disposizione che si occupano di - - aprire canale di comunicazione - - effettuare chaimate - - chiudere canale \ No newline at end of file +Per ogni dettaglio e riferimento alla libreria si rimanda alla sezione @api @Icoel.Soap \ No newline at end of file