static void Main(string[] args) { while (true) { try { TestCardParameter testCard = null; using (var docConnector = new WindchillDocConnector()) using (var testCardConnector = new WindchillTestCardConnector()) { Console.WriteLine("Dimmi il productCode"); string productCodeX = Console.ReadLine(); Console.WriteLine("Dimmi il productRevision"); string productRevisionX = Console.ReadLine(); testCard = testCardConnector.GetTestCard(productCodeX, productRevisionX); Console.WriteLine(JsonConvert.SerializeObject(testCard)); //Console.WriteLine("ProductCode: "); //string productCode = Console.ReadLine(); //Console.WriteLine("101110060"); //Console.WriteLine("Revision: "); //string revision = Console.ReadLine(); var docs = docConnector.GetDocumentList(productCodeX, productRevisionX); foreach (var doc in docs) { Console.WriteLine(doc.Number + " " + doc.Revision + " " + doc.SoftType); doc.SoftType = "wt.doc.WTDocument"; docConnector.DownloadDoc(doc); } } Console.ReadLine(); } catch (Exception e) { Console.WriteLine(e.ToString()); } } }
private GetTestCard.Response GetTestCardHandler(GetTestCard command) { var response = new GetTestCard.Response(); var testCard = Platform.Query <ITestCard>().Include(t => t.Absorptions).FirstOrDefault(t => t.WorkOrderId == command.WorkOrderId); if (testCard == null && command.WindchillIntegration) { WindchillTestConnectorLibrary.TestCardParameter wTestCard = null; string revision = command.ProductRevision == "n/a" ? string.Empty : command.ProductRevision; using (var connector = new WindchillTestCardConnector()) { wTestCard = connector.GetTestCard(command.ProductCode, revision); } if (wTestCard != null) { testCard = Platform.Create <ITestCard>(); testCard.WorkOrderId = command.WorkOrderId; testCard.CodiceProdotto = command.ProductCode; testCard.CorrenteASecco = wTestCard.CorrenteASecco; testCard.CorrenteASeccoPercent = wTestCard.CorrenteASeccoPercent; testCard.PotenzaASecco = wTestCard.PotenzaASecco; testCard.PotenzaASeccoPercent = wTestCard.PotenzaASeccoPercent; foreach (var a in wTestCard.Assorbimenti) { var absorption = Platform.Create <IAbsorption>(); absorption.Ampere = a.Ampere; absorption.AmperePercent = a.AmperePercent; absorption.Nome = a.Nome; absorption.Portata = a.Portata; absorption.PortataPercent = a.PortataPercent; absorption.Pressione = a.Pressione; absorption.PressionePercent = a.PressionePercent; absorption.Watt = a.Watt; absorption.WattPercent = a.WattPercent; testCard.Absorptions.Add(absorption); } Platform.Submit(testCard); } } if (testCard == null) { response.SetError(-1005, $"Nessuna scheda di collaudo trovata per il codice prodotto: {command.ProductCode}"); return(response); } response.TestCard = new Types.TestCardParameter { CodiceProdotto = testCard.CodiceProdotto, CorrenteASecco = testCard.CorrenteASecco, CorrenteASeccoPercent = testCard.CorrenteASeccoPercent, PotenzaASecco = testCard.PotenzaASecco, PotenzaASeccoPercent = testCard.PotenzaASeccoPercent, Assorbimenti = new List <Types.AbsorptionParameter>() }; foreach (var a in testCard.Absorptions) { response.TestCard.Assorbimenti.Add(new Types.AbsorptionParameter { Nome = a.Nome, Ampere = a.Ampere, AmperePercent = a.AmperePercent, Portata = a.Portata, PortataPercent = a.PortataPercent, Pressione = a.Pressione, PressionePercent = a.PressionePercent, Watt = a.Watt, WattPercent = a.WattPercent }); } return(response); }