Exemple #1
0
        private void StartYPos()
        {
            //移动到X8000
            ManagerPlant.flowManager.xData.XPos = ManagerPlant.flowManager.xData.Pos;
            //----------y4移动到3000
            ManagerPlant.flowManager.yData.YPos4 = ManagerPlant.flowManager.yData.Pos;
            ManagerPlant.sendDataManager.Move();
            App.Current.Dispatcher.Invoke((Action)(() =>
            {
                MessageBox.Show(Application.Current.MainWindow, "测量Y轴ADP3位移精度,请固定好千分表后再点击确定按钮!");
            }));
            for (int g = 0; g < yData.Groups;)
            {
                ManagerPlant.flowManager.yData.YPos4 = "0";
                ManagerPlant.sendDataManager.Move();
                ManagerPlant.flowManager.yData.YPos4 = ManagerPlant.flowManager.yData.Pos;
                ManagerPlant.sendDataManager.Move();
                //记录开始值
                yData.SetStart(g + 1, "4", SerialPortManager.Instance.GetValue());

                for (int i = 0; i < yData.Counts; i++)
                {
                    ManagerPlant.flowManager.yData.YPos4 = "0";
                    ManagerPlant.sendDataManager.Move();
                    ManagerPlant.flowManager.yData.YPos4 = ManagerPlant.flowManager.yData.PosCirculation;
                    ManagerPlant.sendDataManager.Move();
                }
                ManagerPlant.flowManager.yData.YPos4 = "0";
                ManagerPlant.sendDataManager.Move();
                ManagerPlant.flowManager.yData.YPos4 = ManagerPlant.flowManager.yData.Pos;
                ManagerPlant.sendDataManager.Move();
                //Thread.Sleep(1000);
                //记录结束值
                bool b = yData.SetEnd(g + 1, "4", SerialPortManager.Instance.GetValue());
                if (!b)
                {
                    App.Current.Dispatcher.Invoke((Action)(() =>
                    {
                        //弹出提示框
                        MessageBox.Show(Application.Current.MainWindow, "偏差超出范围,请重新固定千分表!");
                    }));
                }
                else
                {
                    g++;
                }
            }
            ChaiChuBox();

            ManagerPlant.flowManager.yData.YPos4 = "4200";
            ManagerPlant.sendDataManager.Move();

            //----------

            //----------y2移动到3000
            ManagerPlant.flowManager.yData.YPos2 = ManagerPlant.flowManager.yData.Pos;
            ManagerPlant.sendDataManager.Move();
            App.Current.Dispatcher.Invoke((Action)(() =>
            {
                MessageBox.Show(Application.Current.MainWindow, "测量Y轴ADP2位移精度,请固定好千分表后再点击确定按钮!");
            }));
            for (int g = 0; g < yData.Groups;)
            {
                ManagerPlant.flowManager.yData.YPos2 = "0";
                ManagerPlant.sendDataManager.Move();
                ManagerPlant.flowManager.yData.YPos2 = ManagerPlant.flowManager.yData.Pos;
                ManagerPlant.sendDataManager.Move();
                //记录开始值
                yData.SetStart(g + 1, "2", SerialPortManager.Instance.GetValue());

                for (int i = 0; i < yData.Counts; i++)
                {
                    ManagerPlant.flowManager.yData.YPos2 = "0";
                    ManagerPlant.sendDataManager.Move();
                    ManagerPlant.flowManager.yData.YPos2 = ManagerPlant.flowManager.yData.PosCirculation;
                    ManagerPlant.sendDataManager.Move();
                }
                ManagerPlant.flowManager.yData.YPos2 = "0";
                ManagerPlant.sendDataManager.Move();
                ManagerPlant.flowManager.yData.YPos2 = ManagerPlant.flowManager.yData.Pos;
                ManagerPlant.sendDataManager.Move();
                //Thread.Sleep(1000);
                //记录结束值
                bool b = yData.SetEnd(g + 1, "2", SerialPortManager.Instance.GetValue());
                if (!b)
                {
                    App.Current.Dispatcher.Invoke((Action)(() =>
                    {
                        //弹出提示框
                        MessageBox.Show(Application.Current.MainWindow, "偏差超出范围,请重新固定千分表!");
                    }));
                }
                else
                {
                    g++;
                }
            }
            ChaiChuBox();
            ManagerPlant.flowManager.yData.YPos2 = "4200";
            ManagerPlant.sendDataManager.Move();
            //----------

            //----------y1移动到3000
            ManagerPlant.flowManager.yData.YPos1 = ManagerPlant.flowManager.yData.Pos;
            ManagerPlant.sendDataManager.Move();
            App.Current.Dispatcher.Invoke((Action)(() =>
            {
                MessageBox.Show(Application.Current.MainWindow, "测量Y轴ADP1位移精度,请固定好千分表后再点击确定按钮!");
            }));
            for (int g = 0; g < yData.Groups;)
            {
                ManagerPlant.flowManager.yData.YPos1 = "0";
                ManagerPlant.sendDataManager.Move();
                ManagerPlant.flowManager.yData.YPos1 = ManagerPlant.flowManager.yData.Pos;
                ManagerPlant.sendDataManager.Move();
                //记录开始值
                yData.SetStart(g + 1, "1", SerialPortManager.Instance.GetValue());
                //Thread.Sleep(1000);
                for (int i = 0; i < yData.Counts; i++)
                {
                    ManagerPlant.flowManager.yData.YPos1 = "0";
                    ManagerPlant.sendDataManager.Move();
                    ManagerPlant.flowManager.yData.YPos1 = ManagerPlant.flowManager.yData.PosCirculation;
                    ManagerPlant.sendDataManager.Move();
                }
                ManagerPlant.flowManager.yData.YPos1 = "0";
                ManagerPlant.sendDataManager.Move();
                ManagerPlant.flowManager.yData.YPos1 = ManagerPlant.flowManager.yData.Pos;
                ManagerPlant.sendDataManager.Move();
                //记录结束值
                bool b = yData.SetEnd(g + 1, "1", SerialPortManager.Instance.GetValue());
                if (!b)
                {
                    App.Current.Dispatcher.Invoke((Action)(() =>
                    {
                        //弹出提示框
                        MessageBox.Show(Application.Current.MainWindow, "偏差超出范围,请重新固定千分表!");
                    }));
                }
                else
                {
                    g++;
                }
            }
            ChaiChuBox();
            ManagerPlant.flowManager.yData.YPos1 = "4200";
            ManagerPlant.sendDataManager.Move();
            //----------
        }