/// <summary>
        /// 显示工站数据池
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void toolStripMenuItemDataPool_Click(object sender, EventArgs e)
        {
            if (_station == null)
            {
                MessageBox.Show("无效操作,工站未设置");
                return;
            }

            if (!typeof(JFStationBase).IsAssignableFrom(_station.GetType()))
            {
                MessageBox.Show("无效操作,当前工站基类型不是JFStationBase!");
                return;
            }

            if (!toolStripMenuItemDataPool.Checked)
            {
                splitContainer1.IsSplitterFixed   = false;
                splitContainer1.SplitterDistance  = 150;
                toolStripMenuItemDataPool.Checked = true;
            }
            else
            {
                splitContainer1.IsSplitterFixed   = true;
                splitContainer1.SplitterDistance  = 0;
                toolStripMenuItemDataPool.Checked = false;
            }
        }
示例#2
0
 public void OnStationTxtMsg(IJFStation station, string msgInfo)
 {
     if (station.GetType().Name.Contains("DLAFDetectStation"))
     {
         _uiPanel.OnTxtMsg(msgInfo);
     }
 }
示例#3
0
 /// <summary>
 /// 处理工站发来的其他定制化的消息
 /// </summary>
 /// <param name="station"></param>
 /// <param name="msg"></param>
 public virtual void OnStationCustomizeMsg(IJFStation station, string msgCategory, object[] msgParams)
 {
     if (station.GetType().Name.Contains("DLAFDetectStation"))
     {
         _uiPanel.OnCustomizeMsg(msgCategory, msgParams);
     }
 }
示例#4
0
 /// <summary>
 /// 产品加工完成消息
 /// </summary>
 /// <param name="station">消息发送者</param>
 /// <param name="PassCount">本次生产完成的成品数量</param>
 /// <param name="NGCount">本次生产的次品数量</param>
 /// <param name="NGInfo">次品信息</param>
 public virtual void OnStationProductFinished(IJFStation station, int passCount, string[] passIDs, int ngCount, string[] ngIDs, string[] ngInfo)
 {
     if (station.GetType().Name.Contains("DLAFDetectStation"))
     {
         _uiPanel.OnProductFinished(passCount, passIDs, ngCount, ngIDs, ngInfo);
     }
 }
示例#5
0
        //void HandleStationMsg(IJFStation station,object msg )

        /// <summary>
        ///  处理工站的业务状态发生改变
        /// </summary>
        /// <param name="station"></param>
        /// <param name="currCustomStatus"></param>
        public virtual void OnStationCustomStatusChanged(IJFStation station, int currCustomStatus)
        {
            if (station.GetType().Name.Contains("DLAFDetectStation"))
            {
                string custonStatusTxt = station.GetCustomStatusName(currCustomStatus);
                _uiPanel.OnCustomStatusChanged(custonStatusTxt);
            }
        }
示例#6
0
        /// <summary>
        /// 处理工站状态改变
        /// </summary>
        /// <param name="station"></param>
        /// <param name="currWorkStatus"></param>
        public virtual void OnStationWorkStatusChanged(IJFStation station, JFWorkStatus currWorkStatus)
        {
            if (station.GetType().Name.Contains("DLAFDetectStation"))
            {
                _uiPanel.OnWorkStatusChanged(currWorkStatus);
            }

            ///继续添加其他工站发过来的消息
        }
示例#7
0
        /// <summary>
        /// 注册一个工站(不可删除),
        /// 在Application.Run()运行之前调用
        /// </summary>
        /// <param name="station"></param>
        public void DeclearStation(IJFStation station)
        {
            if (station == null)
            {
                throw new ArgumentNullException("StationManager.DeclearStation(IJFStation station) failed by station = null");
            }
            //if (_lstDeclearStations.Contains(station))
            //    throw new ArgumentException("StationManager.DeclearStation(IJFStation station) failed by station is already decleared!");
            string name = station.Name;

            if (string.IsNullOrEmpty(name))
            {
                throw new ArgumentException("StationManager.DeclearStation(IJFStation station) failed by station's Name null or empty");
            }
            if (_initorStationNames().Contains(name))
            {
                IJFInitializable existedStation = JFHubCenter.Instance.InitorManager.GetInitor(name);
                if (existedStation.GetType() != station.GetType())
                {
                    throw new Exception("StationManager.DeclearStation(IJFStation station) failed by:Exist a station with same name and type unmatched: Decleared Type = " + station.GetType() + " ; Existed Type = " + existedStation.GetType());
                }
                (existedStation as IJFStation).Name = name;
                DeclearedStationNames.Add(station.Name);
                //station.WorkStatusChanged += StationWorkStatusChanged;
                //station.CustomStatusChanged += StationCustomStatusChanged;
                //if(station is JFCmdWorkBase)
                //    (station as JFCmdWorkBase).WorkMsg2Outter += StationTxtMsg;
                return;
                //throw new ArgumentException("StationManager.DeclearStation(IJFStation station) failed by station's Name = \"" + name + "\" is exsited in InitorStation-List!");
            }

            JFHubCenter.Instance.InitorManager.Add(station.Name, station);
            DeclearedStationNames.Add(station.Name);
            //station.WorkStatusChanged += StationWorkStatusChanged;
            //station.CustomStatusChanged += StationCustomStatusChanged;
            //if (station is JFCmdWorkBase)
            //    (station as JFCmdWorkBase).WorkMsg2Outter += StationTxtMsg;
        }
示例#8
0
        void UpdateStations()
        {
            List <string> currStationNames = JFHubCenter.Instance.StationMgr.AllStationNames().ToList();

            if (!IsNeedReLoad(currStationNames))
            {
                return;
            }
            _locStationNames = currStationNames;
            tabControlCF1.TabPages.Clear();
            foreach (string sn in _locStationNames)
            {
                IJFStation station = JFHubCenter.Instance.StationMgr.GetStation(sn);
                if (typeof(JFStationBase).IsAssignableFrom(station.GetType()))
                {
                    FormStationBaseCfg fm = new FormStationBaseCfg();
                    fm.SetStation(station as JFStationBase);
                    AddPage(fm, sn);
                }
                else //使用IJFStaion的ConfigUIProvider
                {
                    TabPage tabPage = new TabPage(); //创建一个TabControl 中的单个选项卡页。
                    tabPage.Text      = sn;
                    tabPage.Name      = sn;
                    tabPage.BackColor = BackColor;
                    tabPage.Font      = Font;
                    tabControlCF1.TabPages.Add(tabPage);   //添加tabPage选项卡到tab控件

                    Button bt = new Button();
                    bt.Text   = "显示工站配置窗口";
                    bt.Tag    = sn;
                    bt.Click += OnBtShowStationCfgUI;
                    tabPage.Controls.Add(bt);  //tabPage选项卡添加一个窗体对象
                }
            }
            if (_selectStationName == null)
            {
                if (tabControlCF1.TabPages.Count > 0)
                {
                    tabControlCF1.SelectedIndex = -1;
                    tabControlCF1.SelectedIndex = 0;
                    _selectStationName          = tabControlCF1.TabPages[0].Text;
                }
            }
            else
            {
                for (int i = 0; i < _locStationNames.Count; i++)
                {
                    if (_selectStationName == _locStationNames[i])
                    {
                        tabControlCF1.SelectedIndex = i;
                        return;
                    }
                }
                if (0 == _locStationNames.Count)
                {
                    _selectStationName = null;
                }
                else
                {
                    _selectStationName          = _locStationNames[0];
                    tabControlCF1.SelectedIndex = 0;
                }
            }
        }