Ejemplo n.º 1
0
        /// <summary>
        /// 计算电能表最大需量误差
        /// </summary>
        /// <param name="arrNumber">电表实际需量</param>
        /// <returns>多功能数据结构体 MeterDgn </returns>
        public override CLDC_DataCore.Model.DnbModel.DnbInfo.MeterErrorBase SetWuCha(params float[] arrNumber)
        {
            string strError;
            string strNumber;
            //计算标准功率
            float starndP = 0;

            try
            {
                starndP = float.Parse(OtherData);
            }
            catch
            { }

            OtherData = "";

            float    xlError     = Number.GetRelativeWuCha(arrNumber[0], starndP);
            MeterDgn returnValue = new MeterDgn();

            strError  = xlError.ToString("F2");
            strNumber = arrNumber[0].ToString("F4");
            returnValue.Md_chrValue = string.Format("{0}|{1}|{2}", starndP, arrNumber[0], strError);
            if (Math.Abs(xlError) <= WuChaPara.MaxError + 0.05F * starndP / arrNumber[0])
            {
                OtherData = CLDC_DataCore.Const.Variable.CTG_HeGe;
            }
            else
            {
                OtherData = CLDC_DataCore.Const.Variable.CTG_BuHeGe;
            }

            return(returnValue);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// 刷新表单数据
        /// </summary>
        /// <param name="MeterGroup"></param>
        public void SetData(List <CLDC_DataCore.Model.DnbModel.DnbInfo.MeterBasicInfo> MeterGroup)
        {
            #region 初始化行
            if (Data_View.Rows.Count != MeterGroup.Count)           //如果当前数据表单行数小于电能表表位数,则需要重新创建对应数据表单
            {
                Data_View.Rows.Clear();
                for (int i = 0; i < MeterGroup.Count; i++)
                {
                    int RowIndex = Data_View.Rows.Add();
                    if ((RowIndex + 1) % 2 == 0)
                    {
                        Data_View.Rows[RowIndex].DefaultCellStyle.BackColor = CLDC_DataCore.Const.Variable.Color_Grid_Alter;
                    }
                    else
                    {
                        Data_View.Rows[RowIndex].DefaultCellStyle.BackColor = CLDC_DataCore.Const.Variable.Color_Grid_Normal;
                    }
                    Data_View.Rows[RowIndex].HeaderCell.Value = MeterGroup[i].ToString();
                }
                Data_View.Refresh();
            }
            #endregion 初始化行

            #region 加载数据
            foreach (DataGridViewColumn column in Data_View.Columns)
            {
                string keyString = string.Empty;
                switch (column.HeaderText)
                {
                case "阶梯数(读)":
                    keyString = (int.Parse(Key) + 100).ToString();
                    break;

                case "阶梯值(读)":
                    keyString = (int.Parse(Key) + 200).ToString();
                    break;

                case "阶梯电价(读)":
                    keyString = (int.Parse(Key) + 300).ToString();
                    break;

                case "结论(读)":
                    keyString = (int.Parse(Key) + 400).ToString();
                    break;

                case "阶梯数(写)":
                    keyString = (int.Parse(Key) + 500).ToString();
                    break;

                case "阶梯值(写)":
                    keyString = (int.Parse(Key) + 600).ToString();
                    break;

                case "阶梯电价(写)":
                    keyString = (int.Parse(Key) + 700).ToString();
                    break;

                case "结论(写)":
                    keyString = (int.Parse(Key) + 800).ToString();
                    break;
                }

                if (keyString == string.Empty)
                {
                    continue;
                }

                for (int i = 0; i < MeterGroup.Count; i++)
                {
                    for (int j = 1; j < Data_View.ColumnCount; j++)
                    {
                        int _ColIndex = (int)(_FirstColIndex + j - 1);
                        if (!MeterGroup[i].MeterDgns.ContainsKey(keyString))
                        {
                            Data_View.Rows[i].Cells[column.Index].Value = "";
                            continue;
                        }
                        else
                        {
                            MeterDgn meterDgn = MeterGroup[i].MeterDgns[keyString];
                            Data_View.Rows[i].Cells[column.Index].Value = meterDgn.Md_chrValue;
                        }
                    }
                }
            }
            #endregion 加载数据
        }