Exemplo n.º 1
0
        public int Case1(List <MRPictureDTO> list, string ProductCalID, bool IsCheck)
        {
            if (IsCheck == false)
            {
                return(0);
            }
            int result = 0;

            if (list[0].x > list[0].XUpperLimit || list[0].x < list[0].XLowLimit)
            {
                //插入问题
                CalFault entity = new CalFault();
                entity.CalFaultID    = CommonHelper.GetGuid;
                entity.ProductCalID  = ProductCalID;
                entity.ProductCalDID = list[0].ProductCalDID;
                entity.FaultContent  = "一点落在控制限以外";
                entity.FaultFrom     = "X";
                entity.CreateDate    = DateTime.Now;
                entity.CreatrBy      = ManageProvider.Provider.Current().UserName;
                FaultRe.Insert(entity);
                result = -1;
            }
            //超过一个数据的话,判断MR数据
            if (list.Count > 1)
            {
                if (list[0].mr > list[0].RUpperLimit || list[0].x < list[0].RLowLimit)
                {
                    //插入问题
                    CalFault entity = new CalFault();
                    entity.CalFaultID    = CommonHelper.GetGuid;
                    entity.ProductCalID  = ProductCalID;
                    entity.ProductCalDID = list[0].ProductCalDID;
                    entity.FaultContent  = "一点落在控制限以外";
                    entity.FaultFrom     = "MR";
                    entity.CreateDate    = DateTime.Now;
                    entity.CreatrBy      = ManageProvider.Provider.Current().UserName;
                    FaultRe.Insert(entity);
                    result = -1;
                }
            }
            return(result);
        }
Exemplo n.º 2
0
        /// <summary>
        /// 连续8个点落在中心线两侧且无一在C区
        /// </summary>
        /// <param name="list"></param>
        /// <param name="ProductCalID"></param>
        /// <returns></returns>
        public int Case8(List <MRPictureDTO> list, string ProductCalID, bool IsCheck)
        {
            if (IsCheck == false)
            {
                return(0);
            }
            int     result      = 0;
            bool    isIn        = false;
            decimal XupAverage  = (list[0].XUpperLimit - list[0].XCenterLine) / 2;
            decimal XlowAverage = (list[0].XLowLimit - list[0].XCenterLine) / 2;


            decimal RupAverage  = (list[0].RUpperLimit - list[0].RCenterLine) / 2;
            decimal RlowAverage = (list[0].RLowLimit - list[0].RCenterLine) / 2;

            for (int i = 0; i < 8; i++)
            {
                if (list[i].x <XupAverage && list[i].x> XlowAverage)
                {
                    isIn = true;
                    break;
                }
            }
            if (isIn == false)
            {
                CalFault entity = new CalFault();
                entity.CalFaultID    = CommonHelper.GetGuid;
                entity.ProductCalID  = ProductCalID;
                entity.ProductCalDID = list[0].ProductCalDID;
                entity.FaultContent  = "连续8个点落在中心线两侧且无一在C区内";
                entity.FaultFrom     = "X";
                entity.CreateDate    = DateTime.Now;
                entity.CreatrBy      = ManageProvider.Provider.Current().UserName;
                FaultRe.Insert(entity);
                result = -8;
            }
            if (list.Count > 8)
            {
                isIn = false;
                for (int i = 0; i < 8; i++)
                {
                    if (list[i].mr <RupAverage && list[i].mr> RlowAverage)
                    {
                        isIn = true;
                        break;
                    }
                }
                if (isIn == false)
                {
                    CalFault entity = new CalFault();
                    entity.CalFaultID    = CommonHelper.GetGuid;
                    entity.ProductCalID  = ProductCalID;
                    entity.ProductCalDID = list[0].ProductCalDID;
                    entity.FaultContent  = "连续8个点落在中心线两侧且无一在C区内";
                    entity.FaultFrom     = "MR";
                    entity.CreateDate    = DateTime.Now;
                    entity.CreatrBy      = ManageProvider.Provider.Current().UserName;
                    FaultRe.Insert(entity);
                    result = -8;
                }
            }
            return(result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// 连续5个点中有4个点落在中心线同一侧的C区以外
        /// </summary>
        /// <param name="list"></param>
        /// <param name="ProductCalID"></param>
        /// <returns></returns>
        ///
        public int Case6(List <MRPictureDTO> list, string ProductCalID, bool IsCheck)
        {
            if (IsCheck == false)
            {
                return(0);
            }
            int     result      = 0;
            int     temp        = 0;
            decimal XupAverage  = (list[0].XUpperLimit - list[0].XCenterLine) / 2;
            decimal XlowAverage = (list[0].XLowLimit - list[0].XCenterLine) / 2;

            if (list[0].x > XupAverage)
            {
                temp = temp + 1;
            }
            if (list[1].x > XupAverage)
            {
                temp = temp + 1;
            }
            if (list[2].x > XupAverage)
            {
                temp = temp + 1;
            }
            if (list[3].x > XupAverage)
            {
                temp = temp + 1;
            }
            if (list[4].x > XupAverage)
            {
                temp = temp + 1;
            }
            if (temp >= 4)
            {
                CalFault entity = new CalFault();
                entity.CalFaultID    = CommonHelper.GetGuid;
                entity.ProductCalID  = ProductCalID;
                entity.ProductCalDID = list[0].ProductCalDID;
                entity.FaultContent  = "连续5个点中有4个点落在中心线上的C区以外";
                entity.FaultFrom     = "X";
                entity.CreateDate    = DateTime.Now;
                entity.CreatrBy      = ManageProvider.Provider.Current().UserName;
                FaultRe.Insert(entity);
                result = -6;
                temp   = 0;
            }
            if (list[0].x < XlowAverage)
            {
                temp = temp - 1;
            }
            if (list[1].x < XlowAverage)
            {
                temp = temp - 1;
            }
            if (list[2].x < XlowAverage)
            {
                temp = temp - 1;
            }
            if (list[3].x < XlowAverage)
            {
                temp = temp - 1;
            }
            if (list[4].x < XlowAverage)
            {
                temp = temp - 1;
            }
            if (temp <= -4)
            {
                CalFault entity = new CalFault();
                entity.CalFaultID    = CommonHelper.GetGuid;
                entity.ProductCalID  = ProductCalID;
                entity.ProductCalDID = list[0].ProductCalDID;
                entity.FaultContent  = "连续5个点中有4个点落在中心线下的C区以外";
                entity.FaultFrom     = "X";
                entity.CreateDate    = DateTime.Now;
                entity.CreatrBy      = ManageProvider.Provider.Current().UserName;
                FaultRe.Insert(entity);
                result = -6;
            }

            if (list.Count > 5)
            {
                temp = 0;
                decimal RupAverage  = (list[0].RUpperLimit - list[0].RCenterLine) / 2;
                decimal RlowAverage = (list[0].RLowLimit - list[0].RCenterLine) / 2;
                if (list[0].mr > RupAverage)
                {
                    temp = temp + 1;
                }
                if (list[1].mr > RupAverage)
                {
                    temp = temp + 1;
                }
                if (list[2].mr > RupAverage)
                {
                    temp = temp + 1;
                }
                if (list[3].mr > RupAverage)
                {
                    temp = temp + 1;
                }
                if (list[4].mr > RupAverage)
                {
                    temp = temp + 1;
                }
                if (temp >= 4)
                {
                    CalFault entity = new CalFault();
                    entity.CalFaultID    = CommonHelper.GetGuid;
                    entity.ProductCalID  = ProductCalID;
                    entity.ProductCalDID = list[0].ProductCalDID;
                    entity.FaultContent  = "连续5个点中有4个点落在中心线上的C区以外";
                    entity.FaultFrom     = "MR";
                    entity.CreateDate    = DateTime.Now;
                    entity.CreatrBy      = ManageProvider.Provider.Current().UserName;
                    FaultRe.Insert(entity);
                    result = -6;
                    temp   = 0;
                }
                if (list[0].mr < RupAverage)
                {
                    temp = temp - 1;
                }
                if (list[1].mr < RupAverage)
                {
                    temp = temp - 1;
                }
                if (list[2].mr < RupAverage)
                {
                    temp = temp - 1;
                }
                if (list[3].mr < RupAverage)
                {
                    temp = temp - 1;
                }
                if (list[4].mr < RupAverage)
                {
                    temp = temp - 1;
                }
                if (temp <= -4)
                {
                    CalFault entity = new CalFault();
                    entity.CalFaultID    = CommonHelper.GetGuid;
                    entity.ProductCalID  = ProductCalID;
                    entity.ProductCalDID = list[0].ProductCalDID;
                    entity.FaultContent  = "连续5个点中有4个点落在中心线下的C区以外";
                    entity.FaultFrom     = "MR";
                    entity.CreateDate    = DateTime.Now;
                    entity.CreatrBy      = ManageProvider.Provider.Current().UserName;
                    FaultRe.Insert(entity);
                    result = -6;
                }
            }
            return(result);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 判断连续14点是否交替上下
        /// </summary>
        /// <param name="list"></param>
        /// <param name="ProductCalID"></param>
        /// <returns></returns>
        public int Case4(List <MRPictureDTO> list, string ProductCalID, bool IsCheck)
        {
            if (IsCheck == false)
            {
                return(0);
            }
            int result = 0;
            //判断下一次判断是大于还是小于
            bool Next = true;

            if (list[0].x > list[1].x)
            {
                Next   = false;
                result = -4;
            }
            else if (list[0].x < list[1].x)
            {
                Next   = true;
                result = -4;
            }
            else
            {
                result = 0;
            }
            if (result == 0)
            {
            }
            else
            {
                for (int i = 1; i < 12; i++)
                {
                    if (Next == false)
                    {
                        if (list[i].x < list[i + 1].x)
                        {
                            Next = true;
                        }
                        else
                        {
                            result = 0;
                            break;
                        }
                    }
                    else
                    {
                        if (list[i].x > list[i + 1].x)
                        {
                            Next = false;
                        }
                        else
                        {
                            result = 0;
                            break;
                        }
                    }
                }
                if (result == -4)
                {
                    CalFault entity = new CalFault();
                    entity.CalFaultID    = CommonHelper.GetGuid;
                    entity.ProductCalID  = ProductCalID;
                    entity.ProductCalDID = list[0].ProductCalDID;
                    entity.FaultContent  = "连续14点交替上下";
                    entity.FaultFrom     = "X";
                    entity.CreateDate    = DateTime.Now;
                    entity.CreatrBy      = ManageProvider.Provider.Current().UserName;
                    FaultRe.Insert(entity);
                }
            }
            if (list.Count > 14)
            {
                //判断R
                if (list[0].mr > list[1].mr)
                {
                    Next   = false;
                    result = -4;
                }
                else if (list[0].mr < list[1].mr)
                {
                    Next   = true;
                    result = -4;
                }
                else
                {
                    result = 0;
                }
                if (result == 0)
                {
                }
                else
                {
                    for (int i = 1; i < 12; i++)
                    {
                        if (Next == false)
                        {
                            if (list[i].mr < list[i + 1].mr)
                            {
                                Next = true;
                            }
                            else
                            {
                                result = 0;
                                break;
                            }
                        }
                        else
                        {
                            if (list[i].mr > list[i + 1].mr)
                            {
                                Next = false;
                            }
                            else
                            {
                                result = 0;
                                break;
                            }
                        }
                    }
                    if (result == -4)
                    {
                        CalFault entity = new CalFault();
                        entity.CalFaultID    = CommonHelper.GetGuid;
                        entity.ProductCalID  = ProductCalID;
                        entity.ProductCalDID = list[0].ProductCalDID;
                        entity.FaultContent  = "连续14点交替上下";
                        entity.FaultFrom     = "MR";
                        entity.CreateDate    = DateTime.Now;
                        entity.CreatrBy      = ManageProvider.Provider.Current().UserName;
                        FaultRe.Insert(entity);
                    }
                }
            }


            return(result);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 连续6点递增或递减
        /// </summary>
        /// <param name="list"></param>
        /// <param name="ProductCalID"></param>
        /// <returns></returns>
        public int Case3(List <MRPictureDTO> list, string ProductCalID, bool IsCheck)
        {
            if (IsCheck == false)
            {
                return(0);
            }
            int result = 0;

            if (list[0].x < list[1].x && list[1].x < list[2].x && list[2].x < list[3].x && list[3].x < list[4].x && list[4].x < list[5].x)
            {
                CalFault entity = new CalFault();
                entity.CalFaultID    = CommonHelper.GetGuid;
                entity.ProductCalID  = ProductCalID;
                entity.ProductCalDID = list[0].ProductCalDID;
                entity.FaultContent  = "连续6点递减";
                entity.FaultFrom     = "X";
                entity.CreateDate    = DateTime.Now;
                entity.CreatrBy      = ManageProvider.Provider.Current().UserName;
                FaultRe.Insert(entity);
                result = -3;
            }
            if (list[0].x > list[1].x && list[1].x > list[2].x && list[2].x > list[3].x && list[3].x > list[4].x && list[4].x > list[5].x)
            {
                CalFault entity = new CalFault();
                entity.CalFaultID    = CommonHelper.GetGuid;
                entity.ProductCalID  = ProductCalID;
                entity.ProductCalDID = list[0].ProductCalDID;
                entity.FaultContent  = "连续6点递增";
                entity.FaultFrom     = "X";
                entity.CreateDate    = DateTime.Now;
                entity.CreatrBy      = ManageProvider.Provider.Current().UserName;
                FaultRe.Insert(entity);
                result = -3;
            }
            if (list.Count > 6)
            {
                if (list[0].mr < list[1].mr && list[1].mr < list[2].mr && list[2].mr < list[3].mr && list[3].mr < list[4].mr && list[4].mr < list[5].mr)
                {
                    CalFault entity = new CalFault();
                    entity.CalFaultID    = CommonHelper.GetGuid;
                    entity.ProductCalID  = ProductCalID;
                    entity.ProductCalDID = list[0].ProductCalDID;
                    entity.FaultContent  = "连续6点递增";
                    entity.FaultFrom     = "MR";
                    entity.CreateDate    = DateTime.Now;
                    entity.CreatrBy      = ManageProvider.Provider.Current().UserName;
                    FaultRe.Insert(entity);
                    result = -3;
                }
                if (list[0].mr > list[1].mr && list[1].mr > list[2].mr && list[2].mr > list[3].mr && list[3].mr > list[4].mr && list[4].mr > list[5].mr)
                {
                    CalFault entity = new CalFault();
                    entity.CalFaultID    = CommonHelper.GetGuid;
                    entity.ProductCalID  = ProductCalID;
                    entity.ProductCalDID = list[0].ProductCalDID;
                    entity.FaultContent  = "连续6点递增";
                    entity.FaultFrom     = "MR";
                    entity.CreateDate    = DateTime.Now;
                    entity.CreatrBy      = ManageProvider.Provider.Current().UserName;
                    FaultRe.Insert(entity);
                    result = -3;
                }
            }
            return(result);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 判断是否连续7点落在中心线的同一侧
        /// </summary>
        /// <param name="list"></param>
        /// <param name="ProductCalID"></param>
        /// <returns></returns>
        public int Case2(List <MRPictureDTO> list, string ProductCalID, bool IsCheck)
        {
            if (IsCheck == false)
            {
                return(0);
            }
            int result = 0;
            //1表示上侧-1表示下侧
            int AboveOrBelow = 0;

            if (list[0].x > list[0].XCenterLine)
            {
                AboveOrBelow = 1;
                for (int i = 1; i < 7; i++)
                {
                    if (list[i].x <= list[0].XCenterLine)
                    {
                        AboveOrBelow = 0;
                        break;
                    }
                    else
                    {
                        //AboveOrBelow = 1;
                    }
                }
                if (AboveOrBelow == 1)
                {
                    // 表示全部在中心线的上侧
                    CalFault entity = new CalFault();
                    entity.CalFaultID    = CommonHelper.GetGuid;
                    entity.ProductCalID  = ProductCalID;
                    entity.ProductCalDID = list[0].ProductCalDID;
                    entity.FaultContent  = "连续7点落在中心线的上侧";
                    entity.FaultFrom     = "X";
                    entity.CreateDate    = DateTime.Now;
                    entity.CreatrBy      = ManageProvider.Provider.Current().UserName;
                    FaultRe.Insert(entity);
                    result = -2;
                }
            }
            else if (list[0].x < list[0].XCenterLine)
            {
                AboveOrBelow = -1;
                for (int i = 1; i < 7; i++)
                {
                    if (list[i].x >= list[0].XCenterLine)
                    {
                        AboveOrBelow = 0;
                        break;
                    }
                    else
                    {
                    }
                }
                if (AboveOrBelow == -1)
                {
                    // 表示全部在中心线的上侧
                    CalFault entity = new CalFault();
                    entity.CalFaultID    = CommonHelper.GetGuid;
                    entity.ProductCalID  = ProductCalID;
                    entity.ProductCalDID = list[0].ProductCalDID;
                    entity.FaultContent  = "连续7点落在中心线的下侧";
                    entity.FaultFrom     = "X";
                    entity.CreateDate    = DateTime.Now;
                    entity.CreatrBy      = ManageProvider.Provider.Current().UserName;
                    FaultRe.Insert(entity);
                    result = -2;
                }
            }
            else
            {
            }
            if (list.Count >= 8)
            {
                if (list[0].mr > list[0].RCenterLine)
                {
                    AboveOrBelow = 1;
                    for (int i = 1; i < 7; i++)
                    {
                        if (list[i].mr <= list[0].RCenterLine)
                        {
                            AboveOrBelow = 0;
                            break;
                        }
                        else
                        {
                            // 表示全部在中心线的上侧
                        }
                    }
                    if (AboveOrBelow == 1)
                    {
                        CalFault entity = new CalFault();
                        entity.CalFaultID    = CommonHelper.GetGuid;
                        entity.ProductCalID  = ProductCalID;
                        entity.ProductCalDID = list[0].ProductCalDID;
                        entity.FaultContent  = "连续7点落在中心线的上侧";
                        entity.FaultFrom     = "MR";
                        entity.CreateDate    = DateTime.Now;
                        entity.CreatrBy      = ManageProvider.Provider.Current().UserName;
                        FaultRe.Insert(entity);
                        result = -2;
                    }
                }
                else if (list[0].mr < list[0].RCenterLine)
                {
                    AboveOrBelow = -1;
                    for (int i = 1; i < 7; i++)
                    {
                        if (list[i].mr >= list[0].RCenterLine)
                        {
                            AboveOrBelow = 0;
                            break;
                        }
                        else
                        {
                            // 表示全部在中心线的上侧
                        }
                    }
                    if (AboveOrBelow == -1)
                    {
                        CalFault entity = new CalFault();
                        entity.CalFaultID    = CommonHelper.GetGuid;
                        entity.ProductCalID  = ProductCalID;
                        entity.ProductCalDID = list[0].ProductCalDID;
                        entity.FaultContent  = "连续7点落在中心线的下侧";
                        entity.FaultFrom     = "MR";
                        entity.CreateDate    = DateTime.Now;
                        entity.CreatrBy      = ManageProvider.Provider.Current().UserName;
                        FaultRe.Insert(entity);
                        result = -2;
                    }
                }
                else
                {
                }
            }

            return(result);
        }