public static ProductionOrder GetActiveByPallet(Pallet pallet) { try { return(ProductionOrderRepository.GetActiveByPallet(pallet)); } catch (Exception ex) { throw ex; } }
/// <summary> /// Query for the ProductionOrder /// </summary> /// <param name="productionOrderFa">the Id of the Production order</param> public ProductionOrder GetProductionOrder(String productionOrderFa) { var pO = ProductionOrderRepository.Where(p => p.FaNr == productionOrderFa) .FirstOrDefault(); if (pO != null) { return(ProductionOrderRepository.FindAsync(pO.FaId) .Result); } return(null); }
private static void CreateProductionOrder(Station station, Pallet pallet, Mold mold) { var productionOrder = new ProductionOrder { Mold = mold, Pallet = pallet, Status = ProductionOrderStatus.Active }; station.ActiveProductionOrder = productionOrder; ProductionOrderRepository.SaveOrUpdate(productionOrder); }
private static void StartRegisterOperation(Pallet pallet, Mold mold, Operation operation) { var operationRegister = new OperationRegister { Pallet = pallet, InitDateTime = DateTime.Now, Mold = mold, OperationIn = operation, Part = ProductionOrderRepository.GetActiveByPallet(pallet).ActivePart }; OperationRegisterRepository.SaveOrUpdate(operationRegister); }
private static void CreatePart(Pallet pallet, string reference) { var productionOrder = ProductionOrderRepository.GetActiveByPallet(pallet); var part = new Part { ProductionOrder = productionOrder, FabricationDate = DateTime.Now, Reference = reference }; productionOrder.ActivePart = part; PartRepository.SaveOrUpdate(part); ProductionOrderRepository.SaveOrUpdate(part.ProductionOrder); }
private static void FinalizeProductionOrder(Pallet pallet) { ProductionOrderRepository.ChangeStatus(ProductionOrderRepository.GetActiveByPallet(pallet), ProductionOrderStatus.Finalized); }
/// <summary> /// Initializes a new testsheet for the faNr and the current date /// </summary> /// <param name="faNr">the production order number</param> /// <returns>the initialized testsheet</returns> public TestSheet InitTestSheetForFaNr(String faNr) { var productionOrder = ProductionOrderRepository.GetAll() .FirstOrDefault(order => order.FaNr == faNr); if (productionOrder == null) { Logger.Error("Fanr " + faNr + " not found in Production Order"); return(null); } var shift = ShiftHelper.GetCurrentShift(); if (shift == null) { return(null); } var testvalues = new List <TestValue>(); if (productionOrder.Article.ArticleType == ArticleType.BabyDiaper) { testvalues = new List <TestValue> { CreateDefaultTestValueBabyDiaper(TestValueType.Average, TestTypeBabyDiaper.Retention), CreateDefaultTestValueBabyDiaper(TestValueType.Average, TestTypeBabyDiaper.Rewet), CreateDefaultTestValueBabyDiaper(TestValueType.Average, TestTypeBabyDiaper.RewetAndPenetrationTime), CreateDefaultTestValueBabyDiaper(TestValueType.StandardDeviation, TestTypeBabyDiaper.Retention), CreateDefaultTestValueBabyDiaper(TestValueType.StandardDeviation, TestTypeBabyDiaper.Rewet), CreateDefaultTestValueBabyDiaper(TestValueType.StandardDeviation, TestTypeBabyDiaper.RewetAndPenetrationTime) } } ; if (productionOrder.Article.ArticleType == ArticleType.IncontinencePad) { testvalues = new List <TestValue> { CreateDefaultTestValueIncontinencePad(TestValueType.StandardDeviation, TestTypeIncontinencePad.AcquisitionTimeAndRewet), CreateDefaultTestValueIncontinencePad(TestValueType.StandardDeviation, TestTypeIncontinencePad.Retention), CreateDefaultTestValueIncontinencePad(TestValueType.StandardDeviation, TestTypeIncontinencePad.RewetFree), CreateDefaultTestValueIncontinencePad(TestValueType.Average, TestTypeIncontinencePad.AcquisitionTimeAndRewet), CreateDefaultTestValueIncontinencePad(TestValueType.Average, TestTypeIncontinencePad.Retention), CreateDefaultTestValueIncontinencePad(TestValueType.Average, TestTypeIncontinencePad.RewetFree) } } ; var testSheet = new TestSheet { ArticleType = productionOrder.Article.ArticleType, ShiftType = shift.Value, FaNr = productionOrder.FaNr, TestValues = testvalues, CreatedDateTime = DateTime.Now, SizeName = productionOrder.Article.SizeName, ProductName = productionOrder.Article.ProductName, DayInYear = DateTime.Now.DayOfYear, MachineNr = productionOrder.Machine.MachineNr, SAPNr = productionOrder.Component?.ComponentNr, SAPType = productionOrder.Component?.ComponentType }; TestSheetRepository.Add(testSheet); TestSheetRepository.SaveChanges(); return(testSheet); } #endregion #region Implementation of ILaborCreatorBll #endregion } }