private ErrorInfoWithPause CheckNGSensor() { //waitHandle = false; string tempSensor = "", tempData = ""; while (true) { for (int i = 0; i < 3; i++) { System.Threading.Thread.Sleep(500); tempSensor = tempData = ""; if (ThisInport(EnumInportName.UnloadOutUnloadLeft).status&& UnloadOutDataStations[(int)EnumCellIndex.左电芯].CellData == null) { tempSensor += " " + EnumCellIndex.左电芯.ToString(); } else if (!ThisInport(EnumInportName.UnloadOutUnloadLeft).status&& UnloadOutDataStations[(int)EnumCellIndex.左电芯].CellData != null) { tempData += " " + EnumCellIndex.左电芯.ToString(); } if (ThisInport(EnumInportName.UnloadOutUnloadMid).status&& UnloadOutDataStations[(int)EnumCellIndex.中电芯].CellData == null) { tempSensor += " " + EnumCellIndex.中电芯.ToString(); } else if (!ThisInport(EnumInportName.UnloadOutUnloadMid).status&& UnloadOutDataStations[(int)EnumCellIndex.中电芯].CellData != null) { tempData += " " + EnumCellIndex.中电芯.ToString(); } if (ThisInport(EnumInportName.UnloadOutUnloadRight).status&& UnloadOutDataStations[(int)EnumCellIndex.右电芯].CellData == null) { tempSensor += " " + EnumCellIndex.右电芯.ToString(); } else if (!ThisInport(EnumInportName.UnloadOutUnloadRight).status&& UnloadOutDataStations[(int)EnumCellIndex.右电芯].CellData != null) { tempData += " " + EnumCellIndex.右电芯.ToString(); } if (tempSensor == "" && tempData == "") { break; } } if (tempSensor != "" || tempData != "") { if (tempSensor == "") { tempSensor = "无"; } if (tempData == "") { tempData = "无"; } ClassCommonSetting.ProgramLog(LogFile.Level.Warning, "WorkFlow", $"NG挑选处下料电芯与数据不符:{tempSensor}{tempData}"); Colibri.CommonModule.Forms.BaseForm.DoInvokeRequired(MainForm.instance, () => MessageBox.Show(MainForm.instance, $"NG挑选处下料电芯与数据不符。{Environment.NewLine}{Environment.NewLine}" + $"传感器检测到有电芯,但是程序没有数据记录:{tempSensor}。{Environment.NewLine}" + $"错误处理:取出不符的多余电芯。{Environment.NewLine}{Environment.NewLine}" + $"程序有数据记录,但是传感器没有检测到电芯:{tempData}。{Environment.NewLine}" + $"错误处理:如果是电芯位置不对,摆正或取走电芯;如果没有电芯则不用处理。点确定后数据将会被删除忽略掉。{Environment.NewLine}{Environment.NewLine}" + $"需要在流程恢复前清除不符电芯。处理完成后点确定。")); SetUnloadOut(); } else { break; } } return(null); }
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 ResetAsyncReturn(IAsyncResult result) { ClassCommonSetting.CallBackCommonAsyncReturn(result, "Reset"); }
private void UpdateNGBoxAsyncReturn(IAsyncResult result) { ClassCommonSetting.CallBackCommonAsyncReturn(result, "UpdateNGBox"); }
protected void WorkZoneActionAsyncReturn(IAsyncResult result) { ClassCommonSetting.CallBackCommonAsyncReturn(result, "WorkZoneAction"); }
/// <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); }
private void AfterPickAsyncReturn(IAsyncResult result) { ClassCommonSetting.CallBackCommonAsyncReturn(result, "TransPNPAfterPick"); }
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; } } }
private void CallBackAsyncReturn(IAsyncResult result) { ClassCommonSetting.CallBackCommonAsyncReturn(result, "AfterCCDMeas"); }