private DataTable getConfigInfo() { DataTable dataTable; try { DateTime svrTime = ReadDataFromDB.GetSvrTime(); string str = " select b.CarId, b.simnum,c.* from giscar b INNER join gpscarcurrentposinfo c WITH(NOLOCK) on b.simnum = c.telephone {2} where c.lastupdatetime between '{0}' and '{1}' "; string str1 = ""; if (ReadDataFromXml.IsOnlyFillCheck) { str1 = "and c.TransportStatus = '3'"; } DataTable dataBySql = SqlDataAccess.getDataBySql(string.Format(str, this.dtNow.ToString(), svrTime.ToString(), str1)); this.dtNow = svrTime; dataTable = dataBySql; } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg("PlatformAlarmPathSegmentAlarm", "getConfigInfo", string.Concat("获取分路段超速报警配置信息错误,", exception.Message)); this.logHelper.WriteError(errorMsg); dataTable = null; } return(dataTable); }
private DataTable getConfigInfo() { DataTable dataTable; try { DateTime svrTime = ReadDataFromDB.GetSvrTime(); string str = " select a.*,b.simnum,c.alarmpathdot,c.pathname,d.* from GpsJtbCarPathAlarm_Platform a inner join giscar b on a.carid = b.carid left join GpsPathType c on a.pathid = c.pathid INNER join gpscarcurrentposinfo d WITH(NOLOCK) on b.simnum = d.telephone {2} where d.lastupdatetime between '{0}' and '{1}' "; string str1 = ""; if (ReadDataFromXml.IsOnlyFillCheck) { str1 = "and d.TransportStatus = '3'"; } DataTable dataBySql = SqlDataAccess.getDataBySql(string.Format(str, this.dtNow.ToString(), svrTime.ToString(), str1)); this.dtNow = svrTime; dataTable = dataBySql; } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg("PlatformAlarmPathAlarm", "getConfigInfo", string.Concat("获取偏移路线报警信息错误,", exception.Message)); this.logHelper.WriteError(errorMsg); dataTable = null; } return(dataTable); }
public long icar_SendRawPackage(CmdParam.ParamType ParamType, string SimNum, string CarPw, CmdParam.CommMode CommMode, TrafficRawPackage trafficRawPackage, string CarID) { long num = (long)-1; this.logMsg.FunctionName = "icar_SendRawPackage"; LogMsg logMsg = this.logMsg; string[] str = new string[] { "发送:类型-", ParamType.ToString(), ",车辆-", SimNum, ",指令-", trafficRawPackage.OrderCode.ToString(), ",参数-", trafficRawPackage.strText }; logMsg.Msg = string.Concat(str); string msg = this.logMsg.Msg; this.log.WriteLog(this.logMsg); if (!this.isStartCommon()) { num = (long)-1; } else { try { int num1 = 1; int newOrderId = DownData.CarCmdSend.GetNewOrderId(); string str1 = ""; string xmlString = trafficRawPackage.ToXmlString(this.CalOrderId(num1, newOrderId), SimNum, "JTBGPS", (int)CommMode, "SendRawPackage", ref str1); num = DownData.CarCmdSend.icar_SendCmdXML(num1, newOrderId, SimNum, "JTBGPS", (int)trafficRawPackage.OrderCode, (int)CommMode, xmlString); if (num == (long)0) { ReadDataFromDB.execSaveGpsLogTable(num1, newOrderId, CarID, (int)trafficRawPackage.OrderCode, trafficRawPackage.strText); } else { AlarmMsg alarmMsg = new AlarmMsg() { ClassName = "GpsPicDownData", FunctionName = "icar_SendRawPackage" }; string[] simNum = new string[] { "异常发送:", SimNum, "类型-", ParamType.ToString(), ",车辆-", SimNum, ",指令-", trafficRawPackage.OrderCode.ToString(), ",参数-", trafficRawPackage.strText }; alarmMsg.AlarmText = string.Concat(simNum); alarmMsg.Code = num.ToString(); this.log.WriteAlarm(alarmMsg); } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg() { ClassName = "GpsPicDownData", ErrorText = "下发消息指令时发生错误!" }; this.log.WriteError(errorMsg, exception); num = (long)-1; } } return(num); }
public long icar_SetCmdXML(string OrderID, string simnum, string strCarType, string CmdCode, string strXML, string CommFlag, string CarID) { long num = (long)0; this.logMsg.FunctionName = "icar_SetCmdXML"; LogMsg logMsg = this.logMsg; string[] strArrays = new string[] { "发送:", strCarType, ",类型-", CmdCode.ToString(), ",车辆-", simnum }; logMsg.Msg = string.Concat(strArrays); if (!this.isStartCommon()) { num = (long)-1; } else { try { this.log.WriteLog(this.logMsg); int newOrderId = DownData.CarCmdSend.GetNewOrderId(); num = DownData.CarCmdSend.icar_SendCmdXML(this.WorkId, Convert.ToInt32(OrderID), simnum, strCarType, Convert.ToInt32(CmdCode), Convert.ToInt32(CommFlag), strXML); if (num == (long)0) { ReadDataFromDB.execSaveGpsLogTable(this.WorkId, newOrderId, CarID, Convert.ToInt32(CmdCode), strXML); } else { AlarmMsg alarmMsg = new AlarmMsg() { ClassName = "GpsPicDownData", FunctionName = "icar_SetCmdXML" }; string[] strArrays1 = new string[] { "异常发送:", strCarType, ",类型-", CmdCode.ToString(), ",车辆-", simnum, ",XML文件:", strXML }; alarmMsg.AlarmText = string.Concat(strArrays1); alarmMsg.Code = num.ToString(); this.log.WriteAlarm(alarmMsg); } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg() { ClassName = "GpsPicDownData", ErrorText = "下发XML时发生错误!" }; this.log.WriteError(errorMsg, exception); num = (long)-1; } } return(num); }
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); }
public long icar_SendRawPackage(string SimNumFirst, object SimNums, int CarId) { long num = (long)0; this.logMsg.FunctionName = "icar_SendRawPackage"; if (!this.isStartCommon()) { num = (long)-1; } else { try { this.log.WriteLog(this.logMsg); int num1 = 0; int num2 = 0; int num3 = 12289; num = DownData.CarCmdSend.icar_SendRawPackage(num1, num2, SimNumFirst, CmdParam.CmdCode.带时间段的超速设置 & CmdParam.CmdCode.定时监控查看, ref SimNums, CmdParam.CommMode.短信); if (num == (long)0) { ReadDataFromDB.execSaveGpsLogTable(this.WorkId, num1, CarId.ToString(), num3, "LBS批量定位"); } else { AlarmMsg alarmMsg = new AlarmMsg() { ClassName = "GpsPicDownData", FunctionName = "icar_SendRawPackage" }; object[] workId = new object[] { "workid-", this.WorkId, ",simNum-", SimNums, ",strMsg-LBS调用位置查询" }; alarmMsg.AlarmText = string.Concat(workId); alarmMsg.Code = num.ToString(); this.log.WriteAlarm(alarmMsg); } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg() { ClassName = "GpsPicDownData", ErrorText = "下发消息指令时发生错误!" }; this.log.WriteError(errorMsg, exception); num = (long)-1; } } return(num); }
public long iCar_SetPosReport(CmdParam.ParamType ParamType, string SimNum, string CarPw, CmdParam.CommMode CommMode, PosReport posReport, int CarID) { long num = (long)0; this.logMsg.FunctionName = "iCar_SetPosReport"; this.logMsg.Msg = string.Concat("发送:类型-", ParamType.ToString(), ",车辆-", SimNum); if (!this.isStartCommon()) { num = (long)-1; } else { try { this.log.WriteLog(this.logMsg); int newOrderId = DownData.CarCmdSend.GetNewOrderId(); num = DownData.CarCmdSend.icar_SetPosReport(this.WorkId, newOrderId, SimNum, posReport.ReportType, posReport.ReportTiming, posReport.ReportCycle, posReport.IsAutoCalArc, posReport.isCompressed, posReport.ReportWhenStop); if (num == (long)0) { ReadDataFromDB.execSaveGpsLogTable(this.WorkId, newOrderId, CarID.ToString(), (int)posReport.OrderCode, "LBS单次定位"); } else { AlarmMsg alarmMsg = new AlarmMsg() { ClassName = "GpsPicDownData", FunctionName = "iCar_SetPosReport" }; object[] workId = new object[] { "workid-", this.WorkId, ",simNum-", SimNum, ",strMsg-调用位置查询" }; alarmMsg.AlarmText = string.Concat(workId); alarmMsg.Code = num.ToString(); this.log.WriteAlarm(alarmMsg); } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg() { ClassName = "GpsPicDownData", ErrorText = "下发消息指令时发生错误!" }; this.log.WriteError(errorMsg, exception); num = (long)-1; } } return(num); }
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, ReadDataFromDB.GetSvrTime(), 0 }; int num = SqlDataAccess.insertBySql(string.Format(str4, objArray)); if (num > 0) { LogMsg logMsg = new LogMsg("CarInOutOfRangeOnTime", "ReportAlarmInfo", "") { Msg = string.Concat("将平台检测超速报警报文插入GPSJTBSysSndCmd表,AlarmType:", alarmType, ",simnum:", simnum) }; this.logHelper.WriteLog(logMsg); } else { ErrorMsg errorMsg = new ErrorMsg("CarInOutOfRangeOnTime", "ReportAlarmInfo", string.Concat("将平台检测超速报警报文插入GPSJTBSysSndCmd表错误,AlarmType:", alarmType, ",返回值!", num.ToString())); this.logHelper.WriteError(errorMsg); } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg1 = new ErrorMsg("CarInOutOfRangeOnTime", "ReportAlarmInfo", string.Concat("上报警情信息入库错误,", exception.Message)); this.logHelper.WriteError(errorMsg1); } }
private DataTable getCarCurrentPosInfo() { DataTable dataTable; try { DateTime svrTime = ReadDataFromDB.GetSvrTime(); DataTable dataBySql = SqlDataAccess.getDataBySql(string.Format(this.sql, this.dtNow, svrTime)); this.dtNow = svrTime; dataTable = dataBySql; } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg("GpsCarCurrentPosInfo", "getCarCurrentPosInfo", string.Concat("获取末次位置信息错误,", exception.Message)); this.logHelper.WriteError(errorMsg); dataTable = null; } return(dataTable); }
private DataTable getData() { DataTable dataTable; try { DateTime svrTime = ReadDataFromDB.GetSvrTime(); string str = "select a.*, c.*,e.[ProtocolName] from GpsCarCheckRoadSpeedAndRank a INNER JOIN GisCar b on a.Carid = b.CarId INNER JOIN GpsCarCurrentPosInfo c on c.telephone = b.simnum inner join GpsTerminalType d on b.[TerminalTypeID]=d.[TerminalTypeID] inner join [GpsProtocol] e on e.[ProtocolCode]=d.[ProtocolCode] where c.LastUpdateTime between '{0}' and '{1}'"; DataTable dataBySql = SqlDataAccess.getDataBySql(string.Format(str, this.dtNow, svrTime)); this.dtNow = svrTime; dataTable = dataBySql; } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg("PlatFormCheckRoadSpeedAndRank", "getData", string.Concat("判断车自定义分段超速报警和道路等级,", exception.Message)); this.logHelper.WriteError(errorMsg); dataTable = null; } return(dataTable); }
private DataTable getConfigInfo() { DataTable dataTable; try { DateTime svrTime = ReadDataFromDB.GetSvrTime(); string str = " select a.*,b.simnum,c.regiondot,c.regionname,c.regionfeature,d.* from GpsJtbCarRegionAlarm_Platform a inner join giscar b on a.carid = b.carid left join GpsRegionType c on a.regionid = c.regionid left join gpscarcurrentposinfo d WITH(NOLOCK) on b.simnum = d.telephone where d.lastupdatetime between '{0}' and '{1}' and (a.stopAlarmTime is null or a.stopAlarmTime < getdate()) "; DataTable dataBySql = SqlDataAccess.getDataBySql(string.Format(str, this.dtNow.ToString(), svrTime.ToString())); this.dtNow = svrTime; dataTable = dataBySql; } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg("PlatformAlarmRegionAlarm", "getConfigInfo", string.Concat("获取平台报警区域报警配置信息错误,", exception.Message)); this.logHelper.WriteError(errorMsg); dataTable = null; } return(dataTable); }
private DataTable getOnLineData() { DataTable dataTable; try { DateTime svrTime = ReadDataFromDB.GetSvrTime(); string str = " exec GpsPicServer_ExecOnLineNoticeJTB '{0}', '{1}' "; DataTable dataBySql = SqlDataAccess.getDataBySql(string.Format(str, this.dtNow.ToString(), svrTime.ToString())); this.dtNow = svrTime; dataTable = dataBySql; } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg("JTBOnOffLineNotice", "getOnLineData", string.Concat("获取上线车辆信息错误,", exception.Message)); this.logHelper.WriteError(errorMsg); dataTable = null; } return(dataTable); }
private DataTable getConfigInfo() { DataTable dataTable; try { DateTime svrTime = ReadDataFromDB.GetSvrTime(); string str = "select a.carid,c.* from gpscarlevelthreeroad a inner join giscar b on a.carid=b.carid inner join GpsCarCurrentPosInfo c with(nolock) on b.simnum=c.telephone where c.lastupdatetime between '{0}' and '{1}'"; DataTable dataBySql = SqlDataAccess.getDataBySql(string.Format(str, this.dtNow, svrTime)); this.dtNow = svrTime; dataTable = dataBySql; } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg("PlatFormAlarmThreeLevelRoadAlarm", "getConfigInfo", string.Concat("获取三级路面报警配置信息错误", exception.Message)); this.logHelper.WriteError(errorMsg); dataTable = null; } return(dataTable); }
private void tGetCurrentPosInfo_Elapsed(object sender, ElapsedEventArgs e) { this.tGetCurrentPosInfo.Enabled = false; try { try { string str = ReadDataFromDB.GetSvrTime().ToString("HH:mm:ss"); lock (this.infoList) { foreach (KeyValuePair <int, CarInOutOfRangeTimeInfo> keyValuePair in this.infoList) { DataTable posInfo = this.getPosInfo(keyValuePair.Value.SimNum); if (posInfo == null || posInfo.Rows.Count <= 0) { continue; } string str1 = posInfo.Rows[0]["Longitude"].ToString(); string str2 = posInfo.Rows[0]["Latitude"].ToString(); string regionDot = keyValuePair.Value.RegionDot; DateTime dateTime = Convert.ToDateTime(posInfo.Rows[0]["gpsTime"]); string str3 = dateTime.ToString("HH:mm:ss"); DateTime dateTime1 = Convert.ToDateTime(posInfo.Rows[0]["gpsTime"]); DateTime svrTime = ReadDataFromDB.GetSvrTime(); if (!this.IsInConfigTime(keyValuePair.Value.StartTime, keyValuePair.Value.EndTime, str) || !this.IsInConfigTime(keyValuePair.Value.StartTime, keyValuePair.Value.EndTime, str3) || !(dateTime1.Date == svrTime.Date) || keyValuePair.Value.IsInAlarm) { if (this.TimeCompareTo(str, keyValuePair.Value.EndTime) <= 0 || this.TimeCompareTo(str3, keyValuePair.Value.EndTime) <= 0 || !(dateTime1.Date == svrTime.Date) || keyValuePair.Value.IsOutAlarm) { continue; } if (this.IsInRegion(str1, str2, regionDot)) { DataRow item = posInfo.Rows[0]; int regionID = keyValuePair.Value.RegionID; this.InsertAlarmInfo(item, regionID.ToString(), 2, keyValuePair.Value.StartTime, keyValuePair.Value.EndTime); } keyValuePair.Value.IsOutAlarm = true; } else { if (!this.IsInRegion(str1, str2, regionDot)) { DataRow dataRow = posInfo.Rows[0]; int num = keyValuePair.Value.RegionID; this.InsertAlarmInfo(dataRow, num.ToString(), 1, keyValuePair.Value.StartTime, keyValuePair.Value.EndTime); } keyValuePair.Value.IsInAlarm = true; } } } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg() { ClassName = "CarInOutOfRangeOnTime", FunctionName = "tGetCurrentPosInfo_Elapsed", ErrorText = string.Concat("检测是否按时进出站错误,", exception.Message) }; this.logHelper.WriteError(errorMsg); } } finally { this.tGetCurrentPosInfo.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; } }
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 tCheckSeparateSticky_Elapsed(object sender, ElapsedEventArgs e) { this.tCheckSeparateSticky.Enabled = false; try { try { DataTable busRouteConfig = this.getBusRouteConfig(); this.clearHashT(); if (busRouteConfig != null && busRouteConfig.Rows.Count > 0) { DateTime svrTime = ReadDataFromDB.GetSvrTime(); this.initInputXML(); string str = ""; string str1 = ""; string str2 = ""; string[] strArrays = new string[2]; bool flag = false; List <string> strs = new List <string>(); foreach (DataRow row in busRouteConfig.Rows) { str = row["RouteId"].ToString(); if (strs.Contains(str)) { continue; } strs.Add(str); this.htRouteList[str] = row["RouteName"].ToString(); str1 = row["Separate"].ToString(); str2 = row["Sticky"].ToString(); strArrays[0] = row["PathDotUp"].ToString(); strArrays[1] = row["PathDotDown"].ToString(); if (string.IsNullOrEmpty(strArrays[0]) && string.IsNullOrEmpty(strArrays[1])) { continue; } DataTable busPosInfo = this.getBusPosInfo(str, svrTime); if (busPosInfo == null || busPosInfo.Rows.Count <= 0) { continue; } XmlElement busesInfo = this.getBusesInfo(busPosInfo); this.setRouteLine(str, str1, str2, strArrays[0], strArrays[1], busesInfo); flag = true; } this.dtNow = svrTime; if (flag) { LogMsg logMsg = new LogMsg("PlatformAlarmPathAlarm", "tCheckSeparateSticky_Elapsed", "") { Msg = string.Concat("脱车粘车传 入 的xml:\r\n", this.xDoc.OuterXml) }; this.logHelper.WriteLog(logMsg); string separateAndStickyCars = ReadDataFromGis.GetSeparateAndStickyCars(this.xDoc.OuterXml); logMsg.Msg = string.Concat("脱车粘车传 回 的xml:\r\n", separateAndStickyCars); this.logHelper.WriteLog(logMsg); if (!string.IsNullOrEmpty(separateAndStickyCars)) { this.ltAlarmBus = new List <AlarmBus>(); this.AnalysisOutputXML(separateAndStickyCars); } this.InsertAlarmInfo(this.ltAlarmBus); } } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg("SeparateAndSticky", "tCheckSeparateSticky_Elapsed", string.Concat("定时检测脱车粘车报警错误,", exception.Message)); this.logHelper.WriteError(errorMsg); } } finally { if (this.ltAlarmBus != null) { this.ltAlarmBus.Clear(); this.ltAlarmBus = null; } if (this.dtBusesPosInfo != null) { this.dtBusesPosInfo.Rows.Clear(); this.dtBusesPosInfo = null; } this.tCheckSeparateSticky.Enabled = true; } }
public long icar_SendTxtMsg(CmdParam.ParamType ParamType, string SimNum, string CarPw, CmdParam.CommMode CommMode, TxtMsg msgContent, int iMsgId, string sMsgType) { long num = (long)0; this.logMsg.FunctionName = "icar_SendTxtMsg"; this.logMsg.Msg = string.Concat("发送:类型-", ParamType.ToString(), ",车辆-", SimNum); string str = string.Concat("消息类型-", msgContent.MsgType.ToString(), string.Format(",{0}-", sMsgType), msgContent.strMsg); LogMsg logMsg = this.logMsg; logMsg.Msg = string.Concat(logMsg.Msg, ",", str); this.log.WriteLog(this.logMsg); if (!this.isStartCommon()) { num = (long)-1; } else { try { if (msgContent.MsgType != CmdParam.MsgType.掉线短信通知) { int num1 = 1; int num2 = iMsgId; num = DownData.CarCmdSend.icar_SendTxtMsg(num1, num2, SimNum, msgContent.MsgType, msgContent.strMsg); if (num == (long)0) { ReadDataFromDB.execSaveGpsLogTable(num1, num2, msgContent.CarId, (int)msgContent.MsgType, msgContent.strMsg); } } else { object[] objArray = new object[] { msgContent.MsgType.ToString(), msgContent.SimNum, msgContent.strMsg }; object obj = objArray; int num3 = 4; int newOrderId = DownData.CarCmdSend.GetNewOrderId(); num = DownData.CarCmdSend.icar_SetCommonCmd(num3, newOrderId, SimNum, (CmdParam.CmdCode) 768, ref obj, CmdParam.CommMode.未知方式); if (num == (long)0) { ReadDataFromDB.execSaveGpsLogTable(num3, newOrderId, msgContent.CarId, (int)msgContent.MsgType, msgContent.strMsg); } } if (num != (long)0) { AlarmMsg alarmMsg = new AlarmMsg() { ClassName = "GpsPicDownData", FunctionName = "icar_SendTxtMsg" }; object[] workId = new object[] { "workid-", this.WorkId, ",simNum-", SimNum, ",strMsg-", msgContent.strMsg }; alarmMsg.AlarmText = string.Concat(workId); alarmMsg.Code = num.ToString(); this.log.WriteAlarm(alarmMsg); } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg() { ClassName = "GpsPicDownData", ErrorText = "下发消息指令时发生错误!" }; this.log.WriteError(errorMsg, exception); num = (long)-1; } } return(num); }
private void tCheckForbidDriveAlarm_Elapsed(object sender, ElapsedEventArgs e) { this.tCheckForbidDriveAlarm.Enabled = false; this.dtTmp = ReadDataFromDB.GetSvrTime(); DataTable dataBySP = null; SqlParameter[] sqlParameter = new SqlParameter[] { new SqlParameter("@CurrentTime", (object)this.dtTmp) }; dataBySP = SqlDataAccess.getDataBySP("GpsPicServer_GetForbidDriveAlarmConfig", sqlParameter); ArrayList arrayLists = new ArrayList(); foreach (int key in this.htCaridStat.Keys) { if ((int)dataBySP.Select(string.Concat("Carid=", key)).Length != 0) { continue; } arrayLists.Add(key); } foreach (int arrayList in arrayLists) { this.htCaridStat.Remove(arrayList); } try { try { this.dtConfig = this.getConfig(); if (this.dtConfig != null && this.dtConfig.Rows.Count > 0) { foreach (DataRow row in this.dtConfig.Rows) { int num = int.Parse(row["CarId"].ToString()); if (!this.htCaridStat.Contains(num)) { this.htCaridStat[num] = 0; } double num1 = double.Parse(row["Speed"].ToString()); int num2 = int.Parse(this.htCaridStat[num].ToString()); DateTime dateTime = DateTime.Parse(row["GpsTime"].ToString()); string str = dateTime.ToString("HH:mm"); DateTime dateTime1 = DateTime.Parse(row["StartTime"].ToString()); string str1 = dateTime1.ToString("HH:mm"); DateTime dateTime2 = DateTime.Parse(row["EndTime"].ToString()); string str2 = dateTime2.ToString("HH:mm"); if ((str1.CompareTo(str2) >= 0 || str.CompareTo(str1) <= 0 || str.CompareTo(str2) >= 0) && (str1.CompareTo(str2) <= 0 || str.CompareTo(str1) <= 0 && str.CompareTo(str2) >= 0)) { if (num2 != 1) { continue; } this.AlarmListEnd.Add(num.ToString()); this.htCaridStat[num] = 0; } else if (num1 <= 0.001) { if (num2 != 1) { continue; } this.AlarmListEnd.Add(num.ToString()); this.htCaridStat[num] = 0; } else if (num2 != 0) { this.AlarmListMid.Add(num.ToString()); } else { this.AlarmListFirst.Add(num.ToString()); this.htCaridStat[num] = 1; } } this.dtNow = this.dtTmp; } this.CheckAndInsert(); } catch (Exception exception) { ErrorMsg errorMsg = new ErrorMsg("PlatFormrForbidDriveAlarm", "tCheckForbidDrivingAlarm_Elapsed", exception.Message); this.logHelper.WriteError(errorMsg); } } finally { this.tCheckForbidDriveAlarm.Enabled = true; } }
public long icar_SendCmdXML(CmdParam.ParamType ParamType, string SimNum, string CarId, string CarPw, string ProtocolName, CmdParam.CommMode CommMode, TxtMsg MsgContext, string sMsgType) { long num = (long)0; this.logMsg.FunctionName = "icar_SendTxtMsg"; this.logMsg.Msg = string.Concat("发送:类型-", ParamType.ToString(), ",车辆-", SimNum); string str = string.Concat("消息类型-", MsgContext.MsgType.ToString(), string.Format(",{0}-", sMsgType), MsgContext.strMsg); LogMsg logMsg = this.logMsg; logMsg.Msg = string.Concat(logMsg.Msg, ",", str); this.log.WriteLog(this.logMsg); if (!this.isStartCommon()) { num = (long)-1; } else { try { int newOrderId = DownData.CarCmdSend.GetNewOrderId(); if (ProtocolName != "JTBGPS") { num = DownData.CarCmdSend.icar_SendTxtMsg(this.WorkId, newOrderId, SimNum, MsgContext.MsgType, MsgContext.strMsg); } else { MsgContext.TransformCode = CmdParam.TrafficProtocolCodeExchange((int)MsgContext.MsgType); string str1 = ""; string xmlString = MsgContext.ToXmlString(this.CalOrderId(this.WorkId, newOrderId), SimNum, ProtocolName, (int)CommMode, "SimpleCmd", ref str1); num = DownData.CarCmdSend.icar_SendCmdXML(this.WorkId, newOrderId, SimNum, ProtocolName, (int)MsgContext.MsgType, (int)CommMode, xmlString); } if (num == (long)0) { ReadDataFromDB.execSaveGpsLogTable(this.WorkId, newOrderId, CarId, (int)MsgContext.MsgType, MsgContext.strMsg); } if (num != (long)0) { AlarmMsg alarmMsg = new AlarmMsg() { ClassName = "GpsPicDownData", FunctionName = "icar_SendTxtMsg" }; object[] workId = new object[] { "workid-", this.WorkId, ",simNum-", SimNum, ",strMsg-", MsgContext.strMsg }; alarmMsg.AlarmText = string.Concat(workId); alarmMsg.Code = num.ToString(); this.log.WriteAlarm(alarmMsg); } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg() { ClassName = "GpsPicDownData", ErrorText = "下发消息指令时发生错误!" }; this.log.WriteError(errorMsg, exception); num = (long)-1; } } return(num); }
public long icar_SetCaptureEx(CmdParam.ParamType ParamType, string SimNum, string CarPw, CmdParam.CommMode CommMode, CaptureEx captureEx, string PicTime, string CarID) { long num = (long)0; this.logMsg.FunctionName = "icar_SetCaptureEx"; this.logMsg.Msg = string.Concat("发送:类型-", ParamType.ToString(), ",车辆-", SimNum); object[] picTime = new object[] { "抓拍时间-", PicTime, ",是否多帧-", captureEx.IsMulitFramebool, ",监控次数-", captureEx.Times, ",间隔时间-", (double)captureEx.Interval * 0.1, ",图像质量-", captureEx.Quality, ",图像亮度-", captureEx.Brightness, ",图像对比度-", captureEx.Contrast, ",图像饱和度-", captureEx.Saturation, ",图像色度", captureEx.Chroma, ",停车是否拍照-", captureEx.IsCapWhenStop }; string str = string.Concat(picTime); LogMsg logMsg = this.logMsg; logMsg.Msg = string.Concat(logMsg.Msg, ",", str); this.log.WriteLog(this.logMsg); if (!this.isStartCommon()) { num = (long)-1; } else { try { if (captureEx.ProtocolName == "JTBGPS") { int newOrderId = DownData.CarCmdSend.GetNewOrderId(); string str1 = ""; captureEx.TransformCode = CmdParam.TrafficProtocolCodeExchange2((int)captureEx.OrderCode); if (captureEx.Quality == 0) { captureEx.Quality = 1; } if (captureEx.CaptureCache == 1) { captureEx.CaptureCache = -1; } string xmlString = captureEx.ToXmlString(this.CalOrderId(this.WorkId, newOrderId), SimNum, captureEx.ProtocolName, (int)CommMode, "SetCapture", ref str1); num = DownData.CarCmdSend.icar_SendCmdXML(this.WorkId, newOrderId, SimNum, captureEx.ProtocolName, captureEx.TransformCode, (int)CommMode, xmlString); } else { int newOrderId = DownData.CarCmdSend.GetNewOrderId(); num = DownData.CarCmdSend.icar_SetCaptureEx(this.WorkId, newOrderId, SimNum, captureEx.IsMultiFrame, captureEx.CamerasID, captureEx.CaptureFlag, captureEx.CaptureCache, captureEx.Times, captureEx.Interval, captureEx.Quality, captureEx.Brightness, captureEx.Contrast, captureEx.Saturation, captureEx.Chroma, captureEx.CapWhenStop); } if (num == (long)0) { ReadDataFromDB.execSaveGpsLogTable(this.WorkId, DownData.CarCmdSend.OrderId, CarID, 18, "定时拍照"); } else { AlarmMsg alarmMsg = new AlarmMsg() { ClassName = "GpsPicDownData", FunctionName = "icar_SetCaptureEx" }; object[] workId = new object[] { "workid-", this.WorkId, ",simNum-", SimNum, ",OrderCode-", captureEx.OrderCode }; alarmMsg.AlarmText = string.Concat(workId); alarmMsg.Code = num.ToString(); this.log.WriteAlarm(alarmMsg); } } catch (Exception exception1) { Exception exception = exception1; ErrorMsg errorMsg = new ErrorMsg() { ClassName = "GpsPicDownData", ErrorText = "下发消息指令时发生错误!" }; this.log.WriteError(errorMsg, exception); num = (long)-1; } } return(num); }