Пример #1
0
        protected override int ResetLoop()
        {
            //load files
            CfgSettings = Machine.Ins.Settings;
            Project     = MeasureProject.Load(CfgSettings.MeasureProjectFile, typeof(MeasureProjectB)) as MeasureProjectB;
            Project.AssertNoNull(this);

            Platform.AssertPosTeached("Wait", this);
            Platform.AssertPosTeached("SafeOrigin", this);


            //reset vio
            VioMeasureStart.SetVio(this, false);
            VioMeasureFinish.SetVio(this, false);


            try
            {
                Product             = new Thermo2ProductB();
                Product.ProductType = Project.ThermoProductType.ToString();
                Product.Description = string.Join("-", new[] { Project.ProductName, CfgSettings.Version });
                Product.SPCItems    = Project.SPCItems;


                //upload data
                if (CfgSettings.Uploader.Enable)
                {
                    //init uploader
                    UploadHelper = DataUploadFactory.Ins.Create(CfgSettings.Uploader.UploaderName, CfgSettings.Uploader);

                    if (UploadHelper == null)
                    {
                        Log($"创建上传模块失败: {CfgSettings.Uploader.UploaderName} 不存在", LogLevel.Error);
                    }
                    else
                    {
                        UploadData();
                    }
                }
            }
            catch (Exception ex)
            {
                Log($"连接FTP ERROR: {ex.Message}", LogLevel.Error);
            }


            //reset gui
            TestProcessControl.OnTestStartEvent(null);

            //wait task finsih
            MeasureTask = Station.Machine.Find <StationTask>("MeasureTask") as MeasureTask;
            MeasureTask.AssertNoNull(this);
            MeasureTask.WaitResetFinish(this);
            MeasureTask.Project = Project;


            Platform.EnterAuto(this).Servo();
            Platform.EnterAuto(this).Home();
            Platform.EnterAuto(this).MoveAbs("Wait");
            return(0);
        }
Пример #2
0
        protected override int ResetLoop()
        {
            //load files
            CfgSettings = Machine.Ins.Settings;
            Project     = MeasureProject.Load(CfgSettings.MeasureProjectFile, typeof(MeasureProjectA)) as MeasureProjectA;
            Project.AssertNoNull(this);

            Platform.AssertPosTeached("Wait", this);


            //reset vio
            VioMeasureStart.SetVio(this, false);
            VioMeasureFinish.SetVio(this, false);

            var isProductFound = CarrierLoader.IsProductExists();

            if (isProductFound)
            {
                CarrierLoader.ClampVC();
            }
            else
            {
                CarrierLoader.ReleaseVC();
            }


            try
            {
                Product             = new Thermo2ProductA();
                Product.ProductType = Project.ThermoProductType.ToString();
                Product.Description = string.Join("-", new[] { Project.ProductName, CfgSettings.Version });
                Product.SPCItems    = Project.SPCItems;


                //upload data
                if (CfgSettings.Uploader.Enable)
                {
                    //init uploader
                    UploadHelper = DataUploadFactory.Ins.Create(CfgSettings.Uploader.UploaderName, CfgSettings.Uploader);

                    if (UploadHelper == null)
                    {
                        Log($"创建上传模块失败: {CfgSettings.Uploader.UploaderName} 不存在", LogLevel.Error);
                    }
                    else
                    {
                        UploadData();
                    }
                }
            }
            catch (Exception ex)
            {
                Log($"连接FTP ERROR: {ex.Message}", LogLevel.Error);
            }


            //reset
            TestProcessControl.OnTestStartEvent(null);
            MeasureTask = Station.Machine.Find <StationTask>("MeasureTask") as MeasureTask;
            MeasureTask.AssertNoNull(this);
            MeasureTask.WaitResetFinish(this);


            if (isProductFound)
            {
                CarrierLoader.ReleaseVC();
                Station.Machine.Beep();
            }


            //reset platform
            Platform.EnterAuto(this);
            return(0);
        }
Пример #3
0
        protected override int ResetLoop()
        {
            Clamper = new XyClamper()
            {
                Task = this,
                CyX  = DoClampCylinderX,
                CyY  = DoClampCylinderY,
            };

            Platform.AssertPosTeached("Wait", this);
            Platform.AssertPosTeached("Work", this);

            CfgSettings = Machine.Ins.Settings;


            if (!Project.CheckIfNormal())
            {
                ThrowException($"Project Error: {Project.ProductName}");
            }


            Thermo1GeometryCalculator = Thermo1CalculatorMgr.Ins.New(Project.ProductName);
            if (Thermo1GeometryCalculator == null || !Thermo1GeometryCalculator.CheckIfNormal())
            {
                ThrowException($"Station {Name} Load Thermo1GeometryCalculator for {Project.ProductName} Fail");
            }


            try
            {
                Product             = new Thermo1Product();
                Product.ProductType = Project.ThermoProductType.ToString();
                Product.Description = string.Join("-", new[] { Station.Name, Project.ProductName, CfgSettings.Version });
                Product.SPCItems    = Project.SPCItems;

                TestProcessControl.OnTestStartEvent(Product);


                //upload data
                if (CfgSettings.Uploader.Enable)
                {
                    //init uploader
                    UploadHelper = DataUploadFactory.Ins.Create(CfgSettings.Uploader.UploaderName, CfgSettings.Uploader);
                    if (UploadHelper == null)
                    {
                        Log($"创建上传模块失败: {CfgSettings.Uploader.UploaderName} 不存在", LogLevel.Error);
                    }
                    else
                    {
                        UploadData();
                    }
                }
            }
            catch (Exception ex)
            {
                Log($"连接FTP ERROR: {ex.Message}", LogLevel.Error);
            }


            DOBtnLight1.SetDo(false);
            DOBtnLight2.SetDo(false);
            Thread.Sleep(500);
            DOBtnLight1.SetDo();
            DOBtnLight2.SetDo();


            //reset vio
            VioTransInp.SetVio(this, false);
            VioBarcodeFinish.SetVio(this, false);
            VioTransFinishUp.SetVio(this, false);
            VioTransFinishDown.SetVio(this, false);

            //start resetting process
            //check air pressure
            //if (!DIAirPressure1.GetDiSts(MotionWrapper))
            //{
            //    return -1;
            //}

            //check gt controller
            try
            {
                if (GtController == null)
                {
                    ThrowException("GT Controller not Created");
                }

                if (GtController.Connected)
                {
                    GtController.Close();
                    GtController = new KeyenceGT();
                }

                GtController.Connect(GtAddress, GtPort);
            }
            catch (Exception e)
            {
                ThrowException($"GT Controller Connected Fail:{e.Message}");
            }


            //wait measure task
            WaitTaskDown.AssertNoNull(this);
            WaitTaskDown.WaitResetFinish(this);
            WaitTaskUp.AssertNoNull(this);
            WaitTaskUp.WaitResetFinish(this);


            WaitTaskUp.GtController   = GtController;
            WaitTaskDown.GtController = GtController;

            DOBrakeZPress.SetDo();

            Clamp(true);

            //home platform
            Platform.EnterAuto(this).Servo();
            Platform.EnterAuto(this).Home();
            Platform.EnterAuto(this).MoveAbs("Wait", checkLimit: false);

            //cy clamp
            Clamper.Release();

            //check sensor
            //while (!DISensorCheck1.GetDiSts( false) || !DISensorCheck2.GetDiSts( false))
            //{
            //    MessageBox.Show("product found");
            //}

            DOBtnLight1.SetDo(false);
            DOBtnLight2.SetDo(false);

            RunningState = RunningState.WaitRun;
            GtController.RunGtService(this);
            return(0);
        }