Ejemplo n.º 1
0
        protected override int ResetLoop()
        {
            //load cfg
            CfgSettings = Machine.Ins.Settings;

            //clear vio
            VioTransInp.SetVio(this, false);
            VioBarcodeFinish.SetVio(this, false);
            VioTransFinish.SetVio(this, false);
            VioMeasureFinish.SetVio(this, false);

            //load axis pos
            Platform.AssertPosTeached("Wait", this);
            Platform.AssertPosTeached("GtWork1", this);
            Platform.AssertPosTeached("GtWork2", this);
            Platform.AssertPosTeached($"Barcode{Project.TypeId}", this);

            PosGtWork1 = Platform["GtWork1"] as PosXYZ;
            PosGtWork2 = Platform["GtWork2"] as PosXYZ;


            if (!DoGTCylinder.SetDo(this, false, ignoreOrWaringOrError: true))
            {
                ThrowException($"GT Cylinder Reset Fail!");
            }

            //connect gt controller and barcode controller
            try
            {
                if (BarcodeController.IsOpen)
                {
                    BarcodeController.Close();
                }

                BarcodeController.Open(BarcodeCOM);
            }
            catch (Exception e)
            {
                ThrowException($"Barcode Open Fail:{e.Message}");
            }

            //home platform
            Platform.EnterAuto(this).Servo();
            Platform.EnterAuto(this).Home(new[] { 1, 1, 0 }, -1);
            Platform.EnterAuto(this).MoveAbs("Wait", checkLimit: false);

            //move gt cylinder push pos
            if (!DoGTCylinder.SetDo(this, true, ignoreOrWaringOrError: true))
            {
                //show alarm
                ThrowException($"GT Cylinder Set Fail!");
            }

            return(0);
        }
Ejemplo n.º 2
0
        protected override int ResetLoop()
        {
            CfgSettings = Machine.Ins.Settings;

            //clear vio
            VioTransFinish.SetVio(this, false);
            VioMeasureFinish.SetVio(this, false);

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

            Platform.EnterAuto(this).Servo();
            Platform.EnterAuto(this).Home(new[] { 1, 1, 0 }, -1);
            Platform.EnterAuto(this).MoveAbs("Wait", checkLimit: false);

            return(0);
        }
Ejemplo n.º 3
0
        protected override int ResetLoop()
        {
            //load files
            CfgSettings           = Machine.Ins.Settings;
            CfgEnableRelCoordMode = CfgSettings.EnableRelCoordMode;
            Project = MeasureProject.Load(CfgSettings.MeasureProjectFile, typeof(MeasureProjectA)) as MeasureProjectA;
            Project.AssertNoNull(this);

            if (CfgEnableRelCoordMode)
            {
                Platform.AssertPosTeached("FocusOrigin", this);
            }
            Platform.AssertPosTeached("Wait", this);


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


            //reconnect camera
            try
            {
                Camera.Disconnect();
                var ret = Camera.Connect();
                if (!ret)
                {
                    Log($"{Camera} Connect Error", LogLevel.Error);
                }

                Camera.SwitchProduct(Project.TypeId);
                Log($"{Camera} SwitchProduct {Project.TypeId}");
            }
            catch (Exception ex)
            {
                Log($"{Camera} Server Connect Fail: {ex.Message}", LogLevel.Error);
            }

            //reset platforms
            Platform.EnterAuto(this).Servo();
            Platform.EnterAuto(this).Home();
            Platform.EnterAuto(this).MoveAbs("Wait");
            return(0);
        }
Ejemplo n.º 4
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);
        }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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);
        }