private void bCalDown_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.cbDownVision.Text))
            {
                VisionResult rtn = DetectLabel?.Invoke(this.cbDownVision.Text, this.module.Module, this.selectNz3.SelectNz);

                if (rtn.State == VisionResultState.OK)
                {
                    var entiy = SystemEntiy.Instance[this.module.Module];
                    var curPt = SystemEntiy.Instance[this.module.Module].XYPos;
                    //PointF wroldPt = new PointF();
                    //SystemEntiy.Instance[this.module.Module].WroldPt(this.selectNz3.SelectNz,
                    //    SystemEntiy.Instance[this.module.Module].MachineConfig[this.selectNz3.SelectNz].RotateCamPoint,
                    //    rtn.Point, out wroldPt);
                    var wroldPt = SystemEntiy.Instance[this.module.Module].RotatePtDown(this.selectNz3.SelectNz, rtn.Point, -rtn.Angle);
                    entiy.XYGoPos(wroldPt);
                    entiy.RGoAngle(entiy.MachineAxis.R[(int)this.selectNz3.SelectNz].Pos - rtn.Angle, this.selectNz3.SelectNz);
                }
            }
        }
        private void bPasteTest_Click(object sender, EventArgs e)
        {
            if (this.cbDownVision.SelectedIndex < 0)
            {
                return;
            }

            var    entiy = SystemEntiy.Instance[this.module.Module];
            Nozzle nz    = this.selectNz3.SelectNz;
            // 记录要贴附的坐标
            PointF pasteXY    = entiy.XYPos;
            double pasteAngle = (double)this.numPasteAngle.Value;

            // Z轴到安全高度
            entiy.ZGoSafeTillStop();
            // 到拍照位
            entiy.XYGoPosTillStop(entiy.MachineConfig[nz].RotateCamPoint);
            // R角度到0
            entiy.RGoAngleTillStop(0, nz);

            Thread.Sleep(50);

            // 拍照
            VisionResult rtn = DetectLabel?.Invoke(this.cbDownVision.Text, this.module.Module, this.selectNz3.SelectNz);

            if (rtn.State == VisionResultState.OK)
            {
                PointF result = entiy.RotatePtDown(nz, rtn.Point, -rtn.Angle + pasteAngle);
                PointF offset = new PointF();
                offset.X = result.X - entiy.MachineConfig[nz].DownMarkPt.X;
                offset.Y = result.Y - entiy.MachineConfig[nz].DownMarkPt.Y;
                PointF realPt = new PointF();
                realPt.X = pasteXY.X + offset.X + entiy.MachineConfig[nz].NzToCam.X;
                realPt.Y = pasteXY.Y + offset.Y + entiy.MachineConfig[nz].NzToCam.Y;

                if (!this.cbCheck.Checked)
                {
                    realPt = entiy.GetPasteOffset(nz, pasteXY, realPt);
                }
                else
                {
                    this.upPt    = pasteXY;
                    this.pastePt = realPt;
                }

                entiy.RGoAngle(-rtn.Angle + pasteAngle, nz);
                entiy.XYGoPosTillStop(realPt);
                entiy.ZGoPaste(nz);
                Thread.Sleep(1000);
                entiy.MachineIO.VaccumSuck[(int)nz].SetIO(false);
                Thread.Sleep(100);
                entiy.MachineIO.VaccumPO[(int)nz].SetIO(true);
                Thread.Sleep(100);
                entiy.MachineIO.VaccumPO[(int)nz].SetIO(false);
                entiy.ZGoSafeTillStop();
                entiy.XYGoPosTillStop(pasteXY);
            }
            else
            {
                MessageBox.Show("Label 侦测失败!!");
            }
        }