示例#1
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);
        }
示例#2
0
 public newTransTask(int id, string name, Station station) : base(id, name, station)
 {
     GtController = new KeyenceGT();
 }