public static bool ConsumeMaterial(ReplacementComponentFacts input) { if (!input.Shopfloorline.UseMaterialsInventory) { return(true); } if (input.PartIn.DisableMaterialsTracking) { return(true); } var inventoryController = new ServiceMaterialsInventoryController(); var transId = inventoryController.Consume (input.PartIn.PartNumber, input.Shopfloorline.Id, 1, "Repair", input.Repair.Item.LotId); if (transId == default(int)) { return(false); } input.ConsumptionId = transId; return(true); }
private bool PartInSnIsValid(ReplacementComponentFacts facts) { if (facts.PartIn.IsSerialized() && string.IsNullOrEmpty(facts.SerialNumberIn)) { m_error = "The [Part In] serial number is required."; return(false); } return(true); }
private bool PartOutIsValid(ReplacementComponentFacts facts) { if (facts.PartOut == null) { m_error = "The [Part Out] part number is not valid"; return(false); } return(true); }
private bool RepairAlreadyContainsComponent(ReplacementComponentFacts facts) { if (facts.Repair.ContainsReplacement(facts)) { m_error = "A replacement with the same data already exists."; return(true); } return(false); }
private bool CommodityComponentIsValid(ReplacementComponentFacts facts) { if (facts.Component == null && facts.Repair.ArePartsRequired) { m_error = "Component Type is required."; return(false); } return(true); }
public void when_mapping_replacement_model_to_component() { var repair = new RouteStationRepair(m_uow); var model = new ReplacementComponentFacts(repair); model.Component = new FakeServiceCommodity(m_uow); model.PartIn = new FakePart(m_uow); model.PartOut = new FakePart(m_uow); model.SerialNumberIn = "sn in"; model.SerialNumberOut = "sn out"; model.UnitOfWork = m_uow as IUnitOfWork; var component = Scout.Core.Mapping.Map <ReplacementComponentFacts, RepairComponent>(model); Assert.IsInstanceOf(typeof(FakePart), component.PartIn); Assert.That(component.SerialNumberIn == "sn in"); Assert.That(component.Session == m_uow); }
private void CreateFacts() { m_facts = new ReplacementComponentFacts(m_repair); m_facts.UnitOfWork = m_session; m_facts.Shopfloorline = m_repair.Failure.Item.Shopfloorline; }
public PartReplacementValidator(ReplacementComponentFacts facts) { m_facts = facts; }
private bool MaterialCanBeConsumed(ReplacementComponentFacts facts) { return(facts.PartIn.DisableMaterialsTracking == false); }