public void DeleteOldRecord(int iLogSaveDate) { try { DirectoryInfo info = new DirectoryInfo(FileHelper.FilePath); if (!info.Exists) { return; } foreach (FileInfo info2 in info.GetFiles()) { if (info2.CreationTime.AddDays((double) iLogSaveDate).Date < DateTime.Now.Date) { File.Delete(info2.FullName); } } } catch (Exception exception) { ErrorMsg pErrorMsg = new ErrorMsg("LogHelper", "清除旧日志文件", exception.Message); new LogHelper().WriteError(pErrorMsg); return; } LogMsg pLogMsg = new LogMsg("LogHelper", "清除旧日志文件", "成功"); new LogHelper().WriteLog(pLogMsg); }
public DownData(int workId) { this.log = new LogHelper(); this.logMsg = new LogMsg() { ClassName = "GpsPicDownData" }; this.WorkId = workId; }
private void DWLBSPosTimer_Elapsed(object sender, ElapsedEventArgs e) { this.DWLBSPosTimer.Enabled = false; try { try { DataTable dWLBSInfo = this.getDWLBSInfo(); if (dWLBSInfo != null && dWLBSInfo.Rows.Count > 0) { LogMsg logMsg = new LogMsg("DWLBSPos", "DWLBSPosTimer_Elapsed", "") { Msg = string.Concat("获取需定位的信息数量为:", dWLBSInfo.Rows.Count) }; this.logHelper.WriteLog(logMsg); int num1 = 0; foreach (DataRow row in dWLBSInfo.Rows) { string str = row["SimNum"].ToString(); int num2 = Convert.ToInt32(row["CarId"]); if (this.myDownData.iCar_SetPosReport(CmdParam.ParamType.SimNum, str, "", CmdParam.CommMode.未知方式, this.m_PosReport, num2) != (long)-1) { num1++; } else { ErrorMsg errorMsg = new ErrorMsg("DWLBSPos", "DWLBSPosTimer_Elapsed", string.Concat("通讯返回失败,SIM卡:", str)); this.logHelper.WriteError(errorMsg); } } logMsg.Msg = string.Concat("实际定位成功的信息数量为:", num1); this.logHelper.WriteLog(logMsg); } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg1 = new ErrorMsg("DWLBSPos", "DWLBSPosTimer_Elapsed", string.Concat("DWLBS定位失败", exception.Message)); this.logHelper.WriteError(errorMsg1); } } finally { this.DWLBSPosTimer.Enabled = true; } }
private void CheckAndAnalysis() { if (this.IsJudge) { LogMsg logMsg = new LogMsg("PlatformAlarmPathAlarm", "tCheckPathAlarm_Elapsed", "") { Msg = string.Concat("偏移路线报警传 入 的xml:\r\n", this.xDoc.OuterXml) }; this.logHelper.WriteLog(logMsg); string str = ReadDataFromGis.IsCarsOnRoad(this.xDoc.OuterXml); logMsg.Msg = string.Concat("偏移路线报警传 回 的xml:\r\n", str); this.logHelper.WriteLog(logMsg); if (!string.IsNullOrEmpty(str) && this.AnalysisOutputXML(str)) { if (this.AlarmListFirst != null && this.AlarmListFirst.Count > 0) { foreach (string alarmListFirst in this.AlarmListFirst) { DataRow[] dataRowArray = this.dtConfigInfo.Select(string.Concat("carid = ", alarmListFirst)); this.InsertAlarmInfo(dataRowArray[0], CmdParam.CarAlarmState.偏移路线, -99999); if (!ReadDataFromXml.IschkDownMsg) { continue; } this.DownToTerminal(dataRowArray[0]["simnum"].ToString(), "0001", dataRowArray[0]["gpsTime"].ToString(), "您的车辆发生偏移路线报警。", alarmListFirst); } this.AlarmListFirst.Clear(); this.AlarmListFirst = null; } if (this.AlarmListMid != null && this.AlarmListMid.Count > 0) { foreach (string alarmListMid in this.AlarmListMid) { DataRow[] dataRowArray1 = this.dtConfigInfo.Select(string.Concat("carid = ", alarmListMid)); this.InsertAlarmInfo(dataRowArray1[0], CmdParam.CarAlarmState.偏移路线, -99998); if (!ReadDataFromXml.IschkDownMsg) { continue; } this.DownToTerminal(dataRowArray1[0]["simnum"].ToString(), "0001", dataRowArray1[0]["gpsTime"].ToString(), "您的车辆发生偏移路线报警。", alarmListMid); } this.AlarmListMid.Clear(); this.AlarmListMid = null; } if (this.AlarmListEnd != null && this.AlarmListEnd.Count > 0) { foreach (string alarmListEnd in this.AlarmListEnd) { DataRow[] dataRowArray2 = this.dtConfigInfo.Select(string.Concat("carid = ", alarmListEnd)); this.InsertAlarmInfo(dataRowArray2[0], CmdParam.CarAlarmState.偏移路线, -99997); } this.AlarmListEnd.Clear(); this.AlarmListEnd = null; } } this.IsJudge = false; } }
public void WriteLog(LogMsg pLogMsg, string funName, string pMsg) { pLogMsg.FunctionName = funName; pLogMsg.Msg = pMsg; base.WriteText(pLogMsg.GetMsg() + "\n"); }
private void tCheckRegionAlarm_Elapsed(object sender, ElapsedEventArgs e) { this.tCheckRegionAlarm.Enabled = false; try { try { DataTable configInfo = this.getConfigInfo(); if (configInfo != null && configInfo.Rows.Count > 0) { DateTime now = DateTime.Now; foreach (DataRow row in configInfo.Rows) { int num = Convert.ToInt32(row["carid"]); int num1 = Convert.ToInt32(row["regionID"]); if (row["Longitude"] == DBNull.Value || row["Latitude"] == DBNull.Value || double.Parse(row["Longitude"].ToString()) < 0.001 || double.Parse(row["Latitude"].ToString()) < 0.001) { continue; } if (row["regionDot"] == DBNull.Value || string.IsNullOrEmpty(row["regionDot"].ToString())) { LogMsg logMsg = new LogMsg("PlatformAlarmRegionAlarm", "tCheckRegionAlarm_Elapsed", ""); object[] str = new object[] { "carid:", num, ",regionID:", num1.ToString(), ",simnum:", row["simnum"].ToString(), ",区域不存在" }; logMsg.Msg = string.Concat(str); this.logHelper.WriteLog(logMsg); } else { DateTime dateTime = Convert.ToDateTime(row["beginTime"]); DateTime dateTime1 = Convert.ToDateTime(row["endTime"]); DateTime dateTime2 = Convert.ToDateTime(row["gpsTime"]); if (!this.IsInConfigTime(dateTime, dateTime1, now) || !this.IsInConfigTime(dateTime, dateTime1, dateTime2) || dateTime2.Date != now.Date) { if (!this.htInfo.Contains(string.Concat(num, "-", num1))) { continue; } this.htInfo.Remove(string.Concat(num, "-", num1)); LogMsg logMsg1 = new LogMsg("PlatformAlarmRegionAlarm", "tCheckRegionAlarm_Elapsed", ""); object[] objArray = new object[] { "carid:", num, ",regionID:", num1.ToString(), ",simnum:", row["simnum"].ToString(), ",未在设置时间段内,将车辆所在区域信息从内存移除" }; logMsg1.Msg = string.Concat(objArray); this.logHelper.WriteLog(logMsg1); } else { string str1 = row["Longitude"].ToString(); string str2 = row["Latitude"].ToString(); string str3 = row["regionDot"].ToString(); int num2 = Convert.ToInt32(row["regionType"]); if (this.IsProvideRegion(str3)) { bool flag = this.IsInRegion(str1, str2, str3); if ((num2 & 1) == 1 && flag && this.htInfo[string.Concat(num, "-", num1)] != null && (int)this.htInfo[string.Concat(num, "-", num1)] == 2) { this.InsertAlarmInfo(row, CmdParam.CarAlarmState.入区域, num1); this.ReportAlarmInfo(row["simnum"].ToString(), "0004", row["gpsTime"].ToString(), "您的车辆发生进入区域报警"); } if ((num2 & 2) == 2 && !flag && this.htInfo[string.Concat(num, "-", num1)] != null && (int)this.htInfo[string.Concat(num, "-", num1)] == 1) { this.InsertAlarmInfo(row, CmdParam.CarAlarmState.出区域, num1); this.ReportAlarmInfo(row["simnum"].ToString(), "0005", row["gpsTime"].ToString(), "您的车辆发生越出区域报警"); } if (!flag) { this.htInfo[string.Concat(num, "-", num1)] = 2; } else { this.htInfo[string.Concat(num, "-", num1)] = 1; } } else { LogMsg logMsg2 = new LogMsg("PlatformAlarmRegionAlarm", "tCheckRegionAlarm_Elapsed", ""); object[] objArray1 = new object[] { "carid:", num, ",regionID:", num1.ToString(), ",simnum:", row["simnum"].ToString(), ",区域不是圆形或矩形" }; logMsg2.Msg = string.Concat(objArray1); this.logHelper.WriteLog(logMsg2); } } } } } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg("PlatformAlarmRegionAlarm", "tCheckRegionAlarm_Elapsed", string.Concat("平台报警检测是否区域报警错误,", exception.Message)); this.logHelper.WriteError(errorMsg); } } finally { this.tCheckRegionAlarm.Enabled = true; } }
private void InsertAlarmInfo(DataRow dr, int AddMsgType) { ErrorMsg errorMsg = new ErrorMsg("PlatFormrForbidDriveAlarm", "InsertAlarmInfo", ""); LogMsg logMsg = new LogMsg("PlatFormrForbidDriveAlarm", "InsertAlarmInfo", ""); try { int num = 0; string empty = string.Empty; int num1 = int.Parse(dr["carstatu"].ToString()); long num2 = 36028797018963968L | long.Parse(dr["carStatuex"].ToString()); int num3 = 1154; int num4 = 65; string str = string.Empty; string str1 = null; bool flag = false; string str2 = null; int num5 = 0; try { SqlParameter[] sqlParameter = new SqlParameter[] { new SqlParameter("@wrkid", (object)num), new SqlParameter("@orderid", dr["OrderId"]), new SqlParameter("@userid", empty), new SqlParameter("@telephone", dr["telephone"]), new SqlParameter("@msgType", (object)num4), new SqlParameter("@recetime", dr["ReceTime"]), new SqlParameter("@gpstime", dr["GpsTime"]), new SqlParameter("@starCondition", dr["StarCondition"]), new SqlParameter("@starNum", dr["StarNum"]), new SqlParameter("@carStatu", (object)num1), new SqlParameter("@carStatuEx", (object)num2), new SqlParameter("@carCondition", dr["CarCondition"]), new SqlParameter("@Longitude", dr["Longitude"]), new SqlParameter("@Latitude", dr["Latitude"]), new SqlParameter("@direct", dr["Direct"]), new SqlParameter("@speed", dr["Speed"]), new SqlParameter("@Reserved", (object)num3), new SqlParameter("@TransportStatus", dr["TransportStatus"]), new SqlParameter("@Accelerration", dr["Accelerration"]), new SqlParameter("@Altitude", dr["Altitude"]), new SqlParameter("@DistanceDiff", dr["DistanceDiff"]), new SqlParameter("@commflag", dr["CommFlag"]), new SqlParameter("@addType", (object)AddMsgType), new SqlParameter("@addTxt", dr["AddMsgTxt"]), new SqlParameter("@DutyStr", str1), new SqlParameter("@isPic", (object)flag), new SqlParameter("@pic", str2), new SqlParameter("@alarmInfo", str), new SqlParameter("@cameraID", (object)num5) }; string str3 = "GpsPicServer_ReceBuffer_Insert"; string str4 = "GpsPicServer_RealTime_Insert"; if (AddMsgType != -99997) { if (SqlDataAccess.insertBySp(str3, sqlParameter) > 0) { logMsg.Msg = string.Concat("车载电话为:", dr["telephone"].ToString(), "的报警报文已插入gpsrecebuffer"); this.logHelper.WriteLog(logMsg); } else { this.logHelper.WriteError(errorMsg); } } int num6 = SqlDataAccess.insertBySp(str4, sqlParameter); if (num6 > 0) { logMsg.Msg = string.Concat("车载电话为:", dr["telephone"].ToString(), "的平台禁驾报警报文已插入gpsrecerealtime"); this.logHelper.WriteLog(logMsg); } else { errorMsg.ErrorText = string.Concat("将平台禁驾报警报文插入gpsrecerealtime_buffer表发生错误,返回值!", num6.ToString()); this.logHelper.WriteError(errorMsg); } } catch (Exception exception1) { Exception exception = exception1; errorMsg.ErrorText = string.Concat("车载电话为:", dr["telephone"].ToString(), "的报警报文插入数据库发生错误! 信息:", exception.Message); this.logHelper.WriteError(errorMsg); } } catch (Exception exception2) { errorMsg.ErrorText = string.Concat("将报警报文插入gpsrecbuffer表 、gpsrecerealtime_buffer表发生错误!", exception2.Message); this.logHelper.WriteError(errorMsg); } }
private bool execConnection() { Response response = RemotingClient.LoginSys_Login(false, true); if (response.ResultCode != (long)0) { Record.execFileRecord("用户登录", string.Format("{0}登录失败:{1}", Variable.sUserId, response.ErrorMsg)); return false; } LogHelper logHelper = new LogHelper(); LogMsg logMsg = new LogMsg() { Msg = string.Concat("用户登录", string.Format("{0}登录成功:{1}", Variable.sUserId, response.ErrorMsg)) }; logHelper.WriteLog(logMsg); return true; }
private bool IsInArea(string Lon, string Lat, string regionDot) { XmlDocument inputXML = this.getInputXML(Lon, Lat, regionDot); if (inputXML != null) { LogMsg logMsg = new LogMsg("PlatformAlarmRegionAlarm", "IsInArea", "") { Msg = string.Concat("平台区域报警传 入 的xml:\r\n", inputXML.OuterXml) }; this.logHelper.WriteLog(logMsg); string str = ReadDataFromGis.IsInArea(inputXML.OuterXml); logMsg.Msg = string.Concat("平台区域报警传 回 的xml:\r\n", str); this.logHelper.WriteLog(logMsg); int result = this.getResult(str); if (result == 1) { return true; } if (result == 0) { return false; } } throw new Exception("XML格式错误"); }
/// <summary> /// 记录日志 /// </summary> /// <param name="pContext"></param> private void WriteLog(string pContext) { LogMsg msg = new LogMsg("业务服务", pContext, ""); new LogHelper().WriteLog(msg); }
/// <summary> /// 记录日志 /// </summary> /// <param name="funtionName"></param> /// <param name="pContext"></param> private void WriteLog(string funtionName, string pContext) { LogMsg msg = new LogMsg("业务服务", funtionName, pContext); new LogHelper().WriteLog(msg); }
protected override void OnStop() { // TODO: 在此处添加代码以执行停止服务所需的关闭操作。 try { if (ReadDataFromXml.IsPic && picTimer != null) { picTimer.stop(); } if (ReadDataFromXml.IsCuff && cuffTimer != null) { cuffTimer.stop(); } if (ReadDataFromXml.IsBroadCast && broadCastTimer != null) { broadCastTimer.stop(); } if (ReadDataFromXml.IsLBSPos && lBSTimer != null) { lBSTimer.stop(); } if (ReadDataFromXml.IsLCSPos && lCSTimer != null) { lCSTimer.stop(); } if (ReadDataFromXml.IsBillPos && addressResolution != null) { addressResolution.stop(); } if (ReadDataFromXml.IsAdminRegionAlarm && iORegionTimer != null) { iORegionTimer.stop(); } if (ReadDataFromXml.IsBeBackOnTime && carBeBackOnTime != null) { carBeBackOnTime.stop(); } if (ReadDataFromXml.IsDWLBSPos && dWLBSPos != null) { dWLBSPos.stop(); } if (ReadDataFromXml.IsInOutOfRangeOnTime && carInOutOfRangeOnTime != null) { carInOutOfRangeOnTime.stop(); } if (ReadDataFromXml.IsPathAlarm && platformAlarmPathAlarm != null) { platformAlarmPathAlarm.stop(); } if (ReadDataFromXml.IsPathSegmentAlarm && platformAlarmPathSegmentAlarm != null) { platformAlarmPathSegmentAlarm.stop(); } if (ReadDataFromXml.IsRegionAlarm && platformAlarmRegionAlarm != null) { platformAlarmRegionAlarm.stop(); } if (ReadDataFromXml.IsJTBOnOffNotice && jTBOnOffLineNotice != null) { jTBOnOffLineNotice.stop(); } if (ReadDataFromXml.IsTerminalDemand && jTBTerminalDemand != null) { jTBTerminalDemand.stop(); } if (ReadDataFromXml.IsGatheredAlarm && platformGatheredAlarm != null) { platformGatheredAlarm.stop(); } if (ReadDataFromXml.IsCurrentAddress && inquiresCarCurrentAddress != null) { inquiresCarCurrentAddress.stop(); } if (ReadDataFromXml.IsSeparateAndSticky && separateAndSticky != null) { separateAndSticky.stop(); } if (ReadDataFromXml.IsMsgRemind && terminalOffLineMessageRemind != null) { terminalOffLineMessageRemind.stop(); } if (ReadDataFromXml.IsSendPZMsg && sendPZMessage != null) { sendPZMessage.stop(); } if (ReadDataFromXml.IsForbidDriveAlarm && platFormrForbidDriveAlarm != null) { platFormrForbidDriveAlarm.stop(); } if (gpsCarCurrentPosInfo != null) { gpsCarCurrentPosInfo.stop(); } if (ReadDataFromXml.IsThreeLevelRoadAlarm && platFormAlarmThreeLevelRoadAlarm != null) { platFormAlarmThreeLevelRoadAlarm.stop(); } if (ReadDataFromXml.IschkRoadSpeedAndRank && platFormAlarmThreeLevelRoadAlarm != null) { platFormAlarmThreeLevelRoadAlarm.stop(); } tDeleteLogTimer.Stop(); LogMsg logMsg = new LogMsg("Service", "OnStop", "成功 关闭"); (new LogHelper()).WriteLog(logMsg); } catch (Exception exception1) { Exception exception = exception1; LogMsg logMsg1 = new LogMsg("Service", "OnStop", string.Concat("发生错误,", exception.Message)); (new LogHelper()).WriteLog(logMsg1); } FileHelper.StopWrite(); }
private static void onRecordTimerMain(object sender, ElapsedEventArgs e) { RecordTimer.Enabled = false; int num = 0; try { num = Convert.ToInt32(Const.LogSaveDate); } catch (Exception exception) { num = 3; LogMsg msg = new LogMsg("业务服务", "onRecordTimerMain", exception.Message); new LogHelper().WriteLog(msg); } new LogHelper().DeleteOldRecord(num); RecordTimer.Interval = 86400000.0; RecordTimer.Enabled = true; }
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)); } }
private void OnLineNotice_Elapsed(object sender, ElapsedEventArgs e) { this.OnLineNotice.Enabled = false; LogMsg logMsg = new LogMsg("JTBOnOffLineNotice", "OnLineNotice_Elapsed", ""); try { try { DataTable onLineData = this.getOnLineData(); if (onLineData != null && onLineData.Rows.Count > 0) { foreach (DataRow row in onLineData.Rows) { logMsg.Msg = string.Concat("交通部车辆上线通知,simnum:", row["simnum"].ToString()); this.logHelper.WriteLog(logMsg); } } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg("JTBOnOffLineNotice", "OnLineNotice_Elapsed", string.Concat("检测上线通知错误,", exception.Message)); this.logHelper.WriteError(errorMsg); } } finally { this.OnLineNotice.Enabled = true; } }
/// <summary> /// 平台查岗请求处理 /// </summary> /// <param name="dr"></param> public void GetPlatRequestUpData(DataRow dr) { //对应存储过程WebGpsClient_GetOutEquipmentData返回列propertyData除掉前4个字符,定义见Protocol.ProtocolDrData string contextData = this.protocolDrData_0.ContextData; //查岗对象类型 OBJECT_TYPE, 重庆运管定义1为自动查岗,2为手动查岗 string sObjectType = NumHelper.Convert16To10ToString(contextData.Substring(0, 2)); //重庆运管要求: //OBJECT_TYPE 为1 时OBJECT_ID 为查岗对象ID, 值为5000000+ 平台接入码( 行政区划码+ 平台唯一编码) //当OBJECT_TYPE 为2,OBJECT_ID 为业户经营许可证号; //当OBJECT_TYPE为3 时,OBJECT_ID值为5000000+平台接入码(行政区划码+平台唯一编码),例如50000008960 string sObjectId = NumHelper.GetStringFromBase16ASCII(contextData.Substring(2, 24)).Replace("\0", ""); //信息ID string sIndex = NumHelper.Convert16To10ToString(contextData.Substring(26, 8)); //内容长度 string sLen = NumHelper.Convert16To10ToString(contextData.Substring(34, 8)); //取得内容 string sContant = NumHelper.GetStringFromBase16ASCII(contextData.Substring(42, int.Parse(sLen) * 2)).Replace("\0", ""); string userIdByRegionCode = string.Empty; string workIdByUserId = string.Empty; if (sObjectType.Equals("1")) { if (!string.IsNullOrEmpty(sContant) && (sContant.IndexOf("请回复当前全部在线业户") != -1)) { workIdByUserId = "-1"; string str10 = this.method_3(sObjectType, sObjectId, sIndex, "当前在线业户列表:=" + AskConfigerParameter.GetAutoRelyInfoString()); try { AskConfigerParameter.InsertCommandParameterToDB("8613489997299", 999, 16900, str10); //修改如果自动查岗,则不发送消息到客户端 huzh 2014.1.22 workIdByUserId = "-2"; dr["WrkId"] = workIdByUserId; return; //修改如果为重庆运管自动查岗则不需要发送到客户端,by huzh 2014.1.8 //goto Label_0147; } catch (Exception exception) { throw new Exception("自动回答发生错误:" + exception.Message + exception.StackTrace); } } userIdByRegionCode = AskConfigerParameter.GetUserIdByRegionCode(sObjectId); } else if (sObjectType.Equals("2")) { if (!string.IsNullOrEmpty(sContant) && (sContant.IndexOf("OBJECT_ID:=") != -1)) { //重庆运管要求,由于营运证长度最长为15位,因此INFO_CONTENT内容格式改为: //OBJECT_ID:=500101000001-3;手工查岗问题及答案:=问题|1,答案1;2,答案2;3,答案3;4,答案4 //因此替换查岗对象 string[] array = sContant.Split(new char[] { ';' }); sObjectId = array[0].Substring(array[0].IndexOf('=')+1); } userIdByRegionCode = AskConfigerParameter.GetUserIdByYYZCarId(sObjectId); } else if (sObjectType.Equals("3")) { workIdByUserId = "0"; } //Label_0147: if (string.IsNullOrEmpty(workIdByUserId) && !string.IsNullOrEmpty(userIdByRegionCode)) { workIdByUserId = AskConfigerParameter.GetWorkIdByUserId(userIdByRegionCode); } if (string.IsNullOrEmpty(workIdByUserId)) { workIdByUserId = "-1"; } dr["WrkId"] = workIdByUserId; dr["msgType"] = "4353"; dr["CarNum"] = ""; dr["OrderName"] = "平台查岗请求"; dr["Describe"] = "消息ID:" + sIndex + ",消息内容:" + sContant.Replace(",", ",") + ",查岗对象类型:" + sObjectType + ",查岗对象的ID:" + sObjectId; dr["OrderType"] = "接收"; LogMsg msg = new LogMsg("JTBDataParse", "GetPlatRequestUpData", dr["Describe"].ToString() + " workIdByUserId: " + workIdByUserId + " userIdByRegionCode: " + userIdByRegionCode); new LogHelper().WriteLog(msg); }
private void InsertAlarmInfo(DataRow dr, CmdParam.CarAlarmState carAlarmState, int AddMsgType) { try { int num = 0; string empty = string.Empty; int num1 = Convert.ToInt32(dr["carstatu"]); long num2 = (long)0; num2 = (dr["carstatuex"] == DBNull.Value || dr["carstatuex"].ToString().Equals("") ? 2251799813685248L : 2251799813685248L | Convert.ToInt64(dr["carstatuex"])); int num3 = 1154; int num4 = 65; string str = string.Empty; string str1 = dr["AddMsgTxt"].ToString(); string str2 = null; bool flag = false; string str3 = null; int num5 = 0; try { SqlParameter[] sqlParameter = new SqlParameter[] { new SqlParameter("@wrkid", (object)num), new SqlParameter("@orderid", dr["OrderId"]), new SqlParameter("@userid", empty), new SqlParameter("@telephone", dr["telephone"]), new SqlParameter("@msgType", (object)num4), new SqlParameter("@recetime", dr["ReceTime"]), new SqlParameter("@gpstime", dr["GpsTime"]), new SqlParameter("@starCondition", dr["StarCondition"]), new SqlParameter("@starNum", dr["StarNum"]), new SqlParameter("@carStatu", (object)num1), new SqlParameter("@carStatuEx", (object)num2), new SqlParameter("@carCondition", dr["CarCondition"]), new SqlParameter("@Longitude", dr["Longitude"]), new SqlParameter("@Latitude", dr["Latitude"]), new SqlParameter("@direct", dr["Direct"]), new SqlParameter("@speed", dr["Speed"]), new SqlParameter("@Reserved", (object)num3), new SqlParameter("@TransportStatus", dr["TransportStatus"]), new SqlParameter("@Accelerration", dr["Accelerration"]), new SqlParameter("@Altitude", dr["Altitude"]), new SqlParameter("@DistanceDiff", dr["DistanceDiff"]), new SqlParameter("@commflag", dr["CommFlag"]), new SqlParameter("@addType", (object)AddMsgType), new SqlParameter("@addTxt", str1), new SqlParameter("@DutyStr", str2), new SqlParameter("@isPic", (object)flag), new SqlParameter("@pic", str3), new SqlParameter("@alarmInfo", str), new SqlParameter("@cameraID", (object)num5) }; string str4 = "GpsPicServer_Alarm_Insert"; string str5 = "GpsPicServer_RealTime_Insert"; if (AddMsgType != -99997) { int num6 = SqlDataAccess.insertBySp(str4, sqlParameter); if (num6 > 0) { LogMsg logMsg = new LogMsg("PlatformAlarmPathAlarm", "InsertAlarmInfo", ""); string[] strArrays = new string[] { "车载电话为:", dr["telephone"].ToString(), "的平台检测", carAlarmState.ToString(), "报警报文已插入gpsrecebuffer" }; logMsg.Msg = string.Concat(strArrays); this.logHelper.WriteLog(logMsg); } else { ErrorMsg errorMsg = new ErrorMsg("PlatformAlarmPathAlarm", "InsertAlarmInfo", string.Concat("将平台检测", carAlarmState.ToString(), "报警报文插入gpsrecbuffer表错误,返回值!", num6.ToString())); this.logHelper.WriteError(errorMsg); } } int num7 = SqlDataAccess.insertBySp(str5, sqlParameter); if (num7 > 0) { string[] strArrays1 = new string[] { "车载电话为:", dr["telephone"].ToString(), "的平台检测", carAlarmState.ToString(), "报警报文已插入gpsrecerealtime" }; LogMsg logMsg1 = new LogMsg("PlatformAlarmPathAlarm", "InsertAlarmInfo", string.Concat(strArrays1)); string[] strArrays2 = new string[] { "车载电话为:", dr["telephone"].ToString(), "的平台检测", carAlarmState.ToString(), "报警报文已插入gpsrecerealtime" }; logMsg1.Msg = string.Concat(strArrays2); this.logHelper.WriteLog(logMsg1); } else { ErrorMsg errorMsg1 = new ErrorMsg("PlatformAlarmPathAlarm", "InsertAlarmInfo", string.Concat("将平台检测", carAlarmState.ToString(), "报警报文插入gpsrecerealtime_buffer表发生错误,返回值!", num7.ToString())); this.logHelper.WriteError(errorMsg1); } } catch (Exception exception1) { Exception exception = exception1; string[] strArrays3 = new string[] { "车载电话为:", dr["telephone"].ToString(), "的平台检测", carAlarmState.ToString(), "报警报文插入数据库发生错误! 信息:", exception.Message }; ErrorMsg errorMsg2 = new ErrorMsg("PlatformAlarmPathAlarm", "InsertAlarmInfo", string.Concat(strArrays3)); this.logHelper.WriteError(errorMsg2); } } catch (Exception exception3) { Exception exception2 = exception3; LogHelper logHelper = new LogHelper(); ErrorMsg errorMsg3 = new ErrorMsg("PlatformAlarmPathAlarm", "InsertAlarmInfo", string.Concat("将平台检测", carAlarmState.ToString(), "报警报文插入gpsrecbuffer表 、gpsrecerealtime_buffer表发生错误!", exception2.Message)); logHelper.WriteError(errorMsg3); } }
private void BroadCastMsg() { try { DataTable msgParamData = this.GetMsgParamData(this.BroadPreTime.ToString()); if (msgParamData == null || msgParamData.Rows.Count == 0) { if (this.dtBroadCastUrgent != null && this.dtBroadCastUrgent.Rows.Count > 0) { this.BroadCastUrgentMsg(); } if (this.dtBroadCastError != null && this.dtBroadCastError.Rows.Count > 0) { this.BroadCastErrorMsg(); } } else { this.BroadPreTime = DateTime.Parse(msgParamData.Rows[0]["PreTime"].ToString()); LogMsg logMsg = new LogMsg(); LogHelper logHelper = new LogHelper(); foreach (DataRow row in msgParamData.Rows) { if (this.dtBroadCastUrgent != null && this.dtBroadCastUrgent.Rows.Count > 0) { this.BroadCastUrgentMsg(); } this.SendBroadCast(row); } if (this.dtBroadCastError != null && this.dtBroadCastError.Rows.Count > 0) { this.BroadCastErrorMsg(); } } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg() { ClassName = "BussinessProcess", FunctionName = "BroadCastMsg", ErrorText = string.Concat("处理普通信息播报发生错误!", exception.Message) }; (new LogHelper()).WriteError(errorMsg); } }
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; } }
private void BroadCastUrgentTimer() { DataTable broadCastUrgent = null; broadCastUrgent = this.getBroadCastUrgent(); if (broadCastUrgent != null && broadCastUrgent.Rows.Count > 0) { this.BroadUrgentPreTime = DateTime.Parse(broadCastUrgent.Rows[0]["PreTime"].ToString()); LogMsg logMsg = new LogMsg(); LogHelper logHelper = new LogHelper(); foreach (DataRow row in broadCastUrgent.Rows) { this.AddBroadCastUrgent(row); } } if (broadCastUrgent != null) { broadCastUrgent.Rows.Clear(); broadCastUrgent.Dispose(); broadCastUrgent = null; } }
private void InsertAlarmInfo(DataRow dr, CmdParam.CarAlarmState carAlarmState, int regionID) { try { int num = 0; string empty = string.Empty; int num1 = 1; long num2 = 4503599627370496L; int num3 = 1154; int num4 = 65; string str = string.Empty; string str1 = dr["AddMsgTxt"].ToString(); string str2 = null; bool flag = false; string str3 = null; int num5 = 0; try { SqlParameter[] sqlParameter = new SqlParameter[] { new SqlParameter("@wrkid", (object)num), new SqlParameter("@orderid", dr["OrderId"]), new SqlParameter("@userid", empty), new SqlParameter("@telephone", dr["telephone"]), new SqlParameter("@msgType", (object)num4), new SqlParameter("@recetime", dr["ReceTime"]), new SqlParameter("@gpstime", dr["GpsTime"]), new SqlParameter("@starCondition", dr["StarCondition"]), new SqlParameter("@starNum", dr["StarNum"]), new SqlParameter("@carStatu", (object)num1), new SqlParameter("@carStatuEx", (object)num2), new SqlParameter("@carCondition", dr["CarCondition"]), new SqlParameter("@Longitude", dr["Longitude"]), new SqlParameter("@Latitude", dr["Latitude"]), new SqlParameter("@direct", dr["Direct"]), new SqlParameter("@speed", dr["Speed"]), new SqlParameter("@Reserved", (object)num3), new SqlParameter("@TransportStatus", dr["TransportStatus"]), new SqlParameter("@Accelerration", dr["Accelerration"]), new SqlParameter("@Altitude", dr["Altitude"]), new SqlParameter("@DistanceDiff", dr["DistanceDiff"]), new SqlParameter("@commflag", dr["CommFlag"]), new SqlParameter("@addType", dr["AddMsgType"]), new SqlParameter("@addTxt", str1), new SqlParameter("@DutyStr", str2), new SqlParameter("@isPic", (object)flag), new SqlParameter("@pic", str3), new SqlParameter("@alarmInfo", str), new SqlParameter("@cameraID", (object)num5) }; string str4 = "GpsPicServer_Alarm_Insert"; string str5 = "GpsPicServer_RealTime_Insert"; int num6 = SqlDataAccess.insertBySp(str4, sqlParameter); if (num6 > 0) { LogMsg logMsg = new LogMsg("PlatformAlarmRegionAlarm", "InsertAlarmInfo", ""); object[] objArray = new object[] { "车载电话为:", dr["telephone"].ToString(), "的平台检测", carAlarmState.ToString(), "报警报文已插入gpsrecebuffer,区域ID:", regionID }; logMsg.Msg = string.Concat(objArray); this.logHelper.WriteLog(logMsg); } else { object[] objArray1 = new object[] { "将平台检测", carAlarmState.ToString(), "报警报文插入gpsrecbuffer表错误,返回值!", num6.ToString(), ",区域ID:", regionID }; ErrorMsg errorMsg = new ErrorMsg("PlatformAlarmRegionAlarm", "InsertAlarmInfo", string.Concat(objArray1)); this.logHelper.WriteError(errorMsg); } int num7 = SqlDataAccess.insertBySp(str5, sqlParameter); if (num7 > 0) { string[] strArrays = new string[] { "车载电话为:", dr["telephone"].ToString(), "的平台检测", carAlarmState.ToString(), "报警报文已插入gpsrecerealtime" }; LogMsg logMsg1 = new LogMsg("PlatformAlarmRegionAlarm", "InsertAlarmInfo", string.Concat(strArrays)); object[] objArray2 = new object[] { "车载电话为:", dr["telephone"].ToString(), "的平台检测", carAlarmState.ToString(), "报警报文已插入gpsrecerealtime,区域ID:", regionID }; logMsg1.Msg = string.Concat(objArray2); this.logHelper.WriteLog(logMsg1); } else { object[] objArray3 = new object[] { "将平台检测", carAlarmState.ToString(), "报警报文插入gpsrecerealtime_buffer表发生错误,返回值!", num7.ToString(), ",区域ID:", regionID }; ErrorMsg errorMsg1 = new ErrorMsg("PlatformAlarmRegionAlarm", "InsertAlarmInfo", string.Concat(objArray3)); this.logHelper.WriteError(errorMsg1); } } catch (Exception exception1) { Exception exception = exception1; object[] objArray4 = new object[] { "车载电话为:", dr["telephone"].ToString(), "的平台检测", carAlarmState.ToString(), ",区域ID:", regionID, "报警报文插入数据库发生错误! 信息:", exception.Message }; ErrorMsg errorMsg2 = new ErrorMsg("PlatformAlarmRegionAlarm", "InsertAlarmInfo", string.Concat(objArray4)); this.logHelper.WriteError(errorMsg2); } } catch (Exception exception3) { Exception exception2 = exception3; LogHelper logHelper = new LogHelper(); object[] objArray5 = new object[] { "将平台检测", carAlarmState.ToString(), ",区域ID:", regionID, "报警报文插入gpsrecbuffer表 、gpsrecerealtime_buffer表发生错误!", exception2.Message }; ErrorMsg errorMsg3 = new ErrorMsg("PlatformAlarmRegionAlarm", "InsertAlarmInfo", string.Concat(objArray5)); logHelper.WriteError(errorMsg3); } }
private void SendBroadCast(DataRow myRow) { try { string str = myRow["SimNum"].ToString(); DateTime dateTime = Convert.ToDateTime(myRow["BeginTime"]); DateTime dateTime1 = Convert.ToDateTime(myRow["EndTime"]); string str1 = myRow["MsgContent"].ToString(); string str2 = myRow["MsgLevel"].ToString(); int num = int.Parse(myRow["MsgId"].ToString()); if (dateTime1.CompareTo(DateTime.Now) < 0) { string str3 = "普通信息"; if ("1".Equals(str2)) { str3 = "即时信息"; } LogMsg logMsg = new LogMsg() { FunctionName = "播报信息" }; string[] strArrays = new string[] { "超时:SimNum-", str, ",信息类型-", str3, ",开始时间-", dateTime.ToString("yyyy-MM-dd HH:mm:ss"), ",结束时间-", dateTime1.ToString("yyyy-MM-dd HH:mm:ss"), ",播报时间-", null, null, null, null }; strArrays[9] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); strArrays[10] = ",播报消息-"; strArrays[11] = str1; strArrays[12] = "\r\n"; logMsg.Msg = string.Concat(strArrays); (new LogHelper()).WriteLog(logMsg); } else if (this.setParam(str1)) { if (this.htBroadCast.ContainsKey(str)) { if (DateTime.Parse(this.htBroadCast[str].ToString()).AddSeconds((double)ReadDataFromXml.BroadCastMsgTime).CompareTo(DateTime.Now) < 0) { this.htBroadCast.Remove(str); } else { bool flag = true; if (this.dtBroadCastError != null) { foreach (DataRow row in this.dtBroadCastError.Rows) { if (!(row["SimNum"].ToString() == myRow["SimNum"].ToString()) || !(row["BeginTime"].ToString() == myRow["BeginTime"].ToString()) || !(row["MsgLevel"].ToString() == myRow["MsgLevel"].ToString())) { continue; } flag = false; break; } } if (flag) { if (!"1".Equals(myRow["MsgLevel"].ToString())) { this.AddBroadCastError(myRow); } else { this.AddBroadCastUrgent(myRow); } } return; } } if (this.myDownData.icar_SendTxtMsg(CmdParam.ParamType.SimNum, str, this.sPw, CmdParam.CommMode.未知方式, this.txtMsg, num, "播报信息") != (long)0) { this.AddBroadCastError(myRow); LogMsg logMsg1 = new LogMsg() { FunctionName = "播报信息" }; string[] strArrays1 = new string[] { "失败:SimNum-", str, ",播报消息-", str1, ",开始时间-", dateTime.ToString("yyyy-MM-dd HH:mm:ss"), ",结束时间-", dateTime1.ToString("yyyy-MM-dd HH:mm:ss"), ",播报时间-", null, null }; strArrays1[9] = DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"); strArrays1[10] = "\r\n"; logMsg1.Msg = string.Concat(strArrays1); (new LogHelper()).WriteLog(logMsg1); } else if (!this.htBroadCast.ContainsKey(str)) { this.htBroadCast.Add(str, DateTime.Now); } } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg() { ClassName = "BussinessProcess", FunctionName = "SendBroadCast", ErrorText = string.Concat("发送播报信息发生错误!", exception.ToString()) }; (new LogHelper()).WriteError(errorMsg); } }
private void ReportAlarmInfo(string simnum, string alarmType, string alarmTime, string alarmInfo) { try { string str = "0"; string str1 = "16901"; string str2 = ""; str2 = "02"; str2 = string.Concat(str2, alarmType); DateTime universalTime = Convert.ToDateTime(alarmTime).ToUniversalTime(); TimeSpan timeSpan = universalTime.Subtract(new DateTime(1970, 1, 1)); str2 = string.Concat(str2, Convert.ToString((long)timeSpan.TotalSeconds, 16).PadLeft(16, '0')); str2 = string.Concat(str2, "00001402"); string str3 = ""; byte[] bytes = Encoding.GetEncoding("gb2312").GetBytes(alarmInfo.Trim()); str2 = string.Concat(str2, Convert.ToString((int)bytes.Length, 16).PadLeft(8, '0')); for (int i = 0; i < (int)bytes.Length; i++) { str3 = string.Concat(str3, bytes[i].ToString("X2")); } str2 = string.Concat(str2, str3); string str4 = "insert into GPSJTBSysSndCmd(OrderId, SimNum, CmdCode, CmdContent, AddTime, bSend) values('{0}', '{1}', '{2}', '{3}', '{4}', '{5}') "; object[] objArray = new object[] { str, simnum, str1, str2, DateTime.Now, 0 }; int num = SqlDataAccess.insertBySql(string.Format(str4, objArray)); if (num > 0) { LogMsg logMsg = new LogMsg("PlatformAlarmRegionAlarm", "ReportAlarmInfo", "") { Msg = string.Concat("将平台检测区域报警报文插入GPSJTBSysSndCmd表,AlarmType:", alarmType, ",simnum:", simnum) }; this.logHelper.WriteLog(logMsg); } else { ErrorMsg errorMsg = new ErrorMsg("PlatformAlarmRegionAlarm", "ReportAlarmInfo", string.Concat("将平台检测区域报警报文插入GPSJTBSysSndCmd表错误,AlarmType:", alarmType, ",返回值!", num.ToString())); this.logHelper.WriteError(errorMsg); } this.DownToTerminal(simnum, alarmType, alarmTime, alarmInfo); } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg1 = new ErrorMsg("PlatformAlarmRegionAlarm", "ReportAlarmInfo", string.Concat("上报警情信息入库错误,", exception.Message)); this.logHelper.WriteError(errorMsg1); } }
private void InsertAlarmInfo(DataRow dr, string regionId) { try { int num = 0; string empty = string.Empty; int num1 = 1154; int num2 = 65; string str = string.Empty; int num3 = Convert.ToInt32(dr["carstatu"]); long num4 = (long)0; num4 = (dr["carstatuex"] == DBNull.Value || dr["carstatuex"].ToString().Equals("") ? 1125899906842624L : 1125899906842624L | Convert.ToInt64(dr["carstatuex"])); string str1 = string.Concat("M150004", regionId); string str2 = null; bool flag = false; string str3 = null; int num5 = 0; try { SqlParameter[] sqlParameter = new SqlParameter[] { new SqlParameter("@wrkid", (object)num), new SqlParameter("@orderid", dr["OrderId"]), new SqlParameter("@userid", empty), new SqlParameter("@telephone", dr["telephone"]), new SqlParameter("@msgType", (object)num2), new SqlParameter("@recetime", dr["ReceTime"]), new SqlParameter("@gpstime", dr["GpsTime"]), new SqlParameter("@starCondition", dr["StarCondition"]), new SqlParameter("@starNum", dr["StarNum"]), new SqlParameter("@carStatu", (object)num3), new SqlParameter("@carStatuEx", (object)num4), new SqlParameter("@carCondition", dr["CarCondition"]), new SqlParameter("@Longitude", dr["Longitude"]), new SqlParameter("@Latitude", dr["Latitude"]), new SqlParameter("@direct", dr["Direct"]), new SqlParameter("@speed", dr["Speed"]), new SqlParameter("@Reserved", (object)num1), new SqlParameter("@TransportStatus", dr["TransportStatus"]), new SqlParameter("@Accelerration", dr["Accelerration"]), new SqlParameter("@Altitude", dr["Altitude"]), new SqlParameter("@DistanceDiff", dr["DistanceDiff"]), new SqlParameter("@commflag", dr["CommFlag"]), new SqlParameter("@addType", dr["AddMsgType"]), new SqlParameter("@addTxt", str1), new SqlParameter("@DutyStr", str2), new SqlParameter("@isPic", (object)flag), new SqlParameter("@pic", str3), new SqlParameter("@alarmInfo", str), new SqlParameter("@cameraID", (object)num5) }; string str4 = "GpsPicServer_Alarm_Insert"; string str5 = "GpsPicServer_RealTime_Insert"; int num6 = SqlDataAccess.insertBySp(str4, sqlParameter); if (num6 > 0) { LogMsg logMsg = new LogMsg("CarBeBackOnTime", "InsertAlarmInfo", string.Concat("车载电话为:", dr["telephone"].ToString(), "的未按时归班报警报文已插入gpsrecebuffer")); this.logHelper.WriteLog(logMsg); } else { ErrorMsg errorMsg = new ErrorMsg("CarBeBackOnTime", "InsertAlarmInfo", string.Concat("将未按时归班报警报文插入gpsrecbuffer表错误,返回值!", num6.ToString())); this.logHelper.WriteError(errorMsg); } int num7 = SqlDataAccess.insertBySp(str5, sqlParameter); if (num7 > 0) { LogMsg logMsg1 = new LogMsg("CarBeBackOnTime", "InsertAlarmInfo", string.Concat("车载电话为:", dr["telephone"].ToString(), "的未按时归班报警报文已插入gpsrecerealtime")); this.logHelper.WriteLog(logMsg1); } else { ErrorMsg errorMsg1 = new ErrorMsg("CarBeBackOnTime", "InsertAlarmInfo", string.Concat("将未按时归班报警报文插入gpsrecerealtime_buffer表发生错误,返回值!", num7.ToString())); this.logHelper.WriteError(errorMsg1); } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg2 = new ErrorMsg("CarBeBackOnTime", "InsertAlarmInfo", string.Concat("车载电话为:", dr["telephone"].ToString(), "的未按时归班报警报文插入数据库发生错误! 信息:", exception.Message)); this.logHelper.WriteError(errorMsg2); } } catch (Exception exception3) { Exception exception2 = exception3; LogHelper logHelper = new LogHelper(); ErrorMsg errorMsg3 = new ErrorMsg("CarBeBackOnTime", "InsertAlarmInfo", string.Concat("将未按时归班报警报文插入gpsrecbuffer表 、gpsrecerealtime_buffer表发生错误!", exception2.Message)); logHelper.WriteError(errorMsg3); } }
private void execSendMsg(DataRow dr) { LogMsg logMsg = new LogMsg(); if (string.IsNullOrEmpty(this.sSendMsg)) { logMsg.Msg = "短息内容为空,不下发短信通知。"; this.logHelper.WriteLog(logMsg); return; } logMsg.Msg = "开始发送短信通信通知..."; this.logHelper.WriteLog(logMsg); bool flag = this.sSendMsg.IndexOf("(C)") >= 0; string str = dr["StarCondition"].ToString(); string str1 = dr["Longitude"].ToString(); string str2 = dr["Latitude"].ToString(); string str3 = dr["CarNum"].ToString(); string str4 = dr["CarId"].ToString(); string str5 = dr["telephone"].ToString(); dr["FirstConnectorName"].ToString(); string str6 = dr["FirstConnectTele"].ToString(); dr["ConnectorName"].ToString(); string str7 = dr["ConnectTele"].ToString(); string str8 = ""; string str9 = ""; TxtMsg txtMsg = new TxtMsg(); try { str1 = str1.Substring(0, str1.IndexOf('.') + 7); str2 = str2.Substring(0, str2.IndexOf('.') + 7); } catch { } if (flag) { str8 = ReadDataFromGis.QueryAllLayerByPoint(str1, str2); } str9 = (str != "1" ? "未定位" : "定位"); this.sSendMsg = this.sSendMsg.Replace("(A)", str3); string str10 = this.sSendMsg; DateTime now = DateTime.Now; this.sSendMsg = str10.Replace("(B)", now.ToString("yyyyMMdd HH:mm:ss")); this.sSendMsg = this.sSendMsg.Replace("(C)", str8); this.sSendMsg = this.sSendMsg.Replace("(D)", str9); txtMsg.strMsg = this.sSendMsg; txtMsg.MsgType = CmdParam.MsgType.UCS2手机短信; txtMsg.OrderCode = CmdParam.OrderCode.调度; txtMsg.CarId = str4; txtMsg.SimNum = str5; if (!string.IsNullOrEmpty(str6)) { this.myDownData.icar_SendTxtMsg(CmdParam.ParamType.SimNum, str6, "", CmdParam.CommMode.短信, txtMsg, 0, "禁驾报警通知第一联系人"); } if (!string.IsNullOrEmpty(str7)) { this.myDownData.icar_SendTxtMsg(CmdParam.ParamType.SimNum, str7, "", CmdParam.CommMode.短信, txtMsg, 0, "禁驾报警通知第二联系人"); } }
public void WriteLog(LogMsg pLogMsg) { base.WriteText(pLogMsg.GetMsg() + "\n"); }
private void AdminRegionAlarmInsert(DataTable dt) { if (dt == null || dt.Rows.Count <= 0) { return; } try { LogHelper logHelper = new LogHelper(); int num = 0; string empty = string.Empty; int num1 = 1154; int num2 = 65; string str = string.Empty; string str1 = null; bool flag = false; string str2 = null; int num3 = 0; foreach (DataRow row in dt.Rows) { try { SqlParameter[] sqlParameter = new SqlParameter[] { new SqlParameter("@wrkid", (object)num), new SqlParameter("@orderid", row["OrderId"]), new SqlParameter("@userid", empty), new SqlParameter("@telephone", row["SimNum"]), new SqlParameter("@msgType", (object)num2), new SqlParameter("@recetime", row["ReceTime"]), new SqlParameter("@gpstime", row["GpsTime"]), new SqlParameter("@starCondition", row["StarCondition"]), new SqlParameter("@starNum", row["StarNum"]), new SqlParameter("@carStatu", row["carStatu"]), new SqlParameter("@carStatuEx", row["CarStatuEx"]), new SqlParameter("@carCondition", row["CarCondition"]), new SqlParameter("@Longitude", row["Longitude"]), new SqlParameter("@Latitude", row["Latitude"]), new SqlParameter("@direct", row["Direct"]), new SqlParameter("@speed", row["Speed"]), new SqlParameter("@Reserved", (object)num1), new SqlParameter("@TransportStatus", row["TransportStatus"]), new SqlParameter("@Accelerration", row["Accelerration"]), new SqlParameter("@Altitude", row["Altitude"]), new SqlParameter("@DistanceDiff", row["DistanceDiff"]), new SqlParameter("@commflag", row["CommFlag"]), new SqlParameter("@addType", row["AddMsgType"]), new SqlParameter("@addTxt", row["AddMsgTxt"]), new SqlParameter("@DutyStr", str1), new SqlParameter("@isPic", (object)flag), new SqlParameter("@pic", str2), new SqlParameter("@alarmInfo", row["AdminRegionName"].ToString()), new SqlParameter("@cameraID", (object)num3) }; string str3 = "GpsPicServer_Alarm_Insert"; string str4 = "GpsPicServer_RealTime_Insert"; int num4 = SqlDataAccess.insertBySp(str3, sqlParameter); if (num4 > 0) { LogMsg logMsg = new LogMsg("", "", string.Concat("车载电话为:", row["SimNum"].ToString(), "的出入行政区报警报文已插入gpsrecebuffer")); logHelper.WriteLog(logMsg); } else { ErrorMsg errorMsg = new ErrorMsg("ReadDataFromDB", "AdminRegionAlarmInsert", string.Concat("将出入行政区报警报文插入gpsrecbuffer表错误,返回值!", num4.ToString())); logHelper.WriteError(errorMsg); } int num5 = SqlDataAccess.insertBySp(str4, sqlParameter); if (num5 > 0) { LogMsg logMsg1 = new LogMsg("", "", string.Concat("车载电话为:", row["SimNum"].ToString(), "的出入行政区报警报文已插入gpsrecerealtime")); logHelper.WriteLog(logMsg1); } else { ErrorMsg errorMsg1 = new ErrorMsg("ReadDataFromDB", "AdminRegionAlarmInsert", string.Concat("将出入行政区报警报文插入gpsrecerealtime_buffer表发生错误,返回值!", num5.ToString())); logHelper.WriteError(errorMsg1); } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg2 = new ErrorMsg("IORegionTimer", "AdminRegionAlarmInsert", string.Concat("车载电话为:", row["SimNum"].ToString(), "的出入行政区报警报文插入数据库发生错误! 信息:", exception.Message)); logHelper.WriteError(errorMsg2); } } } catch (Exception exception3) { Exception exception2 = exception3; LogHelper logHelper1 = new LogHelper(); ErrorMsg errorMsg3 = new ErrorMsg("IORegionTimer", "AdminRegionAlarmInsert", string.Concat("将出入行政区报警报文插入gpsrecbuffer表 、gpsrecerealtime_buffer表发生错误!", exception2.Message)); logHelper1.WriteError(errorMsg3); } }
public void WriteLog(LogMsg pLogMsg, string pMsg) { pLogMsg.Msg = pMsg; base.WriteText(pLogMsg.GetMsg() + "\n"); }
private void tGetConfigInfo_Elapsed(object sender, ElapsedEventArgs e) { this.tGetConfigInfo.Enabled = false; this.tGetConfigInfo.Interval = (double)this.iGetConfigInfo; try { try { string str = ReadDataFromDB.GetSvrTime().ToString("HH:mm:ss"); lock (this.infoList) { List<int> nums = new List<int>(); foreach (KeyValuePair<int, CarBeBackTimeInfo> keyValuePair in this.infoList) { if (this.IsInConfigTime(keyValuePair.Value.BeginTime, keyValuePair.Value.EndTime, str)) { continue; } nums.Add(keyValuePair.Key); LogMsg logMsg = new LogMsg("CarBeBackOnTime", "tGetConfigInfo_Elapsed", ""); object[] d = new object[] { "删除设置时间段外的配置信息ID:", keyValuePair.Value.ID, ",simnum:", keyValuePair.Value.SimNum, ",起始时间:", keyValuePair.Value.BeginTime, ",终止时间: ", keyValuePair.Value.EndTime, ",区域ID:", keyValuePair.Value.RegionID }; logMsg.Msg = string.Concat(d); this.logHelper.WriteLog(logMsg); } foreach (int num in nums) { this.infoList.Remove(num); } DataTable configInfo = this.getConfigInfo(str); if (configInfo != null && configInfo.Rows.Count > 0) { foreach (DataRow row in configInfo.Rows) { int num1 = Convert.ToInt32(row["ID"]); if (this.infoList.Keys.Contains<int>(num1)) { continue; } CarBeBackTimeInfo carBeBackInfo = this.getCarBeBackInfo(row); if (carBeBackInfo == null) { continue; } this.infoList.Add(num1, carBeBackInfo); LogMsg logMsg1 = new LogMsg("CarBeBackOnTime", "tGetConfigInfo_Elapsed", ""); object[] simNum = new object[] { "增加配置信息ID:", num1, ",simnum:", carBeBackInfo.SimNum, ",起始时间:", carBeBackInfo.BeginTime, ",终止时间: ", carBeBackInfo.EndTime, ",区域ID:", carBeBackInfo.RegionID }; logMsg1.Msg = string.Concat(simNum); this.logHelper.WriteLog(logMsg1); } } } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg() { ClassName = "CarBeBackOnTime", FunctionName = "tGetConfigInfo_Elapsed", ErrorText = string.Concat("获取配置信息错误,", exception.Message) }; this.logHelper.WriteError(errorMsg); } } finally { this.tGetConfigInfo.Enabled = true; } }
private void tGetConfigInfo_Elapsed(object sender, ElapsedEventArgs e) { this.tGetConfigInfo.Enabled = false; this.tGetConfigInfo.Interval = (double)this.iGetConfigInfo; try { try { string str = ReadDataFromDB.GetSvrTime().ToString("HH:mm:ss"); lock (this.infoList) { List<int> nums = new List<int>(); foreach (KeyValuePair<int, CarInOutOfRangeTimeInfo> keyValuePair in this.infoList) { if (!keyValuePair.Value.IsInAlarm || !keyValuePair.Value.IsOutAlarm) { continue; } nums.Add(keyValuePair.Key); LogMsg logMsg = new LogMsg("CarInOutOfRangeOnTime", "tGetConfigInfo_Elapsed", ""); object[] d = new object[] { "删除未按时进出站都已检测过的配置信息ID:", keyValuePair.Value.ID, ",simnum:", keyValuePair.Value.SimNum, ",起始时间:", keyValuePair.Value.StartTime, ",终止时间: ", keyValuePair.Value.EndTime, ",区域ID:", keyValuePair.Value.RegionID, ",Index:", keyValuePair.Value.RegionIndex }; logMsg.Msg = string.Concat(d); this.logHelper.WriteLog(logMsg); } foreach (int num in nums) { this.infoList.Remove(num); } DataTable configInfo = this.getConfigInfo(str); if (configInfo != null && configInfo.Rows.Count > 0) { foreach (DataRow row in configInfo.Rows) { int num1 = Convert.ToInt32(row["ID"]); if (this.infoList.Keys.Contains<int>(num1)) { continue; } CarInOutOfRangeTimeInfo inOutOfRangeTimeInfo = this.getInOutOfRangeTimeInfo(row); if (inOutOfRangeTimeInfo == null) { continue; } this.infoList.Add(num1, inOutOfRangeTimeInfo); LogMsg logMsg1 = new LogMsg("CarInOutOfRangeOnTime", "tGetConfigInfo_Elapsed", ""); object[] simNum = new object[] { "增加配置信息ID:", num1, ",simnum:", inOutOfRangeTimeInfo.SimNum, ",起始时间:", inOutOfRangeTimeInfo.StartTime, ",终止时间: ", inOutOfRangeTimeInfo.EndTime, ",区域ID:", inOutOfRangeTimeInfo.RegionID, ",Index:", inOutOfRangeTimeInfo.RegionIndex }; logMsg1.Msg = string.Concat(simNum); this.logHelper.WriteLog(logMsg1); } } } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg("CarInOutOfRangeOnTime", "tGetConfigInfo_Elapsed", string.Concat("获取按时进出站配置信息错误,", exception.Message)); this.logHelper.WriteError(errorMsg); } } finally { this.tGetConfigInfo.Enabled = true; } }