98 lines
3.5 KiB
C#
98 lines
3.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using EgwProxy.Icoel;
|
|
using EgwProxy.Icoel.SizerService;
|
|
|
|
namespace EgwProxy.Icoel.Test
|
|
{
|
|
internal class Program
|
|
{
|
|
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)
|
|
Console.WriteLine("Loading Files...");
|
|
|
|
Connector IcoelSizer = new Connector("192.168.137.50", "8001");
|
|
|
|
#if false
|
|
Connector.Load();
|
|
#endif
|
|
|
|
// ora effettua lettura Varietà e Layout disponibili
|
|
|
|
try
|
|
{
|
|
var varList = IcoelSizer.GetVarietyList();
|
|
var varietyData = IcoelSizer.GetLayoutForVarietyList(varList);
|
|
if (varietyData != null)
|
|
{
|
|
DisplayVarietyLayout(varietyData);
|
|
}
|
|
|
|
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}");
|
|
}
|
|
IcoelSizer.MettiLottoInCoda();
|
|
|
|
IcoelSizer.GetCurrentBatch();
|
|
|
|
Console.WriteLine("Done.");
|
|
Console.ReadKey();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
Console.WriteLine("ECCEZIONE" + ex.Message + ex.StackTrace);
|
|
Console.ReadKey();
|
|
}
|
|
}
|
|
|
|
|
|
/// <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}");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|