示例#1
0
        private void DoLoadCtrlr()
        {
            try
            {
                log.Info("加载人脸设备...");
                Maticsoft.BLL.SMT_FACERECG_DEVICE          bll  = new Maticsoft.BLL.SMT_FACERECG_DEVICE();
                List <Maticsoft.Model.SMT_FACERECG_DEVICE> devs = bll.GetModelList("1=1");
                _devices = devs;

                /*if (devs.Count>0)
                 * {
                 *  log.Info("人脸设备个数:" + devs.Count);
                 *  List<BSTFaceRecg> ctls = new List<BSTFaceRecg>();
                 *  foreach (Maticsoft.Model.SMT_FACERECG_DEVICE dev in devs)
                 *  {
                 *      BSTFaceRecg bst = new BSTFaceRecg();
                 *      bst.InitConfig(dev.FACEDEV_IP, dev.FACEDEV_CTRL_PORT, dev.FACEDEV_HEART_PORT, dev.FACEDEV_DB_PORT, dev.FACEDEV_DB_NAME, dev.FACEDEV_DB_USER, dev.FACEDEV_DB_PWD);
                 *      ctls.Add(bst);
                 *  }
                 *  _devices = ctls;
                 * }*/
            }
            catch (Exception ex)
            {
                log.Error("加载控制器异常:", ex);
            }
        }
示例#2
0
        private void FaceDevPriMgr_Load(object sender, EventArgs e)
        {
            if (!UserInfoHelper.HasPrivate(SYS_FUN_POINT.STAFF_MGR))
            {
                biRegister.Visible           = false;
                dgvStaffs.Columns[6].Visible = false;
            }
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_FACERECG_DEVICE faceBll = new Maticsoft.BLL.SMT_FACERECG_DEVICE();
                    string strWhere = "";
                    if (!UserInfoHelper.IsManager)
                    {
                        strWhere = "ID IN (SELECT RF.FUN_ID FROM SMT_ROLE_FUN RF,SMT_USER_INFO UI WHERE RF.ROLE_TYPE=4 AND RF.ROLE_ID=UI.ROLE_ID AND UI.ID=" + UserInfoHelper.UserID + ")";
                    }
                    _faceDevices = faceBll.GetModelList(strWhere);
                    var areas    = AreaDataHelper.GetAreas();
                    this.Invoke(new Action(() =>
                    {
                        var nodes    = AreaDataHelper.ToTree(areas);
                        var faceDevs = _faceDevices.ToList();
                        foreach (var item in nodes)
                        {
                            DoCreateAreaDevice(item, faceDevs);
                        }

                        for (int i = faceDevs.Count - 1; i >= 0; i--)
                        {
                            var item      = faceDevs[i];
                            Node devNode  = new Node("<font color='blue'>" + item.FACEDEV_NAME + "</font>");
                            devNode.Image = Properties.Resources.editor;
                            devNode.Tag   = item;
                            nodes.Insert(0, devNode);
                        }
                        Node root  = new Node("所有人脸识别设备");
                        root.Image = Properties.Resources.house1818;
                        root.Nodes.AddRange(nodes.ToArray());
                        nodes.Clear();
                        nodes.Add(root);


                        advTree.Nodes.Clear();
                        advTree.Nodes.AddRange(nodes.ToArray());
                        advTree.ExpandAll();
                    }));

                    DoSearch(null, null, null);
                }
                catch (Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "加载人脸设备列表异常!" + ex.Message);
                    log.Error("加载人脸设备列表异常:", ex);
                }
            });

            waiting.Show(this);
        }
        private void FrmAddModifyStaffFaceDevPrivate_Load(object sender, EventArgs e)
        {
            if (_staffInfo != null)
            {
                this.TitleText      = "开始添加“" + _staffInfo.REAL_NAME + "”人脸设备权限";
                this.dtpStart.Value = _staffInfo.VALID_STARTTIME;
                this.dtpEnd.Value   = _staffInfo.VALID_ENDTIME;
            }

            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                try
                {
                    Maticsoft.BLL.SMT_FACERECG_DEVICE faceBll = new Maticsoft.BLL.SMT_FACERECG_DEVICE();
                    _faceDevices = faceBll.GetModelList("");
                    var areas    = AreaDataHelper.GetAreas();
                    this.Invoke(new Action(() =>
                    {
                        var nodes    = AreaDataHelper.ToTree(areas);
                        var faceDevs = _faceDevices.ToList();
                        foreach (var item in nodes)
                        {
                            DoCreateAreaDevice(item, faceDevs);
                        }

                        for (int i = faceDevs.Count - 1; i >= 0; i--)
                        {
                            var item      = faceDevs[i];
                            Node devNode  = new Node("<font color='blue'>" + item.FACEDEV_NAME + "</font>");
                            devNode.Image = Properties.Resources.editor;
                            devNode.Tag   = item;
                            nodes.Insert(0, devNode);
                        }
                        Node root  = new Node("所有人脸识别设备");
                        root.Image = Properties.Resources.house1818;
                        root.Nodes.AddRange(nodes.ToArray());
                        nodes.Clear();
                        nodes.Add(root);


                        advTree.Nodes.Clear();
                        advTree.Nodes.AddRange(nodes.ToArray());
                        advTree.ExpandAll();
                    }));
                }
                catch (Exception ex)
                {
                    WinInfoHelper.ShowInfoWindow(this, "加载人脸设备列表异常!" + ex.Message);
                    log.Error("加载人脸设备列表异常:", ex);
                }
            });

            waiting.Show(this);
        }
示例#4
0
        public static List <Maticsoft.Model.SMT_FACERECG_DEVICE> GetList(string strWhere, bool withArea = false, bool bUpdate = true)
        {
            if (!bUpdate && _devices != null && _devices.Count > 0)
            {
                return(_devices.ToList());
            }

            Maticsoft.BLL.SMT_FACERECG_DEVICE bll = new Maticsoft.BLL.SMT_FACERECG_DEVICE();
            if (withArea)
            {
                _devices = bll.GetModelListWithArea(strWhere);
            }
            _devices = bll.GetModelList(strWhere);
            return(_devices);
        }
示例#5
0
        private void Init()
        {
            dtpStart.Value = DateTime.Now.Date;
            CtrlWaiting waiting = new CtrlWaiting(() =>
            {
                Maticsoft.BLL.SMT_FACERECG_DEVICE faceBll = new Maticsoft.BLL.SMT_FACERECG_DEVICE();
                var depts    = DeptDataHelper.GetDepts(false);
                var facedevs = faceBll.GetModelList("");
                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 devNodes = FaceRecgHelper.ToFaceTree(facedevs, areas);
                    cboFaceTree.Nodes.AddRange(devNodes.ToArray());

                    foreach (Node item in cboFaceTree.Nodes)
                    {
                        item.ExpandAll();
                    }
                }));
            });

            waiting.Show(this, 300);
        }
示例#6
0
        private void Save(bool isupload)
        {
            if (!CheckInput())
            {
                return;
            }
            try
            {
                Maticsoft.Model.SMT_FACERECG_DEVICE devInfo = new Maticsoft.Model.SMT_FACERECG_DEVICE();
                if (_dev != null)
                {
                    devInfo.ID = _dev.ID;
                }
                else
                {
                    devInfo.ID = -1;
                }
                if (string.IsNullOrWhiteSpace(tbName.Text))
                {
                    devInfo.FACEDEV_NAME = ipDevIp.Value;
                }
                else
                {
                    devInfo.FACEDEV_NAME = tbName.Text;
                }

                devInfo.FACEDEV_IS_ENABLE  = cbIsEnable.Checked;
                devInfo.FACEDEV_SN         = tbDevSn.Text;
                devInfo.FACEDEV_IP         = ipDevIp.Value;
                devInfo.FACEDEV_CTRL_PORT  = iiDevCtrlPort.Value;
                devInfo.FACEDEV_HEART_PORT = iiDevHeartPort.Value;
                devInfo.FACEDEV_DB_PORT    = iiDbPort.Value;
                devInfo.FACEDEV_DB_NAME    = tbDbName.Text;
                devInfo.FACEDEV_DB_USER    = tbDbUserName.Text;
                devInfo.FACEDEV_DB_PWD     = tbDbPassword.Text;
                devInfo.FVIDEO_RTSP_COUNT  = cbVideoCount1.Checked ? 1 : 3;
                devInfo.FVIDEO_RTSP        = tbRtsp1.Text;
                devInfo.FVIDEO_RTSP2       = tbRtsp2.Text;
                devInfo.FVIDEO_RTSP3       = tbRtsp3.Text;
                devInfo.FVIDEO_FACE_LEVEL  = (decimal)diFaceLevel.Value;
                devInfo.FVIDEO_RIO_X       = (decimal)diRIO_X.Value;
                devInfo.FVIDEO_RIO_Y       = (decimal)diRIO_Y.Value;
                devInfo.FVIDEO_RIO_W       = (decimal)diRIO_W.Value;
                devInfo.FVIDEO_RIO_H       = (decimal)diRIO_H.Value;
                devInfo.FVIDEO_SINGLE      = cbModelSingle.Checked ? "Y" : "N";
                devInfo.FVIDEO_TITLE1      = tbDevTitle1.Text;
                devInfo.FVIDEO_TITLE2      = tbDevTitle2.Text;
                devInfo.AREA_ID            = -1;
                if (cboTreeArea.SelectedNode != null && cboTreeArea.SelectedNode.Tag is Maticsoft.Model.SMT_CONTROLLER_ZONE)
                {
                    var area = cboTreeArea.SelectedNode.Tag as Maticsoft.Model.SMT_CONTROLLER_ZONE;
                    devInfo.AREA_ID   = area.ID;
                    devInfo.AREA_NAME = area.ZONE_NAME;
                }

                CtrlWaiting waiting = new CtrlWaiting(() =>
                {
                    try
                    {
                        Maticsoft.BLL.SMT_FACERECG_DEVICE bllDev = new Maticsoft.BLL.SMT_FACERECG_DEVICE();
                        if (devInfo.ID == -1)
                        {
                            var models = bllDev.GetModelList("FACEDEV_IP='" + devInfo.FACEDEV_IP + "'");
                            if (models.Count > 0)
                            {
                                WinInfoHelper.ShowInfoWindow(this, "已存在IP为:" + devInfo.FACEDEV_IP + "的设备!");
                                return;
                            }
                            devInfo.ID = bllDev.Add(devInfo);
                        }
                        else
                        {
                            var models = bllDev.GetModelList("FACEDEV_IP='" + devInfo.FACEDEV_IP + "' and ID != " + devInfo.ID);
                            if (models.Count > 0)
                            {
                                WinInfoHelper.ShowInfoWindow(this, "已存在IP为:" + devInfo.FACEDEV_IP + "的设备!");
                                return;
                            }
                            bllDev.Update(devInfo);
                        }
                        _dev = devInfo;
                        if (isupload)
                        {
                            try
                            {
                                using (var faceRecg = FaceRecgHelper.ToFaceController(devInfo))
                                {
                                    var video = FaceRecgHelper.ToFaceVideo(devInfo);
                                    bool ret  = faceRecg.SetVideo(video);
                                    if (!ret)
                                    {
                                        WinInfoHelper.ShowInfoWindow(null, "上传视频设置失败!");
                                    }
                                    else if (!devInfo.FACEDEV_IS_ENABLE)
                                    {
                                        faceRecg.ClearFaces();
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                WinInfoHelper.ShowInfoWindow(null, "上传视频设置失败:" + ex.Message);
                            }
                        }

                        WinInfoHelper.ShowInfoWindow(null, "保存成功。");

                        this.BeginInvoke(new Action(() =>
                        {
                            this.DialogResult = DialogResult.OK;
                            this.Close();
                        }));
                    }
                    catch (Exception ex)
                    {
                        WinInfoHelper.ShowInfoWindow(this, "保存异常:" + ex.Message);
                        log.Error("保存异常:" + ex.Message, ex);
                    }
                });
                waiting.Show(this);
            }
            catch (Exception ex)
            {
                WinInfoHelper.ShowInfoWindow(this, "保存异常:" + ex.Message);
                log.Error("保存异常:" + ex.Message, ex);
            }
        }