コード例 #1
0
        /// <summary>
        /// 数据刷新
        /// </summary>
        /// <param name="MeterGroup">电能表数据集合</param>
        /// <param name="CheckOrderID">当前检定点</param>
        private void RefreshGrid(CLDC_DataCore.Model.DnbModel.DnbGroupInfo MeterGroup, int CheckOrderID)
        {
            //string strMessage = "";
            _DnbGroup = MeterGroup;
            //_DnbGroup.NowMinute ==""
            int FirstYJMeter = Main.GetFirstYaoJianMeterIndex(MeterGroup);

            if (CheckOrderID >= MeterGroup.CheckPlan.Count ||
                !(MeterGroup.CheckPlan[CheckOrderID] is CLDC_DataCore.Struct.StErrAccord))
            {
                return;
            }

            //当前检定方案项
            CLDC_DataCore.Struct.StErrAccord _Item = (CLDC_DataCore.Struct.StErrAccord)MeterGroup.CheckPlan[CheckOrderID];

            for (int i = 0; i < MeterGroup.MeterGroup.Count; i++)
            {
                CLDC_DataCore.Model.DnbModel.DnbInfo.MeterBasicInfo _MeterInfo = MeterGroup.MeterGroup[i];

                DataGridViewRow _Row = dgv_ErrAccord.Rows[i];
                //表位号
                _Row.Cells[1].Value = _MeterInfo.ToString(); //插入表位号

                if (!_MeterInfo.YaoJianYn)                   //如果不检
                {
                    _Row.Cells[0].Value = false;
                    //如果不检,并且常数或者等级都为空,则将勾选单元格设置为只读
                    if (_MeterInfo.Mb_chrBcs == String.Empty || _MeterInfo.Mb_chrBdj == String.Empty)
                    {
                        _Row.Cells[0].ReadOnly = true;
                    }
                    for (int j = 2; j < _Row.Cells.Count; j++)
                    {
                        _Row.Cells[j].Value = string.Empty;
                    }
                    continue;
                }

                _Row.Cells[0].Value = true;

                _Row.Cells[2].Value = _Item.ToString();

                if (dgv_ErrAccord.Tag == null)
                {
                    return;
                }

                if (_MeterInfo.MeterErrAccords == null)
                {
                    _MeterInfo.MeterErrAccords = new Dictionary <string, CLDC_DataCore.Model.DnbModel.DnbInfo.MeterErrAccord>();
                }
                //如果数据中存在值那么就需要插入数据,这个地方插的值都是合格或者不合格,因为取的都是大编号,不是带具体值的小编号
                if (_MeterInfo.MeterErrAccords.ContainsKey(dgv_ErrAccord.Tag.ToString()))
                {
                    _Row.Cells[4].Value = _MeterInfo.MeterErrAccords[dgv_ErrAccord.Tag.ToString()].Mea_Result;
                    if ((MeterGroup.CheckState & CLDC_Comm.Enum.Cus_CheckStaute.检定) == CLDC_Comm.Enum.Cus_CheckStaute.检定 ||
                        (MeterGroup.CheckState & CLDC_Comm.Enum.Cus_CheckStaute.单步检定) == CLDC_Comm.Enum.Cus_CheckStaute.单步检定)
                    {
                        //switch (_Item.ErrAccordType)
                        //{
                        //    case 1:
                        //        strMessage = "误差一致性项目检定中...";
                        //        break;
                        //    case 2:
                        //        strMessage = "误差变差项目检定中...";
                        //        break;
                        //    case 3:
                        //        strMessage = "负载电流升降变差项目检定中...";
                        //        break;
                        //    case 4:
                        //        strMessage = "电流过载试验项目检定中...";
                        //        break;
                        //}
                        //更新检测进度
                        string CurProgrocssValue = _MeterInfo.MeterErrAccords[dgv_ErrAccord.Tag.ToString()].ProgressValue;

                        _Row.Cells[3].Value = CurProgrocssValue;
                        _Row.Cells[4].Value = _MeterInfo.MeterErrAccords[dgv_ErrAccord.Tag.ToString()].Mea_Result;
                    }
                    if (_Row.Cells[4].Value != null)
                    {
                        if (_Row.Cells[4].Value.ToString() == CLDC_DataCore.Const.Variable.CTG_BuHeGe)      //不合格修改当前行背景颜色
                        {
                            _Row.DefaultCellStyle.ForeColor = CLDC_DataCore.Const.Variable.Color_Grid_BuHeGe;
                            foreach (DataGridViewCell cell in _Row.Cells)
                            {
                                cell.ToolTipText = _MeterInfo.MeterErrAccords[dgv_ErrAccord.Tag.ToString()].AVR_DIS_REASON;
                            }
                        }
                        else
                        {
                            _Row.DefaultCellStyle.ForeColor = Color.Black;
                            foreach (DataGridViewCell cell in _Row.Cells)
                            {
                                cell.ToolTipText = string.Empty;
                            }
                        }
                    }
                }
                else
                {
                    _Row.DefaultCellStyle.ForeColor = Color.Black;
                    _Row.Cells[3].Value             = "检定完毕";

                    _Row.Cells[4].Value = CLDC_DataCore.Const.Variable.CTG_HeGe;
                }
            }

            #region -----------------------------------------数据页刷新-------------------------------------------
            if (Tab_ErrAccord.TabPages.Count != 2)
            {
                return;                                              //如果没有附加数据页则返回
            }
            Control _Control = Tab_ErrAccord.TabPages[1].Controls[0];

            if (_Control is CLDC_MeterUI.UI_Detection_New.ErrAccordView.ViewErrAccord)    //误差一致性
            {
                ((CLDC_MeterUI.UI_Detection_New.ErrAccordView.ViewErrAccord)_Control).SetData(MeterGroup.MeterGroup, _Item);
                return;
            }
            if (_Control is CLDC_MeterUI.UI_Detection_New.ErrAccordView.ViewContrast)     //误差变差
            {
                ((CLDC_MeterUI.UI_Detection_New.ErrAccordView.ViewContrast)_Control).SetData(MeterGroup.MeterGroup, _Item);
                return;
            }
            if (_Control is CLDC_MeterUI.UI_Detection_New.ErrAccordView.ViewUpDown)       //负载电流升降变差
            {
                ((CLDC_MeterUI.UI_Detection_New.ErrAccordView.ViewUpDown)_Control).SetData(MeterGroup.MeterGroup, _Item);
                return;
            }
            if (_Control is CLDC_MeterUI.UI_Detection_New.ErrAccordView.ViewOver)         //电流过载
            {
                ((CLDC_MeterUI.UI_Detection_New.ErrAccordView.ViewOver)_Control).SetData(MeterGroup.MeterGroup, _Item);
                return;
            }
            #endregion
        }
コード例 #2
0
        /// <summary>
        /// 加载方案项目
        /// </summary>
        /// <param name="FaItem">方案项目</param>
        public void LoadFA(CLDC_DataCore.Model.Plan.Plan_ErrAccord FaItem)
        {
            //Dgv_Data.Rows.Clear();

            base.FaName = FaItem.Name;

            try
            {
                Cmb_Fa.Text = FaItem.Name;
            }
            catch
            {
                Cmb_Fa.SelectedIndex = 0;
            }

            for (int _i = 0; _i < FaItem.Count; _i++)                               //循环方案对象
            {
                CLDC_DataCore.Struct.StErrAccord _Obj = FaItem.getErrAccordPrj(_i); //取出一个方案项目
                string[] strPara = _Obj.PrjName.Split(' ');
                string[] strTmp  = new string[2];

                if (_Obj.ErrAccordType == 1)
                {
                    chk_Yzx.Checked = true;

                    for (int _row = 0; _row < strPara.Length - 1; _row++)
                    {
                        strTmp = strPara[_row].Split('|');
                        Dgv_Data.Rows[_row].Cells[0].Value = _row + 1;
                        ((DataGridViewComboBoxCell)Dgv_Data.Rows[_row].Cells[1]).Value = strTmp[0];
                        ((DataGridViewComboBoxCell)Dgv_Data.Rows[_row].Cells[2]).Value = strTmp[1];
                    }
                }
                else if (_Obj.ErrAccordType == 2)
                {
                    chk_Bc.Checked = true;
                    txt_Bc.Text    = _Obj.Time1.ToString();
                }
                else if (_Obj.ErrAccordType == 3)
                {
                    chk_Sj.Checked = true;

                    for (int _index = 0; _index < strPara.Length - 1; _index++)
                    {
                        strTmp = strPara[_index].Split('|');
                        switch (_index + 1)
                        {
                        case 1:
                            cbo_Value1.Text = strTmp[0];
                            break;

                        case 2:
                            cbo_Value2.Text = strTmp[0];
                            break;

                        case 3:
                            cbo_Value3.Text = strTmp[0];
                            break;

                        case 4:
                            cbo_Value4.Text = strTmp[0];
                            break;
                        }
                    }
                }
                else if (_Obj.ErrAccordType == 4)
                {
                    chk_Gz.Checked = true;
                    txt_Gz1.Text   = _Obj.Time1.ToString();
                    txt_Gz2.Text   = _Obj.Time2.ToString();
                }
            }

            this.UpDownButtonState(0);    //设置上下移动按钮状态
        }
コード例 #3
0
        /// <summary>
        /// 刷新数据事件
        /// </summary>
        /// <param name="meterGroup"></param>
        /// <param name="CheckOrderID"></param>
        public void RefreshData(CLDC_DataCore.Model.DnbModel.DnbGroupInfo meterGroup, int CheckOrderID)
        {
            if (!(meterGroup.CheckPlan[CheckOrderID] is CLDC_DataCore.Struct.StErrAccord))
            {
                return;
            }

            CLDC_DataCore.Struct.StErrAccord _Item = (CLDC_DataCore.Struct.StErrAccord)meterGroup.CheckPlan[CheckOrderID];

            bool bFind = false;

            if (Tab_ErrAccord.TabPages.Count > 1)            //如果Tab的页数大于1,那表示存在动态增加的数据页
            {
                if (dgv_ErrAccord.Tag != null && dgv_ErrAccord.Tag.ToString() == _Item.ErrAccordType.ToString())
                {
                    bFind = true;
                }
                else
                {
                    for (int i = Tab_ErrAccord.TabPages.Count - 1; i > 0; i--)
                    {
                        Tab_ErrAccord.TabPages.RemoveAt(i);
                    }
                    bFind = false;
                }
            }

            if (!bFind)
            {
                dgv_ErrAccord.Tag = _Item.ErrAccordType;   //将ID值放到数据列表的Tag中,供数据刷新使用

                switch (_Item.ErrAccordType)
                {
                case 1:
                    Tab_ErrAccord.TabPages.Add("误差一致性数据");
                    CLDC_MeterUI.UI_Detection_New.ErrAccordView.ViewErrAccord _ErrorAccord = new CLDC_MeterUI.UI_Detection_New.ErrAccordView.ViewErrAccord();
                    Tab_ErrAccord.TabPages[1].Controls.Add(_ErrorAccord);
                    _ErrorAccord.Dock   = DockStyle.Fill;
                    _ErrorAccord.Margin = new System.Windows.Forms.Padding(0);
                    break;

                case 2:
                    Tab_ErrAccord.TabPages.Add("误差变差数据");
                    CLDC_MeterUI.UI_Detection_New.ErrAccordView.ViewContrast _Contrast = new CLDC_MeterUI.UI_Detection_New.ErrAccordView.ViewContrast();
                    Tab_ErrAccord.TabPages[1].Controls.Add(_Contrast);
                    _Contrast.Dock   = DockStyle.Fill;
                    _Contrast.Margin = new System.Windows.Forms.Padding(0);
                    break;

                case 3:
                    Tab_ErrAccord.TabPages.Add("负载电流升降变差数据");
                    CLDC_MeterUI.UI_Detection_New.ErrAccordView.ViewUpDown _UpDown = new CLDC_MeterUI.UI_Detection_New.ErrAccordView.ViewUpDown();
                    Tab_ErrAccord.TabPages[1].Controls.Add(_UpDown);
                    _UpDown.Dock   = DockStyle.Fill;
                    _UpDown.Margin = new System.Windows.Forms.Padding(0);
                    break;

                case 4:
                    Tab_ErrAccord.TabPages.Add("电流过载数据");
                    CLDC_MeterUI.UI_Detection_New.ErrAccordView.ViewOver _Over = new CLDC_MeterUI.UI_Detection_New.ErrAccordView.ViewOver();
                    Tab_ErrAccord.TabPages[1].Controls.Add(_Over);
                    _Over.Dock   = DockStyle.Fill;
                    _Over.Margin = new System.Windows.Forms.Padding(0);
                    break;
                }
            }

            this.RefreshGrid(meterGroup, CheckOrderID);

            dgv_ErrAccord.Enabled = true;
        }