134 lines
5.5 KiB
C#
134 lines
5.5 KiB
C#
using EgwProxy.MagMan;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DemoApp
|
|
{
|
|
internal class Program
|
|
{
|
|
|
|
|
|
static async Task Main(string[] args)
|
|
{
|
|
|
|
#if DEBUG
|
|
// Indirizzo server (DEBUG)
|
|
string servAddr = "localhost:7207";
|
|
|
|
// token di auth
|
|
string commToken = "91f4fec6-7e9c-4130-9df2-702d729ccdd3";
|
|
#else
|
|
// Indirizzo server (RELEASE)
|
|
string servAddr = "magman.egalware.com";
|
|
|
|
// token di auth
|
|
string commToken = "22fa4426-6670-41ad-ac2b-d7b5c3dfe849";
|
|
#endif
|
|
|
|
string sep = "--------------------------------------------";
|
|
string sepShort = "------------------";
|
|
Console.WriteLine(sep);
|
|
Console.WriteLine("- MagMan REST Demo App");
|
|
Console.WriteLine(sep);
|
|
Console.WriteLine();
|
|
string answ = "";
|
|
DataSyncro commLib = new DataSyncro(servAddr, commToken);
|
|
Console.WriteLine("Premere ENT per check ping");
|
|
answ = Console.ReadLine();
|
|
bool servOk = commLib.CheckRemote();
|
|
string esito = servOk ? "OK" : "KO";
|
|
Console.WriteLine($"Esito controllo server: {esito}");
|
|
Console.WriteLine("Premere un tasto per lettura archivio materiali");
|
|
answ = Console.ReadLine();
|
|
// leggo materiali
|
|
var matList = await commLib.MaterialsGet();
|
|
if (matList != null)
|
|
{
|
|
foreach (var item in matList)
|
|
{
|
|
Console.WriteLine(sep);
|
|
Console.WriteLine($"Mat ID: {item.MatId}");
|
|
Console.WriteLine($"Mat Code: {item.MatCode}");
|
|
Console.WriteLine($"Dtmx Code: {item.MatDtmx}");
|
|
Console.WriteLine($"descript: {item.MatDesc}");
|
|
Console.WriteLine($"Dimensions W x H x L: {item.WMm:N3} x {item.HMm:N3} x {item.LMm:N3}");
|
|
if (item.ItemList != null)
|
|
{
|
|
Console.WriteLine($"Items count: {item.ItemList.Count}");
|
|
}
|
|
Console.WriteLine(sep);
|
|
Console.WriteLine();
|
|
}
|
|
}
|
|
Console.WriteLine("Enter to next step");
|
|
answ = Console.ReadLine();
|
|
|
|
// leggo inventario
|
|
var inventList = await commLib.InventoryGet(0);
|
|
if (inventList != null)
|
|
{
|
|
foreach (var itemMat in inventList)
|
|
{
|
|
Console.WriteLine(sep);
|
|
Console.WriteLine($"Mat ID: {itemMat.MatId}");
|
|
Console.WriteLine($"Mat Code: {itemMat.MatCode}");
|
|
Console.WriteLine($"Dtmx Code: {itemMat.MatDtmx}");
|
|
Console.WriteLine($"descript: {itemMat.MatDesc}");
|
|
Console.WriteLine($"Dimensions W x H x L: {itemMat.WMm:N3} x {itemMat.HMm:N3} x {itemMat.LMm:N3}");
|
|
if (itemMat.ItemList != null)
|
|
{
|
|
Console.WriteLine($"Items count: {itemMat.ItemList.Count}");
|
|
if (itemMat.ItemList.Count > 0)
|
|
{
|
|
Console.WriteLine("Inventario:");
|
|
foreach (var itemInv in itemMat.ItemList)
|
|
{
|
|
Console.WriteLine(sepShort);
|
|
Console.WriteLine($"ID: {itemInv.RawItemCloudId}");
|
|
Console.WriteLine($"Location: {itemInv.Location}");
|
|
Console.WriteLine($"Descript: {itemInv.Note}");
|
|
Console.WriteLine($"Giacenza: {itemInv.QtyAvail}");
|
|
Console.WriteLine($"Dimensions W x H x L: {itemInv.WMm:N3} x {itemInv.HMm:N3} x {itemInv.LMm:N3}");
|
|
Console.WriteLine($"Dtmx Code: {itemInv.ItemDtmx}");
|
|
}
|
|
}
|
|
}
|
|
Console.WriteLine(sep);
|
|
Console.WriteLine();
|
|
}
|
|
}
|
|
Console.WriteLine("Enter to next step");
|
|
answ = Console.ReadLine();
|
|
|
|
// leggo projectList
|
|
var projList = await commLib.ProjectGet(470);
|
|
if (projList != null)
|
|
{
|
|
foreach (var itemMat in projList)
|
|
{
|
|
Console.WriteLine(sep);
|
|
Console.WriteLine($"MachineId: {itemMat.MachineID}");
|
|
Console.WriteLine($"Key: {itemMat.KeyNum}");
|
|
Console.WriteLine($"ProjExtDbId: {itemMat.ProjExtDbId}");
|
|
Console.WriteLine($"ProjExtId: {itemMat.ProjExtId}");
|
|
Console.WriteLine($"BTL filename: {itemMat.BTLFileName}");
|
|
Console.WriteLine($"PType: {itemMat.PType}");
|
|
Console.WriteLine($"Machine: {itemMat.Machine}");
|
|
Console.WriteLine($"Descript: {itemMat.ProjDescription}");
|
|
Console.WriteLine($"Proc time est/real: {itemMat.ProcTimeEst:N1} / {itemMat.ProcTimeReal:N1}");
|
|
Console.WriteLine(sep);
|
|
Console.WriteLine();
|
|
}
|
|
}
|
|
answ = Console.ReadLine();
|
|
|
|
|
|
Console.WriteLine("Enter to close");
|
|
answ = Console.ReadLine();
|
|
}
|
|
}
|
|
}
|