Example #1
0
 public Response icar_SelMultiPathAlarm(CmdParam.ParamType paramType_0, string string_1, string string_2, CmdParam.CommMode commMode_0, PathAlarmList pathAlarmList_0)
 {
     Response response = new Response();
     base.logMsg.FunctionName = "icar_SelMultiPathAlarm";
     base.logMsg.Msg = "发送:类型-" + paramType_0.ToString() + ",车辆-" + string_1;
     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;
     }
     if (base.isStartCommon())
     {
         foreach (Bussiness.CarInfo info in base.carInfoList)
         {
             try
             {
                 Car car = new Car();
                 int num = -1;
                 for (int i = 0; i < pathAlarmList_0.Count; i++)
                 {
                     PathAlarm alarm = (PathAlarm) pathAlarmList_0[i];
                     DataTable table = car.GetNewPathId(info.CarId, alarm.PathName, num);
                     if (table == null)
                     {
                         goto Label_035B;
                     }
                     int num3 = int.Parse(table.Rows[0][0].ToString());
                     if (-1 == num3)
                     {
                         goto Label_039A;
                     }
                     num = int.Parse(table.Rows[0][1].ToString());
                     alarm.ID = num3;
                 }
                 object pvRegions = pathAlarmList_0.pvRegions;
                 int newOrderId = SendBase.CarCmdSend.GetNewOrderId();
                 base.SaveCmdParm(newOrderId.ToString() + "|" + info.CarId.ToString() + ";");
                 string orderIDParam = response.OrderIDParam;
                 response.OrderIDParam = orderIDParam + newOrderId.ToString() + "|" + info.CarId.ToString() + ";";
                 base.userInfo.DownCommd.AddCarNewLogData(newOrderId, info.CarNum, "发送", pathAlarmList_0.OrderCode.ToString(), "等待", "", "");
                 car.InsertPathIntoGisCar(info.CarId, base.WorkId, newOrderId, pathAlarmList_0.AlarmPathDot);
                 response.ResultCode = SendBase.CarCmdSend.icar_SelMultiPathAlarm(base.WorkId, newOrderId, info.SimNum, ref pvRegions);
                 if (response.ResultCode != 0L)
                 {
                     base.alarmMsg.FunctionName = "icar_SelMultiPathAlarm";
                     base.alarmMsg.AlarmText = string.Concat(new object[] { "workid-", base.WorkId, ",simNum-", info.SimNum, ",OrderCode-", pathAlarmList_0.OrderCode });
                     base.alarmMsg.Code = response.ResultCode.ToString();
                     base.log.WriteAlarm(base.alarmMsg);
                 }
                 for (int j = 0; j < pathAlarmList_0.Count; j++)
                 {
                     PathAlarm alarm2 = (PathAlarm) pathAlarmList_0[j];
                     car.UpdatePathAlarm(info.CarId, alarm2.PathName, 1, 0, 0, alarm2.ID, "", "", 0, 0, 0);
                 }
                 response.ResultCode = 0L;
                 continue;
             Label_035B:
                 response.ErrorMsg = base.errMsg.ErrorText = string.Format("\"{0}\"获取偏移路线ID失败!", info.CarNum);
                 base.log.WriteError(base.errMsg);
                 return response;
             Label_039A:
                 response.ErrorMsg = base.errMsg.ErrorText = string.Format("\"{0}\"偏移路线ID已满,请删除部分偏移路线!", info.CarNum);
                 base.log.WriteError(base.errMsg);
                 return response;
             }
             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;
 }
Example #2
0
        public Response icar_SetMultiSegSpeedAlarm(CmdParam.ParamType paramType_0, string string_1, string string_2, CmdParam.CommMode commMode_0, PathAlarmList pathAlarmList)
        {
            Response response = new Response();
            base.logMsg.FunctionName = "icar_SetMultiSegSpeedAlarm";
            base.logMsg.Msg = "发送:类型-" + paramType_0.ToString() + ",车辆-" + string_1;
            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;
            }
            if (base.isStartCommon())
            {
                foreach (Bussiness.CarInfo info in base.carInfoList)
                {
                    try
                    {
                        Car car = new Car();
                        int num = -1;
                        for (int i = 0; i < pathAlarmList.Count; i++)
                        {
                            PathAlarm alarm = (PathAlarm) pathAlarmList[i];
                            DataTable table = car.GetNewPathId(info.CarId, alarm.PathName, num);
                            if (table == null)
                            {
                                response.ErrorMsg = base.errMsg.ErrorText = string.Format("\"{0}\"获取偏移路线ID失败!", info.CarNum);
                                base.log.WriteError(base.errMsg);
                                return response;

                            }
                            int num3 = int.Parse(table.Rows[0][0].ToString());
                            if (-1 == num3)
                            {
                                response.ErrorMsg = base.errMsg.ErrorText = string.Format("\"{0}\"偏移路线ID已满,请删除部分偏移路线!", info.CarNum);
                                base.log.WriteError(base.errMsg);
                                return response;
                            }
                            num = int.Parse(table.Rows[0][1].ToString());
                            alarm.ID = num3;
                        }
                        object pvRegions = pathAlarmList.pvRegions;
                        int newOrderId = SendBase.CarCmdSend.GetNewOrderId();
                        base.SaveCmdParm(newOrderId.ToString() + "|" + info.CarId.ToString() + ";");
                        string orderIDParam = response.OrderIDParam;
                        response.OrderIDParam = orderIDParam + newOrderId.ToString() + "|" + info.CarId.ToString() + ";";
                        if ((info.ProtocolName != SendBase.m_ProtocolName) && (pathAlarmList.protocolType == CarProtocolType.交通厅))
                        {
                            base.userInfo.DownCommd.AddCarNewLogData(newOrderId, info.CarNum, "接收", pathAlarmList.OrderCode.ToString(), "失败", "", "终端不支持该协议!");
                            base.errMsg.ErrorText = "下发消息指令时发生错误!";
                            response.ErrorMsg = base.ErrorMsg = base.errMsg.ErrorText;
                            return response;
                        }
                        base.userInfo.DownCommd.AddCarNewLogData(newOrderId, info.CarNum, "发送", pathAlarmList.OrderCode.ToString(), "等待", "", "");
                        car.InsertPathIntoGisCar(info.CarId, base.WorkId, newOrderId, pathAlarmList.AlarmPathDot);
                        if (pathAlarmList.OrderCode == CmdParam.OrderCode.设置分路段超速报警)
                        {
                            for (int j = 0; j < pathAlarmList.Count; j++)
                            {
                                PathAlarm alarm2 = (PathAlarm) pathAlarmList[j];
                                if (((alarm2.PathSegmentAlarmList != null) && (alarm2.PathSegmentAlarmList.Count != 0)) || !(info.ProtocolName == SendBase.m_ProtocolName))
                                {
                                    car.UpdateTrafficPathAlarm_tmp(base.WorkId, newOrderId, info.CarId, alarm2.PathName, 1, alarm2.Speed, alarm2.Time, alarm2.ID, (alarm2.BeginTime == null) ? "" : alarm2.BeginTime.ToString(), (alarm2.EndTime == null) ? "" : alarm2.EndTime.ToString(), alarm2.PathFlag, alarm2.DriEnough, alarm2.DriNoEnough);
                                }
                            }
                        }
                        if ((info.ProtocolName == SendBase.m_ProtocolName) && (pathAlarmList.protocolType == CarProtocolType.交通厅))
                        {
                            for (int k = 0; k < pathAlarmList.Count; k++)
                            {
                                PathAlarm alarm3 = (PathAlarm) pathAlarmList[k];
                                string conntent = "";
                                alarm3.OrderCode = pathAlarmList.OrderCode;
                                string str2 = alarm3.ToXmlString(base.CalOrderId(base.WorkId, newOrderId), info.SimNum, SendBase.m_ProtocolName, (int) commMode_0, "SetPathAlarm", ref conntent);
                                response.ResultCode = SendBase.CarCmdSend.icar_SendCmdXML(base.WorkId, newOrderId, info.SimNum, SendBase.m_ProtocolName, (int) alarm3.OrderCode, (int) commMode_0, str2);
                            }
                        }
                        else
                        {
                            if ((info.ProtocolName != SendBase.m_ProtocolName) && (pathAlarmList.protocolType == CarProtocolType.交通厅))
                            {
                                base.userInfo.DownCommd.AddCarNewLogData(newOrderId, info.CarNum, "接收", pathAlarmList.OrderCode.ToString(), "失败", "", "终端不支持该协议!");
                                response.ErrorMsg = base.ErrorMsg = base.errMsg.ErrorText;
                                response.ResultCode = 0L;
                                return response;
                            }
                            response.ResultCode = SendBase.CarCmdSend.icar_SimpleCmd(base.WorkId, newOrderId, info.SimNum, CmdParam.CmdCode.设置分段超速报警, ref pvRegions);
                        }
                        if (response.ResultCode != 0L)
                        {
                            base.alarmMsg.FunctionName = "icar_SetMultiSegSpeedAlarm";
                            base.alarmMsg.AlarmText = string.Concat(new object[] { "workid-", base.WorkId, ",simNum-", info.SimNum, ",OrderCode-", pathAlarmList.OrderCode });
                            base.alarmMsg.Code = response.ResultCode.ToString();
                            base.log.WriteAlarm(base.alarmMsg);
                        }
                        int num7 = 0;
                        while (true)
                        {
                            if (num7 >= pathAlarmList.Count)
                            {
                                break;
                            }
                            PathAlarm alarm4 = (PathAlarm) pathAlarmList[num7];
                            if ((pathAlarmList.OrderCode == CmdParam.OrderCode.设置分路段超速报警) && (pathAlarmList.protocolType == CarProtocolType.交通厅))
                            {
                                try
                                {
                                    if ((info.ProtocolName == SendBase.m_ProtocolName) && (pathAlarmList.protocolType == CarProtocolType.交通厅))
                                    {
                                        for (int m = 0; m < alarm4.PathSegmentAlarmList.Count; m++)
                                        {
                                            car.InsertTrafficSegmentParam(info.CarId, alarm4.ParentID, alarm4.PathSegmentAlarmList[m].PathSegmentID, alarm4.PathSegmentAlarmList[m].TopSpeed, alarm4.PathSegmentAlarmList[m].HoldTime, alarm4.PathSegmentAlarmList[m].DriEnough, alarm4.PathSegmentAlarmList[m].DriNoEnough, alarm4.PathSegmentAlarmList[m].Flag, alarm4.PathSegmentAlarmList[m].PathWidth);
                                        }
                                    }
                                }
                                catch (Exception exception)
                                {
                                    base.log.WriteError(base.errMsg, exception);
                                }
                            }
                            num7++;
                        }
                        response.ResultCode = 0L;
                        continue;
                    }
                    catch (Exception exception2)
                    {
                        base.errMsg.ErrorText = "下发消息指令时发生错误!";
                        response.ErrorMsg = base.ErrorMsg = base.errMsg.ErrorText;
                        base.log.WriteError(base.errMsg, exception2);
                    }
                }
                return response;
            }
            response.ErrorMsg = base.ErrorMsg;
            return response;
        }
Example #3
0
 public Response icar_SelMultiPathAlarm(CmdParam.ParamType paramType_0, string string_1, string string_2, CmdParam.CommMode commMode_0, PathAlarmList pathAlarmList_0)
 {
     Response response = new Response();
     base.WriteLog(paramType_0.ToString(), string_1);
     if (!base.CheckCar(paramType_0, string_1, string_2))
     {
         response.ErrorMsg = base.ErrorMsg;
         return response;
     }
     if (!base.isStartCommon())
     {
         response.ErrorMsg = base.ErrorMsg;
         return response;
     }
     Car car = new Car();
     int num = -1;
     int newOrderId = -1;
     DataTable table = null;
     object obj2 = null;
     PathAlarm alarm = null;
     object[] objArray = new object[4];
     foreach (Bussiness.CarInfo info in base.carInfoList)
     {
         try
         {
             int num3 = -1;
             newOrderId = SendBase.CarCmdSend.GetNewOrderId();
             base.SaveCmdParm(newOrderId.ToString() + "|" + info.CarId.ToString() + ";");
             string orderIDParam = response.OrderIDParam;
             response.OrderIDParam = orderIDParam + newOrderId.ToString() + "|" + info.CarId.ToString() + ";";
             for (int i = 0; i < pathAlarmList_0.Count; i++)
             {
                 alarm = (PathAlarm) pathAlarmList_0[i];
                 table = car.GetNewPathId(info.CarId, alarm.PathName, num3);
                 if ((table == null) || (table.Rows.Count <= 0))
                 {
                     goto Label_037E;
                 }
                 num = int.Parse(table.Rows[0][0].ToString());
                 alarm.ID = num;
                 if (-1 == num)
                 {
                     goto Label_033E;
                 }
                 num3 = int.Parse(table.Rows[0][1].ToString());
                 objArray[0] = num.ToString();
                 objArray[1] = alarm.PointCount.ToString();
                 objArray[2] = this.method_7(alarm.Points);
                 objArray[3] = alarm.PathDif;
                 obj2 = objArray;
                 base.AddUpDataLog(newOrderId, info.CarNum, RespCodeParam.GetRespName(((int) pathAlarmList_0.OrderCode) + 0x80), "");
                 car.InsertPathIdsIntoPathParam(info.CarId, base.WorkId.ToString(), newOrderId.ToString(), alarm.ID.ToString(), num.ToString());
                 if (i == (pathAlarmList_0.Count - 1))
                 {
                     object pvRegions = pathAlarmList_0.pvRegions;
                     car.InsertPathIntoGisCar(info.CarId, base.WorkId, newOrderId, pathAlarmList_0.AlarmPathDot);
                 }
                 response.ResultCode = SendBase.CarCmdSend.icar_SetCommonCmd(base.WorkId, newOrderId, info.SimNum, (CmdParam.CmdCode) pathAlarmList_0.OrderCode, ref obj2, commMode_0);
                 if ((pathAlarmList_0.Count - i) > 1)
                 {
                     Thread.Sleep(300);
                 }
                 if (response.ResultCode != 0L)
                 {
                     base.WriteError(base.WorkId.ToString(), info.SimNum, pathAlarmList_0.OrderCode.ToString());
                 }
                 car.UpdatePathAlarm(info.CarId, alarm.PathName, 1, 0, 0, alarm.ID, "", "", alarm.PathFlag, alarm.DriEnough, alarm.DriNoEnough);
             }
             continue;
         Label_033E:
             response.ErrorMsg = base.errMsg.ErrorText = string.Format("\"{0}\"偏移路线ID已满,请删除部分偏移路线!", info.CarNum);
             base.log.WriteError(base.errMsg);
             return response;
         Label_037E:
             response.ErrorMsg = base.errMsg.ErrorText = string.Format("\"{0}\"获取偏移路线ID失败!", info.CarNum);
             base.log.WriteError(base.errMsg);
             return response;
         }
         catch (Exception exception)
         {
             response.ErrorMsg = base.ErrorMsg = base.errMsg.ErrorText = "下发消息指令时发生错误!";
             base.log.WriteError(base.errMsg, exception);
         }
     }
     return response;
 }