public IWS_SP_GetProductionStatisticsByDateAndShiftResult GetStatisticByDateAndShiftNum(DateTime shift, int shiftNum)
 {
     MESDataContext db = new MESDataContext();
     var statisticModel = db.IWS_SP_GetProductionStatisticsByDateAndShift(shift, shiftNum).FirstOrDefault();
     return statisticModel;
 }
        public dynamic GetStatisticsByLine(int id)
        {
            MESDataContext db = new MESDataContext();
            var statistic = db.IWS_SP_GetProductionCurrentStatistics().FirstOrDefault();

            #region Statistics Model By Line
            if (id == 1)
            {
                return new
                {
                    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 (id == 2)
            {
                return new
                {
                    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 (id == 3)
            {
                return new
                {
                    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,
                };
            }
            #endregion

            //wrong line id
            return null;
        }
 public IWS_SP_GetProductionCurrentStatisticsResult GetCurrentStatistics()
 {
     MESDataContext db = new MESDataContext();
     var statisticModel = db.IWS_SP_GetProductionCurrentStatistics().FirstOrDefault();
     return statisticModel;
 }
 public List<IWS_SP_GetTopOvercycleSummaryByLineIdResult> GetTopOvercycleSummaryByLineId(int id, int count)
 {
     MESDataContext db = new MESDataContext();
     var results = db.IWS_SP_GetTopOvercycleSummaryByLineId(id, count).ToList();
     return results;
 }
 public List<IWS_SP_GetCurrentOvercycleSummaryByLineIdResult> GetCurrentOvercycleSummaryByLineId(int id)
 {
     MESDataContext db = new MESDataContext();
     var results = db.IWS_SP_GetCurrentOvercycleSummaryByLineId(id).ToList();
     return results;
 }
 public List<IWS_SP_GetTopASRSPickTimesResult> GetTopASRSPickTimes(int count)
 {
     MESDataContext db = new MESDataContext();
     var pickTimes = db.IWS_SP_GetTopASRSPickTimes(count).ToList();
     return pickTimes;
 }
 public List<IWS_SP_GetTopDefectSummaryByLineIdResult> GetTopDefectSummaryByLineId(int id, int count)
 {
     MESDataContext db = new MESDataContext();
     var defects = db.IWS_SP_GetTopDefectSummaryByLineId(id, count).ToList();
     return defects;
 }