private void InitDoors() { CtrlWaiting waiting = new CtrlWaiting(() => { try { var doors = DoorDataHelper.GetDoors(); Maticsoft.BLL.SMT_CARD_INFO cardBll = new Maticsoft.BLL.SMT_CARD_INFO(); _cards = cardBll.GetModelList(""); this.Invoke(new Action(() => { AddDoorsToView(doors); })); var facedevs = FaceRecgHelper.GetList(""); this.Invoke(new Action(() => { AddFaceDevsToView(facedevs); })); } catch (Exception ex) { WinInfoHelper.ShowInfoWindow(this, "加载门禁异常!" + ex.Message); log.Error("加载门禁异常:", ex); } }); waiting.Show(this, 200); }
private void Init() { dtpStart.Value = DateTime.Now.Date; dtpEnd.Value = DateTime.Now.Date; CtrlWaiting waiting = new CtrlWaiting(() => { var doors = DoorDataHelper.GetDoors(); var areas = AreaDataHelper.GetAreas(); this.Invoke(new Action(() => { var doorNodes = DoorDataHelper.ToTree(areas, doors); //cboDoorTree.Nodes.Add(new Node("--所有门禁--")); cboDoorTree.Nodes.AddRange(doorNodes.ToArray()); if (cboDoorTree.Nodes.Count > 0) { cboDoorTree.SelectedNode = cboDoorTree.Nodes[0]; } foreach (Node item in cboDoorTree.Nodes) { item.ExpandAll(); } })); }); waiting.Show(this, 300); }
private void DoorTree_Load(object sender, EventArgs e) { if (!IsDesignMode()) { CtrlWaiting ctrlWaiting = new CtrlWaiting(() => { try { var doors = DoorDataHelper.GetDoors(); var areas = AreaDataHelper.GetAreas(); this.Invoke(new Action(() => { var nodes = DoorDataHelper.ToTree(areas, doors); advDoorTree.Nodes.Clear(); advDoorTree.Nodes.AddRange(nodes.ToArray()); advDoorTree.ExpandAll(); lock (this) { _isloaded = true; if (_loadEnded != null) { _loadEnded(this, e); } } })); } catch (Exception ex) { WinInfoHelper.ShowInfoWindow(this, "门禁列表加载异常:" + ex.Message); this.Invoke(new Action(() => { lock (this) { _isloaded = true; if (_loadEnded != null) { _loadEnded(this, e); } } })); } }); ctrlWaiting.Show(this, 300); } }
private void Init() { modelTree.Nodes[0].Nodes.Clear(); CtrlWaiting waiting = new CtrlWaiting(() => { try { Maticsoft.BLL.SMT_MAP_INFO mapBll = new Maticsoft.BLL.SMT_MAP_INFO(); var maps = mapBll.GetModelListWithDoors("1=1"); this.Invoke(new Action(() => { foreach (var item in maps) { AddTree(item); } modelTree.ExpandAll(); })); try { if (DoorDataHelper.LastDoors == null) { DoorDataHelper.GetDoors(); } } catch (Exception ex) { log.Error("初始化门禁异常:", ex); } } catch (Exception ex) { WinInfoHelper.ShowInfoWindow(this, "加载地图列表异常:" + ex.Message); log.Error("加载地图列表异常:", ex); } }); waiting.Show(this); }
private void Init() { dtpStart.Value = DateTime.Now.Date; CtrlWaiting waiting = new CtrlWaiting(() => { var depts = DeptDataHelper.GetDepts(false); var doors = DoorDataHelper.GetDoors(); var areas = AreaDataHelper.GetAreas(); this.Invoke(new Action(() => { var deptNodes = DeptDataHelper.ToTree(depts); Node deptNone = new Node("--无--"); deptNodes.Insert(0, deptNone); cboDeptTree.Nodes.AddRange(deptNodes.ToArray()); cboDeptTree.SelectedNode = deptNone; foreach (Node item in cboDeptTree.Nodes) { item.Expand(); } var doorNodes = DoorDataHelper.ToTree(areas, doors); cboDoorTree.Nodes.AddRange(doorNodes.ToArray()); foreach (Node item in cboDoorTree.Nodes) { item.ExpandAll(); } })); }); waiting.Show(this, 300); }
private void InitDoors() { CtrlWaiting ctrlWaiting = new CtrlWaiting(() => { try { var doors = DoorDataHelper.GetDoors(); var areas = AreaDataHelper.GetAreas(); this.Invoke(new Action(() => { var nodes = DoorDataHelper.ToTree(areas, doors); cboDoor.Nodes.Clear(); cboDoor.Nodes.AddRange(nodes.ToArray()); cboDoor.AdvTree.ExpandAll(); })); } catch (Exception ex) { WinInfoHelper.ShowInfoWindow(this, "门禁列表加载异常:" + ex.Message); } }); ctrlWaiting.Show(this, 300); }
private void AddWatchData(Controller ctrlr, bool connected, ControllerState state, bool doorstate, bool relaystate) { string cardNo = null; if (state != null) { if (_cards == null) { Maticsoft.BLL.SMT_CARD_INFO cardBll = new Maticsoft.BLL.SMT_CARD_INFO(); _cards = cardBll.GetModelList(""); } cardNo = state.cardOrNoNumber; var card = _cards.Find(m => m.CARD_WG_NO == state.cardOrNoNumber); if (card != null) { cardNo = card.CARD_NO; } else { Maticsoft.BLL.SMT_CARD_INFO cardBll = new Maticsoft.BLL.SMT_CARD_INFO(); var c = cardBll.GetModelList("CARD_WG_NO='" + state.cardOrNoNumber + "'"); if (c.Count > 0) { _cards.Add(c[0]); cardNo = c[0].CARD_NO; } } } string staffname = "未知"; string orgname = "未知"; Maticsoft.Model.SMT_STAFF_INFO sinfo = null; if (cardNo != null) { try { Maticsoft.BLL.SMT_STAFF_INFO siBll = new Maticsoft.BLL.SMT_STAFF_INFO(); var ds = siBll.GetListByCardNum(cardNo); var list = siBll.DataTableToListWithDept(ds.Tables[0]); if (list.Count > 0) { staffname = list[0].REAL_NAME; orgname = list[0].ORG_NAME; sinfo = list[0]; } } catch (Exception ex) { log.Error("读取职员异常:", ex); } } this.Invoke(new Action(() => { foreach (MapCtrl item in _detectedMaps) { List <Maticsoft.Model.SMT_DOOR_INFO> doors; List <Maticsoft.Model.SMT_FACERECG_DEVICE> faces; GetDoors(item, out doors, out faces); foreach (var door in doors) { if ((decimal)door.CTRL_ID != ctrlr.id) { continue; } var doorRect = item.GetDoor(door.ID, 1); if (doorRect == null) { continue; } doorRect.IsOnline = connected; int doorIndex = (int)door.CTRL_DOOR_INDEX; bool doorLock = false; if (state != null) { //更新状态 switch (doorIndex) { case 1: doorLock = state.isOpenDoorOfLock1; break; case 2: doorLock = state.isOpenDoorOfLock2; break; case 3: doorLock = state.isOpenDoorOfLock3; break; case 4: doorLock = state.isOpenDoorOfLock4; break; default: break; } //更新状态 doorRect.IsOpen = doorLock; door.OPEN_STATE = doorLock ? 1 : 0; DoorDataHelper.UpdateDoorSync(door); } if ((!connected || state == null) && !doorstate) { door.OPEN_STATE = 2; doorRect.IsOnline = false; DoorDataHelper.UpdateDoorSync(door); //item.ImageIndex = connected ? 0 : 2; /*DataGridViewRow row = new DataGridViewRow(); * row.Tag = ctrlr; * row.CreateCells(dgvRealLog, DateTime.Now, door.DOOR_NAME, string.Format("控制器:IP={0},SN={1} {2}!", ctrlr.ip, ctrlr.sn, connected ? "连接成功" : "无法连接")); * row.DefaultCellStyle.BackColor = Color.Yellow; * dgvRealLog.Rows.Insert(0, row);*/ } else if ((byte)door.CTRL_DOOR_INDEX == state.doorNum) { DataGridViewRow row = new DataGridViewRow(); row.Tag = state; if (!relaystate) { string actionname = AccessHelper.GetRecordReasonString(state.reasonNo); if (!doorLock) { actionname += ",锁状态:关"; } else { actionname += ",锁状态:开"; } if (doorstate) { row.CreateCells(dgvRealLog, state.recordTime, door.DOOR_NAME + (state.isEnterDoor ? "-进门" : "-出门"), string.Format("人员:{0},部门:{1},门禁:{2},卡号:{3},动作:{4}", staffname, orgname, door.DOOR_NAME, cardNo, actionname)); dgvRealLog.Rows.Insert(0, row); row.Tag = new object[] { sinfo, state }; ShowStaffInfo(row, row.Tag as object[]); while (dgvRealLog.Rows.Count > 2000) { dgvRealLog.Rows.RemoveAt(dgvRealLog.Rows.Count - 1); } } } } } item.Invalidate(); } })); }
private void Init() { if (_task != null) { this.Text = "编辑定时任务"; tbTaskName.Text = _task.TASK_NAME; tbTaskDesc.Text = _task.TASK_DESC; tbTaskNum.Text = _task.TASK_NO; dtpStartDate.Value = _task.VALID_STARTDATE; dtpEndDate.Value = _task.VALID_ENDDATE; dtiTime.Value = DateTime.Now.Date + _task.ACTION_TIME; if (_task.CTRL_STYLE >= 0 && _task.CTRL_STYLE <= 12) { cboCtrlStyle.SelectedIndex = _task.CTRL_STYLE; } cbWeek1.Checked = _task.MON_STATE; cbWeek2.Checked = _task.TUE_STATE; cbWeek3.Checked = _task.THI_STATE; cbWeek4.Checked = _task.WES_STATE; cbWeek5.Checked = _task.FRI_STATE; cbWeek6.Checked = _task.SAT_STATE; cbWeek7.Checked = _task.SUN_STATE; if (_isview) { tbTaskName.ReadOnly = true; this.Text = "查看定时任务"; tbTaskDesc.ReadOnly = true; tbTaskNum.ReadOnly = true; dtpStartDate.Enabled = false; dtpEndDate.Enabled = false; dtiTime.Enabled = false; cboCtrlStyle.Enabled = false; cbWeek1.Enabled = false; cbWeek2.Enabled = false; cbWeek3.Enabled = false; cbWeek4.Enabled = false; cbWeek5.Enabled = false; cbWeek6.Enabled = false; cbWeek7.Enabled = false; btnOk.Visible = false; btnCancel.Text = "关闭"; } } else { this.Text = "添加定时任务"; cboCtrlStyle.SelectedIndex = 0; dtiTime.Value = DateTime.Now; } CtrlWaiting waiting = new CtrlWaiting(() => { var doors = DoorDataHelper.GetDoors(); var areas = AreaDataHelper.GetAreas(); this.Invoke(new Action(() => { var doorNodes = DoorDataHelper.ToTree(areas, doors); //cboDoorTree.Nodes.Add(new Node("--所有门禁--")); doorTree.Nodes.Clear(); doorTree.Nodes.AddRange(doorNodes.ToArray()); if (_task != null && doorTree.Nodes.Count > 0) { if (!string.IsNullOrWhiteSpace(_task.DOOR_ID)) { if (_task.DOOR_ID == "-1") { doorTree.Nodes[0].Checked = true; doorTree.SetAllCheckState(true); } else { string[] doorIds = _task.DOOR_ID.Split(','); List <decimal> doorIdd = new List <decimal>(); foreach (var id in doorIds) { decimal dd; if (decimal.TryParse(id, out dd)) { doorIdd.Add(decimal.Parse(id)); } } var nodes = doorTree.GetNodeList(typeof(Maticsoft.Model.SMT_DOOR_INFO)); foreach (var item in nodes) { if (doorIdd.Contains(((Maticsoft.Model.SMT_DOOR_INFO)item.Tag).ID)) { item.Checked = true; } } } ShowDoorText(); } } foreach (Node item in doorTree.Nodes) { item.ExpandAll(); } })); }); waiting.Show(this, 300); }