public Response icar_SimpleCmd(CmdParam.ParamType ParamType, string CarValues, string CarPw, CmdParam.CommMode CommMode, SimpleCmd simpleCmd) { Response response = new Response(); string paramDisc = simpleCmd.GetParamDisc(); base.WriteLog(ParamType.ToString(), CarValues + paramDisc); if (!base.CheckCar(ParamType, CarValues, CarPw)) { response.ErrorMsg = base.ErrorMsg; return response; } string strErrorMsg = string.Empty; if (simpleCmd.CheckData(out strErrorMsg) != 0) { response.ErrorMsg = strErrorMsg; return response; } if (!base.isStartCommon()) { response.ErrorMsg = base.ErrorMsg; return response; } object pvArg = null; int newOrderId = -1; foreach (Bussiness.CarInfo info in base.carInfoList) { try { if (simpleCmd.OrderCode == CmdParam.OrderCode.设置车台参数) { response.ResultCode = new Car().UpdateCarconfigOnDuty(info.CarId, simpleCmd.OnDuty, simpleCmd.CloseGSM, simpleCmd.CloseDail); } newOrderId = SendBase.CarCmdSend.GetNewOrderId(); base.SaveCmdParm(newOrderId.ToString() + "|" + info.CarId.ToString() + ";"); string orderIDParam = response.OrderIDParam; response.OrderIDParam = orderIDParam + newOrderId.ToString() + "|" + info.CarId.ToString() + ";"; base.AddUpDataLog(newOrderId, info.CarNum, simpleCmd.OrderCode.ToString(), paramDisc); switch (simpleCmd.CmdCode) { case CmdParam.CmdCode.取消区域报警: new Car().InsertRegionIdsIntoGisCar(info.CarId, base.WorkId.ToString(), newOrderId.ToString(), simpleCmd.RegionIds); break; case CmdParam.CmdCode.取消路线报警: new Car().InsertPathIdsIntoGisCar(info.CarId, base.WorkId.ToString(), newOrderId.ToString(), simpleCmd.RegionIds.Trim(new char[] { '\\' }).Equals("0") ? "" : simpleCmd.RegionIds); break; case CmdParam.CmdCode.配置串口参数: if (response.ResultCode == 0L) { new Car().InsertGpsCarDeviceParam(info.CarId, base.WorkId, newOrderId, simpleCmd.Com1Device, simpleCmd.Com2Device); } break; } if (info.ProtocolName == SendBase.m_ProtocolName) { int orderID = base.CalOrderId(base.WorkId, newOrderId); string conntent = string.Empty; simpleCmd.TransformCode = CmdParam.TrafficProtocolCodeExchange2((int) simpleCmd.OrderCode); string str4 = string.Empty; if (simpleCmd.CmdCode == CmdParam.CmdCode.取消区域报警) { try { string[] strArray = simpleCmd.RegionIds.Split(@"\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); string[] strArray2 = simpleCmd.RegionTypes.Split(@"\".ToCharArray(), StringSplitOptions.RemoveEmptyEntries); if (strArray2.Length <= 0) { throw new Exception(); } List<string> list = new List<string>(); List<string> list2 = new List<string>(); for (int i = 1; i <= 3; i++) { for (int j = 0; j < strArray2.Length; j++) { if (strArray2[j].Equals(i.ToString())) { list.Add(strArray[j]); list2.Add(i.ToString()); } } if (list.Count != 0) { simpleCmd.RegionIds = string.Join(@"\", list.ToArray()); simpleCmd.RegionTypes = string.Join(@"\", list2.ToArray()); str4 = simpleCmd.ToXmlString(orderID, info.SimNum, SendBase.m_ProtocolName, (int) CommMode, "SimpleCmd", ref conntent); list.Clear(); list2.Clear(); response.ResultCode = SendBase.CarCmdSend.icar_SendCmdXML(base.WorkId, newOrderId, info.SimNum, SendBase.m_ProtocolName, simpleCmd.TransformCode, (int) CommMode, str4); } } } catch (Exception) { base.userInfo.DownCommd.AddCarNewLogData(newOrderId, info.CarNum, "发送", simpleCmd.OrderCode.ToString(), "失败", "", "终端不支持该命令"); response.ErrorMsg = "终端不支持该命令"; } } else if ((simpleCmd.OrderCode != CmdParam.OrderCode.取消出入口分段超速报警) && (simpleCmd.OrderCode != CmdParam.OrderCode.取消所有关键区域)) { if ((simpleCmd.OrderCode == CmdParam.OrderCode.取消偏移路线报警) && simpleCmd.RegionIds.Trim(new char[] { '\\' }).Equals("0")) { simpleCmd.RegionIds = ""; } str4 = simpleCmd.ToXmlString(orderID, info.SimNum, SendBase.m_ProtocolName, (int) CommMode, "SimpleCmd", ref conntent); response.ResultCode = SendBase.CarCmdSend.icar_SendCmdXML(base.WorkId, newOrderId, info.SimNum, SendBase.m_ProtocolName, simpleCmd.TransformCode, (int) CommMode, str4); } else { TrafficRawPackage package = new TrafficRawPackage { OrderCode = CmdParam.OrderCode.命令透传, SubOrderCode = simpleCmd.OrderCode, strText = "" }; str4 = package.ToXmlString(base.CalOrderId(base.WorkId, newOrderId), info.SimNum, SendBase.m_ProtocolName, -1, "SendRawPackage", ref conntent); response.ResultCode = SendBase.CarCmdSend.icar_SendCmdXML(base.WorkId, newOrderId, info.SimNum, SendBase.m_ProtocolName, (int) package.OrderCode, -1, str4); } } else { pvArg = simpleCmd.pvArg; response.ResultCode = SendBase.CarCmdSend.icar_SimpleCmd(base.WorkId, newOrderId, info.SimNum, simpleCmd.CmdCode, ref pvArg); } if (response.ResultCode != 0L) { base.WriteError(base.WorkId.ToString(), info.SimNum, simpleCmd.OrderCode.ToString()); } response.ResultCode = 0L; } catch (Exception exception) { response.ErrorMsg = "下发消息指令时发生错误,错误详细信息:" + exception.Message; } } return response; }
public AppRespone icar_SendRawPackage(AppRequest appRequest_0, object object_0) { AppRespone respone = new AppRespone(); base.logMsg.FunctionName = "icar_SendRawPackage"; base.logMsg.Msg = "发送:类型-" + appRequest_0.ParamType.ToString() + ",车辆-" + appRequest_0.CarValues; string str = string.Empty; base.log.WriteLog(base.logMsg); if (!base.CheckCar(appRequest_0.ParamType, appRequest_0.CarValues, appRequest_0.CarPw)) { respone.ResultMsg = base.alarmMsg.AlarmText = base.ErrorMsg; base.log.WriteAlarm(base.alarmMsg); } if (!base.isStartCommon()) { respone.ResultMsg = base.ErrorMsg; return respone; } long num = -1L; foreach (Bussiness.CarInfo info in base.carInfoList) { try { int newOrderId = SendBase.CarCmdSend.GetNewOrderId(); base.SaveCmdParm(newOrderId.ToString() + "|" + info.CarId.ToString() + ";"); base.userInfo.DownCommd.AddCarNewLogData(newOrderId, info.CarNum, "发送", appRequest_0.OrderCode.ToString(), "等待", "", str); if (info.ProtocolName == SendBase.m_ProtocolName) { TrafficRawPackage package = new TrafficRawPackage { OrderCode = CmdParam.OrderCode.命令透传, SubOrderCode = appRequest_0.OrderCode }; StringBuilder builder = new StringBuilder(); byte[] buffer = (byte[]) object_0; if (buffer != null) { for (int i = 0; i < buffer.Length; i++) { builder.Append(buffer[i].ToString("X2")); } } package.strText = builder.ToString(); string conntent = ""; string str3 = package.ToXmlString(base.CalOrderId(base.WorkId, newOrderId), info.SimNum, SendBase.m_ProtocolName, -1, "SendRawPackage", ref conntent); num = SendBase.CarCmdSend.icar_SendCmdXML(base.WorkId, newOrderId, info.SimNum, SendBase.m_ProtocolName, (int) package.OrderCode, -1, str3); } else { num = SendBase.CarCmdSend.icar_SendRawPackage(base.WorkId, newOrderId, info.SimNum, appRequest_0.CmdCode, ref object_0, appRequest_0.CommMode); } if (num != 0L) { base.alarmMsg.FunctionName = "icar_SendRawPackage"; base.alarmMsg.AlarmText = string.Concat(new object[] { "workid-", base.WorkId, ",simNum-", info.SimNum, ",OrderCode-", appRequest_0.OrderCode }); base.alarmMsg.Code = respone.ResultCode.ToString(); base.log.WriteAlarm(base.alarmMsg); } } catch (Exception exception) { respone.ResultMsg = base.ErrorMsg = base.errMsg.ErrorText = "下发消息指令时发生错误!"; respone.ResultCode = -1; base.log.WriteError(base.errMsg, exception); } } return respone; }
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 static Response DownData_icar_SendRawPackage(CmdParam.ParamType ParamType, string CarValues, string CarPw, CmdParam.CommMode CommMode, TrafficRawPackage trafficRawPackage) { Response response; if (RemotingClient.app == null) { return RemotingClient.reResult; } try { response = RemotingClient.app.icar_SendRawPackage(ParamType, CarValues, CarPw, CommMode, trafficRawPackage); } catch (Exception exception) { Record.execFileRecord("交通部透传协议", exception.Message); response = RemotingClient.reResult; } return response; }
public Response icar_SendRawPackage(CmdParam.ParamType paramType_0, string string_1, string string_2, CmdParam.CommMode commMode_0, TrafficRawPackage trafficRawPackage_0) { Response response = new Response(); base.logMsg.FunctionName = "icar_SendRawPackage"; base.logMsg.Msg = "发送:类型-" + paramType_0.ToString() + ",车辆-" + string_1 + ",指令-" + trafficRawPackage_0.OrderCode.ToString() + ",参数-" + trafficRawPackage_0.strText; string msg = base.logMsg.Msg; base.log.WriteLog(base.logMsg); if (!base.CheckCar(paramType_0, string_1, string_2)) { response.ErrorMsg = base.ErrorMsg; return response; } if (!base.isStartCommon()) { response.ErrorMsg = base.ErrorMsg; return response; } new Car(); foreach (Bussiness.CarInfo info in base.carInfoList) { try { int newOrderId = SendBase.CarCmdSend.GetNewOrderId(); if (info.ProtocolName == SendBase.m_ProtocolName) { base.SaveCmdParm(newOrderId.ToString() + "|" + info.CarId.ToString() + ";"); base.userInfo.DownCommd.AddCarNewLogData(newOrderId, info.CarNum, "发送", trafficRawPackage_0.SubOrderCode.ToString(), "等待", "", msg); string conntent = ""; string str3 = trafficRawPackage_0.ToXmlString(base.CalOrderId(base.WorkId, newOrderId), info.SimNum, SendBase.m_ProtocolName, (int) commMode_0, "SendRawPackage", ref conntent); response.ResultCode = SendBase.CarCmdSend.icar_SendCmdXML(base.WorkId, newOrderId, info.SimNum, SendBase.m_ProtocolName, (int) trafficRawPackage_0.OrderCode, (int) commMode_0, str3); if ((response.ResultCode == 0L) && (trafficRawPackage_0.SubOrderCode == CmdParam.OrderCode.获得当前车台温度)) { base.userInfo.CarFilter.UpdatePosSearchFlag(trafficRawPackage_0.SubOrderCode.ToString(), newOrderId, info.CarId); } } else if (trafficRawPackage_0.SubOrderCode == CmdParam.OrderCode.设置禁驾报警) { base.SaveCmdParm(newOrderId.ToString() + "|" + info.CarId.ToString() + ";"); base.userInfo.DownCommd.AddCarNewLogData(newOrderId, info.CarNum, "发送", trafficRawPackage_0.SubOrderCode.ToString(), "等待", "", msg); object pvArg = trafficRawPackage_0.pvArg; response.ResultCode = SendBase.CarCmdSend.icar_SendRawPackage(base.WorkId, newOrderId, info.SimNum, trafficRawPackage_0.CmdCode, ref pvArg, commMode_0); } else if (trafficRawPackage_0.SubOrderCode == CmdParam.OrderCode.获得当前车台温度) { base.SaveCmdParm(newOrderId.ToString() + "|" + info.CarId.ToString() + ";"); base.userInfo.DownCommd.AddCarNewLogData(newOrderId, info.CarNum, "发送", trafficRawPackage_0.SubOrderCode.ToString(), "等待", "", msg); object obj3 = 0; response.ResultCode = SendBase.CarCmdSend.icar_SimpleCmd(base.WorkId, newOrderId, info.SimNum, trafficRawPackage_0.CmdCode, ref obj3); } else if (trafficRawPackage_0.SubOrderCode == CmdParam.OrderCode.设置温度报警) { base.SaveCmdParm(newOrderId.ToString() + "|" + info.CarId.ToString() + ";"); base.userInfo.DownCommd.AddCarNewLogData(newOrderId, info.CarNum, "发送", trafficRawPackage_0.SubOrderCode.ToString(), "等待", "", msg); object obj4 = trafficRawPackage_0.pvArg; response.ResultCode = SendBase.CarCmdSend.icar_SimpleCmd(base.WorkId, newOrderId, info.SimNum, trafficRawPackage_0.CmdCode, ref obj4); } else { base.userInfo.DownCommd.AddCarNewLogData(newOrderId, info.CarNum, "发送", trafficRawPackage_0.SubOrderCode.ToString(), "失败", "", "错误描述:该车辆终端不支持此操作。"); response.ErrorMsg = "终端不支持该协议"; } } catch (Exception exception) { response.ErrorMsg = exception.Message; return response; } } return response; }
public Response icar_SendRawPackage(CmdParam.ParamType paramType_0, string string_1, string string_2, CmdParam.CommMode commMode_0, SimpleCmd simpleCmd_0) { Response response = new Response(); string str = ""; foreach (string[] strArray in simpleCmd_0.CmdParams) { string str8 = str; str = str8 + "命令码-" + simpleCmd_0.OrderCode.ToString() + ",参数-" + this.method_5(strArray, 0) + ";"; } base.WriteLog(paramType_0.ToString(), string_1 + "," + str); if (!base.CheckCar(paramType_0, string_1, string_2)) { response.ErrorMsg = base.ErrorMsg; return response; } if (!base.isStartCommon()) { response.ErrorMsg = base.ErrorMsg; return response; } if ((simpleCmd_0.CmdParams != null) && (simpleCmd_0.CmdParams.Count > 0)) { int newOrderId = -1; object objectArg = null; byte[] bytes = null; foreach (Bussiness.CarInfo info in base.carInfoList) { try { foreach (string[] strArray2 in simpleCmd_0.CmdParams) { newOrderId = SendBase.CarCmdSend.GetNewOrderId(); base.SaveCmdParm(newOrderId.ToString() + "|" + info.CarId.ToString() + ";"); string orderIDParam = response.OrderIDParam; response.OrderIDParam = orderIDParam + newOrderId.ToString() + "|" + info.CarId.ToString() + ";"; base.AddUpDataLog(newOrderId, info.CarNum, simpleCmd_0.OrderCode.ToString(), this.method_5(strArray2, (int) simpleCmd_0.OrderCode)); if (simpleCmd_0.OrderCode == CmdParam.OrderCode.回拔坐席电话指令) { bytes = Encoding.GetEncoding("gb2312").GetBytes(strArray2[0]); byte[] array = new byte[15]; bytes.CopyTo(array, 0); objectArg = array; } if (simpleCmd_0.OrderCode == CmdParam.OrderCode.设置油耗仪参数) { objectArg = new Oix().GetObjectArg(strArray2); } if (simpleCmd_0.OrderCode == CmdParam.OrderCode.设置出入口分段超速报警) { Car car = new Car(); string[] strArray3 = simpleCmd_0.CmdParams[0] as string[]; Hashtable hashtable = new Hashtable(); for (int i = 0; i < (strArray3.Length / 8); i++) { if (!hashtable.Contains(strArray3[i * 8])) { car.Car_AddPassWayPathIdToTmp(info.CarId, base.WorkId, newOrderId, strArray3[i * 8], strArray3[(i * 8) + 1], (Convert.ToDouble(strArray3[(i * 8) + 6]) > 0.0) ? ((int) Convert.ToDouble(strArray3[(i * 8) + 6])) : ((int) Convert.ToDouble(strArray3[(i * 8) + 7]))); hashtable[strArray3[i * 8]] = null; } } objectArg = simpleCmd_0.pvArg; } if (info.ProtocolName == SendBase.m_ProtocolName) { if (simpleCmd_0.OrderCode == CmdParam.OrderCode.设置关键区域) { TrafficRawPackage package = new TrafficRawPackage { OrderCode = CmdParam.OrderCode.命令透传, SubOrderCode = simpleCmd_0.OrderCode }; Car car2 = new Car(); StringBuilder builder = new StringBuilder(); builder.Append((strArray2.Length / 8).ToString("X4")); for (int j = 0; j < strArray2.Length; j += 8) { builder.Append(Convert.ToInt32(strArray2[j]).ToString("X8")); builder.Append(Convert.ToByte(strArray2[j + 1]).ToString("X2")); builder.Append(((int) (Convert.ToDouble(strArray2[j + 2]) * 1000000.0)).ToString("X8")); builder.Append(((int) (Convert.ToDouble(strArray2[j + 3]) * 1000000.0)).ToString("X8")); if (string.IsNullOrEmpty(strArray2[j + 5])) { builder.Append(Convert.ToInt32(strArray2[j + 4]).ToString("X8")); builder.Append("00000000"); } else { builder.Append(((int) (Convert.ToDouble(strArray2[j + 4]) * 1000000.0)).ToString("X8")); builder.Append(((int) (Convert.ToDouble(strArray2[j + 5]) * 1000000.0)).ToString("X8")); } builder.Append(Convert.ToByte(strArray2[j + 6]).ToString("X2")); builder.Append(Convert.ToInt32(strArray2[j + 7]).ToString("X8")); if (car2.SetCriticalRegionToTmp(info.CarId, base.WorkId, newOrderId, strArray2[j], strArray2[j + 6], strArray2[j + 7]) != 0) { base.WriteError(base.WorkId.ToString(), info.SimNum, simpleCmd_0.OrderCode.ToString() + "-参数保存失败-" + strArray2[j] + "," + strArray2[j + 6] + "," + strArray2[j + 7]); } } package.strText = builder.ToString(); string conntent = ""; string str3 = package.ToXmlString(base.CalOrderId(base.WorkId, newOrderId), info.SimNum, SendBase.m_ProtocolName, (int) commMode_0, "SendRawPackage", ref conntent); response.ResultCode = SendBase.CarCmdSend.icar_SendCmdXML(base.WorkId, newOrderId, info.SimNum, SendBase.m_ProtocolName, (int) package.OrderCode, (int) commMode_0, str3); } else if (simpleCmd_0.OrderCode == CmdParam.OrderCode.设置出入口分段超速报警) { TrafficRawPackage package2 = new TrafficRawPackage { OrderCode = CmdParam.OrderCode.命令透传, SubOrderCode = simpleCmd_0.OrderCode }; StringBuilder builder2 = new StringBuilder(); byte[] pvArg = (byte[]) simpleCmd_0.pvArg; if (pvArg != null) { for (int k = 0; k < pvArg.Length; k++) { if (((k + 1) % 0x16) == 1) { byte[] buffer4 = new byte[4]; for (int m = 0; m < 4; m++) { buffer4[m] = pvArg[k + m]; } k += 3; builder2.Append(BitConverter.ToInt32(buffer4, 0).ToString("X8")); } else { builder2.Append(pvArg[k].ToString("X2")); } } } package2.strText = builder2.ToString(); string str4 = ""; string str5 = package2.ToXmlString(base.CalOrderId(base.WorkId, newOrderId), info.SimNum, SendBase.m_ProtocolName, (int) commMode_0, "SendRawPackage", ref str4); response.ResultCode = SendBase.CarCmdSend.icar_SendCmdXML(base.WorkId, newOrderId, info.SimNum, SendBase.m_ProtocolName, (int) package2.OrderCode, (int) commMode_0, str5); } else { string str6 = ""; string str7 = simpleCmd_0.ToXmlString(base.CalOrderId(base.WorkId, newOrderId), info.SimNum, SendBase.m_ProtocolName, (int) commMode_0, "SimpleCmd", ref str6); response.ResultCode = SendBase.CarCmdSend.icar_SendCmdXML(base.WorkId, newOrderId, info.SimNum, SendBase.m_ProtocolName, (int) simpleCmd_0.OrderCode, (int) commMode_0, str7); } } else { response.ResultCode = SendBase.CarCmdSend.icar_SendRawPackage(base.WorkId, newOrderId, info.SimNum, simpleCmd_0.CmdCode, ref objectArg, commMode_0); } if (response.ResultCode != 0L) { base.WriteError(base.WorkId.ToString(), info.SimNum, simpleCmd_0.OrderCode.ToString()); } } } catch (Exception exception) { response.ErrorMsg = "下发消息指令时发生错误,错误详细信息:" + exception.Message; base.log.WriteError(base.errMsg, exception); } } return response; } response.ResultCode = -1L; response.ErrorMsg = "下发参数为空!"; return response; }
public Response icar_SendRawPackage(CmdParam.ParamType ParamType, string CarValues, string CarPw, CmdParam.CommMode CommMode, TrafficRawPackage trafficRawPackage) { try { return this.myDownDataYD.icar_SendRawPackage(ParamType, CarValues, CarPw, CommMode, trafficRawPackage); } catch (Exception exception) { this.m_LogHelper.WriteError(new ErrorMsg("RemotingServer", "icar_SendRawPackage", exception.ToString())); return new Response(); } }