/// <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> /// <param name="taiType"></param> /// <param name="taiId"></param> public void RefreshData(CLDC_DataCore.Model.DnbModel.DnbGroupInfo meterGroup, int CheckOrderID) { if (!(meterGroup.CheckPlan[CheckOrderID] is CLDC_DataCore.Struct.StPlan_EventLog)) { return; } CLDC_DataCore.Struct.StPlan_EventLog _Item = (CLDC_DataCore.Struct.StPlan_EventLog)meterGroup.CheckPlan[CheckOrderID]; bool bFind = false; if (Tab_EventLog.TabPages.Count > 1) //如果Tab的页数大于1,那表示存在动态增加的数据页 { if (Data_EventLog.Tag != null && Data_EventLog.Tag.ToString() == _Item.EventLogPrjID) { bFind = true; } else { for (int i = Tab_EventLog.TabPages.Count - 1; i > 0; i--) { Tab_EventLog.TabPages.RemoveAt(i); } bFind = false; } } if (!bFind) { Data_EventLog.Tag = _Item.EventLogPrjID; //将ID值放到数据列表的Tag中,供数据刷新使用 switch (_Item.EventLogPrjID) { case "001": { Tab_EventLog.TabPages.Add("失压事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventLoseVoltage _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventLoseVoltage(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } case "002": { Tab_EventLog.TabPages.Add("过压事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventOverVoltage _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventOverVoltage(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } case "003": { Tab_EventLog.TabPages.Add("欠压事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventUnderVoltage _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventUnderVoltage(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } case "004": { Tab_EventLog.TabPages.Add("失流事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventLoseCurrent _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventLoseCurrent(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } case "005": { Tab_EventLog.TabPages.Add("断流事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventStopCurrent _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventStopCurrent(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } case "006": { Tab_EventLog.TabPages.Add("过流事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventOverCurrent _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventOverCurrent(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } //case "006": // { // Tab_EventLog.TabPages.Add("过流(485)事件记录数据"); // CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventPassCurrent_485 _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventPassCurrent_485(); // Tab_EventLog.TabPages[1].Controls.Add(_View); // _View.Dock = DockStyle.Fill; // _View.Margin = new Padding(0); // break; // } case "007": { Tab_EventLog.TabPages.Add("过载事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventOverLoad _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventOverLoad(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } case "008": { Tab_EventLog.TabPages.Add("断相事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventStopPhase _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventStopPhase(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } case "009": { Tab_EventLog.TabPages.Add("掉电事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventACdump _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventACdump(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } case "010": { Tab_EventLog.TabPages.Add("全失压事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventLoseFullVoltage _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventLoseFullVoltage(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } case "011": { Tab_EventLog.TabPages.Add("电压不平衡事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventImbalanceU _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventImbalanceU(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } case "012": { Tab_EventLog.TabPages.Add("电流不平衡事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventImbalanceI _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventImbalanceI(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } case "013": { Tab_EventLog.TabPages.Add("电压逆相序事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventReversePhaseU _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventReversePhaseU(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } case "014": { Tab_EventLog.TabPages.Add("电流逆相序事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventReversePhaseI _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventReversePhaseI(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } case "015": { Tab_EventLog.TabPages.Add("开表盖事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventOpenMeterCover _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventOpenMeterCover(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } case "016": { Tab_EventLog.TabPages.Add("开端钮盒事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventOpenButtonCover _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventOpenButtonCover(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } case "017": { Tab_EventLog.TabPages.Add("编程事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventPrograme _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventPrograme(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } case "018": { Tab_EventLog.TabPages.Add("校时事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventCalibrationTime _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventCalibrationTime(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } case "019": { Tab_EventLog.TabPages.Add("需量清零事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventClearDemand _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventClearDemand(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } case "020": { Tab_EventLog.TabPages.Add("事件清零事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventClearEvent _View = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventClearEvent(); Tab_EventLog.TabPages[1].Controls.Add(_View); _View.Dock = DockStyle.Fill; _View.Margin = new Padding(0); break; } case "021": { Tab_EventLog.TabPages.Add("电表清零事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventClearEnergy _Event = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventClearEnergy(); Tab_EventLog.TabPages[1].Controls.Add(_Event); _Event.Dock = DockStyle.Fill; _Event.Margin = new Padding(0); break; } case "022": { Tab_EventLog.TabPages.Add("潮流反向事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventReverseTrend _Event = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventReverseTrend(); Tab_EventLog.TabPages[1].Controls.Add(_Event); _Event.Dock = DockStyle.Fill; _Event.Margin = new Padding(0); break; } case "023": { Tab_EventLog.TabPages.Add("功率反向事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventReversePower _Event = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventReversePower(); Tab_EventLog.TabPages[1].Controls.Add(_Event); _Event.Dock = DockStyle.Fill; _Event.Margin = new Padding(0); break; } case "024": { Tab_EventLog.TabPages.Add("需量超限事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventTransDemand _Event = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventTransDemand(); Tab_EventLog.TabPages[1].Controls.Add(_Event); _Event.Dock = DockStyle.Fill; _Event.Margin = new Padding(0); break; } case "025": { Tab_EventLog.TabPages.Add("功率因数超下限事件记录数据"); CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventTransPF _Event = new CLDC_MeterUI.UI_Detection_New.EventLogDataView.ViewEventTransPF(); Tab_EventLog.TabPages[1].Controls.Add(_Event); _Event.Dock = DockStyle.Fill; _Event.Margin = new Padding(0); break; } } } this.RefreshGrid(meterGroup, CheckOrderID); Data_EventLog.Enabled = true; }