public LineStatistics GetStatisticsByLine(int lineId)
        {
            IntegramMESDataContext db = new IntegramMESDataContext();
            var statistic = db.IWS_SP_GetProductionCurrentStatistics().FirstOrDefault();

            if (lineId == 1)
            {
                return new LineStatistics
                {
                    FTT = (double)statistic.FirstRowFTT,
                    Performance = (int)statistic.FrontPerformance,
                    Production = (int)statistic.FirstRowProduction,
                    Repairs = (int)statistic.FirstRowRepairs,
                    RollingTarget = (int)statistic.FrontRollingTarget,
                    RollingTargetPercent = (int)statistic.RearRollingTargetPercent,
                    WAPProduction = (int)statistic.WAPProduction,
                    TotalShiftLoadsShipped = (int)statistic.TotalShiftLoadsShipped,
                    TotalLoadsShipped = (int)statistic.TotalLoadsShipped,
                    ShipBank = (int)statistic.ShipBank,
                    FrontCleanLoads = (int)statistic.FrontCleanLoads,
                    Inventory = statistic.FrontInventory,
                    RearCleanLoads = (int)statistic.RearCleanLoads,
                    AGVCount = statistic.FirstRowAgvCount,
                    AGVCountVariance = statistic.FirstRowAgvVariance,
                };
            }
            else if (lineId == 2)
            {
                return new LineStatistics
                {
                    FTT = (double)statistic.SecondRowFTT,
                    Performance = (int)statistic.RearPerformance,
                    Production = (int)statistic.SecondRowProduction,
                    Repairs = (int)statistic.SecondRowRepairs,
                    RollingTarget = (int)statistic.RearRollingTarget,
                    RollingTargetPercent = (int)statistic.RearRollingTargetPercent,
                    WAPProduction = (int)statistic.WAPProduction,
                    TotalShiftLoadsShipped = (int)statistic.TotalShiftLoadsShipped,
                    TotalLoadsShipped = (int)statistic.TotalLoadsShipped,
                    ShipBank = (int)statistic.ShipBank,
                    FrontCleanLoads = (int)statistic.FrontCleanLoads,
                    RearCleanLoads = (int)statistic.RearCleanLoads,
                    Inventory = statistic.RearInventory,
                    AGVCount = statistic.SecondRowAgvCount,
                    AGVCountVariance = statistic.SecondRowAgvVariance,
                };
            }
            else if (lineId == 3)
            {
                return new LineStatistics
                {
                    FTT = (double)statistic.ThirdRowFTT,
                    Performance = (int)statistic.RearPerformance,
                    Production = (int)statistic.ThirdRowProduction,
                    Repairs = (int)statistic.ThirdRowRepairs,
                    RollingTarget = (int)statistic.RearRollingTarget,
                    RollingTargetPercent = (int)statistic.RearRollingTargetPercent,
                    WAPProduction = (int)statistic.WAPProduction,
                    TotalShiftLoadsShipped = (int)statistic.TotalShiftLoadsShipped,
                    TotalLoadsShipped = (int)statistic.TotalLoadsShipped,
                    ShipBank = (int)statistic.ShipBank,
                    FrontCleanLoads = (int)statistic.FrontCleanLoads,
                    RearCleanLoads = (int)statistic.RearCleanLoads,
                    Inventory = statistic.RearInventory,
                    AGVCount = statistic.ThirdRowAgvCount,
                    AGVCountVariance = statistic.ThirdRowAgvVariance,
                };
            }

            return null;
        }
 public IWS_SP_GetProductionCurrentStatisticsResult GetCurrentStatistic()
 {
     IntegramMESDataContext db = new IntegramMESDataContext();
     var statistic = db.IWS_SP_GetProductionCurrentStatistics().FirstOrDefault();
     return statistic;
 }