Пример #1
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);
        }
Пример #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);
        }