Ejemplo n.º 1
0
        /// <summary>
        /// 解析 运行 信息
        /// </summary>
        private void txtInfoUpdateEntry(object info)
        {
            try
            {
                wgMjControllerSwipeRecord mjrec = new wgMjControllerSwipeRecord(info as string);
                if (mjrec.ControllerSN > 0)
                {
                    //如果不处于监控的控制器 则不作数据处理
                    int iSn = (int)mjrec.ControllerSN;
                    try
                    {
                        if (!watching.WatchingController.ContainsKey(iSn))
                        {
                            return; //不属于监控的控制器发出的信息 则返回
                        }
                    }
                    catch (Exception)
                    {
                        return;
                    }

                    #region  解析运行状态

                    int iCount = listWg.Count;
                    for (int iIndex = 0; iIndex < iCount; iIndex++)
                    {
                        if (listWg[iIndex] != null)
                        {
                            if (listWg[iIndex].IntSn == iSn)
                            {
                                string str = mjrec.ToDisplaySimpleInfo(true);

                                string strStart  = "Swipe Status: \t";
                                string strEnd    = "\r\nRead Date:";
                                string strStatus = DoorTimeInfo(str, strStart, strEnd);
                                //卡号
                                string strCardNo = "";
                                //门号
                                string strDoorNo = "";

                                #region 取得 卡号和门号

                                if (strStatus == WgOpenDoorType.刷卡开门.ToString() || strStatus == "刷卡禁止通过: 没有权限")
                                {
                                    strStart  = "CardID: \t";
                                    strEnd    = "\r\nDoorNO: \t";
                                    strCardNo = DoorTimeInfo(str, strStart, strEnd);
                                    if (strCardNo.Length == 6)
                                    {
                                        strCardNo = "00" + strCardNo;
                                    }
                                    if (strCardNo.Length == 7)
                                    {
                                        strCardNo = "0" + strCardNo;
                                    }
                                    strStart  = "DoorNO: \t";
                                    strEnd    = "\r\n \t[";
                                    strDoorNo = DoorTimeInfo(str, strStart, strEnd);
                                }
                                else if (strStatus == WgOpenDoorType.超级密码开门.ToString())
                                {
                                    strStart  = "DoorNO: \t";
                                    strEnd    = "\r\nSwipe";
                                    strDoorNo = DoorTimeInfo(str, strStart, strEnd);
                                }

                                #endregion

                                #region  更新 刷卡信息

                                if (listWg[iIndex].listDoor != null)
                                {
                                    int iCountDoor = listWg[iIndex].listDoor.Count;
                                    for (int iIndexDoor = 0; iIndexDoor < iCountDoor; iIndexDoor++)
                                    {
                                        int iDoorIndex = listWg[iIndex].listDoor[iIndexDoor].IntDoorIndex;
                                        if (strDoorNo == iDoorIndex.ToString())
                                        {
                                            if (strStatus == WgOpenDoorType.刷卡开门.ToString())
                                            {
                                                string strGroup = "";
                                                string strUser  = "";
                                                commonCls.GetWgUserGroup(strCardNo, ref strGroup, ref strUser);

                                                lock (listWg)
                                                {
                                                    listWg[iIndex].listDoor[iIndexDoor].StrOpenType = OpenDoorType.刷卡.ToString();
                                                    listWg[iIndex].listDoor[iIndexDoor].StrGroup    = strGroup;
                                                    listWg[iIndex].listDoor[iIndexDoor].StrUser     = strUser;
                                                }
                                            }
                                            else if (strStatus == WgOpenDoorType.超级密码开门.ToString())
                                            {
                                                lock (listWg)
                                                {
                                                    listWg[iIndex].listDoor[iIndexDoor].StrOpenType = OpenDoorType.密码.ToString();
                                                }
                                            }
                                            else if (strStatus == "刷卡禁止通过: 没有权限")
                                            {
                                                //报警显示
                                            }
                                            break;
                                        }
                                    }
                                }

                                #endregion

                                break;
                            }
                        }
                    }

                    #endregion
                }
            }
            catch (Exception ex)
            {
                if (frmMain.blDebug)
                {
                    MessageUtil.ShowTips(ex.Message);
                }
            }
        }