/// <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> /// <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); } } }