示例#1
0
 protected override void Reset(ClassErrorHandle err)
 {
     AxisTransPNPX.ServoOn = true;
     AxisTransPNPX.SetZero();
     if (!PNPCylinder.SetCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
     {
         err.CollectErrInfo("气缸无法上移");
     }
     if (err.NoError)
     {
         AxisTransPNPX.HomeFinish        = true;
         AxisTransPNPX.NeedToCheckSafety = false;
         double speed = AxisTransPNPX.DefaultSpeed;
         AxisTransPNPX.DefaultSpeed = Math.Abs(AxisTransPNPX.JogSpeed);
         AxisTransPNPX.StepMove(-80);
         AxisTransPNPX.DefaultSpeed      = speed;
         AxisTransPNPX.NeedToCheckSafety = true;
         err.CollectErrInfo(AxisTransPNPX.Home(EnumPointPNPX.Unload.ToString()));
     }
     for (int i = 0; i < CELLCOUNT; i++)
     {
         TransLoadDataStations[i].CellData   = null;
         TransUnloadDataStations[i].CellData = null;
     }
 }
示例#2
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);
        }
示例#3
0
 protected override void Reset(ClassErrorHandle err)
 {
     AxisUnloadPNPY.ServoOn = true;
     AxisUnloadPNPY.SetZero();
     if (!PNPCylinder.SetCylinderState(CYLIND_UP, ClassErrorHandle.TIMEOUT))
     {
         err.CollectErrInfo("气缸无法上移");
     }
     if (err.NoError)
     {
         AxisUnloadPNPY.HomeFinish        = true;
         AxisUnloadPNPY.NeedToCheckSafety = false;
         double temp = AxisUnloadPNPY.DefaultSpeed;
         AxisUnloadPNPY.DefaultSpeed = Math.Abs(AxisUnloadPNPY.JogSpeed);
         AxisUnloadPNPY.StepMove(-30);
         AxisUnloadPNPY.DefaultSpeed      = temp;
         AxisUnloadPNPY.NeedToCheckSafety = true;
         err.CollectErrInfo(MotorReset(AxisUnloadPNPY, EnumPoint.Place));
     }
 }
        /// <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);
        }