using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Text; using System.Threading.Tasks; namespace EgwProxy.Gomba.Test { internal class Program { static void Main(string[] args) { // gestire da conf se saltare certificato ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; string linea = "-----------------------------"; Console.WriteLine(linea); Console.WriteLine("Test comunicazione Gomba"); Console.WriteLine(linea); Console.WriteLine(); string escimi = "N"; GombaServ.lwpServiceClient gombaConn; // init proxy SOAP if (false) { //gombaConn = new GombaServ.lwpServiceClient(); } else { //gombaConn = new GombaServ.lwpServiceClient("lwpServicePort", new System.ServiceModel.EndpointAddress("https://172.28.31.56:8000/ws")); gombaConn = new GombaServ.lwpServiceClient("lwpServicePort", new System.ServiceModel.EndpointAddress("https://308gomba:8000/ws")); } Console.WriteLine("Premere un tasto per iniziare test."); escimi = Console.ReadLine().ToUpper(); int idxReq = 10; // lettura while (escimi != "E") { string pesata = ""; Console.WriteLine($"{linea} {DateTime.Now:HH:mm:ss.fff} {linea}"); try { string dataFrom = "01/01/2023"; string dataTo = DateTime.Today.AddDays(1).ToString("dd/MM/yyyy"); var results = gombaConn.reqWeightList("ALL", dataFrom, dataTo); foreach (var item in results) { pesata = $"rm: {item.rm} | DI: {item.dateIn} | DO: {item.dateOut} | BI: {item.balanceIn} | BO: {item.balanceOut} | WI: {item.weightIn} | WO: {item.weightOut} | Feed: {item.feedback} | note: {item.notes}"; //pesata = $"rm: {item.rm} | DI: {item.dateIn} | DO: {item.dateOut} | BI: {item.balanceIn} | BO: {item.balanceOut} | WI: {item.weightIn} | WO: {item.weightOut} | net: {item.net} | MI: {item.idMemIn} | MO: {item.idMemOut} | Feed: {item.feedback} | note: {item.notes}"; Console.WriteLine(pesata); } } catch (Exception exc) { Console.WriteLine($"Errore:{Environment.NewLine}{exc}"); } Console.WriteLine($"{linea} {DateTime.Now:HH:mm:ss.fff} {linea}"); Console.WriteLine(); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Cosa vuoi fare ora? I = pesata IN, O= pesata OUT, E = uscita, altrimenti rilettura"); escimi = Console.ReadLine().ToUpper(); DateTime adesso = DateTime.Now; // invio pesata if (escimi == "I") { try { var answ = gombaConn.memWeight("IN", $"ODL000000{idxReq}", "TEST", "INGRESSO", "15000", "PROVA IN", $"{adesso:yyyy/MM/dd}", $"{adesso:HH:mm:ss}"); bool pesoOk = answ.feedback == "C"; pesata = $"rm: {answ.rm} | DI: {answ.dateIn} | DO: {answ.dateOut} | BI: {answ.balanceIn} | BO: {answ.balanceOut} | WI: {answ.weightIn} | WO: {answ.weightOut} | Feed: {answ.feedback} | note: {answ.notes}"; Console.WriteLine(pesata); Console.WriteLine(); } catch (Exception exc) { Console.WriteLine($"Errore:{Environment.NewLine}{exc}"); } } else if (escimi == "O") { try { var answ = gombaConn.memWeight("OUT", $"ODL000000{idxReq}", "TEST", "USCITA", "15000", "PROVA OUT", $"{adesso:yyyy/MM/dd}", $"{adesso:HH:mm:ss}"); bool pesoOk = answ.feedback == "C"; pesata = $"rm: {answ.rm} | DI: {answ.dateIn} | DO: {answ.dateOut} | BI: {answ.balanceIn} | BO: {answ.balanceOut} | WI: {answ.weightIn} | WO: {answ.weightOut} | Feed: {answ.feedback} | note: {answ.notes}"; Console.WriteLine(pesata); Console.WriteLine(); if (pesoOk) { idxReq++; } } catch (Exception exc) { Console.WriteLine($"Errore:{Environment.NewLine}{exc}"); } } } } } }