/// <summary> /// 将DT转换为List /// </summary> /// <param name="dt"></param> /// <returns></returns> public static List <CrossControlItem> ToList(DataTable dt) { List <CrossControlItem> ret = new List <CrossControlItem>(); if (null != dt) { CrossControlItem temp; for (int i = 0; i < dt.Rows.Count; i++) { temp = new CrossControlItem(); temp.ArrPoint = dt.Rows[i]["ArrPoint"].ToString(); temp.ControlType = dt.Rows[i]["ControlType"].ToString(); temp.FeedBackPointName = dt.Rows[i]["FeedBackPointName"].ToString(); temp.DelInfBtnStr = "删除"; ret.Add(temp); } } return(ret); }
/// <summary> /// 设置交叉控制信息 /// </summary> /// <param name="arrPoint"></param> /// <returns></returns> private void getCrossInf(string arrPoint) { try { Jc_DefInfo temp = Model.DEFServiceModel.QueryPointByCodeCache(arrPoint); if (temp == null) { return; } CrossControlList.Clear(); string[] ControlPoints; Jc_DefInfo tempPoint; CrossControlItem tempCrossItem; if (!string.IsNullOrEmpty(temp.Jckz1)) { ControlPoints = temp.Jckz1.Split('|'); if (ControlPoints.Length > 0) { for (int i = 0; i < ControlPoints.Length; i++) { tempCrossItem = new CrossControlItem(); tempPoint = Model.DEFServiceModel.QueryPointByCodeCache(ControlPoints[i]); if (null != tempPoint) { tempCrossItem.ControlType = "0态控制"; tempCrossItem.ArrPoint = tempPoint.Point; tempCrossItem.PointName = tempPoint.Point + ":" + tempPoint.Wz; if (tempPoint.K1 > 0 & tempPoint.K2 > 0) { tempCrossItem.FeedBackPointName = tempPoint.K1.ToString().PadLeft(3, '0') + "D" + tempPoint.K2.ToString().PadLeft(2, '0') + tempPoint.K4.ToString() + "." + Model.DEFServiceModel.QueryPointByCodeCache(tempPoint.K1.ToString().PadLeft(3, '0') + "D" + tempPoint.K2.ToString().PadLeft(2, '0') + tempPoint.K4.ToString()).Wz; } CrossControlList.Add(tempCrossItem); } } } } if (!string.IsNullOrEmpty(temp.Jckz2)) { ControlPoints = temp.Jckz2.Split('|'); if (ControlPoints.Length > 0) { for (int i = 0; i < ControlPoints.Length; i++) { tempCrossItem = new CrossControlItem(); tempPoint = Model.DEFServiceModel.QueryPointByCodeCache(ControlPoints[i]); if (null != tempPoint) { tempCrossItem.ControlType = "1态控制"; tempCrossItem.ArrPoint = tempPoint.Point; tempCrossItem.PointName = tempPoint.Point + ":" + tempPoint.Wz; if (tempPoint.K1 > 0 & tempPoint.K2 > 0) { tempCrossItem.FeedBackPointName = tempPoint.K1.ToString().PadLeft(3, '0') + "D" + tempPoint.K2.ToString().PadLeft(2, '0') + tempPoint.K4.ToString() + "." + Model.DEFServiceModel.QueryPointByCodeCache(tempPoint.K1.ToString().PadLeft(3, '0') + "D" + tempPoint.K2.ToString().PadLeft(2, '0') + tempPoint.K4.ToString()).Wz; } CrossControlList.Add(tempCrossItem); } } } } if (!string.IsNullOrEmpty(temp.Jckz3)) { ControlPoints = temp.Jckz3.Split('|'); if (ControlPoints.Length > 0) { for (int i = 0; i < ControlPoints.Length; i++) { tempCrossItem = new CrossControlItem(); tempPoint = Model.DEFServiceModel.QueryPointByCodeCache(ControlPoints[i]); if (null != tempPoint) { tempCrossItem.ControlType = "2态控制"; tempCrossItem.ArrPoint = tempPoint.Point; tempCrossItem.PointName = tempPoint.Point + ":" + tempPoint.Wz; if (tempPoint.K1 > 0 & tempPoint.K2 > 0) { tempCrossItem.FeedBackPointName = tempPoint.K1.ToString().PadLeft(3, '0') + "D" + tempPoint.K2.ToString().PadLeft(2, '0') + tempPoint.K4.ToString() + "." + Model.DEFServiceModel.QueryPointByCodeCache(tempPoint.K1.ToString().PadLeft(3, '0') + "D" + tempPoint.K2.ToString().PadLeft(2, '0') + tempPoint.K4.ToString()).Wz; } CrossControlList.Add(tempCrossItem); } } } } } catch (Exception ex) { LogHelper.Error("获得交叉控制信息【getCrossInf】", ex); } }
/// <summary> /// 加载测点的默认信息函数 /// </summary> public override void LoadPretermitInf() { //逻辑报警 CcmbLogicAlarmCon.Properties.Items.Add(""); CcmbLogicAlarmCon.Properties.Items.Add("与"); CcmbLogicAlarmCon.Properties.Items.Add("或"); //注释非 20170714 //CcmbLogicAlarmCon.Properties.Items.Add("非"); IList <Jc_DefInfo> temp = Model.DEFServiceModel.QueryPointByInfs((int)_SourceNum, 2); //得到默认的开关量关联测点 CcmbLogicAlarmPoint.Properties.Items.Add(" "); if (temp.Count > 0) { for (int i = 0; i < temp.Count; i++) { if (_arrPoint != temp[i].Point) { CcmbLogicAlarmPoint.Properties.Items.Add(temp[i].Point + "." + temp[i].Wz); //加入默认的测点 } } } //报警控制 CckZeroAlarm.Checked = false; CckOneAlarm.Checked = false; CckTwoAlarm.Checked = false; IList <Jc_DevInfo> DerailType = Model.DEVServiceModel.QueryDevByDevpropertIDCache(2);; if (DerailType.Count > 0) { for (int i = 0; i < DerailType.Count; i++) { if (!CcmbZeroContent.Properties.Items.Contains(DerailType[i].Xs1)) { CcmbZeroContent.Properties.Items.Add(DerailType[i].Xs1);//0态显示内容 } if (!CcmbOneContent.Properties.Items.Contains(DerailType[i].Xs2)) { CcmbOneContent.Properties.Items.Add(DerailType[i].Xs2);//1态显示内容 } if (!CcmbTwoContent.Properties.Items.Contains(DerailType[i].Xs3)) { CcmbTwoContent.Properties.Items.Add(DerailType[i].Xs3);//2态显示内容 } } } //显示颜色 this.CpZeroColour.Color = Color.Yellow; this.CpOneColour.Color = Color.Red; this.CpTwoColour.Color = Color.Green; //控制Enable IList <Jc_DefInfo> tempLocalControl = Model.DEFServiceModel.QueryPointByInfs((int)_SourceNum, 3); //获得所有滴Local控制量 if (tempLocalControl != null) { for (int i = 0; i < tempLocalControl.Count; i++) { cckLocalControlZero.Properties.Items.Add(tempLocalControl[i].Point); cckLocalControlOne.Properties.Items.Add(tempLocalControl[i].Point); cckLocalControlTwo.Properties.Items.Add(tempLocalControl[i].Point); if (!Model.RelateUpdate.ControlPointLegal(tempLocalControl[i])) //xuzp20151126 { cckLocalControlZero.Properties.Items[tempLocalControl[i].Point].Enabled = false; cckLocalControlOne.Properties.Items[tempLocalControl[i].Point].Enabled = false; cckLocalControlTwo.Properties.Items[tempLocalControl[i].Point].Enabled = false; } } } List <string> StationWindBreakControlPoint = Model.RelateUpdate.GetStationWindBreakControlPoint(); //获取所有甲烷风电闭锁控制口 20170923 IList <Jc_DefInfo> tempControl = Model.DEFServiceModel.QueryPointByDevpropertIDCache(3); //获得所有的控制量 if (null != tempControl) //xuzp20151126 { if (tempControl.Count > 0) { try { tempControl = tempControl.OrderBy(item => item.Fzh).ThenBy(item => item.Kh).ToList(); } catch (Exception ex) { LogHelper.Error(ex); } List <CrossControlItem> tempControlList = new List <CrossControlItem>(); for (int i = 0; i < tempControl.Count; i++) { if (tempControl[i].Fzh != base._SourceNum) { //if (!Model.RelateUpdate.ControlPointLegal(tempControl[i])) //xuzp20151126 //{ // continue; //} //不每次从服务端查询,先获取分站对应的风电闭锁控制口,再判断当前是否包含在风电闭锁控制中 20170721 if (StationWindBreakControlPoint.Contains(tempControl[i].Point)) { continue; } CrossControlItem tempItem = new CrossControlItem(); tempItem.ArrPoint = tempControl[i].Point; tempItem.PointName = tempControl[i].Point + ":" + tempControl[i].Wz; tempControlList.Add(tempItem); } } repositoryItemLookUpEdit2.DataSource = tempControlList; } } repositoryItemComboBox2.Items.Add("0态控制"); repositoryItemComboBox2.Items.Add("1态控制"); repositoryItemComboBox2.Items.Add("2态控制"); }
private void gridLookUpEdit_EditValueChanged(object sender, EventArgs e) { try { string daID = this.gridLookUpEdit.EditValue.ToString(); //是ookUpEdit.Properties.ValueMember的值 string xm = this.gridLookUpEdit.Text.Trim(); gridControlLargedataData.DataSource = largedataAnalysisConfigBusiness.GetLargedataAnalysisConfigDetailById(daID); List <JC_RegionOutageConfigInfo> regionOutageConfigInfoList = regionOutageBusiness.GetRegionOutage(daID); CrossControlList = new List <CrossControlItem>(); DeControlItemList = new List <DeControlItem>(); bool isRemoveControl = false; if (regionOutageConfigInfoList != null && regionOutageConfigInfoList.Count > 0) { foreach (var item in regionOutageConfigInfoList) { if (item.ControlStatus == 1) { isRemoveControl = item.IsRemoveControl == 1 ? true : false; CrossControlItem crossControlItem = new CrossControlItem(); crossControlItem.PointId = item.PointId; crossControlItem.Point = item.Point; if (item.ControlStatus == 1) { crossControlItem.ControlType = "控制"; } else { crossControlItem.ControlType = "解除控制"; } crossControlItem.DelInfBtnStr = "删除"; CrossControlList.Add(crossControlItem); } else { DeControlItem DeControlItem = new DeControlItem(); DeControlItem.PointId = item.PointId; DeControlItem.Point = item.Point; DeControlItem.RemoveModelId = item.RemoveModelId; DeControlItem.RemoveModelName = item.RemoveModelName; DeControlItem.DelInfBtnStrFalse = "删除"; DeControlItemList.Add(DeControlItem); } } } checkEditRemoveControl.Checked = isEdit ? isRemoveControl : true; CdgControl.DataSource = ToDataTable(CrossControlList); gridControlFalse.DataSource = ToDataTable(DeControlItemList); if (DeControlItemList.Count > 0) { checkEditRemoveControl.Enabled = false; } List <JC_LargedataAnalysisConfigInfo> JC_LargedataAnalysisConfigInfoList = largedataAnalysisConfigBusiness.GetLargeDataAnalysisConfigWithRegionOutage(string.Empty); if (!string.IsNullOrEmpty(daID) && JC_LargedataAnalysisConfigInfoList != null && JC_LargedataAnalysisConfigInfoList.Count > 0) { JC_LargedataAnalysisConfigInfo selectedAnalysisModel = JC_LargedataAnalysisConfigInfoList.FirstOrDefault(q => q.Id == daID); if (null != selectedAnalysisModel) { JC_LargedataAnalysisConfigInfoList.Remove(selectedAnalysisModel); } } lookUpEditAnalysisTemplate.Properties.DataSource = JC_LargedataAnalysisConfigInfoList; } catch (Exception ex) { LogHelper.Error(ex.Message); } }