Example #1
0
        /// <summary>
        /// PNP电机移到到指定位置
        /// </summary>
        /// <param name="action"></param>
        public ErrorInfoWithPause ActionMove(EnumPointPNPY action)
        {
            string             err = "";
            ErrorInfoWithPause res = null;

            while (true)
            {
                err = "";
                PNPCylinder[EnumCellIndex.左电芯].SetCylinderState(CYLIND_UP, 0, false);
                PNPCylinder[EnumCellIndex.中电芯].SetCylinderState(CYLIND_UP, 0, false);
                PNPCylinder[EnumCellIndex.右电芯].SetCylinderState(CYLIND_UP, 0, false);
                if (!PNPCylinder[EnumCellIndex.左电芯].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
                {
                    err += " 左气缸";
                }
                if (!PNPCylinder[EnumCellIndex.中电芯].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
                {
                    err += " 中气缸";
                }
                if (!PNPCylinder[EnumCellIndex.右电芯].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
                {
                    err += " 右气缸";
                }
                if (err != "")// return new ErrorInfoWithPause("NG挑选PNP气缸上移超时错:" + err, ErrorLevel.Alarm, false, true);
                {
                    res = WaitAlarmPause("NG挑选PNP移动", "NG挑选PNP气缸上移超时错: " + err);
                    if (res != null)
                    {
                        return(res);
                    }
                }
                else
                {
                    break;
                }
            }
            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Up)) //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Up);
            {
                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Up);
                if (res != null)
                {
                    return(res);
                }
            }
            while (!AxisSortingPNPY.MoveTo(action)) //return DispMotionError(AxisSortingPNPY, action);
            {
                res = DispMotionError(AxisSortingPNPY, action);
                if (res != null)
                {
                    return(res);
                }
            }
            return(null);
        }
Example #2
0
        public ErrorInfoWithPause ActionSortPNPStartPick(CallBackCommonFunc ActionSortPNPPick, CallBackCommonFunc AfterActionSortPNPPick)
        {
            ErrorInfoWithPause res = null;

            //PNP Z down
            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Pick, true, ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean - 1))
            //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Pick);
            {
                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Pick);
                if (res != null)
                {
                    return(res);
                }
            }
            //Start picking
            if (ActionSortPNPPick != null)
            {
                ActionSortPNPPick();
            }
            //PNP Z up
            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Up)) //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Up);
            {
                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Up);
                if (res != null)
                {
                    return(res);
                }
            }
            if (AfterActionSortPNPPick != null)
            {
                AfterActionSortPNPPick();
            }
            //Check vacuum
            System.Threading.Thread.Sleep(100);
            res = CheckVacuumStatus();
            return(res);
        }
Example #3
0
        public ErrorInfoWithPause ActionSortPNPStartPlaceNG(CallBackCommonFunc AfterActionSortPNPPlaceNG)
        {
            ErrorInfoWithPause res = null;

            //Check vacuum
            res = CheckVacuumStatus();
            if (res != null)
            {
                return(res);
            }
            bool NeedCylinderDown;

            //res = UpdateRow();
            //if (res != null) return res;
            if (ClassWorkFlow.Instance.UnloadMode != EnumUnloadMode.全NG)
            {
                for (int i = 0; i < CELLCOUNT; i++)
                {
                    if (CheckCellIsNG(SortNGDataStations[i].CellData))
                    {
                        if (IsUseBackNGBox)
                        {
                            if (SortNGDataStations[i].CellData.ThicknessNG)
                            {
                                CurrentNGBoxRow = (int)EnumPointPNPY.NGBox1;
                            }
                            else
                            {
                                CurrentNGBoxRow = (int)EnumPointPNPY.NGBox2;
                            }
                        }
                        else
                        {
                            if (SortNGDataStations[i].CellData.ThicknessNG)
                            {
                                CurrentNGBoxRow = (int)EnumPointPNPY.NGBox3;
                            }
                            else
                            {
                                CurrentNGBoxRow = (int)EnumPointPNPY.NGBox4;
                            }
                        }
                        NGBoxCellCount[CurrentNGBoxRow, i]++;
                        string NGData = SortNGDataStations[i].CellData.NGDataInfoString;
                        if (NGData != "")
                        {
                            NGBoxDataInfoString[CurrentNGBoxRow, i] += NGData + Environment.NewLine;
                        }
                        NeedCylinderDown = CheckIfNeedCylinder(NGBoxCellCount[CurrentNGBoxRow, i]);

                        //PNP Y move away
                        res = ActionMove((EnumPointPNPY)CurrentNGBoxRow);
                        if (res != null)
                        {
                            return(res);
                        }
                        if (NeedCylinderDown)
                        {
                            //PNP Z down
                            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Place, true, 1 + NGBoxCellCount[CurrentNGBoxRow, i] * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean))
                            //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                            {
                                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                                if (res != null)
                                {
                                    return(res);
                                }
                            }
                            //Cylinder down
                            while (!PNPCylinder[i].SetCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT))
                            //return new ErrorInfoWithPause("NG挑选PNP气缸下移超时错。", ErrorLevel.Error);
                            {
                                res = WaitAlarmPause("NG挑选PNP放料", "NG挑选PNP气缸下移超时错");
                                if (res != null)
                                {
                                    return(res);
                                }
                            }
                        }
                        else
                        {
                            //PNP Z down
                            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Place, true, -100 + 1 + GetMaxCount() * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean))
                            //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                            {
                                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                                if (res != null)
                                {
                                    return(res);
                                }
                            }
                        }
                        //Open blow
                        AirControl((EnumCellIndex)i, EnumAirControl.Blow);
                        //AirControl((EnumCellIndex)i, EnumAirControl.Close);
                        //Delay
                        TimeClass.Delay(400);
                        //Cylinder up
                        while (!PNPCylinder[i].SetCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
                        //return new ErrorInfoWithPause("NG挑选PNP气缸上移超时错。", ErrorLevel.Error);
                        {
                            res = WaitAlarmPause("NG挑选PNP放料", "NG挑选PNP气缸上移超时错");
                            if (res != null)
                            {
                                return(res);
                            }
                        }
                        //Close blow
                        AirControl((EnumCellIndex)i, EnumAirControl.Close);
                    }
                }
            }
            else
            {
                for (int i = 0; i < CELLCOUNT; i++)
                {
                    if (CheckCellIsNG(SortNGDataStations[i].CellData))
                    {
                        NGBoxCellCount[CurrentNGBoxRow, i]++;
                    }
                }
                NeedCylinderDown = CheckIfNeedCylinder(GetMaxCount());

                //PNP Y move away
                res = ActionMove((EnumPointPNPY)CurrentNGBoxRow);
                if (res != null)
                {
                    return(res);
                }
                if (NeedCylinderDown)
                {
                    //PNP Z down
                    while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Place, true, 1 + GetMaxCount() * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean))
                    //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                    {
                        res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                        if (res != null)
                        {
                            return(res);
                        }
                    }
                    //Cylinder down
                    PNPCylinder[0].SetCylinderState(CYLIND_DOWN, 0, false);
                    PNPCylinder[1].SetCylinderState(CYLIND_DOWN, 0, false);
                    PNPCylinder[2].SetCylinderState(CYLIND_DOWN, 0, false);
                    while (!PNPCylinder[0].WaitCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT) || !PNPCylinder[1].WaitCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT) || !PNPCylinder[2].WaitCylinderState(CYLIND_DOWN, ClassErrorHandle.TIMEOUT))
                    //return new ErrorInfoWithPause("NG挑选PNP气缸下移超时错。", ErrorLevel.Error);
                    {
                        res = WaitAlarmPause("NG挑选PNP放料", "NG挑选PNP气缸下移超时错");
                        if (res != null)
                        {
                            return(res);
                        }
                    }
                }
                else
                {
                    //PNP Z down
                    while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Place, true, -100 + 1 + GetMaxCount() * ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellThickness.Mean))
                    //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                    {
                        res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Place);
                        if (res != null)
                        {
                            return(res);
                        }
                    }
                }
                //Open blow
                AirControl(EnumAirControl.Blow, EnumAirControl.Blow, EnumAirControl.Blow);
                //AirControl(EnumAirControl.Close, EnumAirControl.Close, EnumAirControl.Close);
                //Delay
                TimeClass.Delay(400);
                //Cylinder up
                PNPCylinder[0].SetCylinderState(CYLIND_UP, 0, false);
                PNPCylinder[1].SetCylinderState(CYLIND_UP, 0, false);
                PNPCylinder[2].SetCylinderState(CYLIND_UP, 0, false);
                while (!PNPCylinder[0].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT) || !PNPCylinder[1].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT) || !PNPCylinder[2].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
                //return new ErrorInfoWithPause("NG挑选PNP气缸上移超时错。", ErrorLevel.Error);
                {
                    res = WaitAlarmPause("NG挑选PNP放料", "NG挑选PNP气缸上移超时错");
                    if (res != null)
                    {
                        return(res);
                    }
                }
                //Close blow
                AirControl(EnumAirControl.Close, EnumAirControl.Close, EnumAirControl.Close);
            }

            //PNP Z up
            while (!AxisSortingPNPZ.MoveTo(EnumPointPNPZ.Up)) //return DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Up);
            {
                res = DispMotionError(AxisSortingPNPZ, EnumPointPNPZ.Up);
                if (res != null)
                {
                    return(res);
                }
            }
            DoUpdateNGBox();
            //PNP Y move away
            while (!AxisSortingPNPY.MoveTo(EnumPointPNPY.Pick)) //return DispMotionError(AxisSortingPNPY, EnumPointPNPY.Pick);
            {
                res = DispMotionError(AxisSortingPNPY, EnumPointPNPZ.Pick);
                if (res != null)
                {
                    return(res);
                }
            }
            if (AfterActionSortPNPPlaceNG != null)
            {
                AfterActionSortPNPPlaceNG();
            }
            NGBoxFullErrorHandler(this.Name, "", ErrorDialogResult.OK);
            return(null);
        }