//车辆己熄火5分钟 public bool IsAccOff(Guid vehicleCode) { HistoryLocusService db = new HistoryLocusService(); DateTime endDate = DateTime.Now; DateTime beginDate = endDate.AddMinutes(-5); IList<EGPSHistoryInfo> historyList = db.Get(vehicleCode, beginDate, endDate); foreach (EGPSHistoryInfo info in historyList) { if (info.ACCState == 1 || info.Speed != 0) { return false; } } return true; }
/// <summary> /// 从历史表中生成停车明细报表 /// </summary> public IList<VStopCarReport> SearchStop(IList<Guid> ltVehicleCode, DateTime beginTime, DateTime endTime, int second, string tenantCode, out Dictionary<Guid, TimeSpan> totalTime) { List<VStopCarReport> ltStop = new List<VStopCarReport>(); HistoryLocusService historyServ = new HistoryLocusService(); Dictionary<Guid, IList<EGPSHistoryInfo>> dic = historyServ.Get(ltVehicleCode, beginTime, endTime); totalTime = new Dictionary<Guid, TimeSpan>(); foreach (var item in dic) { if (item.Value != null && item.Value.Count > 0) totalTime.Add(item.Key, item.Value.Last().ReportTime - item.Value.First().ReportTime); else totalTime.Add(item.Key, new TimeSpan(0)); ltStop.AddRange(SearchStop(item.Value, second)); } if (ltStop.Count > 0) { IList<VStopCarReport> ltResult = ltStop as IList<VStopCarReport>; return ltResult; } return ltStop; }