diff --git a/EgwProxy.Icoel.Test/INI/Settaggi.cs b/EgwProxy.Icoel.Test/INI/Settaggi.cs
index b22d4760..f198eddb 100644
--- a/EgwProxy.Icoel.Test/INI/Settaggi.cs
+++ b/EgwProxy.Icoel.Test/INI/Settaggi.cs
@@ -1,40 +1,48 @@
using System.IO;
-namespace BinsTracker.INI
+namespace EgwProxy.Icoel.Test.INI
{
public class Settaggi
{
-
- private const string NameFile = "conf.ini";
- private readonly IniFile _sett;
-
+ #region Public Constructors
public Settaggi()
{
_sett = new IniFile();
- }
+ }
+
+ #endregion Public Constructors
+
+ #region Public Properties
+
public string IndirizzoIpSizer
{
get { return _sett.GetKeyValue("Sizer", "IndirizzoIp"); }
set { _sett.SetKeyValue("Sizer", "IndirizzoIp", value); }
}
+ public string IndirizzoIpSizerClient
+ {
+ get { return _sett.GetKeyValue("Sizer", "IndirizzoIpTracciabilità"); }
+ set { _sett.SetKeyValue("Sizer", "IndirizzoIpTracciabilità", value); }
+ }
+
public string SizerTcpPort
{
get { return _sett.GetKeyValue("Sizer", "TcpPort"); }
set { _sett.SetKeyValue("Sizer", "TcpPort", value); }
}
- public string IndirizzoIpSizerClient
- {
- get { return _sett.GetKeyValue("Sizer", "IndirizzoIpTracciabilità"); }
- set { _sett.SetKeyValue("Sizer", "IndirizzoIpTracciabilità", value); }
- }
+
public string TcpPortSizerClient
{
get { return _sett.GetKeyValue("Sizer", "TcpPortTracciabilità"); }
set { _sett.SetKeyValue("Sizer", "TcpPortTracciabilità", value); }
}
+ #endregion Public Properties
+
+ #region Public Methods
+
public void Load()
{
if (!File.Exists(NameFile))
@@ -49,5 +57,14 @@ namespace BinsTracker.INI
{
_sett.Save(NameFile);
}
+
+ #endregion Public Methods
+
+ #region Private Fields
+
+ private const string NameFile = "conf.ini";
+ private readonly IniFile _sett;
+
+ #endregion Private Fields
}
}
\ No newline at end of file
diff --git a/EgwProxy.Icoel.Test/Program.cs b/EgwProxy.Icoel.Test/Program.cs
index 5f2165a1..229dd7e0 100644
--- a/EgwProxy.Icoel.Test/Program.cs
+++ b/EgwProxy.Icoel.Test/Program.cs
@@ -1,4 +1,5 @@
using EgwProxy.Icoel.SizerService;
+using EgwProxy.Icoel.Test.INI;
using System;
using System.Collections.Generic;
@@ -180,18 +181,14 @@ namespace EgwProxy.Icoel.Test
///
private static void Main(string[] args)
{
- // ersempio funzionamento connector via console app setp 1: legge conf da file ini che
- // si trovano in bin (riportati come conf principali)
+ // leggo conf da file ini (ip/port)
Console.WriteLine("Loading Files...");
+ Settaggi setup = new Settaggi();
+ string userInput = "";
+ // oggetto x connessione
+ Connector IcoelSizer = new Connector(setup.IndirizzoIpSizer, setup.TcpPortSizerClient);
- Connector IcoelSizer = new Connector("192.168.137.50", "8001");
-
-#if false
- Connector.Load();
-#endif
-
- // ora effettua lettura Varietà e Layout disponibili
-
+ // ora effettua un pò di letture/scritture
try
{
Console.WriteLine("------------ TUTTE variety ------------");
@@ -202,6 +199,9 @@ namespace EgwProxy.Icoel.Test
DisplayVarietyLayout(varietyData);
}
Console.WriteLine();
+ Console.WriteLine("Premere un tasto x continuare...");
+ userInput = Console.ReadLine();
+
// solo attive
Console.WriteLine("------------ solo attive ------------");
varList = IcoelSizer.GetVarietyList();
@@ -211,16 +211,21 @@ namespace EgwProxy.Icoel.Test
DisplayVarietyLayout(varietyData);
}
Console.WriteLine();
+ Console.WriteLine("Premere un tasto x continuare...");
+ userInput = Console.ReadLine();
+ Console.WriteLine("------------ BATCH correnti ------------");
var currBatch = IcoelSizer.GetCurrentBatch();
foreach (var item in currBatch)
{
string lato = item.Key == 1 ? "SX" : "DX";
Console.WriteLine($"[{item.Key}-{lato}] Grower code: {item.Value.GrowerCode} | Layout Name: {item.Value.LayoutName} | Totalling: [{item.Value.TotallingVarietyCode}] {item.Value.TotallingVariety} | Sizing: {item.Value.SizingProfileName} | Start {item.Value.StartTime} | End {item.Value.EndTime}");
}
+ Console.WriteLine();
+ Console.WriteLine("Premere un tasto x continuare...");
+ userInput = Console.ReadLine();
- // verifico grower (se non ci fosse crea)
-
+ Console.WriteLine("------------ Prova invio BATCH ------------");
// recupero GUID x variety e layout
var varGuid = selVariety(IcoelSizer);
var layGuid = selLayout(IcoelSizer, varGuid);
@@ -230,7 +235,8 @@ namespace EgwProxy.Icoel.Test
IcoelSizer.GetCurrentBatch();
- Console.WriteLine("Done.");
+ Console.WriteLine("Test completato");
+ Console.WriteLine("Premere un tasto x chiudere");
Console.ReadKey();
}
catch (Exception ex)
diff --git a/EgwProxy.Icoel/Compac/ComClient.cs b/EgwProxy.Icoel/Compac/ComClient.cs
index 565fef71..e4b0bd56 100644
--- a/EgwProxy.Icoel/Compac/ComClient.cs
+++ b/EgwProxy.Icoel/Compac/ComClient.cs
@@ -5,21 +5,10 @@ using System.ServiceModel;
namespace EgwProxy.Icoel.Compac
{
- public class ComClient:IDisposable
+ public class ComClient : IDisposable
{
#region Public Constructors
-
- ///
- /// Inidirizzo IP
- ///
- internal string ipAddress { get; set; } = "127.0.0.1";
-
- ///
- /// Porta del webservice (SOAP)
- ///
- internal string tcpPort { get; set; } = "8001";
-
///
/// Oggetto client comunicazione con sizer ICOEL per invio/recupero informazioni di
/// produzione (batch)
@@ -38,7 +27,6 @@ namespace EgwProxy.Icoel.Compac
SSClient = new SizerServiceClient("WSHttpBinding_ISizerService", epa);
}
-
#endregion Public Constructors
#region Public Properties
@@ -63,6 +51,49 @@ namespace EgwProxy.Icoel.Compac
#region Public Methods
+ ///
+ /// Dispose dell'oggetto
+ ///
+ public void Dispose()
+ {
+ Close();
+ }
+
+ #endregion Public Methods
+
+ #region Internal Properties
+
+ ///
+ /// Inidirizzo IP
+ ///
+ internal string ipAddress { get; set; } = "127.0.0.1";
+
+ ///
+ /// Porta del webservice (SOAP)
+ ///
+ internal string tcpPort { get; set; } = "8001";
+
+ #endregion Internal Properties
+
+ #region Internal Methods
+
+ ///
+ /// Verifica del grower da codice/nome con eventuale creazione se mancante
+ ///
+ /// Codice del produttore
+ /// Denominazione del produttore
+ internal void CheckGrower(string growerCode, string growerName)
+ {
+ var grower = SSClient.GetGrower(growerCode);
+
+ if (grower == null)
+ {
+ var nuovo = new Grower() { Code = growerCode, Name = growerName };
+
+ SSClient.AddGrower(nuovo);
+ }
+ }
+
///
/// Effettua chiusura del proxy di comunicazione
///
@@ -74,10 +105,6 @@ namespace EgwProxy.Icoel.Compac
}
}
- #endregion Public Methods
-
- #region Internal Methods
-
///
/// Elenco dei layout attivi della varietà
///
@@ -96,6 +123,7 @@ namespace EgwProxy.Icoel.Compac
{
return SSClient.GetActiveVarieties();
}
+
///
/// Elenco varietà (tutte)
///
@@ -143,31 +171,6 @@ namespace EgwProxy.Icoel.Compac
SSClient.AddBatch(batch);
}
- ///
- /// Verifica del grower da codice/nome con eventuale creazione se mancante
- ///
- /// Codice del produttore
- /// Denominazione del produttore
- internal void CheckGrower(string growerCode, string growerName)
- {
- var grower = SSClient.GetGrower(growerCode);
-
- if (grower == null)
- {
- var nuovo = new Grower() { Code = growerCode, Name = growerName };
-
- SSClient.AddGrower(nuovo);
- }
- }
-
- ///
- /// Dispose dell'oggetto
- ///
- public void Dispose()
- {
- Close();
- }
-
#endregion Internal Methods
#region Private Properties
diff --git a/EgwProxy.Icoel/Connector.cs b/EgwProxy.Icoel/Connector.cs
index 4ef6b537..b00b7014 100644
--- a/EgwProxy.Icoel/Connector.cs
+++ b/EgwProxy.Icoel/Connector.cs
@@ -24,6 +24,10 @@ namespace EgwProxy.Icoel
#region Public Methods
+ ///
+ /// Verifica il fornitore e se non ci fosse crea
+ ///
+ ///
public void CheckGrower(GrowerInfo GrowerData)
{
using (var Client = new ComClient(ipAddress, tcpPort))
@@ -150,76 +154,6 @@ namespace EgwProxy.Icoel
#endregion Public Methods
- ///
- /// Verifica il fornitore, se non esistesse lo crea
- ///
- /// Oggetto dati del fornitore
-#if false
- public void MettiLottoInCoda()
- {
- using (var Client = new ComClient(ipAddress, tcpPort))
- {
- // recupero varietà x selezione
- var varList = GetVarietyList(true);
-
- int idxVar = -1;
- int idxLay = -1;
-
- Guid varGuid = Guid.NewGuid();
- Guid layGuid = Guid.NewGuid();
-
- // recupero layout della varietà
- var layoutList = Client.GetLayouts(varGuid);
- // recupero layout x varietà
- while (idxLay <= 0)
- {
- Console.WriteLine("");
- Console.WriteLine("indicare layout");
- var rawData = Console.ReadLine();
- if (!string.IsNullOrEmpty(rawData))
- {
- int.TryParse(rawData, out idxLay);
- // verifico sia valida..
- if (layoutList.Length >= idxLay)
- {
- layGuid = layoutList[idxLay - 1].Id;
- }
- else
- {
- idxLay = -1;
- }
- }
- }
-
- // compongo batch e metto in coda
- GrowerInfo GrowerData = new GrowerInfo();
- Batch newBatch = CreateBatch(GrowerData, varGuid, layGuid, sizingProfile);
-
- Client.MettiLottoInCoda(newBatch);
- }
- }
-#endif
-#if false
- ///
- /// Mette in coda un lotto con valori default
- ///
- public void EnqueueBatchDefault()
- {
- using (var Client = new ComClient(ipAddress, tcpPort))
- {
- Client.VerificaEsistenzaGrower(Details.GrowerCode, Details.GrowerName);
- Client.MettiLottoInCoda(GeneraBatchDaFile());
- }
- }
-#endif
-
-#if false
- ///
- /// Dettaglio dei batch
- ///
- private GrowerInfo GrowerData { get; set; } = new GrowerInfo();
-#endif
-
#region Private Properties
///
@@ -234,31 +168,16 @@ namespace EgwProxy.Icoel
#endregion Private Properties
-#if false
- private Batch GeneraBatchDaFile()
- {
- var batch = new Batch();
-
- batch.GrowerCode = Details.GrowerCode;
-
- batch.AvoidLayoutChange = true;
- batch.AvoidSavingOldLayouts = true;
-
- batch.Comments = new string[Details.Comments.Count];
- batch.Comments = Details.Comments.ToArray();
-
- using (var Client = new ComClient(ipAddress, tcpPort))
- {
- batch.VarietyId = Client.GetCurrentBatch().VarietyId;
- batch.LayoutId = Client.GetCurrentBatch().LayoutId;
- batch.SizingProfileName = Client.GetCurrentBatch().SizingProfileName;
- }
- return batch;
- }
-#endif
-
#region Private Methods
+ ///
+ /// Genera un obj batch dati i parametri necessari
+ ///
+ ///
+ ///
+ ///
+ ///
+ ///
private Batch CreateBatch(GrowerInfo GrowerData, Guid VarietyId, Guid LayoutId, string SizingProfileName)
{
var batch = new Batch();
diff --git a/EgwProxy.Icoel/GrowerInfo.cs b/EgwProxy.Icoel/GrowerInfo.cs
index 20ef8007..b3fd979f 100644
--- a/EgwProxy.Icoel/GrowerInfo.cs
+++ b/EgwProxy.Icoel/GrowerInfo.cs
@@ -9,6 +9,11 @@ namespace EgwProxy.Icoel
{
#region Public Properties
+ ///
+ /// Riga commento 01
+ ///
+ public List Comments { get; set; } = new List() { "Commento 01", "Commento 02", "Commento 01" };
+
///
/// Codice univoco fornitore
///
@@ -19,11 +24,6 @@ namespace EgwProxy.Icoel
///
public string GrowerName { get; set; } = "Egalware";
- ///
- /// Riga commento 01
- ///
- public List Comments { get; set; } = new List() { "Commento 01" , "Commento 02", "Commento 01" };
-
#endregion Public Properties
}
}
\ No newline at end of file