Ejemplo n.º 1
0
            public static OeeInfo GetOeeInfo(List <HourInfo> hours)
            {
                var result = new OeeInfo();

                if (hours.Count > 0)
                {
                    var oee = new OEE();
                    oee.ConstantQuality = 1;

                    foreach (var hour in hours)
                    {
                        oee.PlannedProductionTime += hour.PlannedProductionTime;
                        oee.OperatingTime         += hour.OperatingTime;
                        oee.IdealOperatingTime    += hour.IdealOperatingTime;
                        oee.TotalPieces           += hour.TotalPieces;
                        oee.GoodPieces            += hour.GoodPieces;
                    }

                    result.Oee          = Math.Round(Math.Min(1, Math.Max(0, oee.Oee)), 4);
                    result.Availability = Math.Round(Math.Min(1, Math.Max(0, oee.Availability)), 4);
                    result.Performance  = Math.Round(Math.Min(1, Math.Max(0, oee.Performance)), 4);
                    result.Quality      = Math.Round(Math.Min(1, Math.Max(0, oee.Quality)), 4);
                    result.TotalPieces  = oee.TotalPieces;
                    result.GoodPieces   = oee.GoodPieces;
                }

                return(result);
            }
        public ActionResult <APIResponse> Post([FromBody] OEEViewModel oEEViewModel)
        {
            APIResponse result = new APIResponse("Success", "Data saved successfully.");

            try
            {
                OEE.SaveOEEData(_context, oEEViewModel);
            }
            catch (Exception ex)
            {
                result.Status  = "Failed";
                result.Message = ex.Message;
            }
            return(result);
        }
Ejemplo n.º 3
0
            public static OeeInfo GetOeeInfo(List<HourInfo> hours)
            {
                var result = new OeeInfo();

                if (hours.Count > 0)
                {
                    var oee = new OEE();
                    oee.ConstantQuality = 1;

                    foreach (var hour in hours)
                    {
                        oee.PlannedProductionTime += hour.PlannedProductionTime;
                        oee.OperatingTime += hour.OperatingTime;
                        oee.IdealOperatingTime += hour.IdealOperatingTime;
                        oee.TotalPieces += hour.TotalPieces;
                        oee.GoodPieces += hour.GoodPieces;
                    }

                    result.Oee = Math.Round(Math.Min(1, Math.Max(0, oee.Oee)), 4);
                    result.Availability = Math.Round(Math.Min(1, Math.Max(0, oee.Availability)), 4);
                    result.Performance = Math.Round(Math.Min(1, Math.Max(0, oee.Performance)), 4);
                    result.Quality = Math.Round(Math.Min(1, Math.Max(0, oee.Quality)), 4);
                    result.TotalPieces = oee.TotalPieces;
                    result.GoodPieces = oee.GoodPieces;
                }

                return result;
            }