/// <summary> /// 获取新增预警信息 /// </summary> public void getdata() { short type = 0; long id = 0; Jc_BInfo jcb = null; Jc_BInfo obj = null; lock (StaticClass.bjobj) { try { #region 获取预警信息 foreach (long key in StaticClass.jcbdata.Keys) { jcb = StaticClass.jcbdata[key]; type = jcb.Type; if (type == StaticClass.itemStateToClient.EqpState7 || type == StaticClass.itemStateToClient.EqpState17) { id = long.Parse(jcb.ID); if (!jc_b.ContainsKey(id)) { #region 新增预警 obj = OprFuction.NewDTO(jcb); jc_b.Add(id, obj); addlist.Add(id); #endregion } else { #region 新增预警结束 if (!OprFuction.IsInitTime(jcb.Etime)) { if (OprFuction.IsInitTime(jc_b[id].Etime)) { obj = OprFuction.NewDTO(jcb); jc_b[id] = obj; updatelist.Add(id); } } #endregion } } } #region 判断是否预警还存在 foreach (long key in jc_b.Keys) { if (!StaticClass.jcbdata.ContainsKey(key)) { deletelist.Add(key); } } #endregion #endregion } catch (Exception ex) { Basic.Framework.Logging.LogHelper.Error(ex); } } }
/// <summary> /// 获取新增报警断电信息 /// </summary> public void getdata() { short type = 0; Jc_BInfo jcb = null; Jc_BInfo obj = null; DateTime maxtime = timenow; long key = 0; List <long> listkey; lock (StaticClass.bjobj) { #region 获取控制数据 try { listkey = StaticClass.jcbdata.Keys.ToList(); for (int kj = 0; kj < listkey.Count; kj++) { key = listkey[kj]; jcb = StaticClass.jcbdata[key]; type = jcb.Type; if (!string.IsNullOrEmpty(jcb.Kzk)) { if (OprFuction.IsInitTime(jcb.Etime)) { if (!jc_b.ContainsKey(long.Parse(jcb.ID))) { #region 新增主控点引发控制 obj = OprFuction.NewDTO(jcb); jc_b.Add(long.Parse(jcb.ID), obj); addlist.Add(long.Parse(jcb.ID)); #endregion } else { if (jc_b[long.Parse(jcb.ID)].Kzk != jcb.Kzk) { obj = OprFuction.NewDTO(jcb); jc_b[long.Parse(jcb.ID)] = obj; addlist.Add(long.Parse(jcb.ID)); } } } else//只要列表中未结束的记录都更新,此处不需要每次加到uplist中 20170715 { //if (jc_b.ContainsKey(long.Parse(jcb.ID)))//&& !OprFuction.IsInitTime(jc_b[long.Parse(jcb.ID)].Etime) 20170706 //{ // #region 新增主控点引发控制 // obj = OprFuction.NewDTO(jcb); // jc_b[long.Parse(jcb.ID)] = obj; // uplist.Add(long.Parse(jcb.ID)); // #endregion //} } } else { //解决控制口取消绑定后,无法删除实时控制记录问题 2017.7.11 by if (jc_b.ContainsKey(long.Parse(jcb.ID))) { deletelist.Add(long.Parse(jcb.ID)); } } } } catch (Exception ex) { Basic.Framework.Logging.LogHelper.Error(ex); } #region 判断记录是否可以删除 DateTime now = Model.RealInterfaceFuction.GetServerNowTime(); listkey = jc_b.Keys.ToList(); for (int kj = 0; kj < listkey.Count; kj++) { key = listkey[kj]; if (!StaticClass.jcbdata.ContainsKey(key)) { deletelist.Add(key); } } #endregion #endregion } }
/// <summary> /// 获取新增报警断电信息 /// </summary> public void getdata() { long id = 0; Jc_BInfo jcb = null; Jc_BInfo obj = null; long key = 0; List <long> listkey; lock (StaticClass.bjobj) { try { #region 获取馈电异常信息 listkey = StaticClass.jcbdata.Keys.ToList(); for (int kj = 0; kj < listkey.Count; kj++) { key = listkey[kj]; jcb = StaticClass.jcbdata[key]; if (!string.IsNullOrEmpty(jcb.Kdid)) { id = long.Parse(jcb.ID); if (!jc_b.ContainsKey(id)) { #region 新增报警断电馈电 obj = OprFuction.NewDTO(jcb); jc_b.Add(id, obj); addlist.Add(id); #endregion } else { #region update 报警 断电 if (jc_b[id].Kdid != jcb.Kdid) { obj = OprFuction.NewDTO(jcb); jc_b[id] = obj; updatelist.Add(id); } else if (jc_b[id].Cs != jcb.Cs)//措施改变进行页面更新 20180206 { obj = OprFuction.NewDTO(jcb); jc_b[id] = obj; updatelist.Add(id); } #endregion } } } #region 判断报警断电是否还存在 listkey = jc_b.Keys.ToList(); for (int kj = 0; kj < listkey.Count; kj++) { key = listkey[kj]; if (!StaticClass.jcbdata.ContainsKey(key)) { deletelist.Add(key); } } #endregion #endregion } catch (Exception ex) { Basic.Framework.Logging.LogHelper.Error(ex); } } }
/// <summary> /// 刷新报警数据 /// </summary> public void refresh(DateTime nowtime) { string point = ""; DataRow[] row; DataRow r; int countn = 0; string[] kzk = null, kdid = null; long temp = 0; Jc_BInfo obj = null, tempobj = null; int tbcount = 0; Dictionary <string, string> kzkd = new Dictionary <string, string>(); object wz = "", dw = "", bjz = "", ddz = "", fzh = "", sszn = "", bjtime = "", ddtime = "", cs = "", idn = "", qy = "", sbstate = ""; long key = 0; #region 除已结束的记录 try { if (deletelist.Count > 0) { #region 除显示 countn = showdt.Rows.Count; lock (objShowDt) { for (int i = 0; i < countn; i++) { try { if (deletelist.Contains(long.Parse(showdt.Rows[i]["id"].ToString()))) { if (jc_kd.ContainsKey(long.Parse(showdt.Rows[i]["kdid"].ToString()))) { jc_kd.Remove(long.Parse(showdt.Rows[i]["kdid"].ToString())); } showdt.Rows.Remove(showdt.Rows[i]); i--; countn--; } } catch (Exception ex) { Basic.Framework.Logging.LogHelper.Error(ex); } } } #endregion #region 除内存 for (int kj = 0; kj < deletelist.Count; kj++) { key = deletelist[kj]; if (jc_b.ContainsKey(key)) { jc_b.Remove(key); } } deletelist.Clear(); #endregion } } catch (Exception ex) { OprFuction.SaveErrorLogs("删除馈电记录", ex); } #endregion #region 修改及刷新记录 if (updatelist.Count > 0) { try { #region 添加记录 for (int kj = 0; kj < updatelist.Count; kj++) { key = updatelist[kj]; kzkd.Clear(); if (jc_b.ContainsKey(key)) { obj = jc_b[key]; point = obj.Point; lock (StaticClass.allPointDtLockObj) { row = StaticClass.AllPointDt.Select("point='" + point + "'"); if (row.Length > 0) { wz = row[0]["wz"]; sbstate = OprFuction.StateChange(obj.State.ToString()); sszn = obj.Ssz + "/" + OprFuction.TimeToString(obj.Stime); if (int.Parse(obj.Type.ToString()) == StaticClass.itemStateToClient.EqpState9 || int.Parse(obj.Type.ToString()) == StaticClass.itemStateToClient.EqpState11) { bjz = row[0]["sxbj"] + "/" + row[0]["sxyj"]; ddz = row[0]["sxdd"] + "/" + row[0]["sxfd"]; dw = row[0]["dw"]; } else if (int.Parse(obj.Type.ToString()) == StaticClass.itemStateToClient.EqpState19 || int.Parse(obj.Type.ToString()) == StaticClass.itemStateToClient.EqpState21) { bjz = row[0]["xxbj"] + "/" + row[0]["xxyj"]; ddz = row[0]["xxdd"] + "/" + row[0]["xxfd"]; dw = row[0]["dw"]; } else { bjz = obj.Ssz; ddz = obj.Ssz; } } } fzh = obj.Fzh + "/" + obj.Kh + "/" + obj.Dzh; bjtime = ddtime = OprFuction.TimeToString(obj.Stime); cs = obj.Cs; idn = key; #region 控制口 //if (!string.IsNullOrEmpty(obj.Kdid)) //{ // kdid = obj.Kdid.Split('|'); // if (kdid.Length > 0) // { // if (!string.IsNullOrEmpty(kdid[0])) // { // kdid1 = kdid[0].Split(','); // #region 断电失败 // lock (StaticClass.bjobj) // { // for (int i = 0; i < kdid1.Length; i++) // { // temp = long.Parse(kdid1[i]); // if (StaticClass.jcbdata.ContainsKey(temp)) // { // tempobj = StaticClass.jcbdata[temp]; // if (!jc_kd.ContainsKey(temp)) // { // jc_kd.Add(temp, OprFuction.NewDTO(tempobj)); // #region 添加记录 // row = StaticClass.AllPointDt.Select("point='" + tempobj.Point + "'"); // if (row.Length > 0) // { // qy = row[0]["wz"]; // } // r = showdt.NewRow(); // r["point"] = point; // r["wz"] = wz; // r["bjz"] = bjz; // r["ddz"] = ddz; // r["dw"] = dw; // //r["fzh"] = fzh; // r["ssz"] = sszn; // r["bjtime"] = bjtime; // r["ddtime"] = ddtime; // r["kdid"] = temp; // r["id"] = key; // r["qy"] = qy; // r["kzk"] = tempobj.Point; // r["kdtime"] = OprFuction.StateChange(tempobj.Type.ToString()) + "/" + tempobj.Stime; // showdt.Rows.InsertAt(r, 0);//添加新记录 // #endregion // } // } // } // } // #endregion // } // if (kdid.Length > 1) // { // #region 复电失败 // if (!string.IsNullOrEmpty(kdid[1])) // { // kdid1 = kdid[1].Split(','); // lock (StaticClass.bjobj) // { // for (int i = 0; i < kdid1.Length; i++) // { // temp = long.Parse(kdid1[i]); // if (StaticClass.jcbdata.ContainsKey(temp)) // { // tempobj = StaticClass.jcbdata[temp]; // if (!jc_kd.ContainsKey(temp)) // { // jc_kd.Add(temp, OprFuction.NewDTO(tempobj)); // #region 添加记录 // row = StaticClass.AllPointDt.Select("point='" + tempobj.Point + "'"); // if (row.Length > 0) // { // qy = row[0]["wz"]; // } // r = showdt.NewRow(); // r["point"] = point; // r["wz"] = wz; // r["bjz"] = bjz; // r["ddz"] = ddz; // r["dw"] = dw; // //r["fzh"] = fzh; // r["ssz"] = sszn; // r["bjtime"] = bjtime; // r["ddtime"] = ddtime; // r["kdid"] = temp; // r["id"] = key; // r["qy"] = qy; // r["kzk"] = tempobj.Point; // r["kdtime"] = OprFuction.StateChange(tempobj.Type.ToString()) + "/" + tempobj.Stime; // showdt.Rows.InsertAt(r, 0);//添加新记录 // #endregion // } // } // } // } // } // #endregion // } // } //} #endregion #region 控制口 if (!string.IsNullOrEmpty(obj.Kdid)) { kdid = obj.Kdid.Split(','); if (kdid.Length > 0) { #region 馈电异常 lock (StaticClass.bjobj) { try { for (int i = 0; i < kdid.Length; i++) { if (!string.IsNullOrEmpty(kdid[i])) { temp = long.Parse(kdid[i]); if (StaticClass.jcbdata.ContainsKey(temp)) { tempobj = StaticClass.jcbdata[temp]; if (!jc_kd.ContainsKey(temp))// { jc_kd.Add(temp, OprFuction.NewDTO(tempobj)); #region 添加记录 lock (StaticClass.allPointDtLockObj) { row = StaticClass.AllPointDt.Select("point='" + tempobj.Point + "'"); if (row.Length > 0) { qy = row[0]["wz"]; } } lock (objShowDt) { r = showdt.NewRow(); r["point"] = point; r["sbstate"] = sbstate; r["wz"] = wz; r["bjz"] = bjz; r["ddz"] = ddz; r["dw"] = dw; //r["fzh"] = fzh; r["ssz"] = sszn; r["bjtime"] = bjtime; r["ddtime"] = ddtime; r["kdid"] = temp; r["id"] = key; r["qy"] = qy; r["kzk"] = tempobj.Point; r["kdtime"] = OprFuction.StateChange(tempobj.Type.ToString()) + "/" + tempobj.Stime; r["cs"] = cs; showdt.Rows.InsertAt(r, 0);//添加新记录 } #endregion } else {//措施改变之后,对对应的记录更新 20180206 for (int k = 0; k < showdt.Rows.Count; k++) { if (showdt.Rows[k]["id"].ToString() == key.ToString()) { showdt.Rows[k]["cs"] = cs; } } } } } } } catch (Exception ex) { Basic.Framework.Logging.LogHelper.Error(ex); } } #endregion } } #endregion } } #endregion } catch (Exception ex) { OprFuction.SaveErrorLogs("添加馈电记录1", ex); } updatelist.Clear(); } #endregion #region 添加记录 if (addlist.Count > 0) { //tbcount = showdt.Rows.Count; try { #region 添加记录 for (int kj = 0; kj < addlist.Count; kj++) { key = addlist[kj]; kzkd.Clear(); if (jc_b.ContainsKey(key)) { obj = jc_b[key]; point = obj.Point; lock (StaticClass.allPointDtLockObj) { row = StaticClass.AllPointDt.Select("point='" + point + "'"); if (row.Length > 0) { wz = row[0]["wz"]; sbstate = OprFuction.StateChange(obj.State.ToString()); sszn = obj.Ssz + "/" + OprFuction.TimeToString(obj.Stime); if (int.Parse(obj.Type.ToString()) == StaticClass.itemStateToClient.EqpState9 || int.Parse(obj.Type.ToString()) == StaticClass.itemStateToClient.EqpState11) { bjz = row[0]["sxbj"] + "/" + row[0]["sxyj"]; ddz = row[0]["sxdd"] + "/" + row[0]["sxfd"]; dw = row[0]["dw"]; } else if (int.Parse(obj.Type.ToString()) == StaticClass.itemStateToClient.EqpState19 || int.Parse(obj.Type.ToString()) == StaticClass.itemStateToClient.EqpState21) { bjz = row[0]["xxbj"] + "/" + row[0]["xxyj"]; dw = row[0]["dw"]; ddz = row[0]["xxdd"] + "/" + row[0]["xxfd"]; } else { bjz = obj.Ssz; ddz = obj.Ssz; } } } fzh = obj.Fzh + "/" + obj.Kh + "/" + obj.Dzh; bjtime = ddtime = OprFuction.TimeToString(obj.Stime); cs = obj.Cs; idn = key; #region 控制口 //if (!string.IsNullOrEmpty(obj.Kdid)) //{ // kdid = obj.Kdid.Split('|'); // if (kdid.Length > 0) // { // if (!string.IsNullOrEmpty(kdid[0])) // { // kdid1 = kdid[0].Split(','); // #region 断电失败 // lock (StaticClass.bjobj) // { // for (int i = 0; i < kdid1.Length; i++) // { // temp = long.Parse(kdid1[i]); // if (StaticClass.jcbdata.ContainsKey(temp)) // { // tempobj = StaticClass.jcbdata[temp]; // if (!jc_kd.ContainsKey(temp)) // { // jc_kd.Add(temp, OprFuction.NewDTO(tempobj)); // } // #region 添加记录 // row = StaticClass.AllPointDt.Select("point='" + tempobj.Point + "'"); // if (row.Length > 0) // { // qy = row[0]["wz"]; // } // r = showdt.NewRow(); // r["point"] = point; // r["wz"] = wz; // r["bjz"] = bjz; // r["ddz"] = ddz; // r["dw"] = dw; // //r["fzh"] = fzh; // r["ssz"] = sszn; // r["bjtime"] = bjtime; // r["ddtime"] = ddtime; // r["kdid"] = temp; // r["id"] = key; // r["qy"] = qy; // r["kzk"] = tempobj.Point; // r["kdtime"] = OprFuction.StateChange(tempobj.Type.ToString()) + "/" + tempobj.Stime; // showdt.Rows.InsertAt(r, 0);//添加新记录 // #endregion // } // } // } // #endregion // } // if (kdid.Length>1) // { // #region 复电失败 // if (!string.IsNullOrEmpty(kdid[1])) // { // kdid1 = kdid[1].Split(','); // lock (StaticClass.bjobj) // { // for (int i = 0; i < kdid1.Length; i++) // { // temp = long.Parse(kdid1[i]); // if (StaticClass.jcbdata.ContainsKey(temp)) // { // tempobj = StaticClass.jcbdata[temp]; // if (!jc_kd.ContainsKey(temp)) // { // jc_kd.Add(temp, OprFuction.NewDTO(tempobj)); // } // #region 添加记录 // row = StaticClass.AllPointDt.Select("point='" + tempobj.Point + "'"); // if (row.Length > 0) // { // qy = row[0]["wz"]; // } // r = showdt.NewRow(); // r["point"] = point; // r["wz"] = wz; // r["bjz"] = bjz; // r["ddz"] = ddz; // r["dw"] = dw; // //r["fzh"] = fzh; // r["ssz"] = sszn; // r["bjtime"] = bjtime; // r["ddtime"] = ddtime; // r["kdid"] = temp; // r["id"] = key; // r["qy"] = qy; // r["kzk"] = tempobj.Point; // r["kdtime"] = OprFuction.StateChange(tempobj.Type.ToString()) + "/" + tempobj.Stime; // showdt.Rows.InsertAt(r, 0);//添加新记录 // } // } // } // #endregion // } // #endregion // } // } //} #endregion #region 控制口 if (!string.IsNullOrEmpty(obj.Kdid)) { kdid = obj.Kdid.Split(','); if (kdid.Length > 0) { #region 馈电异常 lock (StaticClass.bjobj) { try { for (int i = 0; i < kdid.Length; i++) { if (!string.IsNullOrEmpty(kdid[i])) { temp = long.Parse(kdid[i]); if (StaticClass.jcbdata.ContainsKey(temp)) { tempobj = StaticClass.jcbdata[temp]; if (!jc_kd.ContainsKey(temp)) { jc_kd.Add(temp, OprFuction.NewDTO(tempobj)); } #region 添加记录 lock (StaticClass.allPointDtLockObj) { row = StaticClass.AllPointDt.Select("point='" + tempobj.Point + "'"); if (row.Length > 0) { qy = row[0]["wz"]; } } lock (objShowDt) { r = showdt.NewRow(); r["point"] = point; r["wz"] = wz; r["sbstate"] = sbstate; r["bjz"] = bjz; r["ddz"] = ddz; r["dw"] = dw; //r["fzh"] = fzh; r["ssz"] = sszn; r["bjtime"] = bjtime; r["ddtime"] = ddtime; r["kdid"] = temp; r["id"] = key; r["qy"] = qy; r["kzk"] = tempobj.Point; r["kdtime"] = OprFuction.StateChange(tempobj.Type.ToString()) + "/" + tempobj.Stime; r["cs"] = cs; showdt.Rows.InsertAt(r, 0);//添加新记录 } #endregion } } } } catch (Exception ex) { Basic.Framework.Logging.LogHelper.Error(ex); } } #endregion } } #endregion } } #endregion } catch (Exception ex) { OprFuction.SaveErrorLogs("添加馈电记录", ex); } //tbcount = showdt.Rows.Count - tbcount; //StaticClass.yccount[3] += tbcount; addlist.Clear(); //mainGridView.FocusedRowHandle = 0; } #endregion #region 当前报警条数 tbcount = showdt.Rows.Count; StaticClass.yccount[3] = tbcount; #endregion }
/// <summary> /// 获取新增报警断电信息 /// </summary> public void getdata() { short type = 0; int count = 0; long id = 0; List <long> keylist; Jc_BInfo jcb = null; Jc_BInfo obj = null; lock (StaticClass.bjobj) { try { #region 获取报警信息 keylist = new List <long>(StaticClass.jcbdata.Keys); for (int i = 0; i < keylist.Count; i++) { if (StaticClass.jcbdata.ContainsKey(keylist[i])) { jcb = StaticClass.jcbdata[keylist[i]]; type = jcb.Type; if (type == 27) { } if (type == StaticClass.itemStateToClient.EqpState24 || type == StaticClass.itemStateToClient.EqpState25 || type == StaticClass.itemStateToClient.EqpState26) { id = long.Parse(jcb.ID); if (!jc_b.ContainsKey(id) && (OprFuction.KGLisAlarm(jcb) || !string.IsNullOrEmpty(jcb.Kzk)))//增加如果未选择报警,勾选了控制的也进行显示 20170726 { #region 新增报警断电 obj = OprFuction.NewDTO(jcb); jc_b.Add(id, obj); addlist.Add(id); #endregion } else { #region update 报警 断电 if (jc_b.ContainsKey(id)) { #region 控制口改变 if (jc_b[id].Kzk != jcb.Kzk)//报警断电结束 { obj = OprFuction.NewDTO(jcb); jc_b[id] = obj; addlist.Add(id); } #endregion if (OprFuction.IsInitTime(jc_b[id].Etime) && !OprFuction.IsInitTime(jcb.Etime) || jc_b[id].Kdid != jcb.Kdid)//报警断电结束 { obj = OprFuction.NewDTO(jcb); if (jc_b[id].Kdid != jcb.Kdid)//馈电改变 { kdlist.Add(id); } jc_b[id] = obj; updatelist.Add(id); } else if (jc_b[id].Cs != jcb.Cs)//措施改变//&& !OprFuction.GetClientType() 注释 20170817 { obj = OprFuction.NewDTO(jcb); jc_b[id] = obj; updatelist.Add(id); } //else if (jc_b[id].Isalarm != jcb.Isalarm) //{ // //2017.7.14 by // obj = OprFuction.NewDTO(jcb); // jc_b[id] = obj; // updatelist.Add(id); //} else//无变化,直接更新结束时间 20170627 { updatelist.Add(id); } } #endregion } } } } #region 判断报警断电是否还存在 foreach (long key in jc_b.Keys) { if (!StaticClass.jcbdata.ContainsKey(key) || (StaticClass.jcbdata[key].Isalarm == 0 && string.IsNullOrEmpty(StaticClass.jcbdata[key].Kzk)))//如果用户取消报警(只有报警,没有控制时,可取消),此时数据处理会将标记置成正常,客户端显示的时候也取消报警 20170627 { deletelist.Add(key); } } #endregion #endregion } catch (Exception ex) { Basic.Framework.Logging.LogHelper.Error(ex); } } }
/// <summary> /// 获取新增报警断电信息 /// </summary> public void getdata() { short type = 0; long id = 0; Jc_BInfo jcb = null; Jc_BInfo obj = null; DateTime maxtime = timenow; long key = 0; List <long> listkey; lock (StaticClass.bjobj) { #region 获取开关量状态变动数据 try { listkey = StaticClass.jcbdata.Keys.ToList(); for (int kj = 0; kj < listkey.Count; kj++) { key = listkey[kj]; jcb = StaticClass.jcbdata[key]; type = jcb.Type; if (jcb.Stime >= timenow) { if (OprFuction.IsKGL(jcb) && !jc_b.ContainsKey(long.Parse(jcb.ID))) { if (jcb.Stime > maxtime) { maxtime = jcb.Stime; id = long.Parse(jcb.ID); } #region 新增开关量状态 obj = OprFuction.NewDTO(jcb); jc_b.Add(long.Parse(obj.ID), obj); addlist.Add(long.Parse(obj.ID)); #endregion } } } } catch (Exception ex) { Basic.Framework.Logging.LogHelper.Error(ex); } if (id > dqid) { dqid = id; } if (maxtime > timenow) { timenow = maxtime; } #region 判断开关量状态记录是否可以删除 DateTime now = Model.RealInterfaceFuction.GetServerNowTime(); listkey = jc_b.Keys.ToList(); for (int kj = 0; kj < listkey.Count; kj++) { key = listkey[kj]; if ((now - jc_b[key].Stime).TotalMinutes > 1) { deletelist.Add(key); } } #endregion #endregion } }