Exemplo n.º 1
0
        /// <summary>
        /// 设备暂停/恢复
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btPause_Click(object sender, EventArgs e)
        {
            IJFMainStation ms = JFHubCenter.Instance.StationMgr.MainStation;

            if (!_isStationWorking(ms.WorkStatus))
            {
                JFTipsDelayClose.Show("无效操作:设备未运行", 2);
                return;
            }
            if (ms.WorkStatus == JFWorkStatus.Pausing)
            {
                JFTipsDelayClose.Show("无效操作:设备已暂停运行", 2);
                return;
            }
            string errorInfo = null;
            bool   isOK      = ms.Pause(out errorInfo);

            if (!isOK)
            {
                JFTipsDelayClose.Show("暂停操作失败:" + errorInfo, 2);
                return;
            }
            else
            {
                JFTipsDelayClose.Show("设备已暂停", 2);
            }
        }
Exemplo n.º 2
0
        void OnStationWorkStatusChanged(object sender, JFWorkStatus currWorkStatus)
        {
            if (InvokeRequired)
            {
                Invoke(new dgWorkStatusChanged(OnStationWorkStatusChanged), new object[] { sender, currWorkStatus });
                return;
            }

            IJFStation station = sender as IJFStation;

            _dctStationForms[station].OnWorkStatusChanged(sender, currWorkStatus);
            if (_dctTestingForms.ContainsKey(station))
            {
                JFWorkStatus ws = station.CurrWorkStatus;
                if (!JFStationBase.IsWorkingStatus(ws) &&
                    ws != JFWorkStatus.CommandExit &&
                    ws != JFWorkStatus.AbortExit)
                {
                    _dctTestingForms.Remove(station);
                    StopTest();
                    JFTipsDelayClose.Show("工站:" + station.Name + " " + JFStationBase.WorkStatusName(ws) + "  ,停止测试运行!", -1);
                    return;
                }
            }
        }
Exemplo n.º 3
0
        /// <summary>
        /// 手动上料
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btManualFeed_Click(object sender, EventArgs e)
        {
            //料盒/左轨道工站 必须开放一个系统数据项 (上料盒送料完成)
            if (null == _ms)
            {
                return;
            }
            if (_ms.IsAlarming)
            {
                MessageBox.Show("无效操作:设备已报警!");
                return;
            }

            if (_ms.WorkStatus != JFInterfaceDef.JFWorkStatus.Running)
            {
                MessageBox.Show("无效操作,设备当前状态:" + _ms.WorkStatus);
                return;
            }
            string itemName = "检测工站:轨道工站送料完成";

            if (!JFHubCenter.Instance.DataPool.ContainItem(itemName))
            {
                MessageBox.Show("系统数据池未包含数据项:\" " + itemName + "\"");
                return;
            }
            JFHubCenter.Instance.DataPool.SetItemValue(itemName, true);
            JFTipsDelayClose.Show("已设置送料信号!", 1);
        }
Exemplo n.º 4
0
        /// <summary>
        /// 开始定位FOV
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btFixFov_Click(object sender, EventArgs e)
        {
            if (null == _station)
            {
                MessageBox.Show(" 无效操作,工站未设置/空值");
                return;
            }
            if (string.IsNullOrEmpty(cbRecipeID.Text))
            {
                MessageBox.Show("请先选择Recipe!");
                return;
            }

            if (cbFovName.SelectedIndex < 0)
            {
                MessageBox.Show("请先选择 Fov Name!");
                return;
            }

            string errorInfo;

            if (!_station.FixFOV(cbFovName.Text, out errorInfo))
            {
                MessageBox.Show(errorInfo);
                return;
            }

            JFTipsDelayClose.Show("开始定位FOV!", 1);
        }
Exemplo n.º 5
0
        /// <summary>
        /// 开始定位IC
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btFixIC_Click(object sender, EventArgs e)
        {
            if (null == _station)
            {
                MessageBox.Show(" 无效操作,工站未设置/空值");
                return;
            }
            if (string.IsNullOrEmpty(cbRecipeID.Text))
            {
                MessageBox.Show("请先选择Recipe!");
                return;
            }

            if (cbIcRow.SelectedIndex < 0)
            {
                MessageBox.Show("请先选择IC Row!");
                return;
            }

            if (cbIcCol.SelectedIndex < 0)
            {
                MessageBox.Show("请先选择IC Col!");
                return;
            }

            string errorInfo;

            if (!_station.FixIC(cbIcRow.SelectedIndex, cbIcCol.SelectedIndex, out errorInfo))
            {
                MessageBox.Show(errorInfo);
                return;
            }

            JFTipsDelayClose.Show("开始定位IC!", 1);
        }
Exemplo n.º 6
0
        /// <summary>
        /// 设备运行
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btStart_Click(object sender, EventArgs e)
        {
            IJFMainStation ms = JFHubCenter.Instance.StationMgr.MainStation;

            if (ms.WorkStatus == JFWorkStatus.Running)
            {
                JFTipsDelayClose.Show("无效操作:正在运行中", 2);
                return;
            }
            string errorInfo;

            if (!_isStationWorking(ms.WorkStatus))
            {
                ///先将所有使能工站切换为自动模式
                JFStationManager mgr = JFHubCenter.Instance.StationMgr;
                string[]         allEnableStationNames = mgr.AllEnabledStationNames();
                if (null != allEnableStationNames)
                {
                    foreach (string sn in allEnableStationNames)
                    {
                        IJFStation station = mgr.GetStation(sn);
                        if (!station.SetRunMode(JFStationRunMode.Auto))
                        {
                            MessageBox.Show("启动运行失败,未能将工站:" + sn + "切换为自动运行模式");
                            return;
                        }
                    }
                }


                //// 添加消息回调
                //string[] allEnableStationNames = JFHubCenter.Instance.StationMgr.AllEnabledStationNames();
                bool isOK = ms.Start(out errorInfo);
                if (!isOK)
                {
                    MessageBox.Show("启动失败:" + errorInfo);
                    return;
                }
                else
                {
                    JFTipsDelayClose.Show("设备开始运行", 1);
                }
            }

            if (ms.WorkStatus == JFWorkStatus.Pausing) //当前处于暂停状态
            {
                bool isOK = ms.Resume(out errorInfo);
                if (!isOK)
                {
                    MessageBox.Show("恢复运行失败:" + errorInfo);
                    return;
                }
                else
                {
                    JFTipsDelayClose.Show("设备开始运行", 1);
                }
            }
        }
Exemplo n.º 7
0
 private void btVision_Click(object sender, EventArgs e)
 {
     if (IsAutoRunning && _isStationWorking(JFHubCenter.Instance.StationMgr.MainStation.WorkStatus))
     {
         JFTipsDelayClose.Show("设备正在自动运行,不能打开视觉调试界面", 5);
         return;
     }
     JustShowSubForm(_visionForm);
 }
Exemplo n.º 8
0
        /// <summary>
        /// 清除报警信息
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btAlarm_Click(object sender, EventArgs e)
        {
            IJFMainStation ms      = JFHubCenter.Instance.StationMgr.MainStation;
            string         errInfo = "";
            bool           isOK    = ms.ClearAlarming(out errInfo);

            if (!isOK)
            {
                JFTipsDelayClose.Show("清除报警失败:" + errInfo, 20);
                return;
            }
            JFTipsDelayClose.Show("报警已清除:", 2);
        }
Exemplo n.º 9
0
        /// <summary>
        /// 复位按钮被点击
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btReset_Click(object sender, EventArgs e)
        {
            IJFMainStation ms      = JFHubCenter.Instance.StationMgr.MainStation;
            string         errInfo = "";

            if (!ms.Reset(out errInfo))
            {
                JFTipsDelayClose.Show("归零操作失败:" + errInfo, 5);
            }
            else
            {
                JFTipsDelayClose.Show("归零指令OK:", 2);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// 设备停止
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btStop_Click(object sender, EventArgs e)
        {
            IJFMainStation ms      = JFHubCenter.Instance.StationMgr.MainStation;
            string         errInfo = "";

            if (!ms.Stop(out errInfo))
            {
                JFTipsDelayClose.Show("停止操作失败:" + errInfo, 5);
                return;
            }
            //else
            //    JFTipsDelayClose.Show("停止操作OK" + errInfo, 2);
            return;
        }
Exemplo n.º 11
0
 private void btManual_Click(object sender, EventArgs e)
 {
     if (!IsAutoRunning)
     {
         _manualForm.Show();
         return;
     }
     if (_isStationWorking(JFHubCenter.Instance.StationMgr.MainStation.WorkStatus))
     {
         JFTipsDelayClose.Show("自动运行时不能切换到手动调试界面", 3);
         return;
     }
     IsAutoRunning           = false;
     statusLabelRunMode.Text = "手动测试";
     JustShowSubForm(_manualForm);
 }
Exemplo n.º 12
0
        private void btFixMark2_Click(object sender, EventArgs e)
        {
            if (null == _station)
            {
                MessageBox.Show("无效操作,工站未设置");
                return;
            }
            string errorInfo;

            if (!_station.FixMark(1, out errorInfo))
            {
                MessageBox.Show("Mark2定位失败:" + errorInfo);
                return;
            }
            JFTipsDelayClose.Show("开始定位Mark2", 1);
        }
Exemplo n.º 13
0
        /// <summary>
        /// 检测所选FOV
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btInspectCurrFov_Click(object sender, EventArgs e)
        {
            if (null == _station)
            {
                MessageBox.Show(" 无效操作,工站未设置/空值");
                return;
            }
            if (string.IsNullOrEmpty(cbRecipeID.Text))
            {
                MessageBox.Show("请先选择Recipe!");
                return;
            }

            if (cbIcRow.SelectedIndex < 0)
            {
                MessageBox.Show("请先选择 IC Row!");
                return;
            }


            if (cbIcCol.SelectedIndex < 0)
            {
                MessageBox.Show("请先选择 IC Col!");
                return;
            }


            if (cbFovName.SelectedIndex < 0)
            {
                MessageBox.Show("请先选择 Fov Name!");
                return;
            }
            string errorInfo;
            int    row     = Convert.ToInt32(cbIcRow.Text);
            int    col     = Convert.ToInt32(cbIcCol.Text);
            string fovName = cbFovName.Text;

            if (!_station.InspectFov(row, col, fovName, out errorInfo))
            {
                MessageBox.Show("Fov视觉检测失败:" + errorInfo);
                return;
            }
            JFTipsDelayClose.Show("开始检测" + fovName, 1);
        }
Exemplo n.º 14
0
        private void btAuto_Click(object sender, EventArgs e)
        {
            if (IsAutoRunning) //当前处于自动化运行模式
            {
                JustShowSubForm(_autoForm);
            }
            else //非自动运行状态,可能有工站正在运行测试
            {
                JFStationManager stationMgr            = JFHubCenter.Instance.StationMgr;
                string[]         allEnableStationNames = stationMgr.AllEnabledStationNames();
                if (null == allEnableStationNames || allEnableStationNames.Length == 0)
                {
                    JustShowSubForm(_autoForm);
                    statusLabelRunMode.Text = "自动运行";
                    return;
                }


                List <IJFStation> runningStations = new List <IJFStation>();
                foreach (string sn in allEnableStationNames)
                {
                    IJFStation station = stationMgr.GetStation(sn);
                    if (_isStationWorking(station.CurrWorkStatus))
                    {
                        runningStations.Add(station);
                    }
                }

                if (runningStations.Count > 0)
                {
                    StringBuilder sbInfo = new StringBuilder("切换到自动运行模式失败,以下工站未停止:\n");
                    foreach (IJFStation station in runningStations)
                    {
                        sbInfo.AppendLine("工站:" + station.Name + " 当前状态:" + station.CurrWorkStatus.ToString());
                    }
                    JFTipsDelayClose.Show(sbInfo.ToString(), 5);
                    return;
                }
                IsAutoRunning = true;
                JustShowSubForm(_autoForm);
                statusLabelRunMode.Text = "自动运行";
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// 采集产品模板图像 ,每个FOV的Task都采图/保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btGrabModelPics_Click(object sender, EventArgs e)
        {
            if (null == _station)
            {
                MessageBox.Show(" 无效操作,工站未设置/空值");
                return;
            }
            if (string.IsNullOrEmpty(cbRecipeID.Text))
            {
                MessageBox.Show("请先选择Recipe!");
                return;
            }

            string errorInfo;

            if (!_station.GrabModelPicture(out errorInfo))
            {
                MessageBox.Show(errorInfo);
                return;
            }

            JFTipsDelayClose.Show("开始采集产品模板图像!", 1);
        }
Exemplo n.º 16
0
        /// <summary>
        /// 开始产品定位
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btFixMark_Click(object sender, EventArgs e)
        {
            if (null == _station)
            {
                MessageBox.Show(" 无效操作,工站未设置/空值");
                return;
            }
            if (string.IsNullOrEmpty(cbRecipeID.Text))
            {
                MessageBox.Show("请先选择Recipe!");
                return;
            }

            string errorInfo;

            if (!_station.FixProduct(chkVisionFixProduct.Checked, out errorInfo))
            {
                MessageBox.Show(errorInfo);
                return;
            }

            JFTipsDelayClose.Show("开始定位产品!", 1);
        }
Exemplo n.º 17
0
        /// <summary>
        /// 设置/保存 Task视觉参数配置
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btTaskVcEditSave_Click(object sender, EventArgs e)
        {
            if (!_isTaskVcEditting)
            {
                string taskName = cbTaskName.Text;
                if (string.IsNullOrEmpty(taskName))
                {
                    MessageBox.Show("请选择需要设置的Task");
                    return;
                }

                _isTaskVcEditting          = true;
                cbTaskName.Enabled         = false;
                cbTaskVc.Enabled           = true;
                btTaskVcEditSave.Text      = "保存";
                btTaskVcEditCancel.Enabled = true;
            }
            else
            {
                string taskVcName = cbTaskVc.Text;
                if (string.IsNullOrEmpty(taskVcName))
                {
                    MessageBox.Show("请选择需要保存的视觉配置名称");
                    return;
                }
                _isTaskVcEditting          = false;
                cbTaskName.Enabled         = true;
                cbTaskVc.Enabled           = false;
                btTaskVcEditSave.Text      = "编辑";
                btTaskVcEditCancel.Enabled = false;
                JFDLAFRecipeManager rm     = JFHubCenter.Instance.RecipeManager as JFDLAFRecipeManager;
                JFDLAFProductRecipe recipe = rm.GetRecipe(CategoteProduct, cbRecipeID.Text) as JFDLAFProductRecipe;
                recipe.SetVisionCfgName(cbFovName.Text, cbTaskName.Text, taskVcName);
                JFTipsDelayClose.Show("已保存\"taskVcName\" 到:" + cbTaskName.Text, 1);
            }
        }
Exemplo n.º 18
0
        Dictionary <IJFStation, FormSingleStationTest> _dctTestingForms = new Dictionary <IJFStation, FormSingleStationTest>(); //参与当前测试的

        /// <summary>
        /// 启动所有选中的工站
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btStart_Click(object sender, EventArgs e)
        {
            if (_isTesting)
            {
                MessageBox.Show("无效操作,当前测试正在运行");
                return;
            }

            string[] willTestStationNames = TestStationNames();
            if (null == willTestStationNames || 0 == willTestStationNames.Length)
            {
                MessageBox.Show("请先选择参与测试运行的工站!\n菜单->启动测试");
                return;
            }

            JFStationManager mgr = JFHubCenter.Instance.StationMgr;

            string[]      allStationNames     = mgr.AllStationNames();
            List <string> runningStationNames = new List <string>(); //当前正在运行的工站

            foreach (string s in allStationNames)
            {
                if (JFStationBase.IsWorkingStatus(mgr.GetStation(s).CurrWorkStatus))
                {
                    runningStationNames.Add(s);
                }
            }
            if (runningStationNames.Count > 0)
            {
                string info = "以下工站正在运行:\n";
                foreach (string s in runningStationNames)
                {
                    info += s + "\n";
                }
                info += "是否继续?";
                if (DialogResult.Cancel == MessageBox.Show(info, "警告", MessageBoxButtons.OKCancel, MessageBoxIcon.Warning))
                {
                    return;
                }
            }
            _isTesting = true;
            //mgr.EventStationWorkStatusChanged += OnStationWorkStatusChanged;
            _dctTestingForms.Clear();

            string Tipsinfo = "已启动工站:\n";

            foreach (string s in willTestStationNames)
            {
                IJFStation station = mgr.GetStation(s);
                _dctTestingForms.Add(station, _dctStationForms[station]);
                //_dctStationForms[station].EnableStationMsgReceive = true;
                JFWorkCmdResult ret = station.Start();
                if (ret != JFWorkCmdResult.Success) //启动工站失败
                {
                    //_dctStationForms[station].EnableStationMsgReceive = false;
                    foreach (KeyValuePair <IJFStation, FormSingleStationTest> kv in _dctTestingForms)
                    {
                        if (kv.Key.Stop(500) != JFWorkCmdResult.Success)
                        {
                            kv.Key.Abort();
                        }
                    }
                    _isTesting = false;
                    MessageBox.Show("启动工站:" + station.Name + "失败,ErrorCode = " + ret);
                    return;
                }

                Tipsinfo += s + "\n";

                JFTipsDelayClose.Show(Tipsinfo, 2);
                btReset.Enabled  = false;
                btResume.Enabled = true;
                btPause.Enabled  = true;
            }
        }