Ejemplo n.º 1
0
 // //是否超出设防范围
 public bool CheckIsOutRange(EGPSCurrentInfo current, EFortifyAlertsetting setting) 
 {
     //获取设防区域
     var range = VLatLonRange.Get((decimal)setting.Latitude, (decimal)setting.Longitude, setting.RadiusLimit);
     //判断是否超出这个区域
     if ((range.Latitude1 < current.Latitude && current.Latitude < range.Latitude2) && (range.Longitude1 < current.Longitude && current.Longitude < range.Longitude2))
     {
         //在这个范围里面
         return false;
     }
     else 
     {
         //不在这个范围
         return true;
     }
 }
Ejemplo n.º 2
0
        private void Alert(AlarmHandleContext context, EGPSCurrentInfo current,EFortifyAlertsetting setting, bool isAlert)
        {
            DateTime dt1 = DateTime.Now;
            EFortifyAlertReport alertReport = this.CreateAlertReport(context, current, setting);
            GPSServiceFacade.Report.Fortify.Add<EFortifyAlertReport>(alertReport);
            Logger.Info(string.Format("Static_FortifyAlertReportService.Add<EFortifyAlertReport>(alertReport)共花销{0}毫秒", (DateTime.Now - dt1).TotalMilliseconds));

            if (isAlert)
            {
                

                if (setting.EnableSMS || setting.Enable)
                {
                    if (setting.EnableSMS && this.IsInMobileReceiveTime(alertReport))
                    {
                        this.SendSMS(context, alertReport);
                    }
                    if (setting.Enable && this.IsInUserReceiveTime(alertReport))
                    {
                        this.SendWebSiteSMS(context, alertReport);
                    }

                    try
                    {
                        //撤销设防
                        IAlertSettingService s = new AlertSettingService();
                        s.Delete<EFortifyAlertsetting>(setting.RecordID);
                    }
                    catch
                    {


                    }

                }

            }
        }
Ejemplo n.º 3
0
        public EFortifyAlertReport CreateAlertReport(AlarmHandleContext context, EGPSCurrentInfo current, EFortifyAlertsetting alertSetting)
        {
            EFortifyAlertReport newReport = new EFortifyAlertReport();

            newReport.EnumAlarmGrade = EnumAlarmGrade.Alarm;
            newReport.EnumSMSInfoType = EnumSMSInfoType.Fortify;
            newReport.ACCState = current.ACCState;
            newReport.Speed = current.Speed;
            newReport.VStarkMileage = current.StarkMileage;
            newReport.GPSCode = current.GPSCode;
            newReport.GPSReportTime = current.ReportTime;
            newReport.Latitude = current.Latitude;
            newReport.Longitude = current.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(context, current.Latitude, current.Longitude);
            newReport.LicensePlate = this.GetLicensePlate(context, current.VehicleCode.Value, alertSetting.TenantCode);
            newReport.DownSendOrderCode = DownSendCodeHelper.GPS.LogisticVehicle.OutFortifyRegion.ToString();
            return newReport;
        }