Beispiel #1
0
        /// <summary>
        /// 检查参数列表(是否有未设置选项)
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btChkCfg_Click(object sender, EventArgs e)
        {
            string recipeID = cbRecipeID.Text;

            if (string.IsNullOrEmpty(recipeID))
            {
                MessageBox.Show("RecipeID未选择");
                return;
            }

            JFDLAFRecipeManager rm     = JFHubCenter.Instance.RecipeManager as JFDLAFRecipeManager;
            JFDLAFProductRecipe recipe = rm.GetRecipe(CategoteProduct, cbRecipeID.Text) as JFDLAFProductRecipe;

            if (null == recipe)
            {
                MessageBox.Show("RecipeID = \"" + recipeID + "\"产品配方不存在");
                return;
            }

            JFVisionManager vm = JFHubCenter.Instance.VisionMgr;


            bool          isCfgOK   = true;
            StringBuilder errorInfo = new StringBuilder();
            string        mark1Cfg  = recipe.GetMark1LightCfg();

            if (string.IsNullOrEmpty(mark1Cfg))
            {
                isCfgOK = false;
                errorInfo.AppendLine("Mark1视觉配置未设置");
            }
            else
            {
                if (!vm.ContainSingleVisionCfgByName(mark1Cfg))
                {
                    isCfgOK = false;
                    errorInfo.AppendLine("Mark1视觉参数:\"" + mark1Cfg + "\" 在视觉配置表中不存在");
                }
            }


            string mark2Cfg = recipe.GetMark2LightCfg();

            if (string.IsNullOrEmpty(mark2Cfg))
            {
                isCfgOK = false;
                errorInfo.AppendLine("Mark2视觉配置未设置");
            }
            else
            {
                if (!vm.ContainSingleVisionCfgByName(mark2Cfg))
                {
                    isCfgOK = false;
                    errorInfo.AppendLine("Mark2视觉参数:\"" + mark2Cfg + "\" 在视觉配置表中不存在");
                }
            }

            string[] allFovNames = recipe.FovNames();
            if (null != allFovNames)
            {
                foreach (string fovName in allFovNames)
                {
                    string[] taskNames = recipe.TaskNames(fovName);
                    if (null != taskNames)
                    {
                        foreach (string taskName in taskNames)
                        {
                            string vcName = recipe.VisionCfgName(fovName, taskName);
                            if (string.IsNullOrEmpty(vcName))
                            {
                                isCfgOK = false;
                                errorInfo.AppendLine("Fov:\"" + fovName + "\" Task:\"" + taskName + "\" 视觉参数未设置");
                            }
                            else
                            {
                                if (!vm.ContainSingleVisionCfgByName(vcName))
                                {
                                    isCfgOK = false;
                                    errorInfo.AppendLine("Fov:\"" + fovName + "\" Task:\"" + taskName + "\" 视觉参数:\"" + vcName + "\"在视觉配置中不存在");
                                }
                            }
                        }
                    }
                }
            }
            if (isCfgOK)
            {
                MessageBox.Show("所有视觉参数已配置完成!");
                return;
            }
            else
            {
                MessageBox.Show(errorInfo.ToString());
                return;
            }
        }
Beispiel #2
0
        void AdjustStationView()
        {
            IJFRecipeManager mgr = JFHubCenter.Instance.RecipeManager;

            if (null == mgr)
            {
                Enabled         = false;
                cbRecipeID.Text = "RecipeManager = null!";
                return;
            }

            if (!mgr.IsInitOK)
            {
                Enabled         = false;
                cbRecipeID.Text = "RecipeManager not init!";
                return;
            }

            if (_station == null)
            {
                Enabled = false;
                return;
            }

            string _modelPicPath = _station.GetCfgParamValue(DLAFVisionTeachStation.SCItemName_ModelPicPath) as string;

            if (null == _modelPicPath)
            {
                tbModelPicPath.Text = "";
            }
            tbModelPicPath.Text = _modelPicPath;

            Enabled = true;
            string currRecipeID = cbRecipeID.Text; //当前已选的RecipeID

            cbRecipeID.Items.Clear();
            string[] allRecipeIDs = mgr.AllRecipeIDsInCategoty(CategoteProduct);
            if (null != allRecipeIDs && allRecipeIDs.Length > 0)
            {
                foreach (string s in allRecipeIDs)
                {
                    cbRecipeID.Items.Add(s);
                }
                if (!string.IsNullOrEmpty(currRecipeID))
                {
                    if (allRecipeIDs.Contains(currRecipeID))
                    {
                        cbRecipeID.Text = currRecipeID;
                    }
                    else
                    {
                        cbRecipeID.SelectedIndex = -1;
                    }
                }
            }
            else
            {
                cbRecipeID.SelectedIndex = -1;
            }

            string currVAName = cbVAName.Text;

            cbVAName.Items.Clear();
            JFVisionManager vm = JFHubCenter.Instance.VisionMgr;

            string[] allVANames = vm.AllSVAssistNames();
            if (null != allVANames && allVANames.Length > 0)
            {
                foreach (string s in allVANames)
                {
                    cbVAName.Items.Add(s);
                }
                if (!allVANames.Contains(currVAName))
                {
                    cbVAName.SelectedIndex = -1;
                }
                else
                {
                    cbVAName.Text = currVAName;
                }
            }
            else
            {
                cbVAName.SelectedIndex = -1;
            }

            AdjustVisionCfg();
        }