private void buttonMeasOnce_Click(object sender, EventArgs e) { if (MotorSafetyCheck.InPositionRange(zone.AxisOutlineMeasX, ClassZone尺寸测量.EnumPointX.Start, ClassDataInfo.CELLPITCH * (int)EnumCellIndex.右电芯)) { cellindex = EnumCellIndex.右电芯; } else if (MotorSafetyCheck.InPositionRange(zone.AxisOutlineMeasX, ClassZone尺寸测量.EnumPointX.Start, ClassDataInfo.CELLPITCH * (int)EnumCellIndex.中电芯)) { cellindex = EnumCellIndex.中电芯; } else if (MotorSafetyCheck.InPositionRange(zone.AxisOutlineMeasX, ClassZone尺寸测量.EnumPointX.Start, ClassDataInfo.CELLPITCH * (int)EnumCellIndex.左电芯)) { cellindex = EnumCellIndex.左电芯; } else { MessageBox.Show("尺寸测量需要先将指定工位移到相机下方。请先将要测量的工位移动到相机下方。"); return; } if (zone.CCDMeasDataStations[cellindex].CellData == null) { zone.CCDMeasDataStations[cellindex].CellData = ClassDataInfo.NewCellData(); //zone.CCDMeasDataStations[cellindex].CellData.Barcode = "TEST"; } DoAction(sender, () => { ErrorInfoWithPause res = zone.ActionOneCCDMeas(cellindex, DataComp.AddAll); while (!zone.isCCDAllFinish) { Thread.Sleep(1); } zone.CCDMeasDataStations[cellindex].CellData = zone.BufferDatas[(int)cellindex]; return(res); }); }
public ErrorInfoWithPause ActionCylinderTest() { ErrorInfoWithPause res = null; isCylinderTest = !isCylinderTest; for (int i = 0; i < CELLCOUNT; i++) { if (ThicknessDataStations[i].CellData == null) { ThicknessDataStations[i].CellData = ClassDataInfo.NewCellData(); } } while (isCylinderTest) { res = AllCyDown(); if (res != null) { isCylinderTest = false; break; } if (!isCylinderTest) { break; } TimeClass.Delay(ClassCommonSetting.SysParam.ThicknessMeasDelayTime); if (!isCylinderTest) { break; } res = AllCyUp(); if (res != null) { isCylinderTest = false; break; } if (!isCylinderTest) { break; } TimeClass.Delay(ClassCommonSetting.SysParam.ThicknessMeasDelayTime); if (!isCylinderTest) { break; } } return(res); }
private void buttonManualNew_Click(object sender, EventArgs e) { if (DataStation.CellData != null) { if (MessageBox.Show("确定要删除电芯数据吗?点“是”确定删除,点“否”取消。", "删除电芯数据", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { return; } else { DataStation.CellData = null; RefreshData(); } } else if (textBoxCellIndex.ReadOnly) { textBoxCellIndex.ReadOnly = false; textBoxCellIndex.BackColor = SystemColors.Control; textBoxCellIndex.Text = "-1"; textBoxCellIndex.SelectAll(); textBoxCellIndex.Focus(); MessageBox.Show("输入索引号,然后再点一下新增数据按钮。"); } else { int index; if (int.TryParse(textBoxCellIndex.Text.Trim(), out index)) { textBoxCellIndex.ReadOnly = true; textBoxCellIndex.BackColor = Color.YellowGreen; DataStation.CellData = ClassDataInfo.NewCellData(index); //RefreshData(); } else if (MessageBox.Show("索引号格式不对。点重试输入正确的索引号,或者点取消不新增数据。", "索引号错误", MessageBoxButtons.RetryCancel, MessageBoxIcon.Error) == DialogResult.Cancel) { textBoxCellIndex.ReadOnly = true; textBoxCellIndex.BackColor = Color.YellowGreen; if (DataStation.CellData != null) { textBoxCellIndex.Text = DataStation.CellData.Index.ToString(); } } } }
public override void ZoneInit() { base.ZoneInit(); AssignHardware(typeof(EnumAxisName), typeof(EnumInportName), typeof(EnumOutportName), typeof(EnumSerialPortName)); AxisOutlineMeasX = ThisAxis(EnumAxisName.OutlineMeasX); AxisOutlineMeasX.AddPoints(typeof(EnumPointX)); CellVacuums[EnumCellIndex.左电芯].Port = ThisOutport(EnumOutportName.OutlineMeasVacLeft); CellVacuums[EnumCellIndex.中电芯].Port = ThisOutport(EnumOutportName.OutlineMeasVacMid); CellVacuums[EnumCellIndex.右电芯].Port = ThisOutport(EnumOutportName.OutlineMeasVacRight); CellBlow.Port = ThisOutport(EnumOutportName.OutlineMeasBlow); CellVacSensor[EnumCellIndex.左电芯].Port = ThisInport(EnumInportName.OutlineMeasVacSensLeft); CellVacSensor[EnumCellIndex.中电芯].Port = ThisInport(EnumInportName.OutlineMeasVacSensMid); CellVacSensor[EnumCellIndex.右电芯].Port = ThisInport(EnumInportName.OutlineMeasVacSensRight); ZoneSettingPanel = new SettingPanelZone尺寸测量(); ZoneManualPanel = new ManualPanelZone尺寸测量(); for (int i = 0; i <= CELLCOUNT; i++) { MeasDone[i] = true; } BufferDatas[CELLCOUNT] = ClassDataInfo.NewCellData(); }
private void buttonStartMeasCali_Click(object sender, EventArgs e) { int index; string temp = ""; switch (comboBoxStdType.Text) { case "大": temp = "Big"; break; case "中": temp = "Middle"; break; case "小": temp = "Small"; break; } labelStatus.Text = ""; if (!CheckOption()) { return; } EnumCellIndex stdindex = (EnumCellIndex)Enum.Parse(typeof(EnumCellIndex), comboBoxStdPosition.Text); bool res = false; if (!optionBoxFromFile.Checked) { ClassCommonSetting.SocketToAOI.SendCommandCamLive(false); index = (int)stdindex; zone.CCDMeasDataStations[stdindex].CellData = ClassDataInfo.NewCellData(); zone.CCDMeasDataStations[stdindex].CellData.Barcode = ClassCommonSetting.SysParam.CurrentProductParam.UseGauge + temp + "Standard"; zone.MeasDone[(int)stdindex] = false; zone.BufferDatas[(int)stdindex] = zone.CCDMeasDataStations[(int)stdindex].CellData; zone.CellVacuums[stdindex].SetOutPortStatus(true); TimeClass.Delay(500); res = DoAction(sender, () => { return(zone.ActionOneCCDMeas(stdindex, DataComp.AddComp)); }) == null; if (!res) { return; } while (!zone.MeasDone[(int)stdindex]) { Application.DoEvents(); } } else { index = 3; res = DoAction(sender, () => { return(zone.MeasPicture(true)); }) == null; } if (res) { DataRow newrow = DT.NewRow(); newrow[colType] = comboBoxStdType.Text; ////Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.CellWidth, ref zone.BufferDatas[index].Data.CellWidth, StdErr, selectBoxYEnable.Checked); Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.CellLength, ref zone.BufferDatas[index].Data.CellLength, StdErr, true); ////Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.AlTabDistance, ref zone.BufferDatas[index].Data.AlTabDistance, StdErr, selectBoxYEnable.Checked); ////Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.NiTabDistance, ref zone.BufferDatas[index].Data.NiTabDistance, StdErr, selectBoxYEnable.Checked); Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.AlTabLength, ref zone.BufferDatas[index].Data.AlTabLength, StdErr, true); Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.NiTabLength, ref zone.BufferDatas[index].Data.NiTabLength, StdErr, true); ////Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.TabDistance, ref zone.BufferDatas[index].Data.TabDistance, StdErr, selectBoxYEnable.Checked); ////Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.AlSealantHeight, ref zone.BufferDatas[index].Data.AlSealantHeight, StdErr, selectBoxXEnable.Checked); ////Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.NiSealantHeight, ref zone.BufferDatas[index].Data.NiSealantHeight, StdErr, selectBoxXEnable.Checked); ////Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.ShoulderWidth, ref zone.BufferDatas[index].Data.ShoulderWidth, StdErr, selectBoxYEnable.Checked); newrow[colCellWidth] = zone.BufferDatas[index].Data.CellWidth.Value.ToString("0.000"); newrow[colCellLength] = zone.BufferDatas[index].Data.CellLength.Value.ToString("0.000"); newrow[colAlTabDist] = zone.BufferDatas[index].Data.AlTabDistance.Value.ToString("0.000"); newrow[colNiTabDist] = zone.BufferDatas[index].Data.NiTabDistance.Value.ToString("0.000"); newrow[colAlTabLen] = zone.BufferDatas[index].Data.AlTabLength.Value.ToString("0.000"); newrow[colNiTabLen] = zone.BufferDatas[index].Data.NiTabLength.Value.ToString("0.000"); newrow[colTabDist] = zone.BufferDatas[index].Data.TabDistance.Value.ToString("0.000"); newrow[colAlSealantHi] = zone.BufferDatas[index].Data.AlSealantHeight.Value.ToString("0.000"); newrow[colNiSealantHi] = zone.BufferDatas[index].Data.NiSealantHeight.Value.ToString("0.000"); newrow[colShoulderWidth] = zone.BufferDatas[index].Data.ShoulderWidth.Value.ToString("0.000"); DT.Rows.Add(newrow); if (!Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.CellWidth, ref zone.BufferDatas[index].Data.CellWidth, StdErr)) { dataGridView1.Rows[DT.Rows.Count - 1].Cells[colCellWidth.Caption].Style.BackColor = Color.Red; dataGridView1.Rows[DT.Rows.Count - 1].Cells[colCellWidth.Caption].Style.ForeColor = Color.Yellow; } if (!Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.CellLength, ref zone.BufferDatas[index].Data.CellLength, StdErr)) { dataGridView1.Rows[DT.Rows.Count - 1].Cells[colCellLength.Caption].Style.BackColor = Color.Red; dataGridView1.Rows[DT.Rows.Count - 1].Cells[colCellLength.Caption].Style.ForeColor = Color.Yellow; } if (!Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.AlTabDistance, ref zone.BufferDatas[index].Data.AlTabDistance, StdErr)) { dataGridView1.Rows[DT.Rows.Count - 1].Cells[colAlTabDist.Caption].Style.BackColor = Color.Red; dataGridView1.Rows[DT.Rows.Count - 1].Cells[colAlTabDist.Caption].Style.ForeColor = Color.Yellow; } if (!Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.NiTabDistance, ref zone.BufferDatas[index].Data.NiTabDistance, StdErr)) { dataGridView1.Rows[DT.Rows.Count - 1].Cells[colNiTabDist.Caption].Style.BackColor = Color.Red; dataGridView1.Rows[DT.Rows.Count - 1].Cells[colNiTabDist.Caption].Style.ForeColor = Color.Yellow; } if (!Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.AlTabLength, ref zone.BufferDatas[index].Data.AlTabLength, StdErr)) { dataGridView1.Rows[DT.Rows.Count - 1].Cells[colAlTabLen.Caption].Style.BackColor = Color.Red; dataGridView1.Rows[DT.Rows.Count - 1].Cells[colAlTabLen.Caption].Style.ForeColor = Color.Yellow; } if (!Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.NiTabLength, ref zone.BufferDatas[index].Data.NiTabLength, StdErr)) { dataGridView1.Rows[DT.Rows.Count - 1].Cells[colNiTabLen.Caption].Style.BackColor = Color.Red; dataGridView1.Rows[DT.Rows.Count - 1].Cells[colNiTabLen.Caption].Style.ForeColor = Color.Yellow; } if (!Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.TabDistance, ref zone.BufferDatas[index].Data.TabDistance, StdErr)) { dataGridView1.Rows[DT.Rows.Count - 1].Cells[colTabDist.Caption].Style.BackColor = Color.Red; dataGridView1.Rows[DT.Rows.Count - 1].Cells[colTabDist.Caption].Style.ForeColor = Color.Yellow; } if (!Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.AlSealantHeight, ref zone.BufferDatas[index].Data.AlSealantHeight, StdErr)) { dataGridView1.Rows[DT.Rows.Count - 1].Cells[colAlSealantHi.Caption].Style.BackColor = Color.Red; dataGridView1.Rows[DT.Rows.Count - 1].Cells[colAlSealantHi.Caption].Style.ForeColor = Color.Yellow; } if (!Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.NiSealantHeight, ref zone.BufferDatas[index].Data.NiSealantHeight, StdErr)) { dataGridView1.Rows[DT.Rows.Count - 1].Cells[colNiSealantHi.Caption].Style.BackColor = Color.Red; dataGridView1.Rows[DT.Rows.Count - 1].Cells[colNiSealantHi.Caption].Style.ForeColor = Color.Yellow; } if (!Cst.Struct_DataInfo.CheckData(comboBoxStdType.Text, _ProdCellDataSpec.ShoulderWidth, ref zone.BufferDatas[index].Data.ShoulderWidth, StdErr)) { dataGridView1.Rows[DT.Rows.Count - 1].Cells[colShoulderWidth.Caption].Style.BackColor = Color.Red; dataGridView1.Rows[DT.Rows.Count - 1].Cells[colShoulderWidth.Caption].Style.ForeColor = Color.Yellow; } } //zone.CCDMeasDataStations[stdindex].CellData = null; //zone.CellVacuums[stdindex].SetOutPortStatus(false); }
private void buttonLoadCell_Click(object sender, EventArgs e) { bool temp; EnumCellIndex index = EnumCellIndex.右电芯; buttonRelease_Click(sender, e); if (MessageBox.Show("确认顶峰,测厚和CCD测量工位上没有其他电芯或标准块。确认后点\"确定\"按钮。取消则点\"取消\"按钮。", "", MessageBoxButtons.OKCancel, MessageBoxIcon.Information) == DialogResult.Cancel) { return; } MessageBox.Show("将物料放置在顶封工位" + index.ToString() + "的位置。放置好后点击\"确定\"按钮进行加载。"); for (int i = 0; i < ClassBaseWorkZone.CELLCOUNT; i++) { ClassWorkZones.Instance.WorkZone顶封边定位.TopAlignDataStations[i].CellData = null; ClassWorkZones.Instance.WorkZone厚度测量.ThicknessDataStations[i].CellData = null; } ClassWorkZones.Instance.WorkZone顶封边定位.TopAlignDataStations[index].CellData = ClassDataInfo.NewCellData(); //CCD移动到放料位 if (DoAction(sender, () => { return(zone.ActionToGetPart(false)); }) != null) { return; } //顶封位定位 if (DoAction(sender, ClassWorkZones.Instance.WorkZone顶封边定位.ActionAlign) != null) { return; } //顶封位放开 if (DoAction(sender, ClassWorkZones.Instance.WorkZone顶封边定位.ActionRelease) != null) { return; } zone.AxisOutlineMeasX.WaitStop(ClassErrorHandle.TIMEOUT); //传送机械手从顶封位取料 if (DoAction(sender, () => { return(ClassWorkZones.Instance.WorkZone传送机械手.ActionStartLoad(out temp, ClassWorkZones.Instance.DoTransPNPLoad, ClassWorkZones.Instance.AfterTransPNPLoad)); }) != null) { return; } //传送机械手放料到测厚位 if (DoAction(sender, () => { return(ClassWorkZones.Instance.WorkZone传送机械手.ActionStartUnload(ClassWorkZones.Instance.DoTransPNPUnload, ClassWorkZones.Instance.AfterTransPNPUnload)); }) != null) { return; } //传送机械手从测厚位取料 if (DoAction(sender, () => { return(ClassWorkZones.Instance.WorkZone传送机械手.ActionStartLoad(out temp, ClassWorkZones.Instance.DoTransPNPLoad, ClassWorkZones.Instance.AfterTransPNPLoad)); }) != null) { return; } //传送机械手放料到CCD测量位 if (DoAction(sender, () => { return(ClassWorkZones.Instance.WorkZone传送机械手.ActionStartUnload(ClassWorkZones.Instance.DoTransPNPUnload, ClassWorkZones.Instance.AfterTransPNPUnload)); }) != null) { return; } //CCD放物料工位移动到检测位 if (DoAction(sender, () => { return(zone.ActionToMeasPos(index)); }) != null) { return; } MessageBox.Show("物料加载完毕。"); }
/// <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); }
public ErrorInfoWithPause ActionCylinderTest() { ErrorInfoWithPause res = null; isCylinderTest = !isCylinderTest; for (int i = 0; i < CELLCOUNT; i++) { if (TopAlignDataStations[i].CellData == null) { TopAlignDataStations[i].CellData = ClassDataInfo.NewCellData(); } } double zoffset = 0; if (ClassCommonSetting.SysParam.CurrentProductParam.BackSideUp) { zoffset = ClassCommonSetting.SysParam.CurrentProductParam.TopHeight; } if (!AxisTopAlignZClamp.MoveTo(EnumPointAlign.Clamp, true, zoffset)) { while (!AxisTopAlignZClamp.MoveTo(EnumPointAlign.Clamp)) //return DispMotionError(AxisTopAlignZClamp, EnumPointAlign.Clamp); { res = DispMotionError(AxisTopAlignZClamp, EnumPointAlign.Clamp); if (res != null) { return(res); } } } while (isCylinderTest) { res = AllCyDown(); if (res != null) { isCylinderTest = false; break; } if (!isCylinderTest) { break; } TimeClass.Delay(ClassCommonSetting.SysParam.ThicknessMeasDelayTime); if (!isCylinderTest) { break; } res = AllCyUp(); if (res != null) { isCylinderTest = false; break; } if (!isCylinderTest) { break; } TimeClass.Delay(ClassCommonSetting.SysParam.ThicknessMeasDelayTime); if (!isCylinderTest) { break; } } while (!AxisTopAlignZClamp.MoveTo(EnumPointAlign.Release)) //return DispMotionError(AxisTopAlignZClamp, EnumPointAlign.Release); { res = DispMotionError(AxisTopAlignZClamp, EnumPointAlign.Release); if (res != null) { return(res); } } return(res); }