コード例 #1
0
ファイル: OverSpeedHandler.cs プロジェクト: hhahh2011/CH.Gps
        protected void Alert(AlarmHandleContext context, EGPSCurrentInfo current, EnumAlertState state, EOverSpeedAlertSetting setting, LastOverSpeedAlertStatus lastCachingStatus)
        {
            if (setting.EnableSMS || setting.Enable)
            {
                // 生成报警实例,并将报警存入数据库,放入缓存中
                EOverSpeedAlertReport alertReport = this.CreateAlertReport(context, current, state, setting);
                GPSServiceFacade.AlertService.Add<EOverSpeedAlertReport>(alertReport);

                lastCachingStatus.AlertState = state;
                AlarmLastStatusService.Singleton.SaveLastOverSpeedAlertStatus(current.VehicleCode.Value, lastCachingStatus);

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

                if (setting.Enable && this.IsInUserReceiveTime(alertReport))
                {
                    this.SendWebSiteSMS(context, alertReport);
                }
            }
        }
コード例 #2
0
ファイル: OverSpeedHandler.cs プロジェクト: hhahh2011/CH.Gps
        private EOverSpeedAlertReport CreateAlertReport(AlarmHandleContext context, EGPSCurrentInfo current, EnumAlertState state, EOverSpeedAlertSetting alertSetting)
        {
            EOverSpeedAlertReport newReport = new EOverSpeedAlertReport();

            newReport.EnumAlarmGrade = EnumAlarmGrade.Prompt;
            newReport.GPSReportTime = current.ReportTime;
            if (state == EnumAlertState.Resume)
            {
                newReport.EnumSMSInfoType = EnumSMSInfoType.NormalSpeed;
                newReport.DownSendOrderCode = DownSendCodeHelper.GPS.LogisticVehicle.SpeedResume;
            }
            else
            {
                newReport.EnumSMSInfoType = EnumSMSInfoType.OverSpeed;
                newReport.DownSendOrderCode = DownSendCodeHelper.GPS.LogisticVehicle.ExceedSpeed;
            }
            newReport.ACCState = current.ACCState;
            newReport.Speed = current.Speed;
            newReport.VStarkMileage = current.StarkMileage;
            newReport.GPSCode = current.GPSCode;
            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.EnumAlertState = state;
            newReport.SpeedLimit = alertSetting.SpeedLimit;
            newReport.VehicleSpeed = Convert.ToInt32(current.Speed);
            newReport.AlertState = (int)state;

            return newReport;
        }