/// <summary> /// 获取显示数据 /// </summary> private void getmsg(Jc_DefInfo def, DataTable dt) { DataRow[] rows; DataRow row; float ssz = 0; if (objfz.fzh != 0) { PointDefineGetByStationIDRequest PointDefineRequest = new PointDefineGetByStationIDRequest(); PointDefineRequest.StationID = objfz.fzh; //List<Jc_DefInfo> FzList = pointDefineService.GetPointDefineCacheByStationID(PointDefineRequest).Data; //多系统融合修改 20171123 List <Jc_DefInfo> FzList = allSystemPointDefineService.GetPointDefineCacheByStationID(PointDefineRequest).Data; Jc_DefInfo FzInfo = FzList.Find(a => a.DevPropertyID == 0); Jc_DevInfo FzDev = new Jc_DevInfo(); if (FzInfo != null) { if (FzInfo != null) { DeviceDefineGetByDevIdRequest DeviceDefineRequest = new DeviceDefineGetByDevIdRequest(); DeviceDefineRequest.DevId = FzInfo.Devid; FzDev = deviceDefineService.GetDeviceDefineCacheByDevId(DeviceDefineRequest).Data; } } if (objfz.showdt != null) { objfz.showdtrowscount = objfz.showdt.Rows.Count; objfz.topindex1 = mainGridView.TopRowIndex; if (mainGridView.FocusedColumn != null) { objfz.showdtfocusrowid = mainGridView.FocusedRowHandle; objfz.showdtfocuscolid = mainGridView.FocusedColumn.ColumnHandle; } } if (objfz.showdtkz != null) { objfz.showdtkzrowscount = objfz.showdtkz.Rows.Count; objfz.topindex2 = gridView1.TopRowIndex; if (gridView1.FocusedColumn != null) { objfz.showdtkzfocuscolid = gridView1.FocusedColumn.ColumnHandle; objfz.showdtkzfocusrowid = gridView1.FocusedRowHandle; } } objfz.clear(); lock (StaticClass.allPointDtLockObj) { rows = StaticClass.AllPointDt.Select("fzh='" + objfz.fzh + "' and lx='分站'"); if (rows.Length > 0) { objfz.point = rows[0]["point"].ToString(); if (def != null) { if (FzDev != null && FzDev.LC2 == 13)//这几种分站都支持电量显示 { objfz.power = def.Voltage.ToString(); labelControl7.Text = "电量"; } else if (FzDev != null && (FzDev.LC2 == 12 || FzDev.LC2 == 15)) { objfz.power = def.Voltage.ToString(); labelControl7.Text = "电压"; } else { objfz.power = "-"; } objfz.wz = def.Wz; objfz.type = def.DevName; rows = StaticClass.AllPointDt.Select("point='" + objfz.point + "'"); if (rows.Length > 0) { objfz.sszcolor = rows[0]["sszcolor"].ToString(); } else { objfz.sszcolor = Color.Blue.ToArgb().ToString(); } objfz.mac = def.Jckz1; objfz.ip = def.Jckz2; objfz.ssz = OprFuction.StateChange(def.State.ToString()); objfz.stationDyType = rows[0]["StationDyType"].ToString() == "1" ? "通讯故障" : "通讯正常"; } //rows = StaticClass.AllPointDt.Select("fzh=" + objfz.fzh, "tdh"); //重新排列 按基础通道,智能通道,控制通道,累计通道顺序进行排序 20170715 DataTable SortShowDt = StaticClass.AllPointDt.Clone(); //加载基础通道 DataRow[] BaseChanelInStation = StaticClass.AllPointDt.Select("fzh='" + objfz.fzh + "' and (tdh<=16 or (tdh>=40 and tdh<=43)) and (lxtype='1' or lxtype='2' or (lxtype='3' and dzh>0))", "fzh,tdh,dzh ASC"); foreach (DataRow temprow in BaseChanelInStation) { SortShowDt.Rows.Add(temprow.ItemArray); } //加载智能通道 DataRow[] SmartChanelInStation = StaticClass.AllPointDt.Select("fzh='" + objfz.fzh + "' and tdh>=17 and tdh<=24 ", "fzh,tdh,dzh ASC"); foreach (DataRow temprow in SmartChanelInStation) { SortShowDt.Rows.Add(temprow.ItemArray); } //加载本地控制通道 DataRow[] ControlChanelInStation = StaticClass.AllPointDt.Select("fzh='" + objfz.fzh + "' and (lxtype='3' and dzh=0)", "fzh,tdh,dzh ASC"); foreach (DataRow temprow in ControlChanelInStation) { SortShowDt.Rows.Add(temprow.ItemArray); } //加载累计通道 DataRow[] TiredChanelInStation = StaticClass.AllPointDt.Select("fzh='" + objfz.fzh + "' and (lxtype='4')", "fzh,tdh,dzh ASC"); foreach (DataRow temprow in TiredChanelInStation) { SortShowDt.Rows.Add(temprow.ItemArray); } //加载人员通道 DataRow[] PointChanelInStation = StaticClass.AllPointDt.Select("fzh='" + objfz.fzh + "' and (lxtype='7')", "fzh,tdh,dzh ASC"); foreach (DataRow temprow in PointChanelInStation) { SortShowDt.Rows.Add(temprow.ItemArray); } rows = SortShowDt.Select("1=1"); if (rows.Length > 0) { for (int i = 0; i < rows.Length; i++) { row = objfz.showdt.NewRow(); row["point"] = rows[i]["point"]; row["wz"] = rows[i]["wz"]; row["type"] = rows[i]["lb"]; if (int.Parse(rows[i]["zt"].ToString()) == StaticClass.itemStateToClient.EqpState33)//休眠 { row["ssz"] = OprFuction.StateChange(rows[i]["zt"].ToString()); } else { if (rows[i]["lx"].ToString() == "模拟量" && float.TryParse(rows[i]["ssz"].ToString(), out ssz)) { try { if (rows[i]["zl"].ToString().Contains("甲烷")) { if (rows[i]["ssz"].ToString() == "0") { rows[i]["ssz"] = "0.00"; } } } catch (Exception ex) { Basic.Framework.Logging.LogHelper.Error(ex.ToString()); } row["ssz"] = rows[i]["ssz"].ToString() + " " + rows[i]["dw"].ToString(); } else { row["ssz"] = rows[i]["ssz"]; } } row["state"] = OprFuction.StateChange(rows[i]["zt"].ToString()); if (FzDev != null && (FzDev.LC2 == 13 || FzDev.LC2 == 12 || FzDev.LC2 == 15)) { if (rows[i]["lb"].ToString().Contains("无线")) { row["voltage"] = rows[i]["voltage"].ToString() + "%"; } else { row["voltage"] = rows[i]["voltage"].ToString() + "V"; } } else { row["voltage"] = "-"; } row["sxyj"] = rows[i]["sxyj"].ToString() == "0" ? "-" : rows[i]["sxyj"].ToString(); row["sxbj"] = rows[i]["sxbj"].ToString() == "0" ? "-" : rows[i]["sxbj"].ToString(); row["sxdd"] = rows[i]["sxdd"].ToString() == "0" ? "-" : rows[i]["sxdd"].ToString(); row["sxfd"] = rows[i]["sxfd"].ToString() == "0" ? "-" : rows[i]["sxfd"].ToString(); row["xxyj"] = rows[i]["xxyj"].ToString() == "0" ? "-" : rows[i]["xxyj"].ToString(); row["xxbj"] = rows[i]["xxbj"].ToString() == "0" ? "-" : rows[i]["xxbj"].ToString(); row["xxdd"] = rows[i]["xxdd"].ToString() == "0" ? "-" : rows[i]["xxdd"].ToString(); row["xxfd"] = rows[i]["xxfd"].ToString() == "0" ? "-" : rows[i]["xxfd"].ToString(); objfz.showdt.Rows.Add(row); } } if (dt != null) { objfz.showdtkz = dt; } } } } realshow(); }
public BasicResponse <Jc_DevInfo> GetDeviceDefineCacheByDevId(Sys.Safety.Request.DeviceDefine.DeviceDefineGetByDevIdRequest DeviceDefineRequest) { return(_DeviceDefineService.GetDeviceDefineCacheByDevId(DeviceDefineRequest)); }