/// <summary>
        ///     Calculates all values for the incontinence rewet test
        /// </summary>
        /// <param name="incontinencePadTestValue">the test value</param>
        /// <param name="testSheetId">the test sheet id</param>
        /// <returns></returns>
        private IncontinencePadTestValue CalculateInkoRewetValues(IncontinencePadTestValue incontinencePadTestValue,
                                                                  Int32 testSheetId)
        {
            var testSheet       = TestBll.GetTestSheetInfo(testSheetId);
            var productionOrder = TestBll.GetProductionOrder(testSheet.FaNr);

            incontinencePadTestValue.RewetFreeDifference = incontinencePadTestValue.RewetFreeWetValue - incontinencePadTestValue.RewetFreeDryValue;
            incontinencePadTestValue.RewetFreeRw         = GetRewetFreeRwType(incontinencePadTestValue.RewetFreeDifference, productionOrder);
            return(incontinencePadTestValue);
        }
Пример #2
0
        /// <summary>
        ///     Calculates all values for the incontinence rewet test
        /// </summary>
        /// <param name="incontinencePadTestValue">the test value</param>
        /// <param name="testSheetId">the test sheet id</param>
        /// <returns></returns>
        private IncontinencePadTestValue CalculateInkoRetentionValues(IncontinencePadTestValue incontinencePadTestValue,
                                                                      Int32 testSheetId)
        {
            var testSheet       = TestBll.GetTestSheetInfo(testSheetId);
            var productionOrder = TestBll.GetProductionOrder(testSheet.FaNr);

            incontinencePadTestValue.RetentionAbsorbtion = incontinencePadTestValue.RetentionWetValue - incontinencePadTestValue.RetentionWeight;
            incontinencePadTestValue.RetentionEndValue   = incontinencePadTestValue.RetentionAfterZentrifuge - incontinencePadTestValue.RetentionWeight;
            incontinencePadTestValue.RetentionRw         = GetRetentionRwType(incontinencePadTestValue.RetentionEndValue, productionOrder);
            return(incontinencePadTestValue);
        }
Пример #3
0
        /// <summary>
        ///     Calculates all values for the baby diaper rewet test
        /// </summary>
        /// <param name="babyDiaperTestValue">the test value</param>
        /// <param name="testSheetId">the test sheet id</param>
        /// <returns></returns>
        private BabyDiaperTestValue CalculateBabyDiaperRewetValues(BabyDiaperTestValue babyDiaperTestValue,
                                                                   Int32 testSheetId)
        {
            var testSheet       = TestBll.GetTestSheetInfo(testSheetId);
            var productionOrder = TestBll.GetProductionOrder(testSheet.FaNr);

            babyDiaperTestValue.Rewet140Rw        = GetRewet140RwType(babyDiaperTestValue.Rewet140Value, productionOrder);
            babyDiaperTestValue.Rewet210Rw        = GetRewet210RwType(babyDiaperTestValue.Rewet210Value, productionOrder);
            babyDiaperTestValue.PenetrationRwType = GetPenetrationRwType(babyDiaperTestValue.PenetrationTimeAdditionFourth, productionOrder);
            return(babyDiaperTestValue);
        }
        /// <summary>
        ///     Calculates all values for the incontinence acquisition test
        /// </summary>
        /// <param name="incontinencePadTestValue">the test value</param>
        /// <param name="testSheetId">the test sheet id</param>
        /// <returns></returns>
        private IncontinencePadTestValue CalculateInkoAquisitionValues(IncontinencePadTestValue incontinencePadTestValue,
                                                                       Int32 testSheetId)
        {
            var testSheet       = TestBll.GetTestSheetInfo(testSheetId);
            var productionOrder = TestBll.GetProductionOrder(testSheet.FaNr);

            incontinencePadTestValue.AcquisitionTimeFirstRw  = GetMaxRw(incontinencePadTestValue.AcquisitionTimeFirst, productionOrder.Article.MaxHyTec1);
            incontinencePadTestValue.AcquisitionTimeSecondRw = GetMaxRw(incontinencePadTestValue.AcquisitionTimeSecond, productionOrder.Article.MaxHyTec2);
            incontinencePadTestValue.AcquisitionTimeThirdRw  = GetMaxRw(incontinencePadTestValue.AcquisitionTimeThird, productionOrder.Article.MaxHyTec3);

            incontinencePadTestValue.RewetAfterAcquisitionTimeWeightDifference = incontinencePadTestValue.RewetAfterAcquisitionTimeWetWeight
                                                                                 - incontinencePadTestValue.RewetAfterAcquisitionTimeDryWeight;
            incontinencePadTestValue.RewetAfterAcquisitionTimeRw = GetMaxRw(incontinencePadTestValue.RewetAfterAcquisitionTimeWeightDifference,
                                                                            productionOrder.Article.MaxInkoRewetAfterAquisition);
            return(incontinencePadTestValue);
        }
        /// <summary>
        ///     Updates the Average and standard deviation values of the testsheet for retention values
        /// </summary>
        /// <param name="testSheetId">id of the test sheet</param>
        /// <returns>the updated test sheet</returns>
        public TestSheet UpdateRetentionAverageAndStv(Int32 testSheetId)
        {
            var testSheet        = TestBll.GetTestSheetInfo(testSheetId);
            var retentionTestAvg =
                testSheet.TestValues.FirstOrDefault(
                    tv =>
                    (tv.ArticleTestType == ArticleType.BabyDiaper) && (tv.BabyDiaperTestValue.TestType == TestTypeBabyDiaper.Retention) &&
                    (tv.TestValueType == TestValueType.Average));
            var retentionTestStDev =
                testSheet.TestValues.FirstOrDefault(
                    tv =>
                    (tv.ArticleTestType == ArticleType.BabyDiaper) && (tv.BabyDiaperTestValue.TestType == TestTypeBabyDiaper.Retention) &&
                    (tv.TestValueType == TestValueType.StandardDeviation));

            UpdateRetentionAvg(testSheet, retentionTestAvg);
            UpdateRetentionStDev(testSheet, retentionTestAvg, retentionTestStDev);
            TestBll.UpdateTestSheet();
            return(testSheet);
        }
Пример #6
0
        /// <summary>
        ///     Gets the InkoRetentionEditViewModel for edit
        /// </summary>
        /// <param name="testSheetId">The Id of the test sheet where the Inko rewet test is for</param>
        /// <returns>The InkoRewetEditViewModel</returns>
        public InkoRetentionEditViewModel GetNewInkoRetentionEditViewModel(Int32 testSheetId)
        {
            var testSheet = TestBll.GetTestSheetInfo(testSheetId);

            if (testSheet.IsNull() || (testSheet.ArticleType != ArticleType.IncontinencePad))
            {
                Logger.Error("TestBlatt mit id " + testSheetId + "existiert nicht in DB!");
                return(null);
            }

            var errors     = TestBll.GetAllNoteCodes();
            var errorCodes = errors.Select(error => new ErrorCode {
                ErrorId = error.ErrorId, Name = error.ErrorCode + " - " + error.Value
            })
                             .ToList();

            var viewModel = new InkoRetentionEditViewModel
            {
                TestSheetId    = testSheetId,
                TestValueId    = -1,
                ProductionCode = TestServiceHelper.CreateProductionCode(testSheet),
                NoteCodes      = errorCodes,
                Notes          = new List <TestNote>()
            };

            var oldTestValue = testSheet.TestValues.Where(t => t.TestValueType == TestValueType.Single)
                               .ToList()
                               .LastOrDefault();

            if (oldTestValue == null)
            {
                return(viewModel);
            }
            viewModel.TestPerson         = oldTestValue.LastEditedPerson;
            viewModel.ProductionCodeDay  = oldTestValue.DayInYearOfArticleCreation;
            viewModel.ProductionCodeTime = oldTestValue.IncontinencePadTestValue.IncontinencePadTime;
            viewModel.ExpireMonth        = oldTestValue.IncontinencePadTestValue.ExpireMonth;
            viewModel.ExpireYear         = oldTestValue.IncontinencePadTestValue.ExpireYear;

            return(viewModel);
        }
        /// <summary>
        ///     Calculates all values for the baby diaper retention test
        /// </summary>
        /// <param name="babyDiaperTestValue">the test value</param>
        /// <param name="testSheetId">the test sheet id</param>
        /// <returns></returns>
        private BabyDiaperTestValue CalculateBabyDiaperRetentionValues(BabyDiaperTestValue babyDiaperTestValue,
                                                                       Int32 testSheetId)
        {
            var testSheet       = TestBll.GetTestSheetInfo(testSheetId);
            var productionOrder = TestBll.GetProductionOrder(testSheet.FaNr);

            babyDiaperTestValue.RetentionAfterZentrifugeValue = babyDiaperTestValue.RetentionWetWeight -
                                                                babyDiaperTestValue.WeightDiaperDry;
            if (Math.Abs(babyDiaperTestValue.WeightDiaperDry) > 0.1)
            {
                babyDiaperTestValue.RetentionAfterZentrifugePercent = (babyDiaperTestValue.RetentionWetWeight -
                                                                       babyDiaperTestValue.WeightDiaperDry) * 100.0 /
                                                                      babyDiaperTestValue.WeightDiaperDry;
            }
            babyDiaperTestValue.RetentionRw    = GetRetentionRwType(babyDiaperTestValue.RetentionAfterZentrifugeValue, productionOrder);
            babyDiaperTestValue.SapType        = testSheet.SAPType;
            babyDiaperTestValue.SapNr          = testSheet.SAPNr;
            babyDiaperTestValue.SapGHoewiValue = (babyDiaperTestValue.RetentionWetWeight - babyDiaperTestValue.WeightDiaperDry - productionOrder.Component.PillowRetentWithoutSAP)
                                                 / productionOrder.Component.SAP;
            return(babyDiaperTestValue);
        }
Пример #8
0
        /// <summary>
        ///     Updates the Average and standard deviation values of the testsheet for retention values
        /// </summary>
        /// <param name="testSheetId">id of the test sheet</param>
        /// <returns>the updated test sheet</returns>
        public TestSheet UpdateRetentionAverageAndStv(Int32 testSheetId)
        {
            var testSheet            = TestBll.GetTestSheetInfo(testSheetId);
            var inkoRetentionTestAvg =
                testSheet.TestValues.FirstOrDefault(
                    tv =>
                    (tv.ArticleTestType == ArticleType.IncontinencePad) &&
                    (tv.IncontinencePadTestValue.TestType == TestTypeIncontinencePad.Retention) &&
                    (tv.TestValueType == TestValueType.Average));
            var inkoRetentionTestStDev =
                testSheet.TestValues.FirstOrDefault(
                    tv =>
                    (tv.ArticleTestType == ArticleType.IncontinencePad) &&
                    (tv.IncontinencePadTestValue.TestType == TestTypeIncontinencePad.Retention) &&
                    (tv.TestValueType == TestValueType.StandardDeviation));

            UpdateInkoRetentionAvg(testSheet, inkoRetentionTestAvg);
            UpdateInkoRetentionStDev(testSheet, inkoRetentionTestAvg, inkoRetentionTestStDev);

            TestBll.UpdateTestSheet();
            return(testSheet);
        }
        /// <summary>
        ///     Gets the BabyDiaperRewetEditViewModel for edit
        /// </summary>
        /// <param name="testSheetId">The Id of the test sheet where the Babydiaper rewet test is for</param>
        /// <returns>The BabyDiaperRewetEditViewModel</returns>
        public BabyDiaperRewetEditViewModel GetNewBabyDiaperRewetEditViewModel(Int32 testSheetId)
        {
            var testSheetInfo = TestBll.GetTestSheetInfo(testSheetId);

            if (testSheetInfo.IsNull())
            {
                Logger.Error("TestBlatt mit id " + testSheetId + "existiert nicht in DB!");
                return(null);
            }

            var errors     = TestBll.GetAllNoteCodes();
            var errorCodes = errors.Select(error => new ErrorCode {
                ErrorId = error.ErrorId, Name = error.ErrorCode + " - " + error.Value
            })
                             .ToList();
            var viewModel = new BabyDiaperRewetEditViewModel
            {
                TestSheetId    = testSheetId,
                TestValueId    = -1,
                ProductionCode = TestServiceHelper.CreateProductionCode(testSheetInfo),
                NoteCodes      = errorCodes,
                Notes          = new List <TestNote>()
            };

            var oldTestValue = testSheetInfo.TestValues.Where(t => t.TestValueType == TestValueType.Single)
                               .ToList()
                               .LastOrDefault();

            if (oldTestValue == null)
            {
                return(viewModel);
            }
            viewModel.TestPerson         = oldTestValue.LastEditedPerson;
            viewModel.ProductionCodeDay  = oldTestValue.DayInYearOfArticleCreation;
            viewModel.ProductionCodeTime = oldTestValue.BabyDiaperTestValue.DiaperCreatedTime;

            return(viewModel);
        }