public ErrorInfoWithPause CheckLoadin() { ErrorInfoWithPause res = null; if (ClassWorkFlow.Instance.WorkMode != EnumWorkMode.空跑) { if (ThisInport(EnumInportName.LoadInConvInPosRight).status || LoadInDataStations[0].CellData != null) { ClassCommonSetting.CheckTimeOut(() => { res = CheckLoadSensor(); return(res == null); }); } } //for (int i = 0; i < 50; i++) //{ // System.Windows.Forms.Application.DoEvents(); // res = CheckLoadSensor(); // if (res != null) // { // System.Threading.Thread.Sleep(20); // } // else // break; //} return(res); }
public ErrorInfoWithPause CheckVacuumStatus() { bool left = SortNGDataStations[EnumCellIndex.左电芯].CellData != null; bool middle = SortNGDataStations[EnumCellIndex.中电芯].CellData != null; bool right = SortNGDataStations[EnumCellIndex.右电芯].CellData != null; string res = ""; res = ClassCommonSetting.CheckTimeOut(() => { string vac = ""; if (left) { vac += CheckVacuumStatus(EnumCellIndex.左电芯); } if (middle) { vac += CheckVacuumStatus(EnumCellIndex.中电芯); } if (right) { vac += CheckVacuumStatus(EnumCellIndex.右电芯); } return(vac); }); if (res != "") { return(new ErrorInfoWithPause("NG挑选PNP真空错误:" + res, ErrorLevel.Alarm, true)); } else { return(null); } }
public ErrorInfoWithPause MeasPicture(bool isStandard, string path = "") { ErrorInfoWithPause res = null; MeasDone[3] = false; ClassCommonSetting.SocketToAOI.SendCommandMeas(isStandard, path); if (!ClassCommonSetting.CheckTimeOut(() => { return(MeasDone[3]); })) { res = new ErrorInfoWithPause("图像检测超时错。", ErrorLevel.Alarm); } return(res); }
private bool AxisLoadPNPY_CheckSafety(bool IsHome, double TargetPos, ref string ErrorStr) { CAxisBase AxisLoadPNPY = zones.WorkZone上料机械手.AxisLoadPNPY; CAxisBase AxisLoadPNPZ = zones.WorkZone上料机械手.AxisLoadPNPZ; CAxisBase AxisTransPNPX = zones.WorkZone传送机械手.AxisTransPNPX; if (!IsHome) { if (!CheckMotorStatus(AxisLoadPNPY, AxisLoadPNPZ)) { return(false); } if (!CheckMotorStatus(AxisLoadPNPY, AxisTransPNPX)) { return(false); } if (!CheckMotorStatus(AxisLoadPNPY, AxisLoadPNPY)) { return(false); } if (IgnoreSmallStep(AxisLoadPNPY, TargetPos)) { return(true); } } //Z position is lower than Idle point. if (!ClassCommonSetting.CheckTimeOut(() => GreaterThanPosition(AxisLoadPNPZ, ClassZone上料机械手.EnumPointZ.Idle, -5))) { ErrorStr = "上料PNPZ电机低于Idle位置5mm。"; ShowMotorError(AxisLoadPNPY, ErrorStr); return(false); } //Cylinders are not at up position. if (!zones.WorkZone上料机械手.ThisInport(ClassZone上料机械手.EnumInportName.LoadPNPCyLeftUp).status || !zones.WorkZone上料机械手.ThisInport(ClassZone上料机械手.EnumInportName.LoadPNPCyMidUp).status || !zones.WorkZone上料机械手.ThisInport(ClassZone上料机械手.EnumInportName.LoadPNPCyRightUp).status) { ErrorStr = "上料PNP有气缸不在上位。"; ShowMotorError(AxisLoadPNPY, ErrorStr); return(false); } //Move to place point but TransPNP is at block position. if (GreaterThanPosition(AxisLoadPNPY, TargetPos, ClassZone上料机械手.EnumPointY.SafeLimit, 0) && !ClassCommonSetting.CheckTimeOut(() => GreaterThanPosition(AxisTransPNPX, ClassZone传送机械手.EnumPointPNPX.SafeLimit, 0))) { ErrorStr = "传送PNP位置阻挡上料PNPY移到Place位置。"; ShowMotorError(AxisLoadPNPY, ErrorStr); return(false); } return(true); }
public ErrorInfoWithPause SnapShot(int index, string barcode, string path = "") { ErrorInfoWithPause res = null; _camTrigFinish[index] = false; MeasDone[index] = false; BufferDatas[index] = CCDMeasDataStations[index].CellData; ClassCommonSetting.SocketToAOI.SendCommandCamTrig(index + 1, barcode, path); if (!ClassCommonSetting.CheckTimeOut(() => { return(_camTrigFinish[index]); })) { res = new ErrorInfoWithPause("抓取图像超时错。", ErrorLevel.Error); } return(res); }
public string CheckVacuumStatus() { bool loadleft = TransLoadDataStations[EnumCellIndex.左电芯].CellData != null; bool loadmiddle = TransLoadDataStations[EnumCellIndex.中电芯].CellData != null; bool loadright = TransLoadDataStations[EnumCellIndex.右电芯].CellData != null; bool unloadleft = TransUnloadDataStations[EnumCellIndex.左电芯].CellData != null; bool unloadmiddle = TransUnloadDataStations[EnumCellIndex.中电芯].CellData != null; bool unloadright = TransUnloadDataStations[EnumCellIndex.右电芯].CellData != null; string res = ""; res = ClassCommonSetting.CheckTimeOut(() => { string vac = ""; if (loadleft) { vac += CheckLoadVacuumStatus(EnumCellIndex.左电芯); } if (loadmiddle) { vac += CheckLoadVacuumStatus(EnumCellIndex.中电芯); } if (loadright) { vac += CheckLoadVacuumStatus(EnumCellIndex.右电芯); } if (unloadleft) { vac += CheckUnloadVacuumStatus(EnumCellIndex.左电芯); } if (unloadmiddle) { vac += CheckUnloadVacuumStatus(EnumCellIndex.中电芯); } if (unloadright) { vac += CheckUnloadVacuumStatus(EnumCellIndex.右电芯); } return(vac); }); if (res != "") { return("传送PNP真空错误:" + res); } else { return(""); } }
private bool AxisSortingPNPY_CheckSafety(bool IsHome, double TargetPos, ref string ErrorStr) { CAxisBase AxisSortingPNPY = zones.WorkZoneNG挑选机械手.AxisSortingPNPY; CAxisBase AxisSortingPNPZ = zones.WorkZoneNG挑选机械手.AxisSortingPNPZ; if (!IsHome) { if (!CheckMotorStatus(AxisSortingPNPY, AxisSortingPNPZ)) { return(false); } if (!CheckMotorStatus(AxisSortingPNPY, AxisSortingPNPY)) { return(false); } if (IgnoreSmallStep(AxisSortingPNPY, TargetPos)) { return(true); } } //Z position is lower than Up point. if (!ClassCommonSetting.CheckTimeOut(() => GreaterThanPosition(AxisSortingPNPZ, ClassZoneNG挑选机械手.EnumPointPNPZ.Up, -5))) { ErrorStr = "NG挑选PNPZ电机低于Up位置5mm。"; ShowMotorError(AxisSortingPNPY, ErrorStr); return(false); } //Cylinders are not at up position. if (!zones.WorkZoneNG挑选机械手.ThisInport(ClassZoneNG挑选机械手.EnumInportName.SortingPNPCyLeftUp).status || !zones.WorkZoneNG挑选机械手.ThisInport(ClassZoneNG挑选机械手.EnumInportName.SortingPNPCyMidUp).status || !zones.WorkZoneNG挑选机械手.ThisInport(ClassZoneNG挑选机械手.EnumInportName.SortingPNPCyRightUp).status) { ErrorStr = "NG挑选PNP气缸不在上位。"; ShowMotorError(AxisSortingPNPY, ErrorStr); return(false); } return(true); }
private bool AxisTransPNPX_CheckSafety(bool IsHome, double TargetPos, ref string ErrorStr) { CAxisBase AxisTransPNPX = zones.WorkZone传送机械手.AxisTransPNPX; CAxisBase AxisLoadPNPY = zones.WorkZone上料机械手.AxisLoadPNPY; //CAxisBase AxisUnloadPNPY = zones.WorkZone下料机械手.AxisUnloadPNPY; if (!IsHome) { if (!CheckMotorStatus(AxisTransPNPX, AxisTransPNPX)) { return(false); } if (!CheckMotorStatus(AxisTransPNPX, AxisLoadPNPY)) { return(false); } //if (!CheckMotorStatus(AxisTransPNPX, AxisUnloadPNPY)) return false; if (IgnoreSmallStep(AxisTransPNPX, TargetPos)) { return(true); } } //传送PNP气缸不在上位 if (!zones.WorkZone传送机械手.ThisInport(ClassZone传送机械手.EnumInportName.TransPNPCyUp).status) { System.Threading.Thread.Sleep(100); if (!zones.WorkZone传送机械手.ThisInport(ClassZone传送机械手.EnumInportName.TransPNPCyUp).status) { ErrorStr = "传送PNP气缸不在上位。"; ShowMotorError(AxisTransPNPX, ErrorStr); return(false); } } //上料时上料PNP在Place位置 if (LessThanPosition(AxisTransPNPX, TargetPos, ClassZone传送机械手.EnumPointPNPX.SafeLimit, 0) && !ClassCommonSetting.CheckTimeOut(() => LessThanPosition(AxisLoadPNPY, ClassZone上料机械手.EnumPointY.SafeLimit, 0))) { ErrorStr = "上料PNPY阻挡传送PNPX移到Load位置。"; ShowMotorError(AxisTransPNPX, ErrorStr); return(false); } ////下料时下料PNP在Pick位置 //if (!GreaterThanPosition(AxisTransPNPX, TargetPos, ClassZone传送机械手.EnumPointPNPX.Unload, -15) && // GreaterThanPosition(AxisUnloadPNPY, ClassZone下料机械手.EnumPoint.Pick, -15)) //{ // ShowMotorError(AxisTransPNPX, "下料PNPY阻挡传送PNPX移到Unload位置。"); // return false; //} return(true); }
private bool AxisUnloadOutConveyor_CheckSafety(bool IsHome, double TargetPos, ref string ErrorStr) { CAxisBase AxisUnloadOutConveyor = zones.WorkZone下料传送.AxisUnloadOutConveyor; CAxisBase AxisSortingPNPZ = zones.WorkZoneNG挑选机械手.AxisSortingPNPZ; CAxisBase AxisSortingPNPY = zones.WorkZoneNG挑选机械手.AxisSortingPNPY; CAxisBase AxisUnloadPNPY = zones.WorkZone下料机械手.AxisUnloadPNPY; if (!IsHome) { if (!CheckMotorStatus(AxisUnloadOutConveyor, AxisUnloadPNPY)) { return(false); } if (!CheckMotorStatus(AxisUnloadOutConveyor, AxisSortingPNPZ)) { return(false); } if (!CheckMotorStatus(AxisUnloadOutConveyor, AxisSortingPNPY)) { return(false); } if (!CheckMotorStatus(AxisUnloadOutConveyor, AxisUnloadOutConveyor)) { return(false); } if (IgnoreSmallStep(AxisUnloadOutConveyor, TargetPos)) { return(true); } } //Sorting PNP Y is at pick position and Z position is lower than Up point. if (InPositionRange(AxisSortingPNPY, ClassZoneNG挑选机械手.EnumPointPNPY.Pick) && !ClassCommonSetting.CheckTimeOut(() => GreaterThanPosition(AxisSortingPNPZ, ClassZoneNG挑选机械手.EnumPointPNPZ.Up, -5))) { ErrorStr = "NG挑选PNP在Pick位置,但是Z电机低于Up位置5mm。"; ShowMotorError(AxisUnloadOutConveyor, ErrorStr); return(false); } //Unload PNP Y is at place position and cylinder is not at up position. if (InPositionRange(AxisUnloadPNPY, ClassZone下料机械手.EnumPoint.Place) && !zones.WorkZone下料机械手.ThisInport(ClassZone下料机械手.EnumInportName.UnloadPNPCyUp).status) { ErrorStr = "下料PNP气缸不在上位。"; ShowMotorError(AxisUnloadOutConveyor, ErrorStr); return(false); } ////Unload position has part //if (zones.WorkZone下料传送.ThisInport(ClassZone下料传送.EnumInportName.UnloadOutUnload).status) //{ // ErrorStr = "右边下料传感器检测有物料。"; // ShowMotorError(AxisUnloadOutConveyor, ErrorStr); // return false; //} return(true); }
private bool AxisLoadInConveyor_CheckSafety(bool IsHome, double TargetPos, ref string ErrorStr) { CAxisBase AxisLoadInConveyor = zones.WorkZone上料传送.AxisLoadInConveyor; CAxisBase AxisLoadPNPZ = zones.WorkZone上料机械手.AxisLoadPNPZ; CAxisBase AxisLoadPNPY = zones.WorkZone上料机械手.AxisLoadPNPY; if (!IsHome) { if (!CheckMotorStatus(AxisLoadInConveyor, AxisLoadPNPZ)) { return(false); } if (!CheckMotorStatus(AxisLoadInConveyor, AxisLoadPNPY)) { return(false); } if (!CheckMotorStatus(AxisLoadInConveyor, AxisLoadInConveyor)) { return(false); } if (IgnoreSmallStep(AxisLoadInConveyor, TargetPos)) { return(true); } } //Load PNP Y is at Pick point and Z position is lower than Idle point. if (InPositionRange(AxisLoadPNPY, ClassZone上料机械手.EnumPointY.Pick, 0, 15) && !ClassCommonSetting.CheckTimeOut(() => GreaterThanPosition(AxisLoadPNPZ, ClassZone上料机械手.EnumPointZ.Idle, -5))) { ErrorStr = "上料PNP位于Pick位置,但是Z电机低于Idle位置5mm。"; ShowMotorError(AxisLoadInConveyor, ErrorStr); return(false); } if (TargetPos > AxisLoadInConveyor.CurrentPosition) { //InPosition has part if (ClassWorkFlow.Instance.WorkMode != EnumWorkMode.空跑 && zones.WorkZone上料传送.ThisInport(ClassZone上料传送.EnumInportName.LoadInConvInPosRight).status) { ErrorStr = "右边到位传感器检测有物料。"; ShowMotorError(AxisLoadInConveyor, ErrorStr); return(false); } } return(true); }
private void ErrorReturnHandler(string source, string message, ErrorDialogResult result) { if (!owner.IsRunning) { return; } if (result == ErrorDialogResult.OK || result == ErrorDialogResult.Retry) { ClassZone下料机械手 UnloadZone = ClassWorkZones.Instance.WorkZone下料机械手; if (message != "") { ClassBaseWorkZone.HandleVacuumFailCell("下料机械手", UnloadZone.UnloadPNPDataStations.ToArray()); for (int i = 0; i < ClassBaseWorkZone.CELLCOUNT; i++) { ClassWorkZones.Instance.WorkZone尺寸测量.CCDMeasDataStations[i].TransferFrom(ClassWorkZones.Instance.WorkZone下料机械手.UnloadPNPDataStations[i]); } } res = UnloadZone.ActionUnloadPNPStartPick(ClassWorkZones.Instance.DoLoadOutPNPPick, ClassWorkZones.Instance.AfterLoadOutPNPPick); if (res == null) { //while (!UnloadZone.AxisUnloadPNPY.MoveTo(ClassZone下料机械手.EnumPoint.Place, false)) //{ // if (UnloadZone.DispMotionError(UnloadZone.AxisUnloadPNPY, ClassZone下料机械手.EnumPoint.Place) != null) // return; //} ///////同步调用测量工作区域X电机回到GetPart位置 res = ClassWorkZones.Instance.WorkZone尺寸测量.ActionToGetPart(false); if (res != null) { ClassErrorHandle.ShowError(source, res); return; } ///////异步调用测量工作区域X电机回到GetPart位置 //ClassWorkZones.Instance.WorkZone尺寸测量.AsyncActionMotorMove(ClassWorkZones.Instance.WorkZone尺寸测量.AxisOutlineMeasX, // ClassZone尺寸测量.EnumPointX.GetPart); res = UnloadZone.ActionMove(ClassZone下料机械手.EnumPoint.Place, false); if (res != null) { ClassErrorHandle.ShowError(source, res); return; } if (ClassWorkFlow.Instance.WorkMode != EnumWorkMode.空跑) { #region CCD All finish if (!ClassCommonSetting.CheckTimeOut(() => { return(ClassWorkZones.Instance.WorkZone尺寸测量.isCCDAllFinish); })) { string cell = ""; for (int i = 0; i < ClassBaseWorkZone.CELLCOUNT; i++) { if (!ClassWorkZones.Instance.WorkZone尺寸测量.MeasDone[i]) { cell += " " + ((EnumCellIndex)i).ToString(); } } ClassErrorHandle.ShowError(source, "图像检测数据没有全部返回:" + cell, ErrorLevel.Notice); } #endregion CCD All finish } ClassErrorHandle.CheckAlarmListStatus(source, oldres); DoneReturn("UnloadPNPPickFinish"); if (_afterMeasCallBack != null) { _afterMeasCallBack.BeginInvoke(CallBackAsyncReturn, _afterMeasCallBack); } //ClassWorkZones.Instance.WorkZone尺寸测量.AxisOutlineMeasX.WaitStop(ClassErrorHandle.TIMEOUT); ClassWorkZones.Instance.WorkZone尺寸测量.IsWorkFree = true; DoneReturn("CCDMotorBackToGetPart"); } else { ClassErrorHandle.ShowError(source, res, ErrorReturnHandler); oldres = res; } } }