/// <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); }
/// <summary> /// 保存位置信息 /// </summary> /// <param name="obj"></param> private void SaveGpsInfo(GPSInfo obj, TB_Equipment equipment, string terminal, string type) { TB_Data_Position pos = PositionInstance.GetObject(); pos.Altitude = obj.Altitude; pos.Direction = obj.Direction; pos.Equipment = null == equipment ? (int?)null : equipment.id; pos.EW = obj.EW[0]; pos.GpsTime = obj.GPSTime; pos.Latitude = obj.Latitude; pos.Longitude = obj.Longitude; pos.NS = obj.NS[0]; pos.ReceiveTime = DateTime.Now; pos.Speed = obj.Speed; pos.StoreTimes = null == equipment ? 0 : equipment.StoreTimes; pos.Terminal = terminal; pos.Type = type; PositionInstance.Add(pos); }