private void WindPowerLockPointBind_Load(object sender, EventArgs e) { //加载列表 DataTable dtRvalue = new DataTable(); var request = new LoadAllpointDefByTypeRequest() { Type = "4" }; var resposne = _GraphicsbaseinfService.LoadAllpointDefByType(request); dtRvalue = resposne.Data; if (dtRvalue.Rows.Count > 0) { DataRow[] _DataRow = dtRvalue.Select("DevName like '%开停%' and Point like '" + _StationNumber.ToString("000") + "%'"); dtRvalue = ToDataTable(_DataRow); } if (dtRvalue.Rows.Count > 0) { gridControl1.DataSource = dtRvalue; //设置选择状态 for (int i = 0; i < dtRvalue.Rows.Count; i++) { if (_EditPoint.Contains(gridView1.GetDataRow(i).ItemArray[0].ToString())) { gridView1.FocusedRowHandle = i; } } } }
/// <summary> /// 加载所有测点定义信息(含交换机) /// </summary> /// <param name="graphicsbaseinfrequest"></param> /// <returns></returns> public BasicResponse <DataTable> LoadAllpointDefByType(LoadAllpointDefByTypeRequest graphicsbaseinfrequest) { var response = new BasicResponse <DataTable>(); if (string.IsNullOrWhiteSpace(graphicsbaseinfrequest.Type)) { response.Code = -100; response.Message = "参数错误!"; return(response); } try { DataTable dtRvalue = new DataTable(); DataTable dtPoint = new DataTable(); DataTable dtIP = new DataTable(); DataRow[] drRval; dtPoint = _Repository.GetAllPoint(); //dtPoint = _Repository.GetAllEmergencyLinkPoint(); dtIP = _Repository.GetAllIp(); if (dtIP != null && dtIP.Rows.Count > 0) { foreach (DataRow item in dtIP.Rows) { DataRow drtemp = dtPoint.NewRow(); drtemp.ItemArray = item.ItemArray; dtPoint.Rows.InsertAt(drtemp, 0); } } dtRvalue = dtPoint.Clone(); switch (graphicsbaseinfrequest.Type) { case "0": //所有测点 dtRvalue = dtPoint.Copy(); break; case "1": //分站 drRval = dtPoint.Select("type='0'", "Point asc"); foreach (DataRow dr in drRval) { dtRvalue.Rows.Add(dr.ItemArray); } break; case "2": //所有传感器 drRval = dtPoint.Select("type>0 and type<10", "Point asc"); foreach (DataRow dr in drRval) { dtRvalue.Rows.Add(dr.ItemArray); } break; case "3": //交换机 drRval = dtPoint.Select("type='10'", "Point asc"); foreach (DataRow dr in drRval) { dtRvalue.Rows.Add(dr.ItemArray); } break; case "4": //开关量 drRval = dtPoint.Select("type='2'", "Point asc"); foreach (DataRow dr in drRval) { dtRvalue.Rows.Add(dr.ItemArray); } break; case "5": //模拟量 drRval = dtPoint.Select("type='1'", "Point asc"); foreach (DataRow dr in drRval) { dtRvalue.Rows.Add(dr.ItemArray); } break; case "6": //控制量 drRval = dtPoint.Select("type='3'", "Point asc"); foreach (DataRow dr in drRval) { dtRvalue.Rows.Add(dr.ItemArray); } break; case "7": //开关量及控制量 drRval = dtPoint.Select("type='3' or type='2'", "Point asc"); foreach (DataRow dr in drRval) { dtRvalue.Rows.Add(dr.ItemArray); } break; } response.Data = dtRvalue; } catch (Exception ex) { response.Code = -100; response.Message = ex.Message; this.ThrowException("LoadAllpointDefByType-加载所有测点定义信息(含交换机)", ex); } return(response); }
public BasicResponse <DataTable> LoadAllpointDefByType(LoadAllpointDefByTypeRequest graphicsbaseinfrequest) { var responsestr = HttpClientHelper.Post(Webapi + "/v1/graphicsbaseinf/loadallpointdefbytype?token=" + Token, JSONHelper.ToJSONString(graphicsbaseinfrequest)); return(JSONHelper.ParseJSONString <BasicResponse <DataTable> >(responsestr)); }
public BasicResponse <DataTable> LoadAllpointDefByType(LoadAllpointDefByTypeRequest graphicsbaseinfrequest) { return(graphicsbaseinfService.LoadAllpointDefByType(graphicsbaseinfrequest)); }