示例#1
0
        private bool getIsInTime(List <DateTime> L1, List <DateTime> L2)
        {
            PlatformAlarmRegionAlarm platformAlarmRegionAlarm = new PlatformAlarmRegionAlarm();
            DateTime svrTime = ReadDataFromDB.GetSvrTime();

            for (int i = 0; i < L1.Count; i++)
            {
                if (platformAlarmRegionAlarm.IsInConfigTime(L1[i], L2[i], svrTime))
                {
                    return(true);
                }
            }
            return(false);
        }
示例#2
0
 private void tCheckPathAlarm_Elapsed(object sender, ElapsedEventArgs e)
 {
     this.tCheckPathAlarm.Enabled = false;
     try
     {
         try
         {
             PlatformAlarmRegionAlarm platformAlarmRegionAlarm = new PlatformAlarmRegionAlarm();
             this.clearAlarmCar();
             this.dtConfigInfo = this.getConfigInfo();
             if (this.dtConfigInfo != null && this.dtConfigInfo.Rows.Count > 0)
             {
                 foreach (DataRow row in this.dtConfigInfo.Rows)
                 {
                     DateTime dateTime = Convert.ToDateTime(row["BeginTime"]);
                     DateTime dateTime1 = Convert.ToDateTime(row["EndTime"]);
                     DateTime dateTime2 = Convert.ToDateTime(row["gpsTime"]);
                     if (!platformAlarmRegionAlarm.IsInConfigTime(dateTime, dateTime1, this.dtNow) || !platformAlarmRegionAlarm.IsInConfigTime(dateTime, dateTime1, dateTime2) || dateTime2.Date != this.dtNow.Date)
                     {
                         continue;
                     }
                     int num = Convert.ToInt32(row["carid"]);
                     int num1 = Convert.ToInt32(row["PathID"]);
                     if (this.htCarPathInfo[num] == null)
                     {
                         this.htCarPathInfo[num] = "";
                     }
                     try
                     {
                         if (this.htAlarmList[num] != null)
                         {
                             this.htAlarmList[num] = (this.htAlarmList[num] as AlarmCarInfo).updateAlarmCar(num, num1, dateTime, dateTime1);
                         }
                         else
                         {
                             this.htAlarmList[num] = AlarmCarInfo.getAlarmCar(num, num1, dateTime, dateTime1);
                         }
                     }
                     catch (Exception exception1)
                     {
                         Exception exception = exception1;
                         ErrorMsg errorMsg = new ErrorMsg("PlatformAlarmPathAlarm", "tCheckPathAlarm_Elapsed", string.Concat("保存报警车辆信息,", exception.Message));
                         this.logHelper.WriteError(errorMsg);
                     }
                     if (row["Longitude"] == DBNull.Value || row["Latitude"] == DBNull.Value || double.Parse(row["Longitude"].ToString()) < 0.001 || double.Parse(row["Latitude"].ToString()) < 0.001)
                     {
                         if (this.htCarPathInfo.Contains(num))
                         {
                             this.htCarPathInfo.Remove(num);
                         }
                         LogMsg logMsg = new LogMsg("PlatformAlarmPathAlarm", "tCheckPathAlarm_Elapsed", "");
                         object[] str = new object[] { "carid:", num, ",pathId:", num1.ToString(), ",simnum:", row["simnum"].ToString(), ",轨迹不存在或为0" };
                         logMsg.Msg = string.Concat(str);
                         this.logHelper.WriteLog(logMsg);
                     }
                     else if (row["alarmpathdot"] == DBNull.Value || string.IsNullOrEmpty(row["alarmpathdot"].ToString()))
                     {
                         if (this.htCarPathInfo.Contains(num))
                         {
                             this.htCarPathInfo.Remove(num);
                         }
                         LogMsg logMsg1 = new LogMsg("PlatformAlarmPathAlarm", "tCheckPathAlarm_Elapsed", "");
                         object[] objArray = new object[] { "carid:", num, ",pathId:", num1.ToString(), ",simnum:", row["simnum"].ToString(), ",路线不存在" };
                         logMsg1.Msg = string.Concat(objArray);
                         this.logHelper.WriteLog(logMsg1);
                     }
                     else
                     {
                         Hashtable hashtables = this.htCarPathInfo;
                         Hashtable hashtables1 = hashtables;
                         object obj = num;
                         object item = hashtables1[obj];
                         object[] str1 = new object[] { item, num1, ":", row["alarmpathdot"].ToString(), ";" };
                         hashtables[obj] = string.Concat(str1);
                         this.htCarPosInfo[num] = string.Concat(row["Longitude"].ToString(), "*", row["Latitude"].ToString());
                     }
                 }
                 this.setInputXML();
                 this.CheckAndAnalysis();
             }
         }
         catch (Exception exception3)
         {
             Exception exception2 = exception3;
             ErrorMsg errorMsg1 = new ErrorMsg("PlatformAlarmPathAlarm", "tCheckPathAlarm_Elapsed", string.Concat("检测偏移路线报警错误,", exception2.Message));
             this.logHelper.WriteError(errorMsg1);
         }
     }
     finally
     {
         this.htCarPathInfo.Clear();
         this.htCarPosInfo.Clear();
         this.xDoc = null;
         this.tCheckPathAlarm.Enabled = true;
     }
 }
示例#3
0
 private bool getIsInTime(List<DateTime> L1, List<DateTime> L2)
 {
     PlatformAlarmRegionAlarm platformAlarmRegionAlarm = new PlatformAlarmRegionAlarm();
     DateTime svrTime = ReadDataFromDB.GetSvrTime();
     for (int i = 0; i < L1.Count; i++)
     {
         if (platformAlarmRegionAlarm.IsInConfigTime(L1[i], L2[i], svrTime))
         {
             return true;
         }
     }
     return false;
 }
示例#4
0
 private static void GpsPicMain()
 {
     LogMsg logMsg = new LogMsg()
     {
         ClassName = "Service",
         FunctionName = "GpsPicMain",
         Msg = "启动定时服务器 成功"
     };
     LogHelper logHelper = new LogHelper();
     logHelper.WriteLog(logMsg);
     ReadDataFromXml.UpdateParameter();
     logMsg.Msg = "未开启定时拍照功能";
     if (ReadDataFromXml.IsPic)
     {
         logMsg.Msg = "开启定时拍照功能";
         picTimer = new PicTimer();
         picTimer.start();
         logHelper.WriteLog(logMsg, logMsg.Msg);
     }
     logMsg.Msg = "未开启掉线通知功能";
     if (ReadDataFromXml.IsCuff)
     {
         logMsg.Msg = "开启掉线通知功能";
         cuffTimer = new CuffTimer();
         cuffTimer.start();
         logHelper.WriteLog(logMsg, logMsg.Msg);
     }
     logMsg.Msg = "未开启播报信息功能";
     if (ReadDataFromXml.IsBroadCast)
     {
         logMsg.Msg = "开启播报信息功能";
         broadCastTimer = new BroadCastTimer();
         broadCastTimer.start();
         logHelper.WriteLog(logMsg, logMsg.Msg);
     }
     logMsg.Msg = "未开启LBS定位服务";
     if (ReadDataFromXml.IsLBSPos)
     {
         logMsg.Msg = "开启LBS定位服务";
         lBSTimer = new LBSTimer();
         lBSTimer.start();
         logHelper.WriteLog(logMsg, logMsg.Msg);
     }
     logMsg.Msg = "未开启LCS定位服务";
     if (ReadDataFromXml.IsLCSPos)
     {
         logMsg.Msg = "开启LCS定位服务";
         lCSTimer = new LCSTimer();
         lCSTimer.start();
         logHelper.WriteLog(logMsg, logMsg.Msg);
     }
     logMsg.Msg = "未开启订单状态解析";
     if (ReadDataFromXml.IsBillPos)
     {
         logMsg.Msg = "开启订单状态解析";
         addressResolution = new AddressResolution();
         addressResolution.start();
         logHelper.WriteLog(logMsg, logMsg.Msg);
     }
     logMsg.Msg = "未开启出入行政区报警";
     if (ReadDataFromXml.IsAdminRegionAlarm)
     {
         logMsg.Msg = "开启出入行政区报警服务";
         iORegionTimer = new IORegionTimer();
         iORegionTimer.start();
         logHelper.WriteLog(logMsg, logMsg.Msg);
     }
     logMsg.Msg = "未开故障检测功能";
     if (ReadDataFromXml.IsChkError)
     {
         logMsg.Msg = "开启故障检测功能";
         chkErrorTimer = new ChkErrorTimer();
         chkErrorTimer.start();
         logHelper.WriteLog(logMsg, logMsg.Msg);
     }
     logMsg.Msg = "未开启未按时归班报警";
     if (ReadDataFromXml.IsBeBackOnTime)
     {
         logMsg.Msg = "开启未按时归班报警";
         carBeBackOnTime = new CarBeBackOnTime();
         carBeBackOnTime.start();
         logHelper.WriteLog(logMsg);
     }
     logMsg.Msg = "未开启DWLBS手机定位";
     if (ReadDataFromXml.IsDWLBSPos)
     {
         logMsg.Msg = "开启DWLBS手机定位";
         dWLBSPos = new DWLBSPos();
         dWLBSPos.start();
         logHelper.WriteLog(logMsg);
     }
     logMsg.Msg = "未开启未按时进出站报警";
     if (ReadDataFromXml.IsInOutOfRangeOnTime)
     {
         logMsg.Msg = "开启未按时进出站报警";
         carInOutOfRangeOnTime = new CarInOutOfRangeOnTime();
         carInOutOfRangeOnTime.start();
         logHelper.WriteLog(logMsg);
     }
     logMsg.Msg = "未开启平台报警-偏移路线报警";
     if (ReadDataFromXml.IsPathAlarm)
     {
         logMsg.Msg = "开启平台报警-偏移路线报警";
         platformAlarmPathAlarm = new PlatformAlarmPathAlarm();
         platformAlarmPathAlarm.start();
         logHelper.WriteLog(logMsg);
     }
     logMsg.Msg = "未开启平台报警-分路段超速报警";
     if (ReadDataFromXml.IsPathSegmentAlarm)
     {
         logMsg.Msg = "开启平台报警-分路段超速报警";
         platformAlarmPathSegmentAlarm = new PlatformAlarmPathSegmentAlarm();
         platformAlarmPathSegmentAlarm.start();
         logHelper.WriteLog(logMsg);
     }
     logMsg.Msg = "未开启平台报警-区域报警报警";
     if (ReadDataFromXml.IsRegionAlarm)
     {
         logMsg.Msg = "开启平台报警-区域报警报警";
         platformAlarmRegionAlarm = new PlatformAlarmRegionAlarm();
         platformAlarmRegionAlarm.start();
         logHelper.WriteLog(logMsg);
     }
     logMsg.Msg = "未开启交通部上下线通知";
     if (ReadDataFromXml.IsJTBOnOffNotice)
     {
         logMsg.Msg = "开启交通部上下线通知";
         jTBOnOffLineNotice = new JTBOnOffLineNotice();
         jTBOnOffLineNotice.start();
         logHelper.WriteLog(logMsg);
     }
     logMsg.Msg = "未开启定时下发终端点播";
     if (ReadDataFromXml.IsTerminalDemand)
     {
         logMsg.Msg = "开启定时下发终端点播";
         jTBTerminalDemand = new JTBTerminalDemand();
         jTBTerminalDemand.start();
         logHelper.WriteLog(logMsg);
     }
     logMsg.Msg = "未开启聚集报警";
     if (ReadDataFromXml.IsGatheredAlarm)
     {
         logMsg.Msg = "开启聚集报警";
         platformGatheredAlarm = new PlatformGatheredAlarm();
         platformGatheredAlarm.start();
         logHelper.WriteLog(logMsg);
     }
     logMsg.Msg = "未开启发送详细位置信息";
     if (ReadDataFromXml.IsCurrentAddress)
     {
         logMsg.Msg = "开启发送详细位置信息";
         inquiresCarCurrentAddress = new InquiresCarCurrentAddress();
         inquiresCarCurrentAddress.start();
         logHelper.WriteLog(logMsg);
     }
     logMsg.Msg = "未开启脱车粘车报警";
     if (ReadDataFromXml.IsSeparateAndSticky)
     {
         logMsg.Msg = "开启脱车粘车报警";
         separateAndSticky = new SeparateAndSticky();
         separateAndSticky.start();
         logHelper.WriteLog(logMsg);
     }
     logMsg.Msg = "未开启终端未上线短信提醒";
     if (ReadDataFromXml.IsMsgRemind)
     {
         logMsg.Msg = "开启终端未上线短信提醒";
         terminalOffLineMessageRemind = new TerminalOffLineMessageRemind();
         terminalOffLineMessageRemind.start();
         logHelper.WriteLog(logMsg);
     }
     logMsg.Msg = "未开启发送配置短信功能";
     if (ReadDataFromXml.IsSendPZMsg)
     {
         logMsg.Msg = "开启发送配置短信功能";
         sendPZMessage = new SendPZMessage();
         sendPZMessage.start();
         logHelper.WriteLog(logMsg);
     }
     if (ReadDataFromXml.IsForbidDriveAlarm)
     {
         logMsg.Msg = "开启平台禁驾报警功能";
         platFormrForbidDriveAlarm = new PlatFormrForbidDriveAlarm();
         platFormrForbidDriveAlarm.start();
         logHelper.WriteLog(logMsg);
     }
     if (ReadDataFromXml.IsThreeLevelRoadAlarm)
     {
         logMsg.Msg = "开启平台三级路面报警";
         platFormAlarmThreeLevelRoadAlarm = new PlatFormAlarmThreeLevelRoadAlarm();
         platFormAlarmThreeLevelRoadAlarm.start();
         logHelper.WriteLog(logMsg);
     }
     if (ReadDataFromXml.IschkRoadSpeedAndRank)
     {
         logMsg.Msg = "开启分道路等级超速报警";
         platFormCheckRoadSpeedAndRank = new PlatFormCheckRoadSpeedAndRank();
         platFormCheckRoadSpeedAndRank.start();
         logHelper.WriteLog(logMsg);
     }
     try
     {
         tDeleteLogTimer = new System.Timers.Timer((double)1000);
         tDeleteLogTimer.Elapsed += new System.Timers.ElapsedEventHandler(onDeleteOldRecord);
         tDeleteLogTimer.Enabled = true;
     }
     catch (Exception exception)
     {
         logHelper.WriteError(new ErrorMsg("Service", "启动日志删除失败", exception.Message));
     }
 }
示例#5
0
 private void tCheckPathAlarm_Elapsed(object sender, ElapsedEventArgs e)
 {
     this.tCheckPathAlarm.Enabled = false;
     try
     {
         try
         {
             PlatformAlarmRegionAlarm platformAlarmRegionAlarm = new PlatformAlarmRegionAlarm();
             this.clearAlarmCar();
             this.dtConfigInfo = this.getConfigInfo();
             if (this.dtConfigInfo != null && this.dtConfigInfo.Rows.Count > 0)
             {
                 foreach (DataRow row in this.dtConfigInfo.Rows)
                 {
                     DateTime dateTime  = Convert.ToDateTime(row["BeginTime"]);
                     DateTime dateTime1 = Convert.ToDateTime(row["EndTime"]);
                     DateTime dateTime2 = Convert.ToDateTime(row["gpsTime"]);
                     if (!platformAlarmRegionAlarm.IsInConfigTime(dateTime, dateTime1, this.dtNow) || !platformAlarmRegionAlarm.IsInConfigTime(dateTime, dateTime1, dateTime2) || dateTime2.Date != this.dtNow.Date)
                     {
                         continue;
                     }
                     int num  = Convert.ToInt32(row["carid"]);
                     int num1 = Convert.ToInt32(row["PathID"]);
                     if (this.htCarPathInfo[num] == null)
                     {
                         this.htCarPathInfo[num] = "";
                     }
                     try
                     {
                         if (this.htAlarmList[num] != null)
                         {
                             this.htAlarmList[num] = (this.htAlarmList[num] as AlarmCarInfo).updateAlarmCar(num, num1, dateTime, dateTime1);
                         }
                         else
                         {
                             this.htAlarmList[num] = AlarmCarInfo.getAlarmCar(num, num1, dateTime, dateTime1);
                         }
                     }
                     catch (Exception exception1)
                     {
                         Exception exception = exception1;
                         ErrorMsg  errorMsg  = new ErrorMsg("PlatformAlarmPathAlarm", "tCheckPathAlarm_Elapsed", string.Concat("保存报警车辆信息,", exception.Message));
                         this.logHelper.WriteError(errorMsg);
                     }
                     if (row["Longitude"] == DBNull.Value || row["Latitude"] == DBNull.Value || double.Parse(row["Longitude"].ToString()) < 0.001 || double.Parse(row["Latitude"].ToString()) < 0.001)
                     {
                         if (this.htCarPathInfo.Contains(num))
                         {
                             this.htCarPathInfo.Remove(num);
                         }
                         LogMsg   logMsg = new LogMsg("PlatformAlarmPathAlarm", "tCheckPathAlarm_Elapsed", "");
                         object[] str    = new object[] { "carid:", num, ",pathId:", num1.ToString(), ",simnum:", row["simnum"].ToString(), ",轨迹不存在或为0" };
                         logMsg.Msg = string.Concat(str);
                         this.logHelper.WriteLog(logMsg);
                     }
                     else if (row["alarmpathdot"] == DBNull.Value || string.IsNullOrEmpty(row["alarmpathdot"].ToString()))
                     {
                         if (this.htCarPathInfo.Contains(num))
                         {
                             this.htCarPathInfo.Remove(num);
                         }
                         LogMsg   logMsg1  = new LogMsg("PlatformAlarmPathAlarm", "tCheckPathAlarm_Elapsed", "");
                         object[] objArray = new object[] { "carid:", num, ",pathId:", num1.ToString(), ",simnum:", row["simnum"].ToString(), ",路线不存在" };
                         logMsg1.Msg = string.Concat(objArray);
                         this.logHelper.WriteLog(logMsg1);
                     }
                     else
                     {
                         Hashtable hashtables  = this.htCarPathInfo;
                         Hashtable hashtables1 = hashtables;
                         object    obj         = num;
                         object    item        = hashtables1[obj];
                         object[]  str1        = new object[] { item, num1, ":", row["alarmpathdot"].ToString(), ";" };
                         hashtables[obj]        = string.Concat(str1);
                         this.htCarPosInfo[num] = string.Concat(row["Longitude"].ToString(), "*", row["Latitude"].ToString());
                     }
                 }
                 this.setInputXML();
                 this.CheckAndAnalysis();
             }
         }
         catch (Exception exception3)
         {
             Exception exception2 = exception3;
             ErrorMsg  errorMsg1  = new ErrorMsg("PlatformAlarmPathAlarm", "tCheckPathAlarm_Elapsed", string.Concat("检测偏移路线报警错误,", exception2.Message));
             this.logHelper.WriteError(errorMsg1);
         }
     }
     finally
     {
         this.htCarPathInfo.Clear();
         this.htCarPosInfo.Clear();
         this.xDoc = null;
         this.tCheckPathAlarm.Enabled = true;
     }
 }