Exemplo n.º 1
0
        public static bool CheckErrPosTimeOut(Func <bool> action, int timeout = ClassErrorHandle.TIMEOUT)
        {
            bool      res;
            TimeClass timer = new TimeClass();

            timer.StartAlarmClock(timeout);
            do
            {
                res = action();
                Application.DoEvents();
            } while (!res && !timer.TimeOut);
            return(res);
        }
Exemplo n.º 2
0
        public ErrorInfoWithPause ActionRelease()
        {
            ErrorInfoWithPause res = null;

            //Z松开
            ThisOutport(EnumOutportName.TopAlignSoftCyLeft).SetOutput(false);
            ThisOutport(EnumOutportName.TopAlignSoftCyMid).SetOutput(false);
            ThisOutport(EnumOutportName.TopAlignSoftCyRight).SetOutput(false);
            while (!AxisTopAlignZClamp.MoveTo(EnumPointAlign.Release, false))
            //return DispMotionError(AxisTopAlignZClamp, EnumPointAlign.Release);
            {
                res = DispMotionError(AxisTopAlignZClamp, EnumPointAlign.Release);
                if (res != null)
                {
                    return(res);
                }
            }
            //顶部松开
            while (!AxisTopAlignTop.MoveTo(EnumPointAlign.Release, false))
            //return DispMotionError(AxisTopAlignTop, EnumPointAlign.Release);
            {
                res = DispMotionError(AxisTopAlignTop, EnumPointAlign.Release);
                if (res != null)
                {
                    return(res);
                }
            }
            //底部松开
            while (!AxisTopAlignBottom.MoveTo(EnumPointAlign.Release, false))
            //return DispMotionError(AxisTopAlignBottom, EnumPointAlign.Release);
            {
                res = DispMotionError(AxisTopAlignBottom, EnumPointAlign.Release);
                if (res != null)
                {
                    return(res);
                }
            }
            //侧松开
            while (!AxisTopAlignSide.MoveTo(EnumPointAlign.Release, false))
            //return DispMotionError(AxisTopAlignSide, EnumPointAlign.Release);
            {
                res = DispMotionError(AxisTopAlignSide, EnumPointAlign.Release);
                if (res != null)
                {
                    return(res);
                }
            }
            TimeClass time = new TimeClass();

            time.StartAlarmClock(ClassErrorHandle.TIMEOUT);
            while (!ThisInport(EnumInportName.TopAlignSoftCySensLeft).status ||
                   !ThisInport(EnumInportName.TopAlignSoftCySensMid).status ||
                   !ThisInport(EnumInportName.TopAlignSoftCySensRight).status)
            {
                System.Threading.Thread.Sleep(1);
                if (time.TimeOut)
                //return new ErrorInfoWithPause("柔性气缸不动作。", ErrorLevel.Error);
                {
                    res = WaitAlarmPause("顶封边定位", "柔性气缸不动作");
                    if (res != null)
                    {
                        return(res);
                    }
                    time.StartAlarmClock(ClassErrorHandle.TIMEOUT);
                }
            }
            time.StopAlarmClock();
            //X走位
            AxisTopAlignZClamp.WaitStop(ClassErrorHandle.TIMEOUT);
            while (!AxisTopAlignXSide.MoveTo(EnumPointX.Idle, false, offset[0]))
            //return DispMotionError(AxisTopAlignXSide, EnumPointX.Idle);
            {
                res = DispMotionError(AxisTopAlignXSide, EnumPointX.Idle);
                if (res != null)
                {
                    return(res);
                }
            }
            //AxisTopAlignTop.WaitStop(ClassErrorInfo.TIMEOUT);
            //AxisTopAlignBottom.WaitStop(ClassErrorInfo.TIMEOUT);
            //AxisTopAlignSide.WaitStop(ClassErrorInfo.TIMEOUT);
            for (int i = 0; i < CELLCOUNT; i++)
            {
                TopAlignCellVacuums[i].SetOutPortStatus(false);
            }
            return(null);
        }