Exemple #1
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);
            }
        }
        public void OnCustomStatusChanged(object station, int currCustomStatus)
        {
            if (!Created)
            {
                return;
            }
            if (InvokeRequired)
            {
                Invoke(new dgCustomStatusChanged(OnCustomStatusChanged), new object[] { station, currCustomStatus });
                return;
            }
            string csName = _station.GetCustomStatusName(currCustomStatus);

            if (string.IsNullOrEmpty(csName))
            {
                csName = "CsCode = " + currCustomStatus;
            }
            toolStripTextBoxCustomStatus.Text = "任务状态:" + csName;
            if (_stationUI is IJFStationMsgReceiver)
            {
                (_stationUI as IJFStationMsgReceiver).OnCustomStatusChanged(currCustomStatus);
            }
            ShowTips("任务状态:" + csName);
        }
        void AdjustStationView()
        {
            lstBoxCustomStatus.Items.Clear();
            cbCmds.Items.Clear();
            if (null == _station)
            {
                gbStationName.Text         = "工站:未设置";
                btResetProductInfo.Enabled = false;
                btSendCmd.Enabled          = false;
                cbCmds.Enabled             = false;
                btShowLog.Enabled          = false;
                btClearTips.Enabled        = false;
                return;
            }

            gbStationName.Text         = "工站:" + _station.Name;
            btResetProductInfo.Enabled = true;
            //btSendCmd.Enabled = true;
            //cbCmds.Enabled = true;
            btShowLog.Enabled   = true;
            btClearTips.Enabled = true;


            int[] allCustomStatusIDs = _station.AllCustomStatus;
            if (null != allCustomStatusIDs)
            {
                foreach (int customStatusID in allCustomStatusIDs)
                {
                    string statusName = _station.GetCustomStatusName(customStatusID);
                    if (string.IsNullOrEmpty(statusName))
                    {
                        statusName = "CStatus_ID:" + customStatusID;
                    }
                    lstBoxCustomStatus.Items.Add(statusName);
                }
            }


            btSendCmd.Enabled = true;
            cbCmds.Enabled    = true;
            if (AllowedStartStopCmd)
            {
                cbCmds.Items.Add("开始");
            }
            cbCmds.Items.Add("暂停");
            cbCmds.Items.Add("恢复");
            if (AllowedStartStopCmd)
            {
                cbCmds.Items.Add("结批");
                cbCmds.Items.Add("停止");
            }
            int[] allCmds = _station.AllCmds;
            if (null != allCmds)
            {
                foreach (int cmd in allCmds)
                {
                    string cmdTxt = _station.GetCmdName(cmd);
                    if (string.IsNullOrEmpty(cmdTxt))
                    {
                        cmdTxt = "CmdID:" + cmd;
                    }
                    cbCmds.Items.Add(cmdTxt);
                }
            }
        }