public BankingInfoPage ClickTestCard() { IJavaScriptExecutor jse2 = (IJavaScriptExecutor)driver; jse2.ExecuteScript("arguments[0].scrollIntoView()", GetTestCard); GetTestCard.Click(); return(this); }
private DABGetTestCard.Response DABGetTestCardHandler(DABGetTestCard command) { DABGetTestCard.Response response = new DABGetTestCard.Response(); List <ToBeProducedMaterial> toBeProdMats = Platform.ProjectionQuery <ToBeProducedMaterial>().Include("WorkOrderOperation.ToBeUsedMachines").Include(tpm => tpm.MaterialItem).Where(pmi => pmi.MaterialItem.SerialNumberCode == command.SerialNumber).ToList(); if (!toBeProdMats.Any()) { response.SetError(-1000, $"Nessun Ordine trovato per il seriale {command.SerialNumber}"); return(response); } List <int> equipIds = toBeProdMats.SelectMany(m => m.WorkOrderOperation.ToBeUsedMachines).Where(e => e.Machine != null).Select(e => e.Machine.Value).ToList(); var testingIds = Platform.ProjectionQuery <Equipment>().Where(e => equipIds.Contains(e.Id)).Where(e => e.MachineDefinitionNId == "Testing").Select(e => e.Id).ToList(); if (!testingIds.Any()) { response.SetError(-1000, $"Nessun Ordine trovato per il seriale {command.SerialNumber}"); return(response); } ToBeProducedMaterial toBeProdMat = toBeProdMats.FirstOrDefault(mat => mat.WorkOrderOperation.ToBeUsedMachines.Any(m => testingIds.Contains(m.Machine.Value))); if (toBeProdMat == null) { response.SetError(-1000, $"Seriale {command.SerialNumber} non ancora disponibile o già avviato"); return(response); } int?workOrderId = toBeProdMat.WorkOrderOperation.WorkOrder_Id; var matDef = Platform.ProjectionQuery <MaterialDefinition>().Where(md => md.Id == toBeProdMat.MaterialItem.MaterialDefinition).FirstOrDefault(); if (workOrderId == null) { response.SetError(-1000, $"Nessun Ordine trovato per il seriale {command.SerialNumber}"); return(response); } var windchillConf = Platform.ProjectionQuery <ConfigurationKey>().Where(c => c.NId == "WindchillIntegration").Select(c => c.Val).FirstOrDefault(); var windchillIntegration = (!string.IsNullOrEmpty(windchillConf) && windchillConf == "true"); var getInput = new GetTestCard { WorkOrderId = workOrderId.Value, ProductCode = matDef.NId, ProductRevision = matDef.Revision, WindchillIntegration = windchillIntegration }; var getResponse = Platform.CallCommand <GetTestCard, GetTestCard.Response>(getInput); if (!getResponse.Succeeded) { response.SetError(getResponse.Error.ErrorCode, getResponse.Error.ErrorMessage); return(response); } var toBeUsedMachine = toBeProdMat.WorkOrderOperation.ToBeUsedMachines.Where(tum => tum.Machine.HasValue).FirstOrDefault().Machine.Value; var equip = Platform.ProjectionQuery <Equipment>().Where(e => e.Id == toBeUsedMachine).FirstOrDefault(); var startResponse = Platform.CallCommand <DABStartSerial, DABStartSerial.Response>(new DABStartSerial { StartWOOperationSerializedParameterTypeList = new List <StartSerializedParameterType> { new StartSerializedParameterType { Id = toBeProdMat.WorkOrderOperation.Id, NId = toBeProdMat.WorkOrderOperation.NId, EquipmentName = equip.Name, EquipmentNId = equip.NId, ToBeProducedMaterials = new List <MaterialItemParameterType> { new MaterialItemParameterType { NId = toBeProdMat.MaterialItem.NId, EquipmentNId = equip.NId, MaterialDefinitionNId = matDef.NId, SerialNumber = command.SerialNumber } } } } }); if (!startResponse.Succeeded) { response.SetError(startResponse.Error.ErrorCode, startResponse.Error.ErrorMessage); return(response); } response.TestCard = getResponse.TestCard; RefreshOTWebSerials(workOrderId.Value); return(response); }
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); }
public CardPaymentProcessController() { GetTestCard = new GetTestCard(); }