Esempio n. 1
0
        public async Task <IActionResult> Edit(int id, [Bind("PcsTempTargetsId,RecipeType,Recipe,Target,UpperLimit,LowerLimit")] PcsTempTargets pcsTempTargets)
        {
            if (id != pcsTempTargets.PcsTempTargetsId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(pcsTempTargets);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!PcsTempTargetsExists(pcsTempTargets.PcsTempTargetsId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(pcsTempTargets));
        }
Esempio n. 2
0
        protected override void SetLimits()
        {
            PcsTempTargets temps = _pcsActiveTempParameters.GetTargetsFor(RecipeName);

            TargetWeight         = temps.Target;
            UpperLimit           = temps.Target + 0.5M;
            LowerLimit           = temps.Target - 0.5M;
            OutOfRangeLowerLimit = 1;  //temps.Target - 0.6M;
            OutOfRangeUpperLimit = 99; //temps.Target + 0.6M;
        }
Esempio n. 3
0
        public async Task <IActionResult> Create([Bind("PcsTempTargetsId,RecipeType,Recipe,Target,UpperLimit,LowerLimit")] PcsTempTargets pcsTempTargets)
        {
            if (ModelState.IsValid)
            {
                _context.Add(pcsTempTargets);
                await _context.SaveChangesAsync();

                return(RedirectToAction(nameof(Index)));
            }
            return(View(pcsTempTargets));
        }
        private List <ControlChartData> GetActiveDropChartData(List <BatchReport> reports)
        {
            List <ControlChartData> output         = new List <ControlChartData>();
            List <BatchReport>      reportsToCheck = new List <BatchReport>();
            var batchesGroupedByRecipeType         = BatchHelperMethods.GroupBatchesByRecipeType(reports);

            foreach (var recipeType in batchesGroupedByRecipeType.Keys)
            {
                List <decimal> values       = new List <decimal>();
                List <string>  xAxisLabels  = new List <string>();
                PcsTempTargets limits       = new PcsTempTargets();
                string         nameOfRecipe = "";

                foreach (var report in batchesGroupedByRecipeType[recipeType].OrderBy(x => x.StartTime.Date).ThenBy(x => x.StartTime.TimeOfDay))
                {
                    if (recipeType == RecipeTypes.Conc)
                    {
                        if (report.Recipe == "WHTCON" || report.Recipe == "Recipe 38")
                        {
                            limits            = _pcsActiveTempParameters.GetTargetsFor(report.Recipe);
                            limits.UpperLimit = limits.Target + 1.5M;
                            limits.LowerLimit = limits.Target - 1.5M;
                            decimal tempValue = Convert.ToDecimal(_helperMethods.GetTemperatureOfActiveDrop(report.AllVessels.Where(x => x.VesselType == Vessel.VesselTypes.MainMixer).First()));
                            values.Add(CheckTemperatureForAdjustments(tempValue, limits.UpperLimit, limits.LowerLimit));
                            xAxisLabels.Add($"{report.Campaign}-{report.BatchNo}");
                            nameOfRecipe = report.Recipe;
                        }
                    }
                    if (recipeType == RecipeTypes.Reg)
                    {
                        if (report.Recipe == "WHTREG" || report.Recipe == "RE-Recipe 39")
                        {
                            limits            = _pcsActiveTempParameters.GetTargetsFor(report.Recipe);
                            limits.UpperLimit = limits.Target + 1M;
                            limits.LowerLimit = limits.Target - 1M;
                            decimal tempValue = Convert.ToDecimal(_helperMethods.GetTemperatureOfActiveDrop(report.AllVessels.Where(x => x.VesselType == Vessel.VesselTypes.MainMixer).First()));
                            values.Add(CheckTemperatureForAdjustments(tempValue, limits.UpperLimit, limits.LowerLimit));
                            xAxisLabels.Add($"{report.Campaign}-{report.BatchNo}");
                            nameOfRecipe = report.Recipe;
                        }
                    }
                    if (recipeType == RecipeTypes.BigBang)
                    {
                        if (report.Recipe == "BB-SKY" || report.Recipe == "BB-Recipe 15")
                        {
                            limits            = _pcsActiveTempParameters.GetTargetsFor(report.Recipe);
                            limits.UpperLimit = limits.Target + 1.5M;
                            limits.LowerLimit = limits.Target - 1.5M;
                            decimal tempValue = Convert.ToDecimal(_helperMethods.GetTemperatureOfActiveDrop(report.AllVessels.Where(x => x.VesselType == Vessel.VesselTypes.MainMixer).First()));
                            values.Add(CheckTemperatureForAdjustments(tempValue, limits.UpperLimit, limits.LowerLimit));
                            xAxisLabels.Add($"{report.Campaign}-{report.BatchNo}");
                            nameOfRecipe = report.Recipe;
                        }
                    }
                }

                ControlChartData data = new ControlChartData
                {
                    Target      = limits.Target,
                    Max         = limits.UpperLimit,
                    Min         = limits.LowerLimit,
                    Values      = values,
                    XAxisLabels = xAxisLabels,
                    SeriesName  = "Active Drop Temp",
                    Title       = $"Active Drop Temps Of {nameOfRecipe} Batches",
                    YAxisSuffix = " C",
                    ChartId     = recipeType.ToString()
                };
                data.ProcessCpkValues();
                output.Add(data);
                _xLCreator.AddToWorkBook <decimal>($"Active-temp-{nameOfRecipe}", values, data.Min, data.Max);
            }

            return(output);
        }