private void SendSMS(EFatigueDrivingReport report)
 {
     try
     {
         this.SendSMS(report.GetReceiveMobiles(), report.DownSendOrderCode, report.GetSMSParamters(),
             report.TenantCode, ConsumeType.SMSAlert,report.GetReceiveUsers());
        
     }
     catch(Exception ex)
     {
         Logger.Error(ex.Message);
     }
 }
        //是否提醒过
        private bool IsHaveBeenAlert(Guid vehicleCode)
        {
            FatigueDrivingReportService OpenDoorAlertReportService = new FatigueDrivingReportService();
            _alertReport = OpenDoorAlertReportService.GetRecentReport(vehicleCode);

            if (this._alertReport == null)
            {
                return false;
            }
            return true;
        }
        private EBaseAlertReport CreateAlertReport(EnumAlertState state, EFatigueDrivingAlertSetting alertSetting)
        {
            EGPSCurrentInfo _gpsCurrentInfo = new GPSTrackManager().GetCurrentInfo(alertSetting.VehicleCode);
            EFatigueDrivingReport newReport = new EFatigueDrivingReport();
            newReport.EnumAlarmGrade = EnumAlarmGrade.Prompt;
            newReport.ACCState = _gpsCurrentInfo.ACCState;
            newReport.Speed = _gpsCurrentInfo.Speed;
            newReport.VStarkMileage = _gpsCurrentInfo.StarkMileage;
            newReport.EnumSMSInfoType = EnumSMSInfoType.FatigueDriving;
            newReport.GPSCode = _gpsCurrentInfo.GPSCode;
            newReport.GPSReportTime = _gpsCurrentInfo.ReportTime;
            newReport.Latitude = _gpsCurrentInfo.Latitude;
            newReport.Longitude = _gpsCurrentInfo.Longitude;
            newReport.MobileReceiveBeginTime = alertSetting.MobileReceiveBeginTime;
            newReport.MobileReceiveEndTime = alertSetting.MobileReceiveEndTime;
            newReport.ReceiveMobileList = alertSetting.ReceiveMobileList;
            newReport.ReceiveUserList = alertSetting.ReceiveUserList;
            newReport.TenantCode = alertSetting.TenantCode;
            newReport.UserReceiveBeginTime = alertSetting.UserReceiveBeginTime;
            newReport.UserReceiveEndTime = alertSetting.UserReceiveEndTime;
            newReport.VehicleCode = alertSetting.VehicleCode;
            newReport.VehiclePosition = this.GetPlaceName(_gpsCurrentInfo.Latitude, _gpsCurrentInfo.Longitude);
            if (_MOVOVehicleDict.ContainsKey(alertSetting.VehicleCode))
            {
                newReport.LicensePlate = _MOVOVehicleDict[alertSetting.VehicleCode];
            }
   
            newReport.EnumAlertState = state;

            newReport.DownSendOrderCode = DownSendCodeHelper.GPS.LogisticVehicle.FatigueDrive;
            newReport.DurationDrivingTime = alertSetting.DrivingDuration;
            newReport.RestTime = alertSetting.RestTime;
            newReport.AlertState = (int)state;
            return newReport;
        }
        private void Alert(EnumAlertState state, EFatigueDrivingAlertSetting setting)
        {
            if (state == EnumAlertState.Alerting)
            {
                if (setting.EnableSMS || setting.Enable)
                {
                    _alertReport = (EFatigueDrivingReport)CreateAlertReport(state, setting);
                    SaveAlertReport();
                    if (setting.EnableSMS && this.IsInReceiveTime(_alertReport.MobileReceiveBeginTime, _alertReport.MobileReceiveEndTime))
                    {
                        SendSMS(_alertReport);
                    }
                    if (setting.Enable && this.IsInReceiveTime(_alertReport.UserReceiveBeginTime, _alertReport.UserReceiveEndTime))
                    {
                        AlarmHandleContext context = new AlarmHandleContext();                        
                        this.SendWebSiteSMS(context, _alertReport);
                    }
                }

            }
            else
            {
                UpdateAlertReport();
            }
        }