/// <summary> /// 点击分站事件 /// </summary> /// <param name="EventStation"></param> void MapGis_StationClick(ZzhaControlLibrary.Station EventStation) { if (EventStation.StationState == "正常") { DataTable dt = new Graphics_RealTimeBLL().GetRealTimeInStationByStationInfo(EventStation.StationID,true); cpStationHead.CaptionTitle = EventStation.StationName + " 共检测到" + dt.Rows.Count.ToString() + "人"; dgvRealTime.DataSource = dt; pnlRealTime.Visible = true; pnlRealTime.Location = Point.Round(EventStation.StationNowPoint); } }
public List<string> GetHisEmpNumByDept(DateTime sdate,DateTime edate) { List<string> list = new List<string>(); DataTable deptdt = new Graphics_RealTimeBLL().GetAllDept(); if (deptdt != null) { for (int i = 0; i < deptdt.Rows.Count; i++) { string str = deptdt.Rows[i]["deptname"].ToString(); str = str + ": " + ghep.GetHisDeptEmpNum(sdate.ToString("yyyy-MM-dd HH:mm:ss"), edate.ToString("yyyy-MM-dd HH:mm:ss"), deptdt.Rows[i]["deptname"].ToString()) + "人次"; list.Add(str); } } return list; }
public List <string> GetHisEmpNumByDept(DateTime sdate, DateTime edate) { List <string> list = new List <string>(); DataTable deptdt = new Graphics_RealTimeBLL().GetAllDept(); if (deptdt != null) { for (int i = 0; i < deptdt.Rows.Count; i++) { string str = deptdt.Rows[i]["deptname"].ToString(); str = str + ": " + ghep.GetHisDeptEmpNum(sdate.ToString("yyyy-MM-dd HH:mm:ss"), edate.ToString("yyyy-MM-dd HH:mm:ss"), deptdt.Rows[i]["deptname"].ToString()) + "人次"; list.Add(str); } } return(list); }
/// <summary> /// 点击分站事件 /// </summary> /// <param name="EventStation"></param> void MapGis_StationClick(ZzhaControlLibrary.Station EventStation) { if (ShowStationDgv) { if (EventStation.StationState == "正常" && EventStation.HasShowed) { DataTable dt; if (isRealTime) { dt = new Graphics_RealTimeBLL().GetRealTimeInStationByStationInfo(EventStation.StationID,true); cpStationHead.CaptionTitle = EventStation.StationName + " 共检测到" + dt.Rows.Count.ToString() + "人"; } else { dt = ghepb.GetHisStationHeadInfo(hisStartTime, hisEndTime, EventStation.StationID); cpStationHead.CaptionTitle = EventStation.StationName + " 共检测到" + dt.Rows.Count.ToString() + "人次"; } dgvRealTime.DataSource = dt; pnlRealTime.Visible = true; pnlRealTime.Location = Point.Round(EventStation.StationNowPoint); } } }
/// <summary> /// 重新载入实时事件 /// </summary> private void LoadRealTimeInfo() { try { if (IsOut) { int allNum = 0; try { if (isRealTime) { allNum = int.Parse(new Graphics_RealTimeBLL().GetEmpInMineCounts()); this.labTitle.Text = "实时分布: 共有" + allNum.ToString() + "人下井"; } else { allNum = Convert.ToInt32(ghepb.GetHisEmpNum(this.hisStartTime, this.hisEndTime)); this.labTitle.Text = "该时段共有" + allNum.ToString() + "人次下井"; } } catch (Exception ex) { this.labTitle.Text = "共有" + allNum.ToString() + "人下井"; } List<string> list; if (isRealTime) { list = new Graphics_AreaRealtimeBLL().GetAreaInfoAndEmpcount(); } else { list = ghepb.GetAllAreaEmpNum(hisStartTime, hisEndTime); } if (list.Count >= trvRealTime.Nodes["qy"].Nodes.Count) { for (int i = 0; i < list.Count; i++) { if (trvRealTime.Nodes["qy"].Nodes.ContainsKey("qy" + i.ToString())) trvRealTime.Nodes["qy"].Nodes["qy" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["qy"].Nodes.Add("qy" + i.ToString(), list[i]); } } else { for (int i = 0; i < trvRealTime.Nodes["qy"].Nodes.Count; i++) { if (i < list.Count) trvRealTime.Nodes["qy"].Nodes["qy" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["qy"].Nodes.RemoveAt(i); } } if (isRealTime) list = new Graphics_RealTimeBLL().GetEmpWorkTypeNumRealTime(allNum); else list = ghepb.GetHisEmpWorkTypeNum(allNum, this.hisStartTime, this.hisEndTime); if (list.Count >= trvRealTime.Nodes["gz"].Nodes.Count) { for (int i = 0; i < list.Count; i++) { if (trvRealTime.Nodes["gz"].Nodes.ContainsKey("gz" + i.ToString())) trvRealTime.Nodes["gz"].Nodes["gz" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["gz"].Nodes.Add("gz" + i.ToString(), list[i]); } } else { for (int i = 0; i < trvRealTime.Nodes["gz"].Nodes.Count; i++) { if (i < list.Count) trvRealTime.Nodes["gz"].Nodes["gz" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["gz"].Nodes.RemoveAt(i); } } if (isRealTime) list = new Graphics_RealTimeBLL().GetRealTimeEmpNumByDept(); else list = ghepb.GetHisEmpNumByDept(hisStartTime, hisEndTime); if (list.Count >= trvRealTime.Nodes["bm"].Nodes.Count) { for (int i = 0; i < list.Count; i++) { if (trvRealTime.Nodes["bm"].Nodes.ContainsKey("bm" + i.ToString())) trvRealTime.Nodes["bm"].Nodes["bm" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["bm"].Nodes.Add("bm" + i.ToString(), list[i]); } } else { for (int i = 0; i < trvRealTime.Nodes["bm"].Nodes.Count; i++) { if (i < list.Count) trvRealTime.Nodes["bm"].Nodes["bm" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["bm"].Nodes.RemoveAt(i); } } } List<string> stationlist = new Graphics_RealTimeBLL().GetAllStationState(); //trvRealTime.Nodes["bm"].Nodes.Clear(); //foreach (string s in list) //{ // trvRealTime.Nodes["bm"].Nodes.Add(s); //} if (stationlist.Count >= trvStation.Nodes["cf"].Nodes.Count) { for (int i = 0; i < stationlist.Count; i++) { if (trvStation.Nodes["cf"].Nodes.ContainsKey("cf" + i.ToString())) trvStation.Nodes["cf"].Nodes["cf" + i.ToString()].Text = stationlist[i]; else trvStation.Nodes["cf"].Nodes.Add("cf" + i.ToString(), stationlist[i]); } } else { for (int i = 0; i < trvStation.Nodes["cf"].Nodes.Count; i++) { if (i < stationlist.Count) trvStation.Nodes["cf"].Nodes["cf" + i.ToString()].Text = stationlist[i]; else trvStation.Nodes["cf"].Nodes.RemoveAt(i); } } FlashStationInfo(); } catch (Exception ex) { FlashTimer.Stop(); } }
/// <summary> /// 班次 重新载入雇员 根据班次及部门 /// </summary> private void BanFlashPeople() { DataTable dt = null; lsbBanPeople.Items.Clear(); lsbBanPeople.Values.Clear(); DataSet ds = new Graphics_RealTimeBLL().GetEmpByDeptAndClass(int.Parse(Bandeptid), dtpban.Value, classdt.Rows[cmbBan.SelectedIndex][1].ToString()); if (ds != null) classempdt = ds.Tables[0]; classempdt = DistinctDataTable(classempdt, 0); for (int i = 0; i < classempdt.Rows.Count; i++) { lsbBanPeople.AddItem(classempdt.Rows[i]["EmployeeName"].ToString(), classempdt.Rows[i]["EmployeeId"].ToString()); } for (int i = 0; i < lsbBanSelectpeople.Items.Count; i++) { if (lsbBanPeople.Values.Contains(lsbBanSelectpeople.Values[i])) { lsbBanPeople.Items.RemoveAt(lsbBanPeople.Values.IndexOf(lsbBanSelectpeople.Values[i])); lsbBanPeople.Values.Remove(lsbBanSelectpeople.Values[i]); } } }
/// <summary> /// 线程运行 生成轨迹 /// </summary> private void ThreadRun() { try { SetHistoryBtnEnabel(false); int step = 100 / EmpMoverList.Count; frmWait f = new frmWait("正在生成历史轨迹,请稍候...."); f.Show(); if (this.PageIndex == 0) { #region[时间选择] foreach (EmpMoverModel emm in EmpMoverList) { f.Refresh(); List<string> list = new Graphics_RealTimeBLL().GetRouteInfoByEmpID(emm.EmpID, dtpStart.Value.ToString("yyyy-MM-dd HH:mm:ss"), dtpEnd.Value.ToString("yyyy-MM-dd HH:mm:ss")); if (list != null && list.Count >= 5) this.MapGis.AddMover(list[0], list[1], list[2], list[3], list[4], MoverZFilePath, MoverFFilePath); else NoRoutePeoples.Add(emm.EmpName); f.PgbWait.Value += step; } if (NoRoutePeoples.Count == 0 && EmpMoverList.Count != 0) { //this.MapGis.StartMoving(); //this.btnHistoryRoute.Enabled = false; MapgisStartMoving(); } else { if (NoRoutePeoples.Count == EmpMoverList.Count) { MessageBox.Show("选择的人员均没有可播放的历史轨迹!", "提示", MessageBoxButtons.OK); SetHistoryBtnEnabel(true); } else { string message = string.Empty; for (int i = 0; i < NoRoutePeoples.Count; i++) { if (i == 0) message = NoRoutePeoples[i]; else message = message + "," + NoRoutePeoples[i]; } if (message.Length > 0) message.Remove(message.Length - 2); MessageBox.Show(message + "等人员没有可播放的历史轨迹!", "提示", MessageBoxButtons.OK); MapgisStartMoving(); } } #endregion } else { #region[班次选择] foreach (EmpMoverModel emm in EmpMoverList) { f.Refresh(); List<string> list = new Graphics_RealTimeBLL().GetRouteInfoByEmpID(emm.EmpID, dtpban.Value.ToString("yyyy-MM-dd 00:00:00"), dtpban.Value.ToString("yyyy-MM-dd 23:59:59")); if (list != null && list.Count >= 5) this.MapGis.AddMover(list[0], list[1], list[2], list[3], list[4], MoverZFilePath, MoverFFilePath); else NoRoutePeoples.Add(emm.EmpName); f.PgbWait.Value += step; } if (NoRoutePeoples.Count == 0) { MapgisStartMoving(); } else { if (NoRoutePeoples.Count == EmpMoverList.Count) { MessageBox.Show("选择的所有人员均没有可播放的历史轨迹!", "提示", MessageBoxButtons.OK); SetHistoryBtnEnabel(true); } else { string message = string.Empty; foreach (string str in NoRoutePeoples) { message = message + str + ","; } if (message.Length > 0) message.Remove(message.Length - 1); MessageBox.Show(message + "等人员没有可播放的历史轨迹!", "提示", MessageBoxButtons.OK); MapgisStartMoving(); } } #endregion } f.Close(); } catch (Exception ex) { MessageBox.Show("历史轨迹生成失败!", "提示", MessageBoxButtons.OK); SetHistoryBtnEnabel(true); } finally { NoRoutePeoples.Clear(); System.Threading.Thread.CurrentThread.Abort(); } }
/// <summary> /// 重新载入实时事件 /// </summary> private void LoadRealTimeInfo() { try { if (IsOut) { int allNum = int.Parse(new Graphics_RealTimeBLL().GetEmpInMineCounts()); this.labTitle.Text = "实时分布: 共有" + allNum.ToString() + "人下井"; List<string> list = new Graphics_AreaRealtimeBLL().GetAreaInfoAndEmpcount(); //trvRealTime.Nodes["qy"].Nodes.Clear(); //foreach (string s in list) //{ // trvRealTime.Nodes["qy"].Nodes.Add(s); //} if (list.Count >= trvRealTime.Nodes["qy"].Nodes.Count) { for (int i = 0; i < list.Count; i++) { if (trvRealTime.Nodes["qy"].Nodes.ContainsKey("qy" + i.ToString())) trvRealTime.Nodes["qy"].Nodes["qy" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["qy"].Nodes.Add("qy" + i.ToString(), list[i]); } } else { for (int i = 0; i < trvRealTime.Nodes["qy"].Nodes.Count; i++) { if (i < list.Count) trvRealTime.Nodes["qy"].Nodes["qy" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["qy"].Nodes.RemoveAt(i); } } list = new Graphics_RealTimeBLL().GetEmpWorkTypeNumRealTime(allNum); //trvRealTime.Nodes["gz"].Nodes.Clear(); //foreach (string s in list) //{ // trvRealTime.Nodes["gz"].Nodes.Add(s); //} if (list.Count >= trvRealTime.Nodes["gz"].Nodes.Count) { for (int i = 0; i < list.Count; i++) { if (trvRealTime.Nodes["gz"].Nodes.ContainsKey("gz" + i.ToString())) trvRealTime.Nodes["gz"].Nodes["gz" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["gz"].Nodes.Add("gz" + i.ToString(), list[i]); } } else { for (int i = 0; i < trvRealTime.Nodes["gz"].Nodes.Count; i++) { if (i < list.Count) trvRealTime.Nodes["gz"].Nodes["gz" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["gz"].Nodes.RemoveAt(i); } } list = new Graphics_RealTimeBLL().GetRealTimeEmpNumByDept(); //trvRealTime.Nodes["bm"].Nodes.Clear(); //foreach (string s in list) //{ // trvRealTime.Nodes["bm"].Nodes.Add(s); //} if (list.Count >= trvRealTime.Nodes["bm"].Nodes.Count) { for (int i = 0; i < list.Count; i++) { if (trvRealTime.Nodes["bm"].Nodes.ContainsKey("bm" + i.ToString())) trvRealTime.Nodes["bm"].Nodes["bm" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["bm"].Nodes.Add("bm" + i.ToString(), list[i]); } } else { for (int i = 0; i < trvRealTime.Nodes["bm"].Nodes.Count; i++) { if (i < list.Count) trvRealTime.Nodes["bm"].Nodes["bm" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["bm"].Nodes.RemoveAt(i); } } } FlashStationInfo(); } catch (Exception ex) { FlashTimer.Stop(); } }
/// <summary> /// 重新载入实时事件 /// </summary> private void LoadRealTimeInfo() { try { trvRealTime.Nodes.Add("zong", "下井总人数"); trvRealTime.Nodes.Add("qy", "按区域划分"); trvRealTime.Nodes.Add("gz", "按工种划分"); trvRealTime.Nodes.Add("bm", "按部门划分"); trvRealTime.Nodes.Add("cf", "传输分站状态"); int allNum = int.Parse(new Graphics_RealTimeBLL().GetEmpInMineCounts()); trvRealTime.Nodes["zong"].Text = "实时分布: 共有" + allNum.ToString() + "人下井"; List<string> list = new Graphics_AreaRealtimeBLL().GetAreaInfoAndEmpcount(); //trvRealTime.Nodes["qy"].Nodes.Clear(); //foreach (string s in list) //{ // trvRealTime.Nodes["qy"].Nodes.Add(s); //} if (list.Count >= trvRealTime.Nodes["qy"].Nodes.Count) { for (int i = 0; i < list.Count; i++) { if (trvRealTime.Nodes["qy"].Nodes.ContainsKey("qy" + i.ToString())) trvRealTime.Nodes["qy"].Nodes["qy" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["qy"].Nodes.Add("qy" + i.ToString(), list[i]); } } else { for (int i = 0; i < trvRealTime.Nodes["qy"].Nodes.Count; i++) { if (i < list.Count) trvRealTime.Nodes["qy"].Nodes["qy" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["qy"].Nodes.RemoveAt(i); } } list = new Graphics_RealTimeBLL().GetEmpWorkTypeNumRealTime(allNum); //trvRealTime.Nodes["gz"].Nodes.Clear(); //foreach (string s in list) //{ // trvRealTime.Nodes["gz"].Nodes.Add(s); //} if (list.Count >= trvRealTime.Nodes["gz"].Nodes.Count) { for (int i = 0; i < list.Count; i++) { if (trvRealTime.Nodes["gz"].Nodes.ContainsKey("gz" + i.ToString())) trvRealTime.Nodes["gz"].Nodes["gz" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["gz"].Nodes.Add("gz" + i.ToString(), list[i]); } } else { for (int i = 0; i < trvRealTime.Nodes["gz"].Nodes.Count; i++) { if (i < list.Count) trvRealTime.Nodes["gz"].Nodes["gz" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["gz"].Nodes.RemoveAt(i); } } list = new Graphics_RealTimeBLL().GetRealTimeEmpNumByDept(); //trvRealTime.Nodes["bm"].Nodes.Clear(); //foreach (string s in list) //{ // trvRealTime.Nodes["bm"].Nodes.Add(s); //} if (list.Count >= trvRealTime.Nodes["bm"].Nodes.Count) { for (int i = 0; i < list.Count; i++) { if (trvRealTime.Nodes["bm"].Nodes.ContainsKey("bm" + i.ToString())) trvRealTime.Nodes["bm"].Nodes["bm" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["bm"].Nodes.Add("bm" + i.ToString(), list[i]); } } else { for (int i = 0; i < trvRealTime.Nodes["bm"].Nodes.Count; i++) { if (i < list.Count) trvRealTime.Nodes["bm"].Nodes["bm" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["bm"].Nodes.RemoveAt(i); } } list = new Graphics_RealTimeBLL().GetAllStationState(); //trvRealTime.Nodes["bm"].Nodes.Clear(); //foreach (string s in list) //{ // trvRealTime.Nodes["bm"].Nodes.Add(s); //} if (list.Count >= trvRealTime.Nodes["cf"].Nodes.Count) { for (int i = 0; i < list.Count; i++) { if (trvRealTime.Nodes["cf"].Nodes.ContainsKey("cf" + i.ToString())) trvRealTime.Nodes["cf"].Nodes["cf" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["cf"].Nodes.Add("cf" + i.ToString(), list[i]); } } else { for (int i = 0; i < trvRealTime.Nodes["cf"].Nodes.Count; i++) { if (i < list.Count) trvRealTime.Nodes["cf"].Nodes["cf" + i.ToString()].Text = list[i]; else trvRealTime.Nodes["cf"].Nodes.RemoveAt(i); } } } catch (Exception ex) { } }