Exemplo n.º 1
0
        /// <summary>
        /// 编辑/保存
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btEditSave_Click(object sender, EventArgs e)
        {
            if (tabControlCF1.SelectedIndex < 0)
            {
                return;
            }
            if (!isEditting)
            {
                TableLayoutPanel panel = tabControlCF1.SelectedTab.Controls[0] as TableLayoutPanel;
                if (0 == panel.Controls.Count)
                {
                    MessageBox.Show("没有可供编辑的参数项");
                    return;
                }
                foreach (UcJFParamEdit ucParam in panel.Controls)
                {
                    ucParam.IsValueReadOnly = false;
                }
                isEditting          = true;
                btEditSave.Text     = "保存";
                btCancel.Enabled    = true;
                btSaveAs.Enabled    = true;
                btAddItem.Enabled   = true;
                btDeletItem.Enabled = true;
            }
            else
            {
                TableLayoutPanel panel = tabControlCF1.SelectedTab.Controls[0] as TableLayoutPanel;
                foreach (UcJFParamEdit ucParam in panel.Controls)
                {
                    string paramName = ucParam.GetParamDesribe().DisplayName;
                    object paramVal;
                    if (!ucParam.GetParamValue(out paramVal))
                    {
                        MessageBox.Show("未能获取参数 Name = " + paramName);
                        return;
                    }
                    //_station.SetCfgParamValue(paramName, paramVal);
                    //ucParam.IsValueReadOnly = false;
                }

                foreach (UcJFParamEdit ucParam in panel.Controls)
                {
                    string paramName = ucParam.GetParamDesribe().DisplayName;
                    object paramVal;
                    ucParam.GetParamValue(out paramVal);
                    _cfg.SetItemValue(paramName, paramVal);//_station.SetCfgParamValue(paramName, paramVal);
                    ucParam.IsValueReadOnly = true;
                }
                _cfg.Save();

                isEditting          = false;
                btEditSave.Text     = "编辑";
                btCancel.Enabled    = false;
                btSaveAs.Enabled    = false;
                btAddItem.Enabled   = false;
                btDeletItem.Enabled = false;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 工站点位存取测试
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btLoadSaveAxisPos_Click(object sender, EventArgs e)
        {
            JFXCfg cfg = new JFXCfg();

            cfg.Load("StationDemoPosTable.xml", true);
            List <JFMultiAxisPosition> maPoses = new List <JFMultiAxisPosition>();
            JFMultiAxisPosition        maPos1  = new JFMultiAxisPosition();

            maPos1.Name = "Pos1";
            maPos1.Positions.Add(JFAxisPos.Create("X", 1.23));
            maPos1.Positions.Add(JFAxisPos.Create("Y", 4.56));
            maPoses.Add(maPos1);
            JFMultiAxisPosition maPos2 = new JFMultiAxisPosition();

            maPos2.Name = "Pos2";
            maPos2.Positions.Add(JFAxisPos.Create("Y", 9.87));
            maPos2.Positions.Add(JFAxisPos.Create("Z", 6.54));
            maPoses.Add(maPos2);
            if (!cfg.ContainsItem("Positions"))
            {
                cfg.AddItem("Positions", maPoses);
            }
            else
            {
                cfg.SetItemValue("Positions", maPoses);
            }
            cfg.Save();

            JFXCfg cfgAnother = new JFXCfg();

            cfgAnother.Load("StationDemoPosTable.xml", false);
            List <JFMultiAxisPosition> maPoses1 = cfgAnother.GetItemValue("Positions") as List <JFMultiAxisPosition>;//测试OK,可获取
        }
Exemplo n.º 3
0
        public bool Save()
        {
            string path = @"BoxData.ini";

            JFXCfg cfg = new JFXCfg();
            int    i   = 0;

            foreach (var pair in Dir_Boxes)
            {
                Box item = pair.Value;
                cfg.SetItemValue("Box_" + i, item);
                i++;
            }
            Num = Dir_Boxes.Count;
            cfg.SetItemValue("Count", Num);

            cfg.Save(path);
            return(true);
        }
Exemplo n.º 4
0
        public bool SetCurrRecipeID(string recipeID, out string errorInfo)
        {
            if (string.IsNullOrEmpty(recipeID))
            {
                errorInfo = "产品ID为null/空字串";
                return(false);
            }
            if (!CheckRecipeMgr(out errorInfo))
            {
                return(false);
            }

            JFDLAFRecipeManager rm = JFHubCenter.Instance.RecipeManager as JFDLAFRecipeManager;

            string[] allRecipeIDs = rm.AllRecipeIDsInCategoty(SCN_CategotyProd);
            if (null == allRecipeIDs || !allRecipeIDs.Contains(recipeID))
            {
                errorInfo = "产品ID:\"" + recipeID + "\"在配方管理器中不存在";
                return(false);
            }
            if (WorkStatus == JFWorkStatus.Running || WorkStatus == JFWorkStatus.Interactiving || WorkStatus == JFWorkStatus.Pausing)
            {
                errorInfo = "正在运行,不能修改产品ID";
                return(false);
            }

            IJFDataPool dp   = JFHubCenter.Instance.DataPool;
            bool        isOK = dp.SetItemValue(SDN_CurrRecipeID, recipeID);

            if (!isOK)
            {
                errorInfo = "写入数据池失败";
            }
            else
            {
                //将当前产品信息写入SystemCfg
                JFXCfg sysCfg = JFHubCenter.Instance.SystemCfg;
                if (sysCfg.ContainsItem(SCN_CurrentRecipeID))
                {
                    sysCfg.SetItemValue(SCN_CurrentRecipeID, recipeID); //将当前产品ID 加到配置项中
                    sysCfg.Save();
                }
                errorInfo = "Success";
            }
            return(isOK);
        }
Exemplo n.º 5
0
        public bool SetCurrLotID(string lotID, out string errorInfo)
        {
            if (string.IsNullOrEmpty(lotID))
            {
                errorInfo = "LotID为null/空字串";
                return(false);
            }


            if (WorkStatus == JFWorkStatus.Running || WorkStatus == JFWorkStatus.Interactiving || WorkStatus == JFWorkStatus.Pausing)
            {
                errorInfo = "正在运行,不能修改LotID";
                return(false);
            }

            IJFDataPool dp   = JFHubCenter.Instance.DataPool;
            bool        isOK = dp.SetItemValue(SDN_CurrLotID, lotID);

            if (!isOK)
            {
                errorInfo = "LotID写入数据池失败";
            }
            else
            {
                //将当前产品信息写入SystemCfg
                JFXCfg sysCfg = JFHubCenter.Instance.SystemCfg;
                if (sysCfg.ContainsItem(SCN_CurrentLotID))
                {
                    sysCfg.SetItemValue(SCN_CurrentLotID, lotID); //将当前LotID 保存到配置项中
                    sysCfg.Save();
                }



                errorInfo = "Success";
            }
            return(isOK);
        }