/// <summary> /// 刷新表单数据 /// </summary> /// <param name="MeterGroup"></param> public void SetData(List <CLDC_DataCore.Model.DnbModel.DnbInfo.MeterBasicInfo> MeterGroup) { if (Data_View.Columns.Count == 0 || MeterGroup.Count == 0) { return; } 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(); } for (int i = 0; i < MeterGroup.Count; i++) //循环将电能表数据集合中的时段投切数据值插入到表格中 { string _Key = Key; if (!MeterGroup[i].YaoJianYn) { continue; } if (!MeterGroup[i].MeterCostControls.ContainsKey(_Key)) { Data_View.Rows[i].Cells[0].Value = ""; continue; } if (MeterGroup[i].MeterCostControls[_Key].Mfk_chrData == null || MeterGroup[i].MeterCostControls[_Key].Mfk_chrData == string.Empty) { continue; } Data_View.Rows[i].Cells[0].Value = MeterGroup[i].MeterCostControls[_Key].Mfk_chrData; } }
/// <summary> /// 刷新表单数据 /// </summary> /// <param name="MeterGroup"></param> public void SetData(List <CLDC_DataCore.Model.DnbModel.DnbInfo.MeterBasicInfo> MeterGroup) { if (Data_View.Columns.Count == 0 || MeterGroup.Count == 0) { return; } 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(); } for (int i = 0; i < MeterGroup.Count; i++) { Data_View.Rows[i].Cells[0].Value = string.Format("第{0}表位", i + 1); //月冻结 if ((MeterGroup[i].MeterFreezes.ContainsKey(Key) && !string.IsNullOrEmpty(MeterGroup[i].MeterFreezes[Key].Md_chrValue))) { string[] _Values = MeterGroup[i].MeterFreezes[Key].Md_chrValue.Split('|'); if (_Values.Length != 3) { continue; //如果数据长度不等于3,则表示数据有问题,跳过不处理 } for (int j = 0; j < _Values.Length; j++) { Data_View.Rows[i].Cells[j + 1].Value = _Values[j]; } } } }
public void SetData(List <CLDC_DataCore.Model.DnbModel.DnbInfo.MeterBasicInfo> MeterGroup) { 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(); } for (int i = 0; i < MeterGroup.Count; i++) { if (!MeterGroup[i].MeterDgns.ContainsKey(Key) || MeterGroup[i].MeterDgns[Key].Md_chrValue == null) //如果多功能集合中不存在该关键字,则不处理 { continue; } string[] _Values = MeterGroup[i].MeterDgns[Key].Md_chrValue.Split('|'); if (_Values.Length != 5) { continue; //如果数据长度不等于5,则表示数据有问题,跳过不处理 } for (int j = 0; j < _Values.Length; j++) { Data_View.Rows[i].Cells[j].Value = _Values[j]; } } }
public void SetData(List <CLDC_DataCore.Model.DnbModel.DnbInfo.MeterBasicInfo> MeterGroup, string strKey) { 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(); } for (int i = 0; i < MeterGroup.Count; i++) { if (!MeterGroup[i].YaoJianYn) { continue; } if (!MeterGroup[i].MeterInfraredDatas.ContainsKey(strKey)) //如果多功能集合中不存在改关键字则不处理 { continue; } Data_View.Rows[i].Cells[0].Value = MeterGroup[i].MeterInfraredDatas[strKey].Mif_PrjName; Data_View.Rows[i].Cells[1].Value = MeterGroup[i].MeterInfraredDatas[strKey].Mif_Prj485Value; Data_View.Rows[i].Cells[2].Value = MeterGroup[i].MeterInfraredDatas[strKey].Mif_PrjInfrareValue; Data_View.Rows[i].Cells[2].Value = MeterGroup[i].MeterInfraredDatas[strKey].Mif_ItemResult; } }
/// <summary> /// 刷新表单数据 /// </summary> /// <param name="MeterGroup"></param> public void SetData(List <CLDC_DataCore.Model.DnbModel.DnbInfo.MeterBasicInfo> MeterGroup) { if (Data_View.Columns.Count == 0 || MeterGroup.Count == 0) { return; } 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) % 4 == 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(); } if ((Data_View.Columns.Count - _FirstColIndex) % 5 != 0) { return; //如果列数不是3的整数倍则退出,因为每个费率需要有3列数据填充 } for (int i = 0; i < MeterGroup.Count; i++) //循环将电能表数据集合中的时段投切数据值插入到表格中 { for (int j = _FirstColIndex; j < _FirstColIndex + (int)(Data_View.Columns.Count - _FirstColIndex) / 5; j++) { string _Key = Key + (j - _FirstColIndex + 1).ToString("D2"); int _ColIndex = (int)(_FirstColIndex + (j - _FirstColIndex) * 5D + 0); if (!MeterGroup[i].MeterDgns.ContainsKey(_Key)) { Data_View.Rows[i].Cells[_ColIndex].Value = ""; //试验前分费率电量 _ColIndex++; Data_View.Rows[i].Cells[_ColIndex].Value = ""; //试验后分费率电量 _ColIndex++; Data_View.Rows[i].Cells[_ColIndex].Value = ""; //试验前总电量 _ColIndex++; Data_View.Rows[i].Cells[_ColIndex].Value = ""; //试验后总电量 _ColIndex++; Data_View.Rows[i].Cells[_ColIndex].Value = ""; //误差 continue; } if (MeterGroup[i].MeterDgns[_Key].Md_chrValue == null || MeterGroup[i].MeterDgns[_Key].Md_chrValue == string.Empty) { continue; } string[] _Values = MeterGroup[i].MeterDgns[_Key].Md_chrValue.Split('|'); if (_Values.Length != 6) { continue; //分割出来的数据数组应该是6个元素,试验前分费率电量|试验后分费率电量|试验前总电量|试验后总电量|误差|费率 } Data_View.Rows[i].Cells[_ColIndex].Value = _Values[0]; //试验前分费率电量 _ColIndex++; Data_View.Rows[i].Cells[_ColIndex].Value = _Values[1]; //试验后分费率电量 _ColIndex++; Data_View.Rows[i].Cells[_ColIndex].Value = _Values[2]; //试验前总电量 _ColIndex++; Data_View.Rows[i].Cells[_ColIndex].Value = _Values[3]; //试验后总电量 _ColIndex++; Data_View.Rows[i].Cells[_ColIndex].Value = _Values[4]; //误差 } } }
public void SetData(List <CLDC_DataCore.Model.DnbModel.DnbInfo.MeterBasicInfo> MeterGroup) { 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(); } for (int i = 0; i < MeterGroup.Count; i++) //循环将电能表数据集合中的误差值插入到表格中 { if (!MeterGroup[i].MeterDgns.ContainsKey(Key1to5)) { continue; } if (MeterGroup[i].MeterDgns[Key1to5].Md_chrValue == null) { continue; } string[] _Values = MeterGroup[i].MeterDgns[Key1to5].Md_chrValue.Split('|'); if (_Values.Length != 5) { continue; } for (int j = 0; j < _Values.Length; j++) { if (j < Data_View.Columns.Count) { Data_View.Rows[i].Cells[j].Value = _Values[j]; } } if (!MeterGroup[i].MeterDgns.ContainsKey(Key6to10)) { continue; } if (MeterGroup[i].MeterDgns[Key6to10].Md_chrValue == null) { continue; } _Values = MeterGroup[i].MeterDgns[Key6to10].Md_chrValue.Split('|'); if (_Values.Length != 5) { continue; } for (int j = 0; j < _Values.Length; j++) { if (j + 5 < Data_View.Columns.Count) { Data_View.Rows[i].Cells[j + 5].Value = _Values[j]; } } if (!MeterGroup[i].MeterDgns.ContainsKey(Key)) { continue; } Data_View.Rows[i].Cells[Data_View.Columns.Count - 1].Value = MeterGroup[i].MeterDgns[Key].Md_chrValue; } }
/// <summary> /// 刷新表单数据 /// </summary> /// <param name="MeterGroup"></param> public void SetData(List <CLDC_DataCore.Model.DnbModel.DnbInfo.MeterBasicInfo> MeterGroup) { string strValue = ""; string[] arrParam = null; m_intGlfx = cmb_Type.SelectedIndex; if (CLDC_DataCore.Const.GlobalUnit.g_CUS == null) { return; } int intSchemeCount = CLDC_DataCore.Const.GlobalUnit.g_CUS.DnbData.CheckPlan.Count; CLDC_DataCore.Struct.StPlan_Function _Item = new CLDC_DataCore.Struct.StPlan_Function(); for (int intInc = 0; intInc < intSchemeCount; intInc++) { if (GlobalUnit.g_CUS.DnbData.CheckPlan[intInc] is CLDC_DataCore.Struct.StPlan_Function) { if (((CLDC_DataCore.Struct.StPlan_Function)GlobalUnit.g_CUS.DnbData.CheckPlan[intInc]).FunctionPrjID == Key) { _Item = (CLDC_DataCore.Struct.StPlan_Function)GlobalUnit.g_CUS.DnbData.CheckPlan[intInc]; } } } if (_Item.PrjParm == null) { return; } if (_Item.PrjParm.Length < 1) { return; } arrParam = _Item.PrjParm.Split('|'); if (arrParam.Length < 3) { return; } m_intTestNum = int.Parse(arrParam[1]); if (Data_View == null) { return; } if (Data_View.Columns.Count == 0 || MeterGroup.Count == 0) { return; } if (Data_View.Rows.Count != MeterGroup.Count * (m_intTestNum + 1)) //如果当前数据表单行数小于电能表表位数,则需要重新创建对应数据表单 { Data_View.Rows.Clear(); for (int intIna = 0; intIna < MeterGroup.Count; intIna++) { for (int intInb = 0; intInb <= m_intTestNum; intInb++) { 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[intIna].ToString(); Data_View.Rows[RowIndex].Cells[0].Value = MeterGroup[intIna].ToString(); if (intInb == 0) { strValue = "当前"; } else { strValue = string.Format("上{0}次", intInb); } Data_View.Rows[RowIndex].Cells[1].Value = strValue; } } Data_View.Refresh(); } for (int intIna = 0; intIna < MeterGroup.Count; intIna++) { for (int intCurrentNum = 0; intCurrentNum <= m_intTestNum; intCurrentNum++) { string _Key = Key + m_intGlfx.ToString("D2") + intCurrentNum.ToString("D2"); if (!MeterGroup[intIna].YaoJianYn) { continue; } int intRowIndex = intIna * (m_intTestNum + 1) + intCurrentNum; if (!MeterGroup[intIna].MeterFunctions.ContainsKey(_Key)) { for (int k = 0; k < 9; k++) { Data_View.Rows[intRowIndex].Cells[k + 2].Value = ""; } continue; } if (MeterGroup[intIna].MeterFunctions[_Key].Mf_chrValue == null || MeterGroup[intIna].MeterFunctions[_Key].Mf_chrValue == string.Empty) { continue; } string[] arrValue = null; string[] arrEnergy = null; if (MeterGroup[intIna].MeterFunctions[_Key].Mf_chrValue.IndexOf(',') == -1) { continue; } arrValue = MeterGroup[intIna].MeterFunctions[_Key].Mf_chrValue.Split(','); if (arrValue.Length < 5) { continue; } Data_View.Rows[intRowIndex].Cells[2].Value = arrValue[0]; Data_View.Rows[intRowIndex].Cells[3].Value = arrValue[1]; Data_View.Rows[intRowIndex].Cells[4].Value = arrValue[2]; Data_View.Rows[intRowIndex].Cells[5].Value = arrValue[3]; arrEnergy = arrValue[4].Split('|'); if (arrEnergy.Length < 5) { continue; } for (int k = 0; k < arrEnergy.Length; k++) { Data_View.Rows[intRowIndex].Cells[k + 6].Value = arrEnergy[k]; } } } }
/// <summary> /// 刷新表单数据 /// </summary> /// <param name="MeterGroup"></param> public void SetData(List <CLDC_DataCore.Model.DnbModel.DnbInfo.MeterBasicInfo> MeterGroup) { if (Data_View.Columns.Count == 0 || MeterGroup.Count == 0) { return; } 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(); } if ((Data_View.Columns.Count - _FirstColIndex) % 3 != 0) { return; //如果列数不是3的整数倍则退出,因为每个费率需要有3列数据填充 } for (int i = 0; i < MeterGroup.Count; i++) //循环将电能表数据集合中的时段投切数据值插入到表格中 { if (MeterGroup[i].YaoJianYn == false) { continue; } if (MeterGroup[i].MeterDgns.ContainsKey(_DlKey)) { string[] Arr_Dl = MeterGroup[i].MeterDgns[_DlKey].Md_chrValue.Split('|'); if (Arr_Dl.Length == 5) //总|峰|平|谷|尖 { for (int j = 0; j < _FirstColIndex; j++) { Data_View.Rows[i].Cells[j].Value = Arr_Dl[(int)Data_View.Columns[j].Tag]; } } } for (int j = _FirstColIndex; j < _FirstColIndex + (int)(Data_View.Columns.Count - _FirstColIndex) / 3; j++) { string _Key = Key + (j - _FirstColIndex + 1).ToString("D2"); int _ColIndex = (int)(_FirstColIndex + (j - _FirstColIndex) * 3D + 0); if (!MeterGroup[i].MeterDgns.ContainsKey(_Key)) { //不存在该数据 Data_View.Rows[i].Cells[_ColIndex].Value = ""; //标准时间 _ColIndex++; Data_View.Rows[i].Cells[_ColIndex].Value = ""; //实际时间 _ColIndex++; Data_View.Rows[i].Cells[_ColIndex].Value = ""; //投切误差,在投切过程中应该显示对应费率电量 continue; } if (MeterGroup[i].MeterDgns[_Key].Md_chrValue == null || MeterGroup[i].MeterDgns[_Key].Md_chrValue == string.Empty) { continue; } string[] _Values = MeterGroup[i].MeterDgns[_Key].Md_chrValue.Split('|'); if (_Values.Length != 4) { continue; //分割出来的数据数组应该是4个元素,标准时间|实际时间|投切误差|费率 } Data_View.Rows[i].Cells[_ColIndex].Value = _Values[0]; //标准时间 _ColIndex++; Data_View.Rows[i].Cells[_ColIndex].Value = _Values[1]; //实际时间 _ColIndex++; Data_View.Rows[i].Cells[_ColIndex].Value = _Values[2]; //投切误差,在投切过程中应该显示对应费率电量 } } }
/// <summary> /// 刷新表单数据 /// </summary> /// <param name="MeterGroup"></param> public override void SetData(CLDC_DataCore.Model.DnbModel.DnbGroupInfo MeterGroup, bool allowedit) { int intFirstMeter = MeterGroup.GetFirstYaoJianMeterBwh(); Data_View.Rows.Clear(); Data_View.Columns.Clear(); if (MeterGroup.MeterGroup[intFirstMeter].MeterDgns.Count == 0) { return; } for (int j = _FirstColIndex; j <= _FirstColIndex + (int)(30 - _FirstColIndex) / 3; j++) { string _Key = Key + (j - _FirstColIndex).ToString("D2"); int _ColIndex = (int)(_FirstColIndex + (j - _FirstColIndex) * 3D + 0); if (MeterGroup.MeterGroup[intFirstMeter].MeterDgns.ContainsKey(_Key)) { if (MeterGroup.MeterGroup[intFirstMeter].MeterDgns[_Key].Md_chrValue == null || MeterGroup.MeterGroup[intFirstMeter].MeterDgns[_Key].Md_chrValue == string.Empty) { continue; } string[] _Values; if (MeterGroup.MeterGroup[intFirstMeter].MeterDgns[_Key].Md_chrValue.IndexOf('|') != -1) { _Values = MeterGroup.MeterGroup[intFirstMeter].MeterDgns[_Key].Md_chrValue.Split('|'); } else { _Values = new string[1]; _Values[0] = MeterGroup.MeterGroup[intFirstMeter].MeterDgns[_Key].Md_chrValue; } if (_Values.Length != 4 && j < _FirstColIndex + (int)(Data_View.Columns.Count - _FirstColIndex) / 3) { continue; //分割出来的数据数组应该是4个元素,标准时间|实际时间|投切误差|费率 } int ColIndex; if (_Values.Length == 4) { ColIndex = Data_View.Columns.Add("Data_" + j, string.Format("试验前({0})电量", _Values[3])); Data_View.Columns[ColIndex].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; Data_View.Columns[ColIndex].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; Data_View.Columns[ColIndex].SortMode = DataGridViewColumnSortMode.NotSortable; ColIndex = Data_View.Columns.Add("Data_" + j, string.Format("试验后({0})电量", _Values[3])); Data_View.Columns[ColIndex].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; Data_View.Columns[ColIndex].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; Data_View.Columns[ColIndex].SortMode = DataGridViewColumnSortMode.NotSortable; ColIndex = Data_View.Columns.Add("Data_" + j, string.Format("({0})电量差值", _Values[3])); Data_View.Columns[ColIndex].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; Data_View.Columns[ColIndex].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; Data_View.Columns[ColIndex].DefaultCellStyle.Font = new Font("Arial Black", 10); Data_View.Columns[ColIndex].SortMode = DataGridViewColumnSortMode.NotSortable; } else { ColIndex = Data_View.Columns.Add("Data_Z", "组合误差"); Data_View.Columns[ColIndex].Tag = 0; Data_View.Columns[ColIndex].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; Data_View.Columns[ColIndex].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; Data_View.Columns[ColIndex].SortMode = DataGridViewColumnSortMode.NotSortable; } } } if (Data_View.Rows.Count != MeterGroup.MeterGroup.Count) //如果当前数据表单行数小于电能表表位数,则需要重新创建对应数据表单 { if (Data_View.ColumnCount == 0) { return; } Data_View.Rows.Clear(); for (int i = 0; i < MeterGroup.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.MeterGroup[i].ToString(); } Data_View.Refresh(); } if (Data_View.Columns.Count == 0) { return; } for (int i = 0; i < MeterGroup._Bws; i++) { //int RowIndex = Data_View.Rows.Add(); int j; for (j = _FirstColIndex; j <= _FirstColIndex + (int)(Data_View.Columns.Count - _FirstColIndex) / 3; j++) { string _Key = Key + (j - _FirstColIndex).ToString("D2"); int _ColIndex = (int)(_FirstColIndex + (j - _FirstColIndex) * 3D + 0); if (MeterGroup.MeterGroup[i].MeterDgns.ContainsKey(_Key)) { if (MeterGroup.MeterGroup[i].MeterDgns[_Key].Md_chrValue == null || MeterGroup.MeterGroup[i].MeterDgns[_Key].Md_chrValue == string.Empty) { continue; } string[] _Values; if (MeterGroup.MeterGroup[i].MeterDgns[_Key].Md_chrValue.IndexOf('|') != -1) { _Values = MeterGroup.MeterGroup[i].MeterDgns[_Key].Md_chrValue.Split('|'); } else { _Values = new string[1]; _Values[0] = MeterGroup.MeterGroup[i].MeterDgns[_Key].Md_chrValue; } if (_Values.Length != 4 && j < _FirstColIndex + (int)(Data_View.Columns.Count - _FirstColIndex) / 3) { continue; //分割出来的数据数组应该是4个元素,标准时间|实际时间|投切误差|费率 } //if (j == 0) //{ // 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.MeterGroup[i].ToString(); // Data_View.Refresh(); //} if (_Values.Length != 4 && j < _FirstColIndex + (int)(Data_View.Columns.Count - _FirstColIndex) / 3) { continue; } if (_ColIndex >= Data_View.Columns.Count) { continue; } Data_View.Rows[i].Cells[_ColIndex].Value = _Values[0]; //起始电量 _ColIndex++; if (j < _FirstColIndex + (int)(Data_View.Columns.Count - _FirstColIndex) / 3) { Data_View.Rows[i].Cells[_ColIndex].Value = _Values[1]; //终止电量 _ColIndex++; Data_View.Rows[i].Cells[_ColIndex].Value = _Values[2]; //电量差值 } } } { string _Key = Key + (j + 1).ToString("D2"); if (!MeterGroup.MeterGroup[i].MeterDgns.ContainsKey(_Key)) { Data_View.Rows[i].Cells[Data_View.Columns.Count - 1].Value = ""; } else { if (MeterGroup.MeterGroup[i].MeterDgns[_Key].Md_chrValue != null) { Data_View.Rows[i].Cells[Data_View.Columns.Count - 1].Value = MeterGroup.MeterGroup[i].MeterDgns[_Key].Md_chrValue; } } } } }
/// <summary> /// 刷新表单数据 /// </summary> /// <param name="MeterGroup"></param> public void SetData(List <CLDC_DataCore.Model.DnbModel.DnbInfo.MeterBasicInfo> MeterGroup) { int intPhase = 0; int intTestNum = 0; string[] arrParam = null; int intSchemeCount = CLDC_DataCore.Const.GlobalUnit.g_CUS.DnbData.CheckPlan.Count; int intKey = int.Parse(Key); CLDC_DataCore.Struct.StPlan_EventLog _Item = new CLDC_DataCore.Struct.StPlan_EventLog(); for (int intInc = 0; intInc < intSchemeCount; intInc++) { if (GlobalUnit.g_CUS.DnbData.CheckPlan[intInc] is CLDC_DataCore.Struct.StPlan_EventLog) { if (((CLDC_DataCore.Struct.StPlan_EventLog)GlobalUnit.g_CUS.DnbData.CheckPlan[intInc]).EventLogPrjID == Key) { _Item = (CLDC_DataCore.Struct.StPlan_EventLog)GlobalUnit.g_CUS.DnbData.CheckPlan[intInc]; } } } if (_Item.PrjParm == null) { return; } if (_Item.PrjParm.Length < 1) { return; } arrParam = _Item.PrjParm.Split('|'); if (arrParam.Length < 3) { return; } intTestNum = int.Parse(arrParam[2]); if (Data_View.Columns.Count == 0 || MeterGroup.Count == 0) { return; } if (Data_View.Rows.Count != MeterGroup.Count * intTestNum) //如果当前数据表单行数小于电能表表位数,则需要重新创建对应数据表单 { Data_View.Rows.Clear(); for (int intIna = 0; intIna < MeterGroup.Count; intIna++) { for (int intInb = 0; intInb < intTestNum; intInb++) { 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[intIna * intTestNum + intInb].Cells[0].Value = string.Format("第{0}表位", intIna + 1); Data_View.Rows[intIna * intTestNum + intInb].Cells[1].Value = string.Format("上{0}次", intInb + 1); } } Data_View.Refresh(); } for (int intIna = 0; intIna < MeterGroup.Count; intIna++) //循环将电能表数据集合中的时段投切数据值插入到表格中 { for (int intCurrentNum = 1; intCurrentNum <= intTestNum; intCurrentNum++) { for (int intHappen = 1; intHappen <= 2; intHappen++) { if (!MeterGroup[intIna].YaoJianYn) { continue; } string _Key = Key + intPhase.ToString("D2") + intCurrentNum.ToString("D2") + intHappen.ToString("D2"); if (!MeterGroup[intIna].MeterSjJLgns.ContainsKey(_Key)) { for (int k = 0; k < 3; k++) { Data_View.Rows[intIna * intTestNum + intCurrentNum - 1].Cells[(intHappen - 1) * 3 + k + 2].Value = ""; } continue; } if (MeterGroup[intIna].MeterSjJLgns[_Key].RecordOther == null || MeterGroup[intIna].MeterSjJLgns[_Key].RecordOther == string.Empty) { continue; } else { string[] arrValue = null; if (MeterGroup[intIna].MeterSjJLgns[_Key].RecordOther.IndexOf('|') == -1) { continue; } arrValue = MeterGroup[intIna].MeterSjJLgns[_Key].RecordOther.Split('|'); for (int k = 0; k < arrValue.Length; k++) { Data_View.Rows[intIna * intTestNum + intCurrentNum - 1].Cells[(intHappen - 1) * 3 + k + 2].Value = arrValue[k]; } } } } } }
/// <summary> /// 刷新表单数据 /// </summary> /// <param name="MeterGroup"></param> public void SetData(List <CLDC_DataCore.Model.DnbModel.DnbInfo.MeterBasicInfo> MeterGroup) { if (Data_View.Columns.Count < 3 || MeterGroup.Count == 0) { return; //最大需量数据最小有3列标准需量,实际需量,误差 } try { 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(); } for (int i = 0; i < MeterGroup.Count; i++) { int _ColNum = 0; if (MeterGroup[i].YaoJianYn == false) { continue; } if (_Xlzq) { _ColNum = Data_View.Columns.Count - 1; } else { _ColNum = Data_View.Columns.Count; } for (int ColIndex = 0; ColIndex < (int)_ColNum / 3; ColIndex++) { string _Key = string.Format("{0}{1}{2}", Key, Data_View.Columns[ColIndex * 3].Tag, ChildMaxKey); //最大需量值的项目ID if (MeterGroup[i].MeterDgns.Count == 0) { return; } if (MeterGroup[i].MeterDgns.ContainsKey(_Key)) { string[] _Values = MeterGroup[i].MeterDgns[_Key].Md_chrValue.Split('|'); if (_Values.Length >= 3) { for (int j = 0; j < _Values.Length; j++) { Data_View.Rows[i].Cells[j + ColIndex * 3].Value = _Values[j]; } } } } string _XlzqKey = string.Format("{0}{1}", Key, ChildCycKey); //需量周期值的项目ID //if (Data_View.Columns.Count != 5) continue; if (!MeterGroup[i].MeterDgns.ContainsKey(_XlzqKey)) { //Data_View.Rows[i].Cells[Data_View.Columns.Count - 1].Value = ""; //周期误差 continue; //如果不存在该项目ID,则跳出 } if (MeterGroup[i].MeterDgns[_XlzqKey].Md_chrValue == null) { continue; } string[] _CycValues = MeterGroup[i].MeterDgns[_XlzqKey].Md_chrValue.Split('|'); if (_CycValues.Length != 3) { continue; //如果分割后长度不等于3,及表示数据有问题,直接退出 } Data_View.Rows[i].Cells[Data_View.Columns.Count - 1].Value = _CycValues[1]; //周期误差 } } catch (Exception ex) { CLDC_DataCore.Const.GlobalUnit.g_MsgControl.OutMessage(ex.Message, false); } }
/// <summary> /// 刷新表单数据 /// </summary> /// <param name="MeterGroup"></param> public override void SetData(CLDC_DataCore.Model.DnbModel.DnbInfo.MeterBasicInfo MeterInfo, bool allowedit) { Data_View.Rows.Clear(); Data_View.Columns.Clear(); for (int j = _FirstColIndex; j < _FirstColIndex + (int)(30 - _FirstColIndex) / 5; j++) { string _Key = Key + (j - _FirstColIndex + 1).ToString("D2"); int _ColIndex = (int)(_FirstColIndex + (j - _FirstColIndex) * 5D + 0); if (MeterInfo.MeterDgns.ContainsKey(_Key)) { if (MeterInfo.MeterDgns[_Key].Md_chrValue == null || MeterInfo.MeterDgns[_Key].Md_chrValue == string.Empty) { continue; } string[] _Values = MeterInfo.MeterDgns[_Key].Md_chrValue.Split('|'); if (_Values.Length != 6) { continue; //分割出来的数据数组应该是6个元素,试验前分费率电量|试验后分费率电量|试验前总电量|试验后总电量|误差|费率 } int ColIndex = Data_View.Columns.Add("Data_" + j, string.Format("试验前({0})电量", _Values[5])); Data_View.Columns[ColIndex].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; Data_View.Columns[ColIndex].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; Data_View.Columns[ColIndex].SortMode = DataGridViewColumnSortMode.NotSortable; ColIndex = Data_View.Columns.Add("Data_" + j, string.Format("试验后({0})电量", _Values[5])); Data_View.Columns[ColIndex].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; Data_View.Columns[ColIndex].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; Data_View.Columns[ColIndex].SortMode = DataGridViewColumnSortMode.NotSortable; ColIndex = Data_View.Columns.Add("Data_" + j, string.Format("试验前(总)电量", _Values[5])); Data_View.Columns[ColIndex].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; Data_View.Columns[ColIndex].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; Data_View.Columns[ColIndex].SortMode = DataGridViewColumnSortMode.NotSortable; ColIndex = Data_View.Columns.Add("Data_" + j, string.Format("试验后(总)电量", _Values[5])); Data_View.Columns[ColIndex].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; Data_View.Columns[ColIndex].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; Data_View.Columns[ColIndex].SortMode = DataGridViewColumnSortMode.NotSortable; ColIndex = Data_View.Columns.Add("Data_" + j, string.Format("({0})误差", _Values[5])); Data_View.Columns[ColIndex].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; Data_View.Columns[ColIndex].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; Data_View.Columns[ColIndex].DefaultCellStyle.Font = new Font("Arial Black", 10); Data_View.Columns[ColIndex].SortMode = DataGridViewColumnSortMode.NotSortable; if (j == 0) { int RowIndex = Data_View.Rows.Add(); if ((RowIndex + 1) % 4 == 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 = MeterInfo.ToString(); Data_View.Refresh(); } Data_View.Rows[0].Cells[_ColIndex].Value = _Values[0]; //试验前分费率电量 _ColIndex++; Data_View.Rows[0].Cells[_ColIndex].Value = _Values[1]; //试验后分费率电量 _ColIndex++; Data_View.Rows[0].Cells[_ColIndex].Value = _Values[2]; //试验前总电量 _ColIndex++; Data_View.Rows[0].Cells[_ColIndex].Value = _Values[3]; //试验后总电量 _ColIndex++; Data_View.Rows[0].Cells[_ColIndex].Value = _Values[4]; //误差 } } }
/// <summary> /// 刷新表单数据 /// </summary> /// <param name="MeterGroup"></param> public override void SetData(CLDC_DataCore.Model.DnbModel.DnbGroupInfo MeterGroup, bool allowedit) { int intFirstMeter = MeterGroup.GetFirstYaoJianMeterBwh(); Data_View.Rows.Clear(); Data_View.Columns.Clear(); if (MeterGroup.MeterGroup[intFirstMeter].MeterDgns.Count == 0) { return; } string strShowValue = "运行时区|第一套时区表数据|第二套时区表数据|第一套第1日时段表数据|第二套第1日时段表数据|标准时段表数据"; string[] _ShowValues = strShowValue.Split('|'); for (int i = 0; i < _ShowValues.Length; i++) //动态创建数据表单样式 { int ColIndex = Data_View.Columns.Add("Data_" + i, _ShowValues[i]); Data_View.Columns[ColIndex].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; Data_View.Columns[ColIndex].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; Data_View.Columns[ColIndex].SortMode = DataGridViewColumnSortMode.NotSortable; if (i == _ShowValues.Length - 1) { Data_View.Columns[ColIndex].DefaultCellStyle.Font = new Font("Arial Black", 10); } } for (int i = 0; i < MeterGroup._Bws; i++) { //if (!MeterGroup.MeterGroup[i].YaoJianYn) continue; int RowIndex = Data_View.Rows.Add(); if ((RowIndex + 1) % 4 == 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.MeterGroup[i].ToString(); Data_View.Refresh(); for (int j = 1; j <= 6; j++) { string _Key = Key + j.ToString("D2"); int _ColIndex = (int)(_FirstColIndex + j - 1); if (!MeterGroup.MeterGroup[i].MeterDgns.ContainsKey(_Key)) { if (i < Data_View.Rows.Count) { Data_View.Rows[i].Cells[_ColIndex].Value = ""; } continue; } if (MeterGroup.MeterGroup[i].MeterDgns[_Key].Md_chrValue == null || MeterGroup.MeterGroup[i].MeterDgns[_Key].Md_chrValue == string.Empty) { continue; } Data_View.Rows[RowIndex].Cells[_ColIndex].Value = MeterGroup.MeterGroup[i].MeterDgns[_Key].Md_chrValue; } } }
/// <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 加载数据 for (int i = 0; i < MeterGroup.Count; i++) { if (MeterGroup[i].YaoJianYn) { int num = 0; int tmp = 3; for (int j = 0; j < 8; j++) { string keyTemp1 = key2 + (j + 1).ToString().PadLeft(2, '0'); string keyTemp2 = key1 + (j + 1).ToString().PadLeft(2, '0'); if (j < 5) { if (MeterGroup[i].MeterCostControls.ContainsKey(keyTemp1)) { Data_View.Rows[i].Cells[j + num].Value = MeterGroup[i].MeterCostControls[keyTemp1].Mfk_chrData; } else { Data_View.Rows[i].Cells[j + num].Value = ""; } num++; if (MeterGroup[i].MeterCostControls.ContainsKey(keyTemp2)) { Data_View.Rows[i].Cells[j + num].Value = MeterGroup[i].MeterCostControls[keyTemp2].Mfk_chrData; } else { Data_View.Rows[i].Cells[j + num].Value = ""; } } else { if (MeterGroup[i].MeterCostControls.ContainsKey(keyTemp1)) { Data_View.Rows[i].Cells[j + num].Value = MeterGroup[i].MeterCostControls[keyTemp1].Mfk_chrData; } else { Data_View.Rows[i].Cells[j + num].Value = ""; } if (MeterGroup[i].MeterCostControls.ContainsKey(keyTemp2)) { Data_View.Rows[i].Cells[j + num + tmp].Value = MeterGroup[i].MeterCostControls[keyTemp2].Mfk_chrData; } else { Data_View.Rows[i].Cells[j + num + tmp].Value = ""; } } } } } #endregion 加载数据 }
/// <summary> /// 刷新表单数据 /// </summary> /// <param name="MeterGroup"></param> public override void SetData(CLDC_DataCore.Model.DnbModel.DnbInfo.MeterBasicInfo MeterInfo, bool allowedit) { Data_View.Rows.Clear(); Data_View.Columns.Clear(); for (int j = _FirstColIndex; j <= _FirstColIndex + (int)(30 - _FirstColIndex) / 3; j++) { string _Key = Key + (j - _FirstColIndex).ToString("D2"); int _ColIndex = (int)(_FirstColIndex + (j - _FirstColIndex) * 3D + 0); if (MeterInfo.MeterDgns.ContainsKey(_Key)) { if (MeterInfo.MeterDgns[_Key].Md_chrValue == null || MeterInfo.MeterDgns[_Key].Md_chrValue == string.Empty) { continue; } string[] _Values; if (MeterInfo.MeterDgns[_Key].Md_chrValue.IndexOf('|') != -1) { _Values = MeterInfo.MeterDgns[_Key].Md_chrValue.Split('|'); } else { _Values = new string[1]; _Values[0] = MeterInfo.MeterDgns[_Key].Md_chrValue; } if (_Values.Length != 4 && j < _FirstColIndex + (int)(Data_View.Columns.Count - _FirstColIndex) / 3) { continue; //分割出来的数据数组应该是4个元素,标准时间|实际时间|投切误差|费率 } int ColIndex; if (_Values.Length == 4) { ColIndex = Data_View.Columns.Add("Data_" + j, string.Format("试验前({0})电量", _Values[3])); Data_View.Columns[ColIndex].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; Data_View.Columns[ColIndex].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; Data_View.Columns[ColIndex].SortMode = DataGridViewColumnSortMode.NotSortable; ColIndex = Data_View.Columns.Add("Data_" + j, string.Format("试验后({0})电量", _Values[3])); Data_View.Columns[ColIndex].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; Data_View.Columns[ColIndex].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; Data_View.Columns[ColIndex].SortMode = DataGridViewColumnSortMode.NotSortable; ColIndex = Data_View.Columns.Add("Data_" + j, string.Format("({0})电量差值", _Values[3])); Data_View.Columns[ColIndex].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; Data_View.Columns[ColIndex].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; Data_View.Columns[ColIndex].DefaultCellStyle.Font = new Font("Arial Black", 10); Data_View.Columns[ColIndex].SortMode = DataGridViewColumnSortMode.NotSortable; } else { ColIndex = Data_View.Columns.Add("Data_Z", "组合误差"); Data_View.Columns[ColIndex].Tag = 0; Data_View.Columns[ColIndex].AutoSizeMode = DataGridViewAutoSizeColumnMode.DisplayedCells; Data_View.Columns[ColIndex].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; Data_View.Columns[ColIndex].SortMode = DataGridViewColumnSortMode.NotSortable; } if (j == 0) { 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 = MeterInfo.ToString(); Data_View.Refresh(); } if (Data_View.Rows[0].Cells.Count > _ColIndex) { Data_View.Rows[0].Cells[_ColIndex].Value = _Values[0]; //起始电量 _ColIndex++; if (j < _FirstColIndex + (int)(Data_View.Columns.Count - _FirstColIndex) / 3) { Data_View.Rows[0].Cells[_ColIndex].Value = _Values[1]; //终止电量 _ColIndex++; Data_View.Rows[0].Cells[_ColIndex].Value = _Values[2]; //电量差值 } } } } }
/// <summary> /// 刷新表单数据 /// </summary> /// <param name="MeterGroup"></param> public void SetData(List <CLDC_DataCore.Model.DnbModel.DnbInfo.MeterBasicInfo> MeterGroup) { int intRecordType = 1; int intTestNum = 0; string[] arrParam = null; int intSchemeCount = CLDC_DataCore.Const.GlobalUnit.g_CUS.DnbData.CheckPlan.Count; int intKey = int.Parse(Key); CLDC_DataCore.Struct.StPlan_LoadRecord _Item = new CLDC_DataCore.Struct.StPlan_LoadRecord(); for (int intInc = 0; intInc < intSchemeCount; intInc++) { if (GlobalUnit.g_CUS.DnbData.CheckPlan[intInc] is CLDC_DataCore.Struct.StPlan_LoadRecord) { if (((CLDC_DataCore.Struct.StPlan_LoadRecord)GlobalUnit.g_CUS.DnbData.CheckPlan[intInc]).PrjID == Key) { _Item = (CLDC_DataCore.Struct.StPlan_LoadRecord)GlobalUnit.g_CUS.DnbData.CheckPlan[intInc]; intTestNum = _Item.OverTime / 1;// _Item.MarginTime; } } } intRecordType = cmb_RecordType.SelectedIndex + 1; if (intTestNum < 1) { return; } if (intTestNum > 10) { intTestNum = 10; } if (Data_View.Columns.Count == 0 || MeterGroup.Count == 0) { return; } if (Data_View.Rows.Count != MeterGroup.Count * intTestNum) //如果当前数据表单行数小于电能表表位数,则需要重新创建对应数据表单 { Data_View.Rows.Clear(); for (int intIna = 0; intIna < MeterGroup.Count; intIna++) { for (int intInb = 0; intInb < intTestNum; intInb++) { 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[intIna * intTestNum + intInb].Cells[0].Value = string.Format("第{0}表位", intIna + 1); Data_View.Rows[intIna * intTestNum + intInb].Cells[1].Value = string.Format("第{0}次", intInb + 1); } } Data_View.Refresh(); } for (int intIna = 0; intIna < MeterGroup.Count; intIna++) //循环将电能表数据集合中的时段投切数据值插入到表格中 { for (int intCurrentNum = 1; intCurrentNum <= intTestNum; intCurrentNum++) { if (!MeterGroup[intIna].YaoJianYn) { continue; } string _Key = Key + intRecordType.ToString("D2") + intCurrentNum.ToString("D2"); if (MeterGroup[intIna].MeterLoadRecords == null) { continue; } if (!MeterGroup[intIna].MeterLoadRecords.ContainsKey(_Key)) { for (int k = 0; k < 2; k++) { Data_View.Rows[intIna * intTestNum + intCurrentNum - 1].Cells[k + 2].Value = ""; } continue; } if (MeterGroup[intIna].MeterLoadRecords[_Key].Ml_chrValue == null || MeterGroup[intIna].MeterLoadRecords[_Key].Ml_chrValue == string.Empty) { continue; } else { string[] arrValue = null; if (MeterGroup[intIna].MeterLoadRecords[_Key].Ml_chrValue.IndexOf(',') == -1) { continue; } arrValue = MeterGroup[intIna].MeterLoadRecords[_Key].Ml_chrValue.Split(','); for (int k = 0; k < arrValue.Length; k++) { Data_View.Rows[intIna * intTestNum + intCurrentNum - 1].Cells[k + 2].Value = arrValue[k]; } } } } }
/// <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; } 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].MeterCostControls.ContainsKey(keyString)) { Data_View.Rows[i].Cells[column.Index].Value = ""; continue; } else { MeterFK meterDgn = MeterGroup[i].MeterCostControls[keyString]; Data_View.Rows[i].Cells[column.Index].Value = meterDgn.Mfk_chrData; } } } } #endregion 加载数据 }
/// <summary> /// 刷新表单数据 /// </summary> /// <param name="MeterGroup"></param> public void SetData(List <CLDC_DataCore.Model.DnbModel.DnbInfo.MeterBasicInfo> MeterGroup) { if (Data_View.Columns.Count == 0 || MeterGroup.Count == 0) { return; } 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(); } for (int i = 0; i < MeterGroup.Count; i++) //循环将电能表数据集合中的时段投切数据值插入到表格中 { Data_View.Rows[i].Cells[0].Value = string.Format("第{0}表位", i + 1); for (int j = 1; j <= 8; j++) { string _Key = Key + j.ToString("D2"); if (!MeterGroup[i].YaoJianYn) { continue; } if (!MeterGroup[i].MeterFunctions.ContainsKey(_Key)) { for (int k = 0; k < 4; k++) { Data_View.Rows[i].Cells[(j - 1) * 4 + k + 1].Value = ""; } continue; } if (MeterGroup[i].MeterFunctions[_Key].Mf_chrValue == null || MeterGroup[i].MeterFunctions[_Key].Mf_chrValue == string.Empty) { continue; } string[] arrValue = null; if (MeterGroup[i].MeterFunctions[_Key].Mf_chrValue.IndexOf('|') == -1) { continue; } arrValue = MeterGroup[i].MeterFunctions[_Key].Mf_chrValue.Split('|'); for (int k = 0; k < arrValue.Length; k++) { Data_View.Rows[i].Cells[(j - 1) * 4 + k + 1].Value = arrValue[k]; } } } }
/// <summary> /// 刷新表单数据 /// </summary> /// <param name="MeterGroup"></param> public void SetData(List <CLDC_DataCore.Model.DnbModel.DnbInfo.MeterBasicInfo> MeterGroup) { if (Data_View.Columns.Count == 0 || MeterGroup.Count == 0) { return; } 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(); } if ((Data_View.Columns.Count - _FirstColIndex - 1) % 3 != 0) { return; //如果列数不是3的整数倍则退出,因为每个费率需要有3列数据填充 } for (int i = 0; i < MeterGroup.Count; i++) //循环将电能表数据集合中的时段投切数据值插入到表格中 { int j; for (j = _FirstColIndex; j <= _FirstColIndex + (int)(Data_View.Columns.Count - _FirstColIndex) / 3; j++) { string _Key = Key + (j - _FirstColIndex).ToString("D2"); int _ColIndex = (int)(_FirstColIndex + (j - _FirstColIndex) * 3D + 0); if (!MeterGroup[i].MeterDgns.ContainsKey(_Key)) { Data_View.Rows[i].Cells[_ColIndex].Value = ""; //起始电量 _ColIndex++; if (j < _FirstColIndex + (int)(Data_View.Columns.Count - _FirstColIndex) / 3) { Data_View.Rows[i].Cells[_ColIndex].Value = ""; //终止电量 _ColIndex++; Data_View.Rows[i].Cells[_ColIndex].Value = ""; //电量差值 } continue; } if (MeterGroup[i].MeterDgns[_Key].Md_chrValue == null || MeterGroup[i].MeterDgns[_Key].Md_chrValue == string.Empty) { continue; } string[] _Values; if (j < _FirstColIndex + (int)(Data_View.Columns.Count - _FirstColIndex) / 3) { _Values = MeterGroup[i].MeterDgns[_Key].Md_chrValue.Split('|'); } else { _Values = new string[1]; _Values[0] = MeterGroup[i].MeterDgns[_Key].Md_chrValue; } if (_Values.Length != 4 && j < _FirstColIndex + (int)(Data_View.Columns.Count - _FirstColIndex) / 3) { continue; //分割出来的数据数组应该是4个元素,标准时间|实际时间|投切误差|费率 } Data_View.Rows[i].Cells[_ColIndex].Value = _Values[0]; //起始电量 _ColIndex++; if (j < _FirstColIndex + (int)(Data_View.Columns.Count - _FirstColIndex) / 3) { Data_View.Rows[i].Cells[_ColIndex].Value = _Values[1]; //终止电量 _ColIndex++; Data_View.Rows[i].Cells[_ColIndex].Value = _Values[2]; //电量差值 } } try { string _Key = Key + (j + 1).ToString("D2"); if (!MeterGroup[i].MeterDgns.ContainsKey(_Key)) { Data_View.Rows[i].Cells[Data_View.Columns.Count - 1].Value = ""; } else { if (MeterGroup[i].MeterDgns[_Key].Md_chrValue != null) { Data_View.Rows[i].Cells[Data_View.Columns.Count - 1].Value = MeterGroup[i].MeterDgns[_Key].Md_chrValue; } } } catch (Exception ex) {} } }