Пример #1
0
        //非报警状态直接从当前数据做判断。
        private string GetRunningState(EGPSCurrentInfo gpsCurrentInfo)
        {
            EnumRunningState state = EnumRunningState.Running;

            if (gpsCurrentInfo.Speed == 0 || gpsCurrentInfo.ACCState == 0)
                state = EnumRunningState.Stop;
            if (gpsCurrentInfo.Speed == 0 && gpsCurrentInfo.ACCState == 1)
                state = EnumRunningState.StopAccOn;
            return ((int)state).ToString();
        }
Пример #2
0
        private string GetOilValue(EBaseVehicle vehicleInfo, EGPSCurrentInfo currentInfo, EGPSInstallationInfo installationInfo)
        {
            try
            {
                string oilValue = string.Empty;

                if (installationInfo != null)
                {
                    if (GPSTypeHelper.IsSupportOil(installationInfo))
                    {
                        double oliValue = CalculateOilValue.GetOilValue(vehicleInfo, installationInfo, Convert.ToDouble(currentInfo.OilBearing));
                        return oliValue.ToString("0.00");
                    }
                }
            }
            catch (Exception ex)
            {
                Logger.Error(ex);
            }

            return "0";
        }
Пример #3
0
 private void SetOilValue(EBaseVehicle vehicleInfo, VRealTimeInfo realTimeInfoViewEntity, EGPSCurrentInfo currentInfo, EGPSInstallationInfo installationInfo, bool isNotCalcOil)
 {
     if (!isNotCalcOil)      //isNotCalcOil 为真时,不取油耗数据
     {
         try
         {
             realTimeInfoViewEntity.OilValue = GetOilValue(vehicleInfo, currentInfo, installationInfo);
         }
         catch (Exception ex)
         {
             Logger.Error(ex);
         }
     }
 }
Пример #4
0
 private void UpdateMileage(IList<EVehicleAndMileage> ltEVehicleAndMileage, EGPSCurrentInfo currentInfo, EGPSInstallationInfo installationInfo)
 {
     try
     {
         if (ltEVehicleAndMileage.Count > 0)
         {
             EVehicleAndMileage vehileAndMileage = ltEVehicleAndMileage.SingleOrDefault(s => s.VehicleCode == currentInfo.VehicleCode.Value);
             if (vehileAndMileage != null)
             {
                 currentInfo.StarkMileage = currentInfo.StarkMileage - vehileAndMileage.FirstMileage + vehileAndMileage.TotalMileage;
             }
         }
         currentInfo.StarkMileage = CaculateMileage.CalculateTotalMileage(installationInfo, currentInfo.StarkMileage);
     }
     catch (Exception ex)
     {
         Logger.Error(ex);
     }
 }
Пример #5
0
        private VRealTimeInfo CreateVRealTimeInfo(IList<EVehicleAndMileage> ltEVehicleAndMileage, SessionContext sessionContext,
            EGPSCurrentInfo currentInfo, EGPSInstallationInfo installationInfo, bool isNotCalcOil, IList<VehicleType> ltVehicleType
            , IList<EDriver> ltDriver, IList<EVehicleRunningState> ltRunningState)
        {
            LocationInfo locationInfo = null;

            Logger.Trace(string.Format("Vehicle:{0},Latidute:{1},Longitude:{2},EncodeLatLon{3}", currentInfo.VehicleCode.ToString(), currentInfo.Latitude, currentInfo.Longitude, currentInfo.EncodeLatLon));

            EBaseVehicle vehicleInfo = installationInfo.VehicleInfo;

            VRealTimeInfo realTimeInfoViewEntity = new VRealTimeInfo(currentInfo, vehicleInfo, locationInfo);

            SetVehicleType(vehicleInfo, realTimeInfoViewEntity,ltVehicleType);

            SetDriverInfo(vehicleInfo, realTimeInfoViewEntity,ltDriver);

            SetOilValue(vehicleInfo, realTimeInfoViewEntity, currentInfo, installationInfo,isNotCalcOil);

            UpdateMileage(ltEVehicleAndMileage, currentInfo, installationInfo);

            realTimeInfoViewEntity.AlarmInfo = GetAlarmInfo(currentInfo.VehicleCode.Value, realTimeInfoViewEntity,ltRunningState);

            return realTimeInfoViewEntity;
        }
Пример #6
0
 private static DateTime? GetRunningOrOffTime(HistoryLocusService locusServ, EGPSCurrentInfo item)
 {
     DateTime? runningOrOffTime = null;      //启动/熄火时间
     try
     {
         runningOrOffTime = locusServ.GetRunngingOrOffTime(item.VehicleCode.Value, item.GPSCode, item.ReportTime, item.ACCState);
     }
     catch (Exception ex)
     {
         Logger.Error("GetRunningOrOffTime" + ex.Message, ex);
     }
     return runningOrOffTime;
 }
Пример #7
0
 private CurrentInfoViewModel ConvertToViewModel(EGPSCurrentInfo eGPSCurrentInfo, DateTime? runningOrOffTime)
 {
     CurrentInfoViewModel vm = new CurrentInfoViewModel();
     vm.Direction = eGPSCurrentInfo.Direction;
     vm.Latitude = eGPSCurrentInfo.Latitude;
     vm.Longitude = eGPSCurrentInfo.Longitude;
     vm.VehicleCode = eGPSCurrentInfo.VehicleCode.Value;
     vm.GPSCode = eGPSCurrentInfo.GPSCode;
     vm.Speed = eGPSCurrentInfo.Speed;
     vm.ReportTime = eGPSCurrentInfo.ReportTime;
     vm.RunningOrOffTime = runningOrOffTime;
     vm.Acc = eGPSCurrentInfo.ACCState;
     vm.TotalMileage = GetTotalMileage(eGPSCurrentInfo.VehicleCode.Value, eGPSCurrentInfo.ReportTime);
     return vm;
 }