Esempio n. 1
0
        /// <summary>
        /// 处理定期报告信息
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="equipment"></param>
        /// <param name="terminal"></param>
        private void Handle0x1001(TX300 obj, TB_Equipment equipment, TB_Terminal terminal)
        {
            _0x1001 x1001 = new _0x1001();

            x1001.Content = obj.MsgContent;
            x1001.Unpackage();
            if (null != equipment)
            {
                EquipmentInstance.Update(f => f.id == equipment.id, act => {
                    act.Signal = x1001.CSQ_1 > 0 ? x1001.CSQ_1 : (x1001.CSQ_2 > 0 ? x1001.CSQ_2 : byte.MinValue);
                    if (x1001.WorkTime > 0)
                    {
                        act.Runtime = (int)x1001.WorkTime;
                    }
                });
            }

            var pos = GetGpsinfoFrom1001(x1001, true);

            pos.Equipment  = null == equipment ? (int?)null : equipment.id;
            pos.Terminal   = obj.TerminalID;
            pos.StoreTimes = null == equipment ? 0 : equipment.StoreTimes;
            PositionInstance.Add(pos);

            pos            = GetGpsinfoFrom1001(x1001, false);
            pos.Equipment  = null == equipment ? (int?)null : equipment.id;
            pos.Terminal   = obj.TerminalID;
            pos.StoreTimes = null == equipment ? 0 : equipment.StoreTimes;
            PositionInstance.Add(pos);
        }
Esempio n. 2
0
        /// <summary>
        /// 处理定期报告信息
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="equipment"></param>
        /// <param name="terminal"></param>
        private void Handle0x1001(TX300 obj, TB_Equipment equipment, TB_Terminal terminal)
        {
            _0x1001 x1001 = new _0x1001();

            x1001.Content = obj.MsgContent;
            x1001.Unpackage();
            HandleEquipmentRuntime(equipment, x1001.WorkTime);
            if (null != equipment)
            {
                using (var bll = new EquipmentBLL())
                {
                    bll.Update(f => f.id == equipment.id, act =>
                    {
                        act.Signal = (x1001.CSQ_1 > 0 && x1001.CSQ_1 <= 31) ? x1001.CSQ_1 :
                                     ((x1001.CSQ_2 > 0 && x1001.CSQ_2 <= 31) ? x1001.CSQ_2 : byte.MinValue);
                        // 去掉 0x1001 里面的运转时间更新
                        //if (x1001.WorkTime > 0)
                        //{
                        act.AccumulativeRuntime = equipment.AccumulativeRuntime;
                        act.Runtime             = equipment.Runtime;
                        //}
                        // 更新0x1001里的定位信息  2015/09/09 23:29
                        if (x1001.Available_2)
                        {
                            act.Latitude  = x1001.Latitude_2;
                            act.Longitude = x1001.Longitude_2;
                        }
                        else if (x1001.Available_1)
                        {
                            act.Latitude  = x1001.Latitude_1;
                            act.Longitude = x1001.Longitude_1;
                        }
                    });
                }
            }

            using (var posbll = new PositionBLL())
            {
                var pos = GetGpsinfoFrom1001(x1001, true);
                if ((pos.Longitude > 0 && pos.Longitude < 180) && (pos.Latitude > 0 && pos.Latitude < 90))
                {
                    pos.Equipment  = null == equipment ? (int?)null : equipment.id;
                    pos.Terminal   = obj.TerminalID;
                    pos.StoreTimes = null == equipment ? 0 : equipment.StoreTimes;
                    pos.Type       = "Period report" + GetPackageType(obj.ProtocolType);
                    posbll.Add(pos);
                }

                pos = GetGpsinfoFrom1001(x1001, false);
                if ((pos.Longitude > 0 && pos.Longitude < 180) && (pos.Latitude > 0 && pos.Latitude < 90))
                {
                    pos.Equipment  = null == equipment ? (int?)null : equipment.id;
                    pos.Terminal   = obj.TerminalID;
                    pos.StoreTimes = null == equipment ? 0 : equipment.StoreTimes;
                    pos.Type       = "Period report" + GetPackageType(obj.ProtocolType);
                    posbll.Add(pos);
                }
            }
        }
Esempio n. 3
0
        /// <summary>
        /// 从0x1001数据中取得定位信息记录
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="first"></param>
        /// <returns></returns>
        private TB_Data_Position GetGpsinfoFrom1001(_0x1001 obj, bool first)
        {
            TB_Data_Position info = PositionInstance.GetObject();

            info.Csq       = first ? obj.CSQ_1 : obj.CSQ_2;
            info.GpsTime   = first ? obj.GPSTime : obj.GPSTime.AddMinutes(30);
            info.Latitude  = first ? obj.Latitude_1 : obj.Latitude_2;
            info.Longitude = first ? obj.Longitude_1 : obj.Longitude_2;
            //info.SectorCode = obj.Sector;
            //info.StationCode = obj.Station;
            info.Type = "0x1001";
            return(info);
        }
Esempio n. 4
0
        /// <summary>
        /// 从0x1001数据中取得定位信息记录
        /// </summary>
        /// <param name="obj"></param>
        /// <param name="first"></param>
        /// <returns></returns>
        private TB_Data_Position GetGpsinfoFrom1001(_0x1001 obj, bool first)
        {
            TB_Data_Position info = new PositionBLL().GetObject();

            info.Csq       = first ? obj.CSQ_1 : obj.CSQ_2;
            info.GpsTime   = first ? obj.GPSTime : obj.GPSTime.AddMinutes(30);
            info.Latitude  = first ? obj.Latitude_1 : obj.Latitude_2;
            info.Longitude = first ? obj.Longitude_1 : obj.Longitude_2;
            //info.SectorCode = obj.Sector;
            //info.StationCode = obj.Station;
            //info.Type = "Period report" + GetPackageType(obj.ProtocolType);
            return(info);
        }