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

            while (true)
            {
                temp = "";
                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))
                {
                    temp = " 左气缸";
                }
                if (!PNPCylinder[EnumCellIndex.中电芯].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
                {
                    temp = " 中气缸";
                }
                if (!PNPCylinder[EnumCellIndex.右电芯].WaitCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
                {
                    temp = " 右气缸";
                }
                if (temp != "") //return new ErrorInfoWithPause("气缸上移超时错:" + temp, ErrorLevel.Error);
                {
                    res = WaitAlarmPause("上料PNP移动", "气缸上移超时错: " + temp);
                    if (res != null)
                    {
                        return(res);
                    }
                }
                else
                {
                    break;
                }
            }
            while (!AxisLoadPNPZ.MoveTo(EnumPointZ.Idle))
            //return DispMotionError(AxisLoadPNPZ, EnumPointZ.Idle);
            {
                res = DispMotionError(AxisLoadPNPZ, EnumPointZ.Idle);
                if (res != null)
                {
                    return(res);
                }
            }
            while (!AxisLoadPNPY.MoveTo(action))
            //return DispMotionError(AxisLoadPNPY, action);
            {
                res = DispMotionError(AxisLoadPNPY, action);
                if (res != null)
                {
                    return(res);
                }
            }
            return(null);
        }
示例#2
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);
        }
示例#3
0
        public ErrorInfoWithPause ActionLoad()
        {
            ErrorInfoWithPause res = null;

            while (!AxisThicknessMeasY.MoveTo(EnumPointX.Meas))
            //return DispMotionError(AxisThicknessMeasY, EnumPointX.Meas);
            {
                res = DispMotionError(AxisThicknessMeasY, EnumPointX.Meas);
                if (res != null)
                {
                    return(res);
                }
            }
            return(AllCyDown());
        }
示例#4
0
        public ErrorInfoWithPause ActionMove(EnumPointPNPX point, bool NeedWait = true)
        {
            ErrorInfoWithPause res = null;

            //气缸上移
            while (!PNPCylinder.SetCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
            //return new ErrorInfoWithPause("传送机械手气缸上移超时错。", ErrorLevel.Error);
            {
                res = WaitAlarmPause("传送PNP移动", "传送机械手气缸上移超时错");
                if (res != null)
                {
                    return(res);
                }
            }
            //电机移动
            if (!MotorSafetyCheck.InPositionRange(AxisTransPNPX, point, 0, 0.005))
            {
                while (!AxisTransPNPX.MoveTo(point, NeedWait))
                //return DispMotionError(AxisTransPNPX, point);
                {
                    res = DispMotionError(AxisTransPNPX, point);
                    if (res != null)
                    {
                        return(res);
                    }
                }
            }
            return(null);
        }
示例#5
0
        public ErrorInfoWithPause ActionStartShift(CallBackCommonFunc AfterUnloadOutShift)
        {
            ErrorInfoWithPause res = null;

            AxisUnloadOutConveyor.SetZero();
            while (!AxisUnloadOutConveyor.MoveTo(EnumPoint.Shift))
            //return DispMotionError(AxisUnloadOutConveyor, "移到NG取料位");
            {
                res = DispMotionError(AxisUnloadOutConveyor, "移到NG取料位");
                if (res != null)
                {
                    return(res);
                }
            }
            if (AfterUnloadOutShift != null)
            {
                AfterUnloadOutShift();
            }
            CheckNGSensor();
            return(null);
        }
示例#6
0
        public ErrorInfoWithPause ActionMotorMove(CAxisBase axis, object point, bool NeedWait = true)
        {
            ErrorInfoWithPause res = null;

            while (!axis.MoveTo(point, NeedWait))
            //return DispMotionError(AxisOutlineMeasX, EnumPointX.GetPart);
            {
                res = DispMotionError(axis, point);
                if (res != null)
                {
                    return(res);
                }
            }
            return(null);
        }
        public ErrorInfoWithPause ActionToGetPart(bool NeedWait = true)
        {
            ErrorInfoWithPause res = null;

            while (!AxisOutlineMeasX.MoveTo(EnumPointX.GetPart, NeedWait))
            //return DispMotionError(AxisOutlineMeasX, EnumPointX.GetPart);
            {
                res = DispMotionError(AxisOutlineMeasX, EnumPointX.GetPart);
                if (res != null)
                {
                    return(res);
                }
            }
            return(null);
        }
示例#8
0
        /// <summary>
        /// PNP电机移到到指定位置
        /// </summary>
        /// <param name="action"></param>
        public ErrorInfoWithPause ActionMove(EnumPoint action, bool NeedWait = true)
        {
            ErrorInfoWithPause res;

            if (!PNPCylinder.SetCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
            {
                return(new ErrorInfoWithPause("下料PNP气缸上移超时错。", ErrorLevel.Error));
            }
            while (!AxisUnloadPNPY.MoveTo(action, NeedWait))
            //return DispMotionError(AxisUnloadPNPY, action);
            {
                res = DispMotionError(AxisUnloadPNPY, action);
                if (res != null)
                {
                    return(res);
                }
            }
            return(null);
        }
        /// <summary>
        /// 开始传送准备。
        /// 开始的条件是SMEMA的ready信号为true,并且InPos传感器没有检测到物料。
        /// 传送带运行,
        /// SMEMA avaliable为false。
        /// </summary>
        /// <returns>返回执行结果。成功返回空字符。</returns>
        public ErrorInfoWithPause ActionStartLoad(CallBackCommonFunc AfterActionLoadNew)
        {
            ErrorInfoWithPause res = null;
            string             barcodeReadRes;

            ////Go back to align the new cell.
            AxisLoadInConveyor.SetZero();
            bool   havenewpart = ClassWorkFlow.Instance.WorkMode != EnumWorkMode.空跑;// && ThisInport(EnumInportName.LoadInConvLoad).status;
            double offsetTemp  = 0;

            if (ClassWorkFlow.Instance.LoadMode == EnumLoadMode.自动)
            {
                offsetTemp  = ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellWidth.Mean - ClassCommonSetting.SysParam.Products[CALIBPROD].CellDataSpec.CellWidth.Mean;
                offsetTemp /= 2;
                offsetTemp += ThisAxis(EnumAxisName.LoadInConveyor).PointList[EnumPointConveyor.BackDistance].Position;
                while (!ThisAxis(EnumAxisName.LoadInConveyor).MoveTo(offsetTemp))
                //return DispMotionError(AxisLoadInConveyor, "回移");
                {
                    res = DispMotionError(AxisLoadInConveyor, "回移");
                    if (res != null)
                    {
                        return(res);
                    }
                }
            }
            if ((havenewpart || ClassWorkFlow.Instance.WorkMode == EnumWorkMode.空跑) && ClassWorkFlow.Instance.FeedNewPart)
            {
                LoadInDataStations[LoadInDataStations.Length - 1].CellData = ClassDataInfo.NewCellData(++ClassWorkFlow.Instance.GetCell);
            }
            else
            {
                LoadInDataStations[LoadInDataStations.Length - 1].CellData = null;
            }
            //Go to next pitch position and start scan barcode
            AxisLoadInConveyor.SetZero();
            while (!AxisLoadInConveyor.MoveTo(EnumPointConveyor.CellPitch, true, -offsetTemp))
            //return DispMotionError(AxisLoadInConveyor, "进料移动");
            {
                res = DispMotionError(AxisLoadInConveyor, "进料移动");
                if (res != null)
                {
                    return(res);
                }
            }
            ////If PNP can pick
            //if (ThisInport(EnumInportName.LoadInConvInPos).status)
            //{
            //    NotifyDoneEvent(EnumEventName.NewCellLoad);
            //}
            if (LoadInDataStations[LoadInDataStations.Length - 1].CellData != null)
            {
                havenewpart &= BarcodeEnabled;
                if (ClassWorkFlow.Instance.LoadMode == EnumLoadMode.自动)
                {
                    barcodeReadRes = StartBarcodeScan(havenewpart);
                }
                else
                {
                    do
                    {
                        barcodeReadRes = StartBarcodeScan(havenewpart);
                        if (barcodeReadRes != "")
                        {
                            BaseForm.DoInvokeRequired(MainForm.instance,
                                                      () =>
                            {
                                while (MessageBox.Show(MainForm.instance, $"条码枪扫码出错: {barcodeReadRes}。{Environment.NewLine}请检查电芯位置是否正确或者是否有电芯。{Environment.NewLine}" +
                                                       "点“重试”重新扫条码。如果无电芯或需要移除电芯,则点“取消”放弃扫码。",
                                                       "条码枪扫码", MessageBoxButtons.RetryCancel, MessageBoxIcon.Information) == DialogResult.Cancel)
                                {
                                    if (MessageBox.Show(MainForm.instance, "确定要取消并移除电芯?", "取消电芯", MessageBoxButtons.YesNo) == DialogResult.Yes)
                                    {
                                        LoadInDataStations[LoadInDataStations.Length - 1].CellData = null;
                                        break;
                                    }
                                }
                            });
                        }
                    } while (LoadInDataStations[LoadInDataStations.Length - 1].CellData != null && barcodeReadRes != "");
                }
                if (LoadInDataStations[LoadInDataStations.Length - 1].CellData != null)
                {
                    ClassCommonSetting.ProgramLog(LogFile.Level.Notice, this.Name, "加载新物料,索引号" + ClassWorkFlow.Instance.GetCell.ToString() + " NG结果为" + (LoadInDataStations[LoadInDataStations.Length - 1].CellData.LoadNG ? "NG" : "OK"));
                }
            }
            if (AfterActionLoadNew != null)
            {
                AfterActionLoadNew();
            }
            return(null);
        }
示例#10
0
        public ErrorInfoWithPause ActionAlign()
        {
            ErrorInfoWithPause res = null;

            ThisOutport(EnumOutportName.TopAlignSoftCyLeft).SetOutput(true);
            ThisOutport(EnumOutportName.TopAlignSoftCyMid).SetOutput(true);
            ThisOutport(EnumOutportName.TopAlignSoftCyRight).SetOutput(true);
            //侧定位
            double offsetTemp = 0;
            double mainlenprod, mainlencali;

            offsetTemp  = ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellWidth.Mean - ClassCommonSetting.SysParam.Products[CALIBPROD].CellDataSpec.CellWidth.Mean;
            offsetTemp /= 2;
            while (!AxisTopAlignSide.MoveTo(EnumPointAlign.Clamp, false, -offsetTemp))
            //return DispMotionError(AxisTopAlignSide, EnumPointAlign.Clamp);
            {
                res = DispMotionError(AxisTopAlignSide, EnumPointAlign.Clamp);
                if (res != null)
                {
                    return(res);
                }
            }
            //底部定位
            mainlenprod = ClassCommonSetting.SysParam.CurrentProductParam.CellDataSpec.CellLength.Mean - ClassCommonSetting.SysParam.CurrentProductParam.TopSealHeight;
            mainlencali = ClassCommonSetting.SysParam.Products[CALIBPROD].CellDataSpec.CellLength.Mean - ClassCommonSetting.SysParam.Products[CALIBPROD].TopSealHeight;
            offsetTemp  = -1 * (mainlenprod - mainlencali);
            while (!AxisTopAlignBottom.MoveTo(EnumPointAlign.Clamp, false, offsetTemp))
            //return DispMotionError(AxisTopAlignBottom, EnumPointAlign.Clamp);
            {
                res = DispMotionError(AxisTopAlignBottom, EnumPointAlign.Clamp);
                if (res != null)
                {
                    return(res);
                }
            }
            //Z松开
            while (!AxisTopAlignZClamp.MoveTo(EnumPointAlign.Release, false))
            //return DispMotionError(AxisTopAlignZClamp, EnumPointAlign.Release);
            {
                res = DispMotionError(AxisTopAlignZClamp, EnumPointAlign.Release);
                if (res != null)
                {
                    return(res);
                }
            }
            //顶部定位
            if (!(ClassWorkFlow.Instance.IsGRR || ClassCommonSetting.SysParam.CurrentProductParam.ClampDisable))
            {
                while (!AxisTopAlignTop.MoveTo(EnumPointAlign.Clamp))
                //return DispMotionError(AxisTopAlignTop, EnumPointAlign.Clamp);
                {
                    res = DispMotionError(AxisTopAlignTop, EnumPointAlign.Clamp);
                    if (res != null)
                    {
                        return(res);
                    }
                }
            }
            //X走位
            while (!AxisTopAlignXSide.MoveTo(EnumPointX.Idle, true, offset[0]))
            //return DispMotionError(AxisTopAlignXSide, EnumPointX.Idle);
            {
                res = DispMotionError(AxisTopAlignXSide, EnumPointX.Idle);
                if (res != null)
                {
                    return(res);
                }
            }
            //double zoffset = 0;
            //if (ClassCommonSetting.SysParam.CurrentProductParam.BackSideUp)
            //    zoffset = ClassCommonSetting.SysParam.CurrentProductParam.TopHeight;
            //if (!AxisTopAlignZClamp.MoveTo(EnumPointAlign.Clamp, true, zoffset - 1))
            //    return DispMotionError(AxisTopAlignZClamp, EnumPointAlign.Clamp);
            AxisTopAlignBottom.WaitStop(ClassErrorHandle.TIMEOUT);
            if (ClassWorkFlow.Instance.WorkMode != EnumWorkMode.空跑)
            {
                for (int i = 0; i < CELLCOUNT; i++)
                {
                    if (TopAlignDataStations[i].CellData != null)
                    {
                        TopAlignCellVacuums[i].SetOutPortStatus(true);
                    }
                }
            }
            //Check vacuum
            //ErrorInfoWithPause temp;
            //temp = CheckVacuumStatus();
            //if (temp != null) return temp;
            return(null);
        }