Merge branch 'release/UpdateIcoseProxyDll'
This commit is contained in:
@@ -43,11 +43,20 @@
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="INI\BatchDetails.cs" />
|
||||
<Compile Include="INI\IniFileCs.cs" />
|
||||
<Compile Include="INI\Settaggi.cs" />
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="batch.ini">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="conf.ini">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\EgwProxy.Icoel\EgwProxy.Icoel.csproj">
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
+226
-19
@@ -1,38 +1,243 @@
|
||||
using System;
|
||||
using EgwProxy.Icoel.SizerService;
|
||||
using EgwProxy.Icoel.Test.INI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using EgwProxy.Icoel;
|
||||
|
||||
namespace EgwProxy.Icoel.Test
|
||||
{
|
||||
internal class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
#region Internal Methods
|
||||
|
||||
/// <summary>
|
||||
/// Generazione di una list di info sui dati variety
|
||||
/// </summary>
|
||||
/// <param name="varietiesList"></param>
|
||||
/// <returns></returns>
|
||||
internal static void DisplayVariety(Variety[] varietyData)
|
||||
{
|
||||
// ersempio funzionamento connector via console app
|
||||
// setp 1: legge conf da file ini che si trovano in bin (riportati come conf principali)
|
||||
foreach (var item in varietyData)
|
||||
{
|
||||
Console.WriteLine("--------------------------");
|
||||
Console.WriteLine($"Variety Id: {item.Id} | Variety Name: {item.Name}");
|
||||
Console.WriteLine(" - Qualities");
|
||||
foreach (var quality in item.Qualities)
|
||||
{
|
||||
Console.WriteLine($" Name: {quality.Name}");
|
||||
}
|
||||
Console.WriteLine(" - Grades");
|
||||
foreach (var grade in item.Grades)
|
||||
{
|
||||
Console.WriteLine($" Name: {grade.Name}");
|
||||
}
|
||||
Console.WriteLine(" - Sizes");
|
||||
foreach (var size in item.SizingMaps)
|
||||
{
|
||||
Console.WriteLine($" Name: {size.Name}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generazione di una list di info sui dati variety
|
||||
/// </summary>
|
||||
/// <param name="varietiesList"></param>
|
||||
/// <returns></returns>
|
||||
internal static void DisplayVarietyLayout(Dictionary<Variety, Layout[]> varietyData)
|
||||
{
|
||||
foreach (var item in varietyData)
|
||||
{
|
||||
Console.WriteLine("--------------------------");
|
||||
Console.WriteLine($"Variety Id: {item.Key.Id} | Variety Name: {item.Key.Name}");
|
||||
Console.WriteLine(" - Qualities");
|
||||
foreach (var quality in item.Key.Qualities)
|
||||
{
|
||||
Console.WriteLine($" Name: {quality.Name}");
|
||||
}
|
||||
Console.WriteLine(" - Grades");
|
||||
foreach (var grade in item.Key.Grades)
|
||||
{
|
||||
Console.WriteLine($" Name: {grade.Name}");
|
||||
}
|
||||
Console.WriteLine(" - Sizes");
|
||||
foreach (var size in item.Key.SizingMaps)
|
||||
{
|
||||
Console.WriteLine($" Name: {size.Name}");
|
||||
}
|
||||
Console.WriteLine(" - LAYOUTS");
|
||||
foreach (var layout in item.Value)
|
||||
{
|
||||
Console.WriteLine($" Id: {layout.Id} | Name: {layout.Name}");
|
||||
Console.WriteLine(" - Products");
|
||||
foreach (var product in layout.Products)
|
||||
{
|
||||
Console.WriteLine($" Id: {product.Id} | Name: {product.Name} | DisplayName: {product.DisplayName} | Pack: {product.Pack}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mostra elenco variety e quanod utente seleziona restituisce varGuid
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal static Guid selLayout(Connector IcoelSizer, Guid varGuid)
|
||||
{
|
||||
int idxLay = -1;
|
||||
Guid layGuid = Guid.NewGuid();
|
||||
|
||||
// recupero layout della varietà
|
||||
var layoutList = IcoelSizer.GetLayoutForVariety(varGuid);
|
||||
|
||||
Console.WriteLine("--------------------");
|
||||
Console.WriteLine("Layout disponibili:");
|
||||
Console.WriteLine("--------------------");
|
||||
DisplayLayout(layoutList);
|
||||
// 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 && idxLay > 0)
|
||||
{
|
||||
layGuid = layoutList[idxLay - 1].Id;
|
||||
}
|
||||
else
|
||||
{
|
||||
idxLay = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return layGuid;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mostra elenco variety e quanod utente seleziona restituisce varGuid
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal static Guid selVariety(Connector IcoelSizer)
|
||||
{
|
||||
int idxVar = -1;
|
||||
Guid varGuid = Guid.NewGuid();
|
||||
var varList = IcoelSizer.GetVarietyList(true);
|
||||
|
||||
Console.WriteLine("--------------------");
|
||||
Console.WriteLine("Varietà disponibili:");
|
||||
Console.WriteLine("--------------------");
|
||||
DisplayVariety(varList);
|
||||
// chiedo di selezionare
|
||||
while (idxVar <= 0)
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("indicare varietà richiesta (#)");
|
||||
var rawData = Console.ReadLine();
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
int.TryParse(rawData, out idxVar);
|
||||
// verifico sia valida..
|
||||
if (varList.Length >= idxVar && idxVar > 0)
|
||||
{
|
||||
varGuid = varList[idxVar - 1].Id;
|
||||
}
|
||||
else
|
||||
{
|
||||
idxVar = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return varGuid;
|
||||
}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Private Methods
|
||||
|
||||
/// <summary>
|
||||
/// Generazione di una list di layout dato elenco
|
||||
/// </summary>
|
||||
/// <param name="layoutList"></param>
|
||||
/// <exception cref="NotImplementedException"></exception>
|
||||
private static void DisplayLayout(Layout[] layoutList)
|
||||
{
|
||||
foreach (var layout in layoutList)
|
||||
{
|
||||
Console.WriteLine($" Id: {layout.Id} | Name: {layout.Name}");
|
||||
Console.WriteLine(" - Products");
|
||||
foreach (var product in layout.Products)
|
||||
{
|
||||
Console.WriteLine($" Id: {product.Id} | Name: {product.Name} | DisplayName: {product.DisplayName} | Pack: {product.Pack}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Programma principale
|
||||
/// </summary>
|
||||
/// <param name="args"></param>
|
||||
private static void Main(string[] args)
|
||||
{
|
||||
// leggo conf da file ini (ip/port)
|
||||
Console.WriteLine("Loading Files...");
|
||||
Connector.Load();
|
||||
|
||||
// ora effettua lettura Varietà e Layout disponibili
|
||||
Settaggi setup = new Settaggi();
|
||||
setup.Load();
|
||||
string userInput = "";
|
||||
// oggetto x connessione
|
||||
Connector IcoelSizer = new Connector(setup.IndirizzoIpSizer, setup.TcpPortSizerClient);
|
||||
|
||||
// ora effettua un pò di letture/scritture
|
||||
try
|
||||
{
|
||||
var varList = Connector.RecuperaVarietyLayout();
|
||||
if (varList != null)
|
||||
Console.WriteLine("------------ TUTTE variety ------------");
|
||||
var varList = IcoelSizer.GetVarietyList(false);
|
||||
var varietyData = IcoelSizer.GetLayoutForVarietyList(varList);
|
||||
if (varietyData != null)
|
||||
{
|
||||
Connector.DisplayVarietyLayout(varList);
|
||||
DisplayVarietyLayout(varietyData);
|
||||
}
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Premere un tasto x continuare...");
|
||||
userInput = Console.ReadLine();
|
||||
|
||||
Connector.VerificaLottoCorrente();
|
||||
// solo attive
|
||||
Console.WriteLine("------------ solo attive ------------");
|
||||
varList = IcoelSizer.GetVarietyList();
|
||||
varietyData = IcoelSizer.GetLayoutForVarietyList(varList);
|
||||
if (varietyData != null)
|
||||
{
|
||||
DisplayVarietyLayout(varietyData);
|
||||
}
|
||||
Console.WriteLine();
|
||||
Console.WriteLine("Premere un tasto x continuare...");
|
||||
userInput = Console.ReadLine();
|
||||
|
||||
Connector.MettiLottoInCoda();
|
||||
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();
|
||||
|
||||
Connector.VerificaLottoCorrente();
|
||||
Console.WriteLine("------------ Prova invio BATCH ------------");
|
||||
// recupero GUID x variety e layout
|
||||
var varGuid = selVariety(IcoelSizer);
|
||||
var layGuid = selLayout(IcoelSizer, varGuid);
|
||||
|
||||
Console.WriteLine("Done.");
|
||||
GrowerInfo GrowerData = new GrowerInfo();
|
||||
IcoelSizer.EnqueueBatch(GrowerData, varGuid, layGuid);
|
||||
|
||||
IcoelSizer.GetCurrentBatch();
|
||||
|
||||
Console.WriteLine("Test completato");
|
||||
Console.WriteLine("Premere un tasto x chiudere");
|
||||
Console.ReadKey();
|
||||
}
|
||||
catch (Exception ex)
|
||||
@@ -41,5 +246,7 @@ namespace EgwProxy.Icoel.Test
|
||||
Console.ReadKey();
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Private Methods
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,10 @@ using System.ServiceModel;
|
||||
|
||||
namespace EgwProxy.Icoel.Compac
|
||||
{
|
||||
public class ComClient
|
||||
/// <summary>
|
||||
/// Classe di comunicazione x
|
||||
/// </summary>
|
||||
public class ComClient : IDisposable
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
@@ -17,8 +20,13 @@ namespace EgwProxy.Icoel.Compac
|
||||
/// <param name="port">Porta di connessione del sizer (def: 8001)</param>
|
||||
public ComClient(string sizerIp, string port)
|
||||
{
|
||||
// Salvo IP e porta
|
||||
ipAddress = sizerIp;
|
||||
tcpPort = port;
|
||||
|
||||
// inizializzazione servizio comunicazione
|
||||
var url = "http://" + sizerIp + ":" + port + "/SizerService/";
|
||||
var epa = new EndpointAddress(new Uri(url));
|
||||
EndpointAddress epa = new EndpointAddress(new Uri(url));
|
||||
SSClient = new SizerServiceClient("WSHttpBinding_ISizerService", epa);
|
||||
}
|
||||
|
||||
@@ -46,10 +54,53 @@ namespace EgwProxy.Icoel.Compac
|
||||
|
||||
#region Public Methods
|
||||
|
||||
/// <summary>
|
||||
/// Dispose dell'oggetto
|
||||
/// </summary>
|
||||
public void Dispose()
|
||||
{
|
||||
Close();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Internal Properties
|
||||
|
||||
/// <summary>
|
||||
/// Inidirizzo IP
|
||||
/// </summary>
|
||||
internal string ipAddress { get; set; } = "127.0.0.1";
|
||||
|
||||
/// <summary>
|
||||
/// Porta del webservice (SOAP)
|
||||
/// </summary>
|
||||
internal string tcpPort { get; set; } = "8001";
|
||||
|
||||
#endregion Internal Properties
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
/// <summary>
|
||||
/// Verifica del grower da codice/nome con eventuale creazione se mancante
|
||||
/// </summary>
|
||||
/// <param name="growerCode">Codice del produttore</param>
|
||||
/// <param name="growerName">Denominazione del produttore</param>
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Effettua chiusura del proxy di comunicazione
|
||||
/// </summary>
|
||||
public void Close()
|
||||
internal void Close()
|
||||
{
|
||||
if (SSClient.State != CommunicationState.Closed)
|
||||
{
|
||||
@@ -57,10 +108,6 @@ namespace EgwProxy.Icoel.Compac
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Internal Methods
|
||||
|
||||
/// <summary>
|
||||
/// Elenco dei layout attivi della varietà
|
||||
/// </summary>
|
||||
@@ -80,6 +127,15 @@ namespace EgwProxy.Icoel.Compac
|
||||
return SSClient.GetActiveVarieties();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Elenco varietà (tutte)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
internal Variety[] GetAllVarieties()
|
||||
{
|
||||
return SSClient.GetAllVarieties();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera il batch corrente (se monolinea)
|
||||
/// </summary>
|
||||
@@ -118,23 +174,6 @@ namespace EgwProxy.Icoel.Compac
|
||||
SSClient.AddBatch(batch);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verifica del grower da codice/nome
|
||||
/// </summary>
|
||||
/// <param name="growerCode">Codice del produttore</param>
|
||||
/// <param name="growerName">Denominazione del produttore</param>
|
||||
internal void VerificaEsistenzaGrower(string growerCode, string growerName)
|
||||
{
|
||||
var grower = SSClient.GetGrower(growerCode);
|
||||
|
||||
if (grower == null)
|
||||
{
|
||||
var nuovo = new Grower() { Code = growerCode, Name = growerName };
|
||||
|
||||
SSClient.AddGrower(nuovo);
|
||||
}
|
||||
}
|
||||
|
||||
#endregion Internal Methods
|
||||
|
||||
#region Private Properties
|
||||
|
||||
+145
-234
@@ -1,289 +1,200 @@
|
||||
using BinsTracker.INI;
|
||||
using EgwProxy.Icoel.Compac;
|
||||
using EgwProxy.Icoel.INI;
|
||||
using EgwProxy.Icoel.Compac;
|
||||
using EgwProxy.Icoel.SizerService;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace EgwProxy.Icoel
|
||||
{
|
||||
public static class Connector
|
||||
/// <summary>
|
||||
/// Connettore proxy x servizi rest di Icoel
|
||||
/// </summary>
|
||||
public class Connector
|
||||
{
|
||||
#region Public Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Inizializazzione classe con salvataggio ip/porta del webservice del sizer
|
||||
/// </summary>
|
||||
/// <param name="ipAddress"></param>
|
||||
/// <param name="tcpPort"></param>
|
||||
public Connector(string ipAddress, string tcpPort)
|
||||
{
|
||||
this.ipAddress = ipAddress;
|
||||
this.tcpPort = tcpPort;
|
||||
}
|
||||
|
||||
#endregion Public Constructors
|
||||
|
||||
#region Public Methods
|
||||
|
||||
public static void DisplayVarietyLayout(Variety[] varietiesList)
|
||||
/// <summary>
|
||||
/// Verifica il fornitore e se non ci fosse crea
|
||||
/// </summary>
|
||||
/// <param name="GrowerData"></param>
|
||||
public void CheckGrower(GrowerInfo GrowerData)
|
||||
{
|
||||
if (Client == null || !Client.connected)
|
||||
using (var Client = new ComClient(ipAddress, tcpPort))
|
||||
{
|
||||
Client = new ComClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort);
|
||||
Client.CheckGrower(GrowerData.GrowerCode, GrowerData.GrowerName);
|
||||
}
|
||||
foreach (var item in varietiesList)
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Invia un lotto in coda produzione sul sizer
|
||||
/// </summary>
|
||||
/// <param name="newBatch">Batch da accodare</param>
|
||||
public void EnqueueBatch(GrowerInfo GrowerData, Guid varGuid, Guid layGuid)
|
||||
{
|
||||
using (var Client = new ComClient(ipAddress, tcpPort))
|
||||
{
|
||||
Console.WriteLine("--------------------------");
|
||||
Console.WriteLine($"Variety Id: {item.Id} | Variety Name: {item.Name}");
|
||||
Console.WriteLine(" - Qualities");
|
||||
foreach (var quality in item.Qualities)
|
||||
string sizingProfile = Client.GetCurrentBatch().SizingProfileName;
|
||||
Batch newBatch = CreateBatch(GrowerData, varGuid, layGuid, sizingProfile);
|
||||
Client.MettiLottoInCoda(newBatch);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Recupera elenco dei Batch correnti (su L1 SX e L2 DX)
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public Dictionary<int, Batch> GetCurrentBatch()
|
||||
{
|
||||
Dictionary<int, Batch> outVal = new Dictionary<int, Batch>();
|
||||
using (var Client = new ComClient(ipAddress, tcpPort))
|
||||
{
|
||||
//Client.GetCurrentBatch();
|
||||
for (int i = 1; i <= 2; i++)
|
||||
{
|
||||
Console.WriteLine($" Name: {quality.Name}");
|
||||
var batch = Client.GetCurrentBatchByLane(i);
|
||||
outVal.Add(i, batch);
|
||||
}
|
||||
Console.WriteLine(" - Grades");
|
||||
foreach (var grade in item.Grades)
|
||||
}
|
||||
return outVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce un dictionary di varietà e relativi layout
|
||||
/// </summary>
|
||||
/// <param name="varietiesList"></param>
|
||||
/// <returns></returns>
|
||||
public Dictionary<Variety, Layout[]> GetLayoutAndVariety()
|
||||
{
|
||||
Dictionary<Variety, Layout[]> outVal = new Dictionary<Variety, Layout[]>();
|
||||
using (var Client = new ComClient(ipAddress, tcpPort))
|
||||
{
|
||||
Variety[] varietiesList = Client.GetActiveVarieties();
|
||||
foreach (var item in varietiesList)
|
||||
{
|
||||
Console.WriteLine($" Name: {grade.Name}");
|
||||
}
|
||||
Console.WriteLine(" - Sizes");
|
||||
foreach (var size in item.SizingMaps)
|
||||
{
|
||||
Console.WriteLine($" Name: {size.Name}");
|
||||
// recupero layout della varietà
|
||||
var layoutList = Client.GetLayouts(item.Id);
|
||||
outVal.Add(item, layoutList);
|
||||
}
|
||||
}
|
||||
// restituisco dati
|
||||
return outVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce un array di Layout validi data Guid della Variety
|
||||
/// </summary>
|
||||
/// <param name="varietiesList"></param>
|
||||
/// <returns></returns>
|
||||
public Layout[] GetLayoutForVariety(Guid varGuid)
|
||||
{
|
||||
Layout[] outVal = new Layout[1];
|
||||
using (var Client = new ComClient(ipAddress, tcpPort))
|
||||
{
|
||||
// recupero layout della varietà
|
||||
var layoutList = Client.GetLayouts(item.Id);
|
||||
Console.WriteLine(" - LAYOUTS");
|
||||
foreach (var layout in layoutList)
|
||||
var layoutList = Client.GetLayouts(varGuid);
|
||||
outVal = layoutList;
|
||||
}
|
||||
// restituisco dati
|
||||
return outVal;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Restituisce un dictionary di layout validi x un array di varietà fornito
|
||||
/// </summary>
|
||||
/// <param name="varietiesList"></param>
|
||||
/// <returns></returns>
|
||||
public Dictionary<Variety, Layout[]> GetLayoutForVarietyList(Variety[] varietiesList)
|
||||
{
|
||||
Dictionary<Variety, Layout[]> outVal = new Dictionary<Variety, Layout[]>();
|
||||
using (var Client = new ComClient(ipAddress, tcpPort))
|
||||
{
|
||||
foreach (var item in varietiesList)
|
||||
{
|
||||
Console.WriteLine($" Id: {layout.Id} | Name: {layout.Name}");
|
||||
// ciclo su sub info
|
||||
#if false
|
||||
Console.WriteLine(" - Assignments");
|
||||
foreach (var assign in layout.Assignments)
|
||||
{
|
||||
Console.WriteLine($" Key: {assign.Key} | Val: {assign.Value}");
|
||||
}
|
||||
#endif
|
||||
Console.WriteLine(" - Products");
|
||||
foreach (var product in layout.Products)
|
||||
{
|
||||
Console.WriteLine($" Id: {product.Id} | Name: {product.Name} | DisplayName: {product.DisplayName} | Pack: {product.Pack}");
|
||||
}
|
||||
// recupero layout della varietà
|
||||
var layoutList = Client.GetLayouts(item.Id);
|
||||
outVal.Add(item, layoutList);
|
||||
}
|
||||
}
|
||||
|
||||
// chiudo se fosse rimasto aperto
|
||||
Client.Close();
|
||||
// restituisco dati
|
||||
return outVal;
|
||||
}
|
||||
|
||||
public static void Load()
|
||||
/// <summary>
|
||||
/// Restituisce elenco delle Variety
|
||||
/// </summary>
|
||||
/// <param name="onlyActive">Solo attive (true) o tutte (false)</param>
|
||||
/// <returns></returns>
|
||||
public Variety[] GetVarietyList(bool onlyActive = true)
|
||||
{
|
||||
Settaggi = new Settaggi();
|
||||
Details = new BatchDetails();
|
||||
|
||||
Settaggi.Load();
|
||||
Details.Load();
|
||||
}
|
||||
|
||||
public static void MettiLottoInCoda()
|
||||
{
|
||||
Client = new ComClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort);
|
||||
|
||||
Client.VerificaEsistenzaGrower(Details.GrowerCode, Details.GrowerName);
|
||||
|
||||
// recupero varietà x selezione
|
||||
var varList = Connector.RecuperaVarietyLayout();
|
||||
|
||||
int idxVar = -1;
|
||||
int idxLay = -1;
|
||||
|
||||
Guid varGuid = Guid.NewGuid();
|
||||
Guid layGuid = Guid.NewGuid();
|
||||
|
||||
Console.WriteLine("--------------------");
|
||||
Console.WriteLine("Varietà disponibili:");
|
||||
Console.WriteLine("--------------------");
|
||||
DisplayVarietyLayout(varList);
|
||||
// chiedo di selezionare
|
||||
while (idxVar <= 0)
|
||||
{
|
||||
Console.WriteLine("");
|
||||
Console.WriteLine("indicare varietà richiesta (#)");
|
||||
var rawData = Console.ReadLine();
|
||||
if (!string.IsNullOrEmpty(rawData))
|
||||
{
|
||||
int.TryParse(rawData, out idxVar);
|
||||
// verifico sia valida..
|
||||
if (varList.Length >= idxVar)
|
||||
{
|
||||
varGuid = varList[idxVar - 1].Id;
|
||||
}
|
||||
else
|
||||
{
|
||||
idxVar = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (Client == null || !Client.connected)
|
||||
{
|
||||
Client = new ComClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort);
|
||||
} // 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
|
||||
var newBatch = GeneraBatchDaSelezione(varGuid, layGuid, Client.GetCurrentBatch().SizingProfileName);
|
||||
|
||||
Client.MettiLottoInCoda(newBatch);
|
||||
|
||||
Client.Close();
|
||||
}
|
||||
|
||||
public static void MettiLottoInCodaDefault()
|
||||
{
|
||||
Client = new ComClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort);
|
||||
|
||||
Client.VerificaEsistenzaGrower(Details.GrowerCode, Details.GrowerName);
|
||||
|
||||
Client.MettiLottoInCoda(GeneraBatchDaFile());
|
||||
|
||||
Client.Close();
|
||||
}
|
||||
|
||||
public static Variety[] RecuperaVarietyLayout()
|
||||
{
|
||||
//Client = new CompacClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort);
|
||||
if (Client == null || !Client.connected)
|
||||
{
|
||||
Client = new ComClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort);
|
||||
}
|
||||
Variety[] varietiesList;
|
||||
varietiesList = Client.GetActiveVarieties();
|
||||
#if false
|
||||
foreach (var item in varietiesList)
|
||||
using (var cClient = new ComClient(ipAddress, tcpPort))
|
||||
{
|
||||
Console.WriteLine("--------------------------");
|
||||
Console.WriteLine($"Variety Id: {item.Id} | Variety Name: {item.Name}");
|
||||
Console.WriteLine(" - Qualities");
|
||||
foreach (var quality in item.Qualities)
|
||||
if (onlyActive)
|
||||
{
|
||||
Console.WriteLine($" Name: {quality.Name}");
|
||||
varietiesList = cClient.GetActiveVarieties();
|
||||
}
|
||||
Console.WriteLine(" - Grades");
|
||||
foreach (var grade in item.Grades)
|
||||
else
|
||||
{
|
||||
Console.WriteLine($" Name: {grade.Name}");
|
||||
}
|
||||
Console.WriteLine(" - Sizes");
|
||||
foreach (var size in item.SizingMaps)
|
||||
{
|
||||
Console.WriteLine($" Name: {size.Name}");
|
||||
}
|
||||
// recupero layout della varietà
|
||||
var layoutList = Client.GetLayouts(item.Id);
|
||||
Console.WriteLine(" - LAYOUTS");
|
||||
foreach (var layout in layoutList)
|
||||
{
|
||||
Console.WriteLine($" Id: {layout.Id} | Name: {layout.Name}");
|
||||
// ciclo su sub info
|
||||
Console.WriteLine(" - Assignments");
|
||||
foreach (var assign in layout.Assignments)
|
||||
{
|
||||
Console.WriteLine($" Key: {assign.Key} | Val: {assign.Value}");
|
||||
}
|
||||
Console.WriteLine(" - Products");
|
||||
foreach (var product in layout.Products)
|
||||
{
|
||||
Console.WriteLine($" Id: {product.Id} | Name: {product.Name} | DisplayName: {product.DisplayName} | Pack: {product.Pack}");
|
||||
}
|
||||
varietiesList = cClient.GetAllVarieties();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Client.Close();
|
||||
|
||||
return varietiesList;
|
||||
}
|
||||
|
||||
public static void VerificaLottoCorrente()
|
||||
{
|
||||
Client = new ComClient(Settaggi.IndirizzoIpSizer, Settaggi.SizerTcpPort);
|
||||
|
||||
//Client.GetCurrentBatch();
|
||||
var batch = Client.GetCurrentBatchByLane(1);
|
||||
Console.WriteLine($"[1-SX] Grower code: {batch.GrowerCode} | Layout Name: {batch.LayoutName} | Totalling: [{batch.TotallingVarietyCode}] {batch.TotallingVariety} | Sizing: {batch.SizingProfileName} | Start {batch.StartTime} | End {batch.EndTime}");
|
||||
|
||||
batch = Client.GetCurrentBatchByLane(2);
|
||||
Console.WriteLine($"[2-DX] Grower code: {batch.GrowerCode} | Layout Name: {batch.LayoutName} | Totalling: [{batch.TotallingVarietyCode}] {batch.TotallingVariety} | Sizing: {batch.SizingProfileName} | Start {batch.StartTime} | End {batch.EndTime}");
|
||||
|
||||
Client.Close();
|
||||
}
|
||||
|
||||
#endregion Public Methods
|
||||
|
||||
#region Internal Properties
|
||||
#region Private Properties
|
||||
|
||||
/// <summary>
|
||||
/// Oggetto di connessione client
|
||||
/// Inidirizzo IP
|
||||
/// </summary>
|
||||
internal static ComClient Client { get; set; }
|
||||
/// <summary>
|
||||
/// Dettaglio dei batch
|
||||
/// </summary>
|
||||
internal static BatchDetails Details { get; set; }
|
||||
/// <summary>
|
||||
/// Parametri di setup
|
||||
/// </summary>
|
||||
internal static Settaggi Settaggi { get; set; }
|
||||
private string ipAddress { get; set; } = "127.0.0.1";
|
||||
|
||||
#endregion Internal Properties
|
||||
/// <summary>
|
||||
/// Porta del webservice (SOAP)
|
||||
/// </summary>
|
||||
private string tcpPort { get; set; } = "8001";
|
||||
|
||||
#endregion Private Properties
|
||||
|
||||
#region Private Methods
|
||||
|
||||
private static Batch GeneraBatchDaFile()
|
||||
{
|
||||
var batch = new Batch();
|
||||
|
||||
batch.GrowerCode = Details.GrowerCode;
|
||||
|
||||
batch.AvoidLayoutChange = true;
|
||||
batch.AvoidSavingOldLayouts = true;
|
||||
|
||||
batch.Comments = new string[3];
|
||||
batch.Comments[0] = Details.Comment1;
|
||||
batch.Comments[1] = Details.Comment2;
|
||||
batch.Comments[2] = Details.Comment3;
|
||||
|
||||
batch.VarietyId = Client.GetCurrentBatch().VarietyId;
|
||||
batch.LayoutId = Client.GetCurrentBatch().LayoutId;
|
||||
batch.SizingProfileName = Client.GetCurrentBatch().SizingProfileName;
|
||||
|
||||
return batch;
|
||||
}
|
||||
|
||||
private static Batch GeneraBatchDaSelezione(Guid VarietyId, Guid LayoutId, string SizingProfileName)
|
||||
/// <summary>
|
||||
/// Genera un obj batch dati i parametri necessari
|
||||
/// </summary>
|
||||
/// <param name="GrowerData"></param>
|
||||
/// <param name="VarietyId"></param>
|
||||
/// <param name="LayoutId"></param>
|
||||
/// <param name="SizingProfileName"></param>
|
||||
/// <returns></returns>
|
||||
private Batch CreateBatch(GrowerInfo GrowerData, Guid VarietyId, Guid LayoutId, string SizingProfileName)
|
||||
{
|
||||
var batch = new Batch();
|
||||
|
||||
batch.AvoidLayoutChange = true;
|
||||
batch.AvoidSavingOldLayouts = true;
|
||||
|
||||
batch.GrowerCode = Details.GrowerCode;
|
||||
batch.Comments = new string[3];
|
||||
batch.Comments[0] = Details.Comment1;
|
||||
batch.Comments[1] = Details.Comment2;
|
||||
batch.Comments[2] = Details.Comment3;
|
||||
batch.GrowerCode = GrowerData.GrowerCode;
|
||||
batch.Comments = new string[GrowerData.Comments.Count];
|
||||
batch.Comments = GrowerData.Comments.ToArray();
|
||||
|
||||
batch.VarietyId = VarietyId;
|
||||
batch.LayoutId = LayoutId;
|
||||
batch.SizingProfileName = SizingProfileName;
|
||||
//batch.VarietyId = Client.GetCurrentBatch().VarietyId;
|
||||
//batch.LayoutId = Client.GetCurrentBatch().LayoutId;
|
||||
//batch.SizingProfileName = Client.GetCurrentBatch().SizingProfileName;
|
||||
|
||||
return batch;
|
||||
}
|
||||
|
||||
@@ -54,14 +54,12 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Compac\ComClient.cs" />
|
||||
<Compile Include="GrowerInfo.cs" />
|
||||
<Compile Include="Connected Services\SizerService\Reference.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Reference.svcmap</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="INI\BatchDetails.cs" />
|
||||
<Compile Include="INI\IniFileCs.cs" />
|
||||
<Compile Include="INI\Settaggi.cs" />
|
||||
<Compile Include="Connector.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
@@ -70,12 +68,6 @@
|
||||
<None Include="App.config" />
|
||||
<None Include="articles\intro.md" />
|
||||
<None Include="articles\toc.md" />
|
||||
<None Include="batch.ini">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="conf.ini">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="Connected Services\SizerService\Arrays.xsd">
|
||||
<SubType>Designer</SubType>
|
||||
</None>
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace EgwProxy.Icoel
|
||||
{
|
||||
/// <summary>
|
||||
/// Classe rappresentazione dati del Grower
|
||||
/// </summary>
|
||||
public class GrowerInfo
|
||||
{
|
||||
#region Public Properties
|
||||
|
||||
/// <summary>
|
||||
/// Riga commento 01
|
||||
/// </summary>
|
||||
public List<string> Comments { get; set; } = new List<string>() { "Commento 01", "Commento 02", "Commento 01" };
|
||||
|
||||
/// <summary>
|
||||
/// Codice univoco fornitore
|
||||
/// </summary>
|
||||
public string GrowerCode { get; set; } = "02";
|
||||
|
||||
/// <summary>
|
||||
/// Denominazione del fornitore
|
||||
/// </summary>
|
||||
public string GrowerName { get; set; } = "Egalware";
|
||||
|
||||
#endregion Public Properties
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -87,17 +87,20 @@
|
||||
<HintPath>..\packages\EasyModbusTCP.5.6.0\lib\net40\EasyModbus.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgwProxy.MultiCncLib, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EgwProxy.MultiCncLib.3.6.2205.1913\lib\net40\EgwProxy.MultiCncLib.dll</HintPath>
|
||||
<HintPath>..\packages\EgwProxy.MultiCncLib.3.6.2205.1917\lib\EgwProxy.MultiCncLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgwProxy.OsaiCncLib, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EgwProxy.OsaiCncLib.3.6.2205.1913\lib\net40\EgwProxy.OsaiCncLib.dll</HintPath>
|
||||
<HintPath>..\packages\EgwProxy.OsaiCncLib.3.6.2205.1917\lib\EgwProxy.OsaiCncLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="EgwProxy.OsaiCncLib.XmlSerializers, Version=0.0.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\EgwProxy.OsaiCncLib.3.6.2205.1917\lib\EgwProxy.OsaiCncLib.XmlSerializers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="krcc, Version=0.0.0.0, Culture=neutral, processorArchitecture=x86">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>ExtLib\krcc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MapoSDK, Version=6.14.2204.2115, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MapoSDK.6.14.2204.2115\lib\net40\MapoSDK.dll</HintPath>
|
||||
<Reference Include="MapoSDK, Version=6.14.2204.2616, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MapoSDK.6.14.2204.2616\lib\MapoSDK.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="MathNet.Numerics, Version=4.15.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\MathNet.Numerics.4.15.0\lib\net461\MathNet.Numerics.dll</HintPath>
|
||||
@@ -308,14 +311,10 @@
|
||||
<None Include="DATA\CONF\IobOpcUaClient.Config.xml">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
<Content Include="arstcomm.ico" />
|
||||
<Content Include="ExtLib\CndexLinkDotNet.dll" />
|
||||
<Content Include="ExtLib\krcc.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
<Content Include="ExtLib\krcc64.dll" />
|
||||
<Content Include="ExtLib\Siemens.Sinumerik.Operate.Services.dll" />
|
||||
<Content Include="ExtLib\Siemens.Sinumerik.Operate.Services.Wrapper.dll" />
|
||||
<Content Include="ExtLib\S_Fwlib32_V6.3.1.exe" />
|
||||
<Content Include="logs\.placeholder.txt">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 766 B |
@@ -2,9 +2,9 @@
|
||||
<packages>
|
||||
<package id="Autoupdater.NET.Official" version="1.7.0" targetFramework="net462" />
|
||||
<package id="EasyModbusTCP" version="5.6.0" targetFramework="net462" />
|
||||
<package id="EgwProxy.MultiCncLib" version="3.6.2205.1913" targetFramework="net462" />
|
||||
<package id="EgwProxy.OsaiCncLib" version="3.6.2205.1913" targetFramework="net462" />
|
||||
<package id="MapoSDK" version="6.14.2204.2115" targetFramework="net462" />
|
||||
<package id="EgwProxy.MultiCncLib" version="3.6.2205.1917" targetFramework="net462" />
|
||||
<package id="EgwProxy.OsaiCncLib" version="3.6.2205.1917" targetFramework="net462" />
|
||||
<package id="MapoSDK" version="6.14.2204.2616" targetFramework="net462" />
|
||||
<package id="MathNet.Numerics" version="4.15.0" targetFramework="net462" />
|
||||
<package id="Microsoft.CodeAnalysis.NetAnalyzers" version="6.0.0" targetFramework="net462" developmentDependency="true" />
|
||||
<package id="Microsoft.VisualStudio.SlowCheetah" version="4.0.8" targetFramework="net462" developmentDependency="true" />
|
||||
|
||||
Reference in New Issue
Block a user