Exemple #1
0
        public string CheckVacuumStatus(EnumCellIndex CellIndex)
        {
            if (ClassWorkFlow.Instance.WorkMode == EnumWorkMode.空跑)
            {
                return("");
            }
            bool   status = CellVacSensor[CellIndex].GetInPortStatus();
            string res    = "";

            switch (CellIndex)
            {
            case EnumCellIndex.左电芯:
                res += status ? "" : " 左真空";
                break;

            case EnumCellIndex.中电芯:
                res += status ? "" : " 中真空";
                break;

            case EnumCellIndex.右电芯:
                res += status ? "" : " 右真空";
                break;
            }
            SortNGDataStations[CellIndex].CellData.isPickingError = !status;
            return(res);
        }
Exemple #2
0
        private void SetUnitStatus(EnumCellIndex CellIndex, EnumAirControl status)
        {
            switch (status)
            {
            case EnumAirControl.Blow:
                CellVacuums[CellIndex].MainPort.SetOutPortStatus(false);
                CellBlow.SetOutPortStatus(true);
                for (int i = 0; i < ClassAirUnit.VACCOUNT; i++)
                {
                    CellVacuums[CellIndex].AirPorts[i].SetOutPortStatus(true);
                }
                break;

            case EnumAirControl.Close:
                CellVacuums[CellIndex].MainPort.SetOutPortStatus(false);
                for (int i = 0; i < ClassAirUnit.VACCOUNT; i++)
                {
                    CellVacuums[CellIndex].AirPorts[i].SetOutPortStatus(false);
                }
                break;

            case EnumAirControl.Vacuum:
                CellVacuums[CellIndex].MainPort.SetOutPortStatus(true);
                for (int i = 0; i < ClassAirUnit.VACCOUNT; i++)
                {
                    CellVacuums[CellIndex].AirPorts[i].SetOutPortStatus(CellVacuums[CellIndex].AirPorts[i].PortEnable);
                }
                break;
            }
        }
 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);
     });
 }
Exemple #4
0
 private void AsyncStartSerialReading(EnumCellIndex index, HardwareSerialProtocolName protocol, DataComp NeedComp)
 {
     if (_serialReading != null)
     {
         _serialReading.BeginInvoke(index, protocol, NeedComp, SerialReadingAsyncReturn, _serialReading);
     }
 }
Exemple #5
0
        private void buttonLoadStd_Click(object sender, EventArgs e)
        {
            if (!CheckOption())
            {
                return;
            }
            EnumCellIndex index = (EnumCellIndex)Enum.Parse(typeof(EnumCellIndex), comboBoxStdPosition.Text);

            zone.ActionToMeasPos(index);
        }
Exemple #6
0
        private void buttonOpen_Click(object sender, EventArgs e)
        {
            if (!CheckOption())
            {
                return;
            }
            EnumCellIndex index = (EnumCellIndex)Enum.Parse(typeof(EnumCellIndex), comboBoxStdPosition.Text);

            zone.CellVacuums[index].SetOutPortStatus(true);
            zone.CellBlow.SetOutPortStatus(false);
        }
Exemple #7
0
 public void AirControl(EnumCellIndex CellIndex, EnumAirControl status)
 {
     if (ClassWorkFlow.Instance.WorkMode == EnumWorkMode.空跑)
     {
         return;
     }
     if (status == EnumAirControl.None)
     {
         return;
     }
     SetUnitStatus(CellIndex, status);
 }
Exemple #8
0
 public void AirControl(EnumCellIndex CellIndex, EnumAirControl status)
 {
     if (ClassWorkFlow.Instance.WorkMode == EnumWorkMode.空跑)
     {
         return;
     }
     if (status == EnumAirControl.None)
     {
         return;
     }
     CellVacuums[CellIndex].SetUnitStatus(status == EnumAirControl.Vacuum);
     CellBlow[CellIndex].SetOutPortStatus(status == EnumAirControl.Blow);
 }
Exemple #9
0
        private void GetData(EnumCellIndex index, string Data, DataComp NeedComp)
        {
            double temp;

            ClassCommonSetting.ProgramLog(LogFile.Level.Info, "测厚", $"{index}测厚GetData得到的数据:{Data}");
            if (!double.TryParse(Data.Replace("?", ""), out temp))
            {
                ClassCommonSetting.ProgramLog(LogFile.Level.Info, "测厚", "GetData得到的数据转换为double失败,数据没有处理");
                return;
            }
            ThicknessDataStations[index].CellData.Data.CellThickness.Value = temp;// double.Parse(Data.Replace("?", ""));
            if (NeedComp != DataComp.NoComp && ClassCommonSetting.SysParam.CurrentUsedGauge != null)
            {
                double reference = 0;
                double slope = 0, intercept = 0;
                bool   enable = false;
                switch (index)
                {
                case EnumCellIndex.中电芯:
                    reference = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessMeasRefMid;
                    slope     = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessMidLinear.Slope;
                    intercept = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessMidLinear.Intercept;
                    enable    = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessMidLinear.Enable;
                    break;

                case EnumCellIndex.右电芯:
                    reference = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessMeasRefRight;
                    slope     = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessRightLinear.Slope;
                    intercept = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessRightLinear.Intercept;
                    enable    = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessRightLinear.Enable;
                    break;

                case EnumCellIndex.左电芯:
                    reference = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessMeasRefLeft;
                    slope     = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessLeftLinear.Slope;
                    intercept = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessLeftLinear.Intercept;
                    enable    = ClassCommonSetting.SysParam.CurrentUsedGauge.ThicknessLeftLinear.Enable;
                    break;
                }
                if ((NeedComp & DataComp.AddRef) != DataComp.NoComp)
                {
                    ThicknessDataStations[index].CellData.Data.CellThickness.Value = reference - ThicknessDataStations[index].CellData.Data.CellThickness.Value;
                }
                if ((NeedComp & DataComp.AddComp) != DataComp.NoComp && enable)
                {
                    ThicknessDataStations[index].CellData.Data.CellThickness.Value = ThicknessDataStations[index].CellData.Data.CellThickness.Value * slope + intercept;
                }
            }
            ClassCommonSetting.ProgramLog(LogFile.Level.Info, "测厚", $"获取原始数据{temp},最终数据{ThicknessDataStations[index].CellData.Data.CellThickness.Value:0.000}");
            ThicknessDataStations[index].Refresh();
        }
        public ErrorInfoWithPause ActionToMeasPos(EnumCellIndex cell)
        {
            ErrorInfoWithPause res = null;

            while (!AxisOutlineMeasX.MoveTo(EnumPointX.Start, true, ClassDataInfo.CELLPITCH * (int)cell))
            //return DispMotionError(AxisOutlineMeasX, cell);
            {
                res = DispMotionError(AxisOutlineMeasX, cell);
                if (res != null)
                {
                    return(res);
                }
            }
            return(null);
        }
 public ErrorInfoWithPause ActionOneCCDMeas(EnumCellIndex cellindex, DataComp NeedComp)
 {
     if (CCDMeasDataStations[cellindex].CellData != null)
     {
         if (ClassWorkFlow.Instance.WorkMode != EnumWorkMode.空跑)
         {
             Comps[(int)cellindex] = NeedComp;
             SnapShot((int)cellindex, CCDMeasDataStations[cellindex].CellData.Barcode);
         }
         else
         {
             TimeClass.Delay(400);
             MeasDone[(int)cellindex] = true;
         }
     }
     return(null);
 }
Exemple #12
0
        protected string StartSerialReading(EnumCellIndex index, HardwareSerialProtocolName protocol, DataComp NeedComp)
        {
            string Data = "";
            int    i    = (int)index;

            ReadDone[i] = false;
            string res = StartSerialReading(SerialPort[i], HardwareSerialProtocolName.ThicknessRead, ref Data);

            if (res != "")
            {
                ClassErrorHandle.ShowError("读取测厚数据", String.Format("读取{0}测量数据出错:{1}", index, res), ErrorLevel.Error);
            }
            else
            {
                GetData(index, Data, NeedComp);
                ReadDone[i] = true;
            }
            ReadDone[i] = true;
            return(res);
        }
Exemple #13
0
        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);
        }
Exemple #14
0
        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("物料加载完毕。");
        }