public bool Execute()
        {
            try
            {
                if (_content.Length != 10)
                {
                    MyLibrary.Log.Debug(NAME + "长度错误:" + " 原始代码:" + OriginalCode);
                    return(true);
                }

                string SimCardNum = ConverUtil.ByteToStr_Q(_content, 0, 10);   //SIM卡串号

                MenJinInfo info = new MenJinInfo();
                info.pi_bigtype     = "67"; //0x0043
                info.pi_devicetime  = PlatformTime;
                info.pi_devicetype  = "";
                info.pi_devicecode  = StationId.ToString();
                info.pi_param1      = SimCardNum;
                info.pi_servicetime = PlatformTime;
                string Result = IMj2Dal.Insert(info);
                if (Result != "0")
                {
                    MyLibrary.Log.Debug(NAME + "出错:" + Result + " 原始代码:" + OriginalCode);
                }
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(NAME + "出错:" + ex.Message + " 原始代码:" + OriginalCode);
            }

            return(true);
        }
Beispiel #2
0
        public bool Execute()
        {
            try
            {
                DateTime DeviceTime        = ConverUtil.Time(_content, 0);            //设备时间。
                string   RoomCardType      = _content[6].ToString();                  //房卡类型。
                string   OldIdentitycardId = ConverUtil.ByteToStr_Q(_content, 7, 8);  //原身份证Id.
                string   NewCardType       = _content[15].ToString();                 //房卡类型。
                string   NewIdentitycardId = ConverUtil.ByteToStr_Q(_content, 16, 8); //新身份证Id.
                string   NewIdentitycard   = SFZUtil.ByteToStr(_content, 24);         //新身份证。

                MenJinInfo info = new MenJinInfo();
                info.pi_bigtype            = "61443"; //0xF003
                info.pi_devicetime         = DeviceTime;
                info.pi_devicecode         = StationId.ToString();
                info.pi_protocoltype       = "9"; //0x01
                info.pi_lordcardtype       = RoomCardType;
                info.pi_lordidentitycardid = OldIdentitycardId;
                info.pi_cardtype           = NewCardType;
                info.pi_identitycardid     = NewIdentitycardId;
                info.pi_identitycard       = NewIdentitycard;
                info.pi_servicetime        = PlatformTime;
                string Result = IMj2Dal.Insert(info);
                if (Result != "0")
                {
                    MyLibrary.Log.Debug(NAME + "出错:" + Result + " 原始代码:" + OriginalCode);
                }
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(NAME + "出错:" + ex.Message + " 原始代码:" + OriginalCode);
            }

            return(true);
        }
Beispiel #3
0
        private void Single(byte[] content)
        {
            try
            {
                Pro_CrewregistDevice_Card_Mod info = new Pro_CrewregistDevice_Card_Mod();
                info.Pi_DevId     = StationId.ToString();
                info.Pi_DevTime   = ConverUtil.Time(content, 0);                                    //设备时间
                info.Pi_CardId    = ConverUtil.ByteToStr_Q(content, 6, 8);                          //身份证卡号
                info.Pi_Identity  = ConverUtil.ASI_To_Str(ConverUtil.ByteToStr_Q(Content, 14, 18)); //身份证号
                info.Pi_Name      = Address(ConverUtil.ByteToStr_Q(Content, 32, 30));               //姓名
                info.Pi_Sex       = IsSex(ConverUtil.ByteToStr_Q(Content, 62, 1));                  //性别。
                info.Pi_Nation    = ConverUtil.MinZu(ConverUtil.ByteToStr_Q(Content, 63, 2));       //民族。
                info.Pi_Birthday  = TimeStr(ConverUtil.ByteToStr_Q(Content, 65, 8));                //出生年月日。
                info.Pi_Address   = Address(ConverUtil.ByteToStr_Q(Content, 73, 70));               //住址。
                info.Pi_SignUnit  = Address(ConverUtil.ByteToStr_Q(Content, 143, 30));              //签发机关。
                info.Pi_StartTime = TimeStr(ConverUtil.ByteToStr_Q(Content, 173, 8));               //起始日期。
                info.Pi_EndTime   = TimeStr(ConverUtil.ByteToStr_Q(Content, 181, 8));               //结束日期。

                UInt16 ResultNum;
                string Reason;
                Pro_CrewregistDevice_Card_Dal.Exec(info, out ResultNum, out Reason);
                if (ResultNum != 0)
                {
                    MyLibrary.Log.Debug(Name + "出错;" + Reason + " 原始代码:" + OriginalCode);
                }
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(Name + "错误:" + ex.Message + " 原始代码:" + OriginalCode);
            }
        }
Beispiel #4
0
        public bool Execute()
        {
            try
            {
                int      length = 12;
                int      count  = _content.Length / length;
                DateTime DeviceTime;
                string   MacAddress = "";
                for (int i = 0; i < count; i++)
                {
                    DeviceTime = ConverUtil.Time(_content, i * length);                 //设备时间。
                    MacAddress = ConverUtil.ByteToStr_Q(_content, 6 + (i * length), 6); //Mac地址。

                    MenJinInfo info = new MenJinInfo();
                    info.pi_bigtype     = "61446"; //0xF006
                    info.pi_devicetime  = DeviceTime;
                    info.pi_devicecode  = StationId.ToString();
                    info.pi_param1      = MacAddress;
                    info.pi_servicetime = PlatformTime;
                    string Result = IMj2Dal.Insert(info);
                    if (Result != "0")
                    {
                        MyLibrary.Log.Debug(NAME + "出错:" + Result + " 原始代码:" + OriginalCode);
                    }
                }
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(NAME + "出错:" + ex.Message + " 原始代码:" + OriginalCode);
            }

            return(true);
        }
Beispiel #5
0
        public void Single_30(byte[] content)
        {
            Pro_QiangZhiGuanKong_Mod info = new Pro_QiangZhiGuanKong_Mod();

            info.pi_CmdType     = "1";
            info.pi_ListId      = Guid.NewGuid().ToString("N");
            info.pi_DeviceTime  = ConverUtil.Time(content, 0);                             //设备时间
            info.pi_StationLng  = GetPosition(content, 6);                                 //经度。
            info.pi_StationLat  = GetPosition(content, 10);                                //维度。
            info.pi_param1      = content[14].ToString();                                  //防拆开关状态。
            info.pi_param2      = content[15].ToString();                                  //电量。
            info.pi_param3      = content[28].ToString();                                  //标志位。
            info.pi_param4      = content[29].ToString();                                  //是否移动。
            info.pi_param5      = ConverUtil.ByteToStr_Q(content, 18, 10);                 //手机串号。
            info.pi_param6      = content[16].ToString("D2") + content[17].ToString("D2"); //省市。
            info.pi_StationNo   = StationId.ToString();                                    //基站编号。
            info.pi_ServiceTime = PlatformTime;                                            //平台时间。
            info.pi_InTime      = DateTime.Now;                                            //入库时间。
            string Result = QiangZhiGuanKongDal.Handle(info);

            if (Result != "0")
            {
                MyLibrary.Log.Debug(Name + "出错:" + Result + " 原始代码:" + OriginalCode);
            }
        }
        public bool Execute()
        {
            try
            {
                DateTime DeviceTime     = ConverUtil.Time(_content, 0);           //设备时间。
                string   CardType       = _content[6].ToString();                 //卡类型。
                string   IdentitycardId = ConverUtil.ByteToStr_Q(_content, 7, 8); //身份证Id.
                string   Identitycard   = SFZUtil.ByteToStr(_content, 15);
                string   HomeNum        = _content[24].ToString();                //房东编号



                MenJinInfo info = new MenJinInfo();
                info.pi_bigtype        = "61443"; //0xF004
                info.pi_devicetime     = DeviceTime;
                info.pi_devicecode     = StationId.ToString();
                info.pi_protocoltype   = "1"; //0x01
                info.pi_cardtype       = CardType;
                info.pi_identitycardid = IdentitycardId;
                info.pi_identitycard   = Identitycard;
                info.pi_houseno        = HomeNum;
                info.pi_servicetime    = PlatformTime;
                string Result = IMj2Dal.Insert(info);
                if (Result != "0")
                {
                    MyLibrary.Log.Debug(NAME + "出错:" + Result + " 原始代码:" + OriginalCode);
                }
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(NAME + "出错:" + ex.Message + " 原始代码:" + OriginalCode);
            }

            return(true);
        }
        public bool Execute()
        {
            try
            {
                if (_content.Length != 21)
                {
                    MyLibrary.Log.Debug(Name + "长度无效:原始代码:" + OriginalCode);
                    return(true);
                }

                Pro_IndateBase_DZMP_Mod info = new Pro_IndateBase_DZMP_Mod();
                info.pi_bigtype      = "2";
                info.pi_protocoltype = "531";
                info.pi_devicetime   = ConverUtil.Time(_content, 0);
                info.pi_cardtype     = _content[6].ToString();                                                                                  //卡类型
                info.pi_cardid       = info.pi_cardtype == "0" ? ConverUtil.ByteToStr_Q(_content, 7, 8) : ConverUtil.ByteToStr_4(_content, 11); //设备时间
                info.pi_devicetype   = ConverUtil.ByteToStr_2(_content, 15);                                                                    //设备类型
                info.pi_devicecode   = ConverUtil.ByteToStr_4(_content, 17);                                                                    //设备Id
                info.pi_stationno    = StationId.ToString();
                info.pi_servicetime  = PlatformTime;
                Other.ChuZuWu.Pro_IndateBase_DZMP_Bll c = new Other.ChuZuWu.Pro_IndateBase_DZMP_Bll(info);
                string Result = c.Exec();
                if (Result != "0")
                {
                    MyLibrary.Log.Debug(Name + "出错:" + Result + " 原始代码:" + OriginalCode);
                }
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(Name + "出错:" + ex.Message + " 原始代码:" + OriginalCode);
            }

            return(true);
        }
        public bool Execute()
        {
            try
            {
                if (FileManagement.Commands.MenJin.Filter_Bll.IsRepeat(this.OriginalCode))
                {
                    MyLibrary.Log.RepeatDataInfo("基站编号:" + StationId.ToString() + " 原始代码:" + OriginalCode);
                    return(true);
                }

                DateTime DeviceTime      = ConverUtil.Time(_content, 0); //设备时间。
                string   IdentitycardId  = ConverUtil.ByteToStr_Q(_content, 6, 8);
                string   IsOpenByCardStr = _content[14].ToString();

                MJInfo info = new MJInfo();
                info.Protocol       = "661";
                info.DeviceId       = StationId.ToString();
                info.DeviceTime     = DeviceTime;
                info.IdentitycardId = IdentitycardId;
                info.IsOpenByCard   = IsOpenByCardStr;

                IMjDal.Handle(NAME, OriginalCode, info);
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(NAME + "错误;" + ex.Message + " 原始代码:" + OriginalCode);
            }
            return(true);
        }
        private Pro_IndateBase_MJNew_Mod GetInfo_New()
        {
            Pro_IndateBase_MJNew_Mod info = new Pro_IndateBase_MJNew_Mod();
            int    IsIdentitycard         = Convert.ToInt32(_content[22].ToString());//有无身份证(128:无身份证)
            string CardType = "";
            string ICCard   = "";
            string HouseNum = "";      //房东编号。

            if (IsIdentitycard >= 128)
            {
                CardType = _content[13].ToString();
                ICCard   = ConverUtil.ByteToStr_4(_content, 14); //IC卡。
                HouseNum = (IsIdentitycard - 128).ToString();
            }
            else
            {
                CardType = "0";
                ICCard   = ConverUtil.ByteToStr_Q(_content, 10, 8); //租客身份证。
                HouseNum = IsIdentitycard.ToString();
            }
            info.pi_bigtype      = "2";
            info.pi_devicetime   = ConverUtil.Time(_content, 0);
            info.pi_protocoltype = CmdId;
            info.pi_devicecode   = ConverUtil.ByteToStr_4(_content, 6); //门戒编号。
            info.pi_cardtype     = CardType;
            info.pi_cardid       = ICCard;
            info.pi_houseno      = HouseNum;
            info.pi_activecardid = ConverUtil.ByteToStr_4(_content, 18);  //有源卡。
            info.pi_stationno    = StationId.ToString();
            info.pi_servicetime  = PlatformTime;
            return(info);
        }
        public bool Execute()
        {
            try
            {
                if (_content.Length != 27)
                {
                    MyLibrary.Log.Debug(Name + "长度无效:原始代码:" + OriginalCode);
                    return(true);
                }

                Pro_IndateBase_ZHMJ_Mod info = new Pro_IndateBase_ZHMJ_Mod();
                info.pi_bigtype     = "1";
                info.pi_cardtype    = _content[14].ToString();      //卡类型
                info.pi_cardid      = info.pi_cardtype == "0" ? ConverUtil.ByteToStr_Q(_content, 15, 8) : ConverUtil.ByteToStr_4(_content, 19);
                info.pi_HEADCOUNT   = _content[23].ToString();      //房间内人数
                info.pi_OPENTIMES   = _content[24].ToString();      //每天开门次数
                info.pi_stationno   = StationId.ToString();
                info.pi_servicetime = PlatformTime;


                Other.ChuZuWu.Pro_IndateBase_ZHMJ_Bll c = new Other.ChuZuWu.Pro_IndateBase_ZHMJ_Bll(info);
                string Result = c.Exec();
                if (Result != "0")
                {
                    MyLibrary.Log.Debug(Name + "出错:" + Result + " 原始代码:" + OriginalCode);
                }
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(Name + "出错:" + ex.Message + " 原始代码:" + OriginalCode);
            }


            return(true);
        }
        public bool Execute()
        {
            try
            {
                string[] GetCardTypeAndHouseNo = DataJM.GetCardTypeAndHouseNo(_content[14].ToString());
                Pro_IndateBase_ZHMJ_Mod info   = new Pro_IndateBase_ZHMJ_Mod();
                info.pi_bigtype      = "2";
                info.pi_devicetime   = ConverUtil.Time(_content, 0);
                info.pi_devicetype   = ConverUtil.ByteToStr_2(_content, 7);
                info.pi_devicecode   = ConverUtil.ByteToStr_4(_content, 9);
                info.pi_protocoltype = _content[13].ToString();
                info.pi_houseno      = GetCardTypeAndHouseNo[1]; //房东编号。
                info.pi_cardtype     = GetCardTypeAndHouseNo[0];
                info.pi_cardid       = info.pi_cardtype == "0" ? ConverUtil.ByteToStr_Q(_content, 15, 8) : ConverUtil.ByteToStr_4(_content, 19);;
                info.pi_policecard   = ConverUtil.ByteToStr_4(_content, 23); //警察卡
                info.pi_stationno    = StationId.ToString();
                info.pi_servicetime  = PlatformTime;
                Other.ChuZuWu.Pro_IndateBase_ZHMJ_Bll c = new Other.ChuZuWu.Pro_IndateBase_ZHMJ_Bll(info);
                string Result = c.Exec();
                if (Result != "0")
                {
                    MyLibrary.Log.Debug(Name + "出错:" + Result + " 原始代码:" + OriginalCode);
                }
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(Name + "出错:" + ex.Message + " 原始代码:" + OriginalCode);
            }


            return(true);
        }
        public static bool IsRepeat(byte[] content)
        {
            int    Int_10      = content[6] & 0x1f;
            string Str_16      = Int_10.ToString("x2").ToUpper();
            string Str_Content = ConverUtil.ByteToStr_Q(content, 7, 26);
            string Data        = Str_16 + Str_Content;

            return(FileManagementDal.RepeatData.IsRepeatDataNN(Data));
        }
        public bool Execute()
        {
            try
            {
                DateTime DeviceTime             = ConverUtil.Time(_content, 0);           //设备时间。
                string   HomeCardType           = _content[6].ToString();                 //房东卡类型.
                string   HomeCardIdentitycardId = ConverUtil.ByteToStr_Q(_content, 7, 8); //房东卡身份证ID.
                string   CardType   = _content[15].ToString();                            //卡类型。
                string   CardId     = "";
                byte[]   EJUcardNum = new byte[4];                                        //E居卡卡号
                Array.Copy(_content, 16, EJUcardNum, 0, 4);
                if (CardType == "9")
                {
                    CardId = ConverUtil.ByteToStr_A(EJUcardNum);
                }
                else
                {
                    CardId = (Convert.ToUInt32(ConverUtil.ByteToStr_A(EJUcardNum), 16)).ToString();
                }
                string UserIdentitycardId = ConverUtil.ByteToStr_Q(_content, 20, 8); //用户身份证ID。
                string Identitycard       = SFZUtil.ByteToStr(_content, 28);         //身份证。
                string HomeNum            = _content[37].ToString();                 //房东编号。
                string RoomNum            = ConverUtil.ByteToStr_2(_content, 38);    //房间号。

                MenJinInfo info = new MenJinInfo();
                info.pi_bigtype            = "61443"; //0xF004
                info.pi_devicetime         = DeviceTime;
                info.pi_devicecode         = StationId.ToString();
                info.pi_protocoltype       = "4"; //0x01
                info.pi_lordcardtype       = HomeCardType;
                info.pi_lordidentitycardid = HomeCardIdentitycardId;
                info.pi_cardtype           = CardType;
                info.pi_cardid             = CardId;
                info.pi_identitycardid     = UserIdentitycardId;
                info.pi_identitycard       = Identitycard;
                info.pi_houseno            = HomeNum;
                info.pi_roomno             = RoomNum;
                info.pi_servicetime        = PlatformTime;
                string Result = IMj2Dal.Insert(info);
                if (Result != "0")
                {
                    MyLibrary.Log.Debug(NAME + "出错:" + Result + " 原始代码:" + OriginalCode);
                }
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(NAME + "出错:" + ex.Message + " 原始代码:" + OriginalCode);
            }

            return(true);
        }
Beispiel #14
0
 private string CardId(string type, byte[] content)
 {
     if (type == "5")
     {
         return(ConverUtil.ByteToStr_Q(content, 14, 4));  //CardId。
     }
     else if (type == "9")
     {
         return(ConverUtil.ByteToStr_Q(content, 10, 8));  //身份证。
     }
     else
     {
         return("");
     }
 }
        public bool Execute()
        {
            try
            {
                DateTime DeviceTime         = ConverUtil.Time(_content, 0);           //设备时间。
                string   HomeCardType       = _content[6].ToString();                 //房东卡类型。
                string   HomeIdentitycardId = ConverUtil.ByteToStr_Q(_content, 7, 8); //房东身份Id.
                string   CardType           = _content[15].ToString();                //卡类型。

                string pi_cardid      = "";
                byte[] ShenFenZhengID = new byte[8];
                Array.Copy(_content, 16, ShenFenZhengID, 0, 8);
                if (CardType == "5")
                {
                    pi_cardid = (Convert.ToUInt64(ConverUtil.ByteToStr_A(ShenFenZhengID), 16)).ToString();
                }
                if (CardType == "9")
                {
                    pi_cardid = ConverUtil.ByteToStr_A(ShenFenZhengID);
                }
                string HomeNum = _content[24].ToString();              //房东编号。
                string RoomNum = ConverUtil.ByteToStr_2(_content, 25); //房间号。


                MenJinInfo info = new MenJinInfo();
                info.pi_bigtype            = "61443"; //0xF004
                info.pi_devicetime         = DeviceTime;
                info.pi_devicecode         = StationId.ToString();
                info.pi_protocoltype       = "7"; //0x01
                info.pi_lordcardtype       = HomeCardType;
                info.pi_lordidentitycardid = HomeIdentitycardId;
                info.pi_cardtype           = CardType;
                info.pi_cardid             = pi_cardid;
                info.pi_houseno            = HomeNum;
                info.pi_roomno             = RoomNum;
                info.pi_servicetime        = PlatformTime;
                string Result = IMj2Dal.Insert(info);
                if (Result != "0")
                {
                    MyLibrary.Log.Debug(NAME + "出错:" + Result + " 原始代码:" + OriginalCode);
                }
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(NAME + "出错:" + ex.Message + " 原始代码:" + OriginalCode);
            }
            return(true);
        }
        public static CZW_61506_0426_02_Mod GetMod(byte[] content)
        {
            CZW_61506_0426_02_Mod info = new CZW_61506_0426_02_Mod();

            info.设备时间 = ConverUtil.Time(content, 0);
            info.中继号  = content[6].ToString();
            info.设备类型 = ConverUtil.ByteToInt_2(content, 7);
            info.设备编号 = ConverUtil.ByteToInt_4(content, 9);
            info.命令字  = content[13];

            info.卡类型   = content[14];
            info.卡号    = ConverUtil.ByteToStr_Q(content, 15, 8);
            info.软件版本号 = content[33];
            info.RSSI  = content[34];

            return(info);
        }
Beispiel #17
0
 private void Single(byte[] content)
 {
     try
     {
         Tb_LKCommunity_Alarm_Mod info = new Tb_LKCommunity_Alarm_Mod();
         info.ListId     = Guid.NewGuid().ToString("N");
         info.DeviceId   = StationId.ToString();
         info.DeviceTime = ConverUtil.Time(content, 0);
         info.Alarm      = ConverUtil.ByteToStr_Q(content, 6, 3);
         info.InTime     = DateTime.Now;
         FileManagementDal.SocialAppTerminal.Tb_LKCommunity_Alarm_Dal.Insert(info);
     }
     catch (Exception ex)
     {
         MyLibrary.Log.Error(Name + "错误:" + ex.Message + " 原始代码:" + OriginalCode);
     }
 }
Beispiel #18
0
        public bool Execute()
        {
            int length = 19;

            if (Content.Length % length == 0)
            {
                int    Count = Content.Length / length;
                string DeviceType;
                string CommandId;
                byte[] SubContent;
                for (int i = 0; i < Count; i++)
                {
                    DeviceType = ConverUtil.ByteToStr_Q(Content, 7 + (length * i), 2);
                    CommandId  = Content[13 + (i * length)].ToString();
                    SubContent = ConverUtil.Byte_Q(Content, length * i, length);
                    ICommand cmd;
                    switch (DeviceType)
                    {
                    case "8016":
                        switch (CommandId)
                        {
                        case "1":
                            cmd = new DJJ_61443_8016_01(SubContent, StationId, PlatformTime);
                            break;

                        default:
                            cmd = new IgnoreCommand();
                            break;
                        }
                        break;

                    default:
                        cmd = new IgnoreCommand();
                        break;
                    }
                    cmd.Execute();
                }
            }
            else
            {
                MyLibrary.Log.Fatal(NAME + "长度出错;原始代码:" + MyLibrary.ConverUtil.ByteToHStr(Content));
            }

            return(true);
        }
Beispiel #19
0
 private void Single(byte[] content)
 {
     try
     {
         Tb_LKCommunityRecord_Mod info = new Tb_LKCommunityRecord_Mod();
         info.DeviceId   = StationId.ToString();
         info.RecordTime = DateTime.Now;
         info.DeviceTime = ConverUtil.Time(content, 0);
         info.CardType   = content[6].ToString(); //身份证卡类型09信息为8位,IC卡类型05信息为4位;
         info.CardId     = CardId(info.CardType, content);
         info.Reserve    = ConverUtil.ByteToStr_Q(content, 7, 3);
         info.IdCard     = DataJM.SFZ_Str(content, 18);
         FileManagementDal.SocialAppTerminal.Tb_LKCommunityRecord_Dal.Insert(info);
     }
     catch (Exception ex)
     {
         MyLibrary.Log.Error(Name + "错误:" + ex.Message + " 原始代码:" + OriginalCode);
     }
 }
        public bool Execute()
        {
            try
            {
                if (_content.Length != 23)
                {
                    MyLibrary.Log.Debug(Name + "长度无效:原始代码:" + OriginalCode);
                    return(true);
                }

                Pro_CZW_XiaFa_Mod info = new Pro_CZW_XiaFa_Mod();
                info.pi_Protocol = "1";
                info.pi_Guid     = ConverUtil.ByteToStr_Q(_content, 4, 16); //Guid
                info.pi_CmdId    = ConverUtil.ByteToStr_2(_content, 20);    //命令字。
                info.pi_Result   = _content[22].ToString();                 //结果。



                string Result = "";
                int    resultnum;
                string reason;
                Pro_CZW_XiaFa_Dal.Exec(info, out resultnum, out reason);
                if (resultnum == 0)
                {
                    Result = "0";
                }
                else
                {
                    Result = reason;
                }
                if (Result != "0")
                {
                    MyLibrary.Log.Debug(Name + "出错:" + Result + " 原始代码:" + OriginalCode);
                }
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(Name + "出错:" + ex.Message + " 原始代码:" + OriginalCode);
            }


            return(true);
        }
        public bool Execute()
        {
            try
            {
                if (_content.Length != 22)
                {
                    MyLibrary.Log.Debug(Name + "长度无效:原始代码:" + OriginalCode);
                    return(true);
                }

                string   ElectronicsDoorPlate   = ConverUtil.ByteToStr_4(_content, 0);    //电子门牌ID
                string   MasterIdentificationId = ConverUtil.ByteToStr_Q(_content, 4, 8); //房东身份证ID
                string   PoliceCard             = ConverUtil.ByteToStr_4(_content, 12);   // 警察卡ID
                DateTime time = ConverUtil.Time(_content, 16);                            //设备时间


                Pro_IndateBase_DZMP_Mod info = new Pro_IndateBase_DZMP_Mod();
                info.pi_bigtype        = "2";
                info.pi_devicetype     = "1029";
                info.pi_protocoltype   = "522";
                info.pi_devicetime     = time;
                info.pi_stationno      = StationId.ToString();
                info.pi_servicetime    = PlatformTime;
                info.pi_devicecode     = ElectronicsDoorPlate;
                info.pi_identitycardid = MasterIdentificationId;
                info.pi_cardid         = PoliceCard;

                Other.ChuZuWu.Pro_IndateBase_DZMP_Bll c = new Other.ChuZuWu.Pro_IndateBase_DZMP_Bll(info);
                string Result = c.Exec();
                if (Result != "0")
                {
                    MyLibrary.Log.Debug(Name + "出错:" + Result + " 原始代码:" + OriginalCode);
                }
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(Name + "出错:" + ex.Message + " 原始代码:" + OriginalCode);
            }



            return(true);
        }
        private Pro_IndateBase_MJNew_Mod GetInfo_New()
        {
            Pro_IndateBase_MJNew_Mod info = new Pro_IndateBase_MJNew_Mod();
            int Count = (_content.Length - 10) / 13;

            string[] CardTypeArray = new string[Count]; //卡类型数组。
            string[] CardIdArray   = new string[Count]; //是身份证或Ic卡数组。
            string[] HouseNumArray = new string[Count]; //房东号数组。
            string[] ActivecArray  = new string[Count]; //有源卡数组。
            byte[]   Data;
            int      IsIdentitycard;

            for (int i = 0; i < Count; i++)
            {
                Data = new byte[13];
                Array.Copy(_content, (i * 13) + 10, Data, 0, 13);
                IsIdentitycard = Convert.ToInt32(Data[0].ToString());
                if (IsIdentitycard >= 128)
                {
                    CardTypeArray[i] = Data[4].ToString();
                    CardIdArray[i]   = ConverUtil.ByteToStr_4(Data, 5);
                    HouseNumArray[i] = (IsIdentitycard - 128).ToString();
                }
                else
                {
                    CardTypeArray[i] = "0";
                    CardIdArray[i]   = ConverUtil.ByteToStr_Q(Data, 1, 8);
                    HouseNumArray[i] = IsIdentitycard.ToString();
                }
                ActivecArray[i] = ConverUtil.ByteToStr_4(Data, 9);
            }
            info.pi_bigtype      = "2";
            info.pi_protocoltype = CmdId;
            info.pi_devicetime   = ConverUtil.Time(_content, 0);
            info.pi_devicecode   = ConverUtil.ByteToStr_4(_content, 6); //门戒Id。
            info.pi_cardtype     = ConverUtil.GetArrayToStr(CardTypeArray);
            info.pi_cardid       = ConverUtil.GetArrayToStr(CardIdArray);
            info.pi_houseno      = ConverUtil.GetArrayToStr(HouseNumArray);
            info.pi_activecardid = ConverUtil.GetArrayToStr(ActivecArray);
            info.pi_stationno    = StationId.ToString();
            info.pi_servicetime  = PlatformTime;
            return(info);
        }
Beispiel #23
0
        public bool Execute()
        {
            try
            {
                if (_content.Length != 38)
                {
                    MyLibrary.Log.Debug(Name + "长度无效:原始代码:" + OriginalCode);
                    return(true);
                }



                Pro_IndateBase_DZMP_Mod info = new Pro_IndateBase_DZMP_Mod();
                info.pi_bigtype            = "2";
                info.pi_devicetype         = "1029";
                info.pi_protocoltype       = "524";
                info.pi_devicetime         = ConverUtil.Time(_content, 32);           //设备时间
                info.pi_devicecode         = ConverUtil.ByteToStr_4(_content, 0);     //电子门牌ID
                info.pi_lordidentitycardid = ConverUtil.ByteToStr_Q(_content, 4, 8);  //房东身份证ID
                info.pi_identitycardid     = ConverUtil.ByteToStr_Q(_content, 12, 8); //租客身份证ID
                info.pi_cardid             = ConverUtil.ByteToStr_4(_content, 20);    // e居住卡ID
                info.pi_activecardid       = ConverUtil.ByteToStr_4(_content, 24);    // 有源卡ID
                info.pi_roomno             = ConverUtil.ByteToStr_4(_content, 28);    // 房间ID
                info.pi_stationno          = StationId.ToString();
                info.pi_servicetime        = PlatformTime;

                Other.ChuZuWu.Pro_IndateBase_DZMP_Bll c = new Other.ChuZuWu.Pro_IndateBase_DZMP_Bll(info);
                string Result = c.Exec();
                if (Result != "0")
                {
                    MyLibrary.Log.Debug(Name + "出错:" + Result + " 原始代码:" + OriginalCode);
                }
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(Name + "出错:" + ex.Message + " 原始代码:" + OriginalCode);
            }


            return(true);
        }
Beispiel #24
0
 /// <summary>
 /// 14字节处理程序。
 /// </summary>
 /// <param name="content"></param>
 private void Single_14(byte[] content)
 {
     try
     {
         Pro_ShipDevice_Card_Mod info = new Pro_ShipDevice_Card_Mod();
         info.Pi_DevId   = StationId.ToString();                  //设备编号
         info.Pi_DevTime = ConverUtil.Time(content, 0);           //设备时间
         info.Pi_CardNo  = ConverUtil.ByteToStr_Q(content, 6, 8); //身份证Id。
         UInt16 ResultNum;
         string Reason;
         Pro_ShipDevice_Card_Dal.Exec(info, out ResultNum, out Reason);
         if (ResultNum != 0)
         {
             MyLibrary.Log.Debug(Name + "出错;" + Reason + " 原始代码:" + OriginalCode);
         }
     }
     catch (Exception ex)
     {
         MyLibrary.Log.Error(Name + "错误:" + ex.Message + " 原始代码:" + OriginalCode);
     }
 }
Beispiel #25
0
        public bool Execute()
        {
            try
            {
                if (RepeatData.IsRepeatData(_content))
                {
                    MyLibrary.Log.RepeatDataInfo("基站编号:" + StationId.ToString() + " 原始代码:" + OriginalCode);
                    return(true);
                }


                Pro_IndateBase_ZHMJ_Mod info = new Pro_IndateBase_ZHMJ_Mod();
                info.pi_bigtype      = "1";
                info.pi_devicetime   = ConverUtil.Time(_content, 0);
                info.pi_devicetype   = ConverUtil.ByteToStr_2(_content, 7);
                info.pi_devicecode   = ConverUtil.ByteToStr_4(_content, 9);
                info.pi_protocoltype = _content[13].ToString();
                info.pi_cardtype     = _content[14].ToString(); //卡类型
                info.pi_cardid       = info.pi_cardtype == "0" ? ConverUtil.ByteToStr_Q(_content, 15, 8) : ConverUtil.ByteToStr_4(_content, 19);;
                info.pi_HEADCOUNT    = _content[23].ToString(); //房间内人数
                info.pi_OPENTIMES    = _content[24].ToString(); //每天开门次数
                info.pi_version      = _content[26].ToString();
                info.pi_stationno    = StationId.ToString();
                info.pi_servicetime  = PlatformTime;

                Other.ChuZuWu.Pro_IndateBase_ZHMJ_Bll c = new Other.ChuZuWu.Pro_IndateBase_ZHMJ_Bll(info);
                string Result = c.Exec();
                if (Result != "0")
                {
                    MyLibrary.Log.Debug(Name + "出错:" + Result + " 原始代码:" + OriginalCode);
                }
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(Name + "出错:" + ex.Message + " 原始代码:" + OriginalCode);
            }


            return(true);
        }
Beispiel #26
0
        public bool Execute()
        {
            try
            {
                if (_content.Length != 20)
                {
                    MyLibrary.Log.Debug(Name + "长度无效:原始代码:" + OriginalCode);
                    return(true);
                }

                string   DeviceType = ConverUtil.ByteToStr_2(_content, 0);     //设备类型
                string   DeviceId   = ConverUtil.ByteToStr_4(_content, 2);     //设备Id
                DateTime time       = ConverUtil.Time(_content, 6);            //设备时间
                string   IdentityId = ConverUtil.ByteToStr_Q(_content, 12, 8); //身份证Id


                Pro_IndateBase_Sec_Mod info = new Pro_IndateBase_Sec_Mod();
                info.pi_bigtype      = "10";
                info.pi_devicetime   = time;
                info.pi_devicetype   = DeviceType;
                info.pi_devicecode   = DeviceId;
                info.pi_protocoltype = "519";
                info.pi_param1       = IdentityId;
                info.pi_stationno    = StationId.ToString();
                info.pi_servicetime  = PlatformTime;

                Other.ChuZuWu.Pro_IndateBase_Sec_Bll c = new Other.ChuZuWu.Pro_IndateBase_Sec_Bll(info);
                string Result = c.Exec();
                if (Result != "0")
                {
                    MyLibrary.Log.Debug(Name + "出错:" + Result + " 原始代码:" + OriginalCode);
                }
            }
            catch (Exception ex)
            {
                MyLibrary.Log.Error(Name + "出错:" + ex.Message + " 原始代码:" + OriginalCode);
            }

            return(true);
        }
        /// <summary>
        /// 是否为重复数据。
        /// </summary>
        /// <param name="_content"></param>
        /// <returns></returns>
        //public static bool IsRepeatData(byte[] _content)
        //{


        //    string RelayNo = _content[6].ToString();  //中继号
        //    string DevInfo = ConverUtil.ByteToStr_Q(_content, 6, _content.Length - 6);
        //    string sn = (Convert.ToInt32(RelayNo) % 32).ToString();
        //    if (DataClear.IsDataInsert(DevInfo, sn))   //返回true进入下一循环
        //    {
        //        return true;
        //    }
        //    else
        //    {
        //        return false;
        //    }
        //}


        public static bool IsRepeatData(byte[] _content)
        {
            if (!Config.RedoDataConfig.IsOpen)
            {
                return(false);
            }

            if (!DataClear.IsChuShiHua)
            {
                return(false);
            }
            string DevInfo = ConverUtil.ByteToStr_Q(_content, 7, _content.Length - 7);

            if (DataClear.IsDataInsert(DevInfo, DevInfo))   //返回true进入下一循环
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
        public static CZW_2_Mod GetMod(byte[] content)
        {
            //时间(6) + 身份证id(8) + 身份证号(18) + 姓名(30) + 性别(1) + 名族(2) + 出生年月日(8) + 住址(70) + 签发机关(30) + 起始日期(8) + 结束日期(8)

            CZW_2_Mod info = new CZW_2_Mod();

            info.时间    = ConverUtil.Time(content, 0);
            info.身份证id = ConverUtil.ByteToStr_Q(content, 6, 8);
            info.身份证号  = GetSFZ(content.Skip(14).Take(18).ToArray());
            info.姓名    = GetName(content.Skip(32).Take(30).ToArray());
            info.性别    = GetSex(content.Skip(62).Take(1).ToArray());
            info.族     = GetMZ(content.Skip(63).Take(2).ToArray());
            info.出生年月日 = GetBirday(content.Skip(65).Take(8).ToArray());
            info.住址    = GetAddress(content.Skip(73).Take(70).ToArray());
            info.签发机关  = GetAddress(content.Skip(143).Take(30).ToArray());
            info.起始日期  = GetBirday(content.Skip(173).Take(8).ToArray());
            info.结束日期  = GetBirday(content.Skip(181).Take(8).ToArray());



            return(info);
        }
Beispiel #29
0
 private string RepeatStr()
 {
     return(ConverUtil.ByteToStr_Q(this._content, 6, this._content.Length - 7));
 }
        public bool Execute()
        {
            int length = 35;

            if (Content.Length % length == 0)
            {
                int    Count = Content.Length / length;
                string DeviceType;
                string CommandId;
                byte[] SubContent;
                for (int i = 0; i < Count; i++)
                {
                    DeviceType = ConverUtil.ByteToStr_Q(Content, 7 + (length * i), 2);
                    CommandId  = Content[13 + (i * length)].ToString();
                    SubContent = ConverUtil.Byte_Q(Content, length * i, length);
                    ICommand cmd;
                    switch (DeviceType)
                    {
                    case "0411":
                        switch (CommandId)
                        {
                        case "1":
                            cmd = new CZW_61506_0411_01(SubContent, StationId, PlatformTime);
                            break;

                        case "2":
                            cmd = new CZW_61506_0411_02(SubContent, StationId, PlatformTime);
                            break;

                        case "3":
                            cmd = new CZW_61506_0411_03(SubContent, StationId, PlatformTime);
                            break;

                        case "17":
                            cmd = new CZW_61506_0411_17(SubContent, StationId, PlatformTime);
                            break;

                        case "19":
                            cmd = new CZW_61506_0411_19(SubContent, StationId, PlatformTime);
                            break;

                        case "21":
                            cmd = new CZW_61506_0411_21(SubContent, StationId, PlatformTime);
                            break;

                        //case "33":
                        //    cmd = new CZW_61506_0411_33(SubContent, StationId, PlatformTime);
                        //    break;
                        case "35":
                            cmd = new CZW_61506_0411_35(SubContent, StationId, PlatformTime);
                            break;

                        case "37":
                            cmd = new CZW_61506_0411_37(SubContent, StationId, PlatformTime);
                            break;

                        case "51":
                            cmd = new CZW_61506_0411_51(SubContent, StationId, PlatformTime);
                            break;

                        case "53":
                            cmd = new CZW_61506_0411_53(SubContent, StationId, PlatformTime);
                            break;

                        case "67":
                            cmd = new CZW_61506_0411_67(SubContent, StationId, PlatformTime);
                            break;

                        case "69":
                            cmd = new CZW_61506_0411_69(SubContent, StationId, PlatformTime);
                            break;

                        case "177":
                            cmd = new CZW_61506_0411_177(SubContent, StationId, PlatformTime);
                            break;

                        case "195":
                            cmd = new CZW_61506_0411_195(SubContent, StationId, PlatformTime);
                            break;

                        case "197":
                            cmd = new CZW_61506_0411_197(SubContent, StationId, PlatformTime);
                            break;

                        case "199":
                            cmd = new CZW_61506_0411_199(SubContent, StationId, PlatformTime);
                            break;

                        case "201":
                            cmd = new CZW_61506_0411_201(SubContent, StationId, PlatformTime);
                            break;

                        default:
                            cmd = new IgnoreCommand();
                            break;
                        }
                        break;

                    case "0426":
                        switch (CommandId)
                        {
                        case "1":
                            cmd = new CZW_61506_0426_01(SubContent, StationId, PlatformTime);
                            break;

                        case "2":
                            cmd = new CZW_61506_0426_02(SubContent, StationId, PlatformTime);
                            break;

                        case "3":
                            cmd = new CZW_61506_0426_03(SubContent, StationId, PlatformTime);
                            break;

                        case "4":
                            cmd = new CZW_61506_0426_04(SubContent, StationId, PlatformTime);
                            break;

                        default:
                            cmd = new IgnoreCommand();
                            break;
                        }
                        break;

                    default:
                        cmd = new IgnoreCommand();
                        break;
                    }
                    cmd.Execute();
                }
            }
            else
            {
                MyLibrary.Log.Fatal(Name + "长度出错;原始代码:" + MyLibrary.ConverUtil.ByteToHStr(Content));
            }

            return(true);
        }