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 Response icar_SendTxtMsg(CmdParam.ParamType paramType_0, string string_1, string string_2, CmdParam.CommMode commMode_0, TxtMsg txtMsg_0) { Response response = new Response(); base.logMsg.FunctionName = "icar_SendTxtMsg"; base.logMsg.Msg = "发送:类型-" + paramType_0.ToString() + ",车辆-" + string_1 + ",指令-" + txtMsg_0.OrderCode.ToString(); string str = "信息-" + txtMsg_0.strMsg + ",信息类型-" + txtMsg_0.MsgType.ToString(); base.logMsg.Msg = base.logMsg.Msg + "," + str; base.log.WriteLog(base.logMsg); if (!base.CheckCar(paramType_0, string_1, string_2)) { response.ErrorMsg = base.alarmMsg.AlarmText = base.ErrorMsg; base.log.WriteAlarm(base.alarmMsg); return response; } string strErrorMsg = string.Empty; if (txtMsg_0.CheckData(out strErrorMsg) != 0) { response.ErrorMsg = strErrorMsg; return response; } if (base.isStartCommon()) { string str3 = null; foreach (Bussiness.CarInfo info in base.carInfoList) { try { int newOrderId = SendBase.CarCmdSend.GetNewOrderId(); switch (((int) txtMsg_0.MsgType)) { case 240: case 0xf1: case 0xf2: case 0xf3: str3 = txtMsg_0.MsgType.ToString(); break; } base.SaveCommandParameterToGpsLogTable(newOrderId.ToString() + "|" + info.CarId.ToString() + ";", str3); string orderIDParam = response.OrderIDParam; response.OrderIDParam = orderIDParam + newOrderId.ToString() + "|" + info.CarId.ToString() + ";"; base.userInfo.DownCommd.AddCarNewLogData(newOrderId, info.CarNum, "发送", txtMsg_0.OrderCode.ToString(), "等待", "", str); if (info.ProtocolName == SendBase.m_ProtocolName) { txtMsg_0.TransformCode = CmdParam.TrafficProtocolCodeExchange((int) txtMsg_0.MsgType); string conntent = ""; string str5 = txtMsg_0.ToXmlString(base.CalOrderId(base.WorkId, newOrderId), info.SimNum, SendBase.m_ProtocolName, (int) commMode_0, "SimpleCmd", ref conntent); response.ResultCode = SendBase.CarCmdSend.icar_SendCmdXML(base.WorkId, newOrderId, info.SimNum, SendBase.m_ProtocolName, txtMsg_0.TransformCode, (int) commMode_0, str5); } else { response.ResultCode = SendBase.CarCmdSend.icar_SendTxtMsg(base.WorkId, newOrderId, info.SimNum, txtMsg_0.MsgType, txtMsg_0.strMsg); } if (response.ResultCode != 0L) { base.alarmMsg.FunctionName = "icar_SendTxtMsg"; base.alarmMsg.AlarmText = string.Concat(new object[] { "workid-", base.WorkId, ",simNum-", info.SimNum, ",OrderCode-", txtMsg_0.OrderCode }); base.alarmMsg.Code = response.ResultCode.ToString(); base.log.WriteAlarm(base.alarmMsg); } response.ResultCode = 0L; } catch (Exception exception) { base.errMsg.ErrorText = "下发消息指令时发生错误!"; response.ErrorMsg = base.ErrorMsg = base.errMsg.ErrorText; base.log.WriteError(base.errMsg, exception); } } return response; } response.ErrorMsg = base.ErrorMsg; return response; }
public Response icar_SetTextMsg(CmdParam.ParamType paramType_0, string string_1, string string_2, CmdParam.CommMode commMode_0, TxtMsg txtMsg_0, string string_3, string string_4) { Response response = new Response(); if (string.IsNullOrEmpty(string_1)) { DataTable table = base.GetCarInfoByArea(txtMsg_0.LLon, txtMsg_0.LLat, txtMsg_0.RLon, txtMsg_0.RLat, string_3, string_4); if ((table != null) && (table.Rows.Count > 0)) { foreach (DataRow row in table.Rows) { string_1 = string_1 + row["telephone"].ToString() + ","; } string_1 = string_1.Trim(new char[] { ',' }); } if (string.IsNullOrEmpty(string_1)) { response.ErrorMsg = "没有存在下发的车辆!"; return response; } } base.logMsg.FunctionName = "icar_SetTextMsg"; base.logMsg.Msg = "发送:类型-" + paramType_0.ToString() + ",车辆-" + string_1 + ",指令-" + txtMsg_0.OrderCode.ToString(); 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, "发送", txtMsg_0.OrderCode.ToString(), "等待", "", msg); string orderIDParam = response.OrderIDParam; response.OrderIDParam = orderIDParam + newOrderId.ToString() + "|" + info.CarId.ToString() + ";"; string conntent = ""; string str3 = txtMsg_0.ToXmlString(base.CalOrderId(base.WorkId, newOrderId), info.SimNum, SendBase.m_ProtocolName, (int) commMode_0, "SetTextMsg", ref conntent); response.ResultCode = SendBase.CarCmdSend.icar_SendCmdXML(base.WorkId, newOrderId, info.SimNum, SendBase.m_ProtocolName, (int) txtMsg_0.OrderCode, (int) commMode_0, str3); } else if ((txtMsg_0.OrderCode == CmdParam.OrderCode.电召指令) && (txtMsg_0.MsgType == CmdParam.MsgType.电召信息)) { base.SaveCmdParm(newOrderId.ToString() + "|" + info.CarId.ToString() + ";"); base.userInfo.DownCommd.AddCarNewLogData(newOrderId, info.CarNum, "发送", txtMsg_0.OrderCode.ToString(), "等待", "", msg); string str4 = base.WorkId.ToString() + SendBase.CarCmdSend.GetNewOrderId().ToString(); response.SvcContext = str4; string str6 = response.OrderIDParam; response.OrderIDParam = str6 + newOrderId.ToString() + "|" + info.CarId.ToString() + ";"; object obj2 = this.method_9(info.SimNum, txtMsg_0.TelNumber, txtMsg_0.strMsg, str4, txtMsg_0.Way, txtMsg_0.LLon + "," + txtMsg_0.LLat + "," + txtMsg_0.RLon + "," + txtMsg_0.RLat); response.ResultCode = SendBase.CarCmdSend.icar_SetCommonCmd(base.WorkId, newOrderId, info.SimNum, CmdParam.CmdCode.电召指令, ref obj2, commMode_0); } else if (txtMsg_0.OrderCode == CmdParam.OrderCode.拨打电话号码) { base.SaveCmdParm(newOrderId.ToString() + "|" + info.CarId.ToString() + ";"); base.userInfo.DownCommd.AddCarNewLogData(newOrderId, info.CarNum, "发送", txtMsg_0.OrderCode.ToString(), "等待", "", msg); string str7 = response.OrderIDParam; response.OrderIDParam = str7 + newOrderId.ToString() + "|" + info.CarId.ToString() + ";"; SimpleCmd cmd = new SimpleCmd { OrderCode = CmdParam.OrderCode.抢答确认指令 }; new ArrayList(); string[] strArray = new string[] { txtMsg_0.sPhone, txtMsg_0.TelNumber, txtMsg_0.strMsg, txtMsg_0.Orderid, txtMsg_0.sCarName }; object obj3 = this.method_6(strArray); response.ResultCode = SendBase.CarCmdSend.icar_SetCommonCmd(base.WorkId, newOrderId, info.SimNum, cmd.CmdCode, ref obj3, commMode_0); } else { base.userInfo.DownCommd.AddCarNewLogData(newOrderId, info.CarNum, "发送", txtMsg_0.OrderCode.ToString(), "失败", "", "错误描述:该车辆终端不支持此操作。"); response.ErrorMsg = "终端不支持该协议"; } } catch (Exception exception) { response.ErrorMsg = exception.Message; return response; } } return response; }