예제 #1
0
 public GpsResponse iSetPathAlarm(int ParamType, string sCarValue, string sPw, string[] PathList)
 {
     GpsResponse response = new GpsResponse(-1L);
     try
     {
         PathAlarmList pathAlarmList = new PathAlarmList();
         if (PathList.Length <= 0)
         {
             response.ErrorMsg = "没有选择预设路线!";
             Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg);
             return response;
         }
         StringBuilder builder = new StringBuilder();
         foreach (string str in PathList)
         {
             builder.Append(str + ",");
         }
         DataTable table = RemotingClient.Car_GetPathRouteByPathName(builder.ToString().Trim(new char[] { ',' }));
         if ((table == null) || (table.Rows.Count <= 0))
         {
             response.ErrorMsg = "没有读取到偏移路线数据,请重新设置";
             Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg);
             return response;
         }
         foreach (DataRow row in table.Rows)
         {
             PathAlarm alarm = new PathAlarm();
             ArrayList list2 = new ArrayList();
             string str2 = row["PathName"] as string;
             string str3 = row["alarmPathDot"] as string;
             if (string.IsNullOrEmpty(str3))
             {
                 response.ErrorMsg = "解析行驶线路失败!";
                 Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg);
                 return response;
             }
             string[] strArray = str3.Split(new char[] { '/' });
             alarm.PointCount = strArray.Length;
             for (int i = 0; i < (strArray.Length - 1); i++)
             {
                 if (string.IsNullOrEmpty(strArray[i]))
                 {
                     response.ErrorMsg = "解析行驶线路失败!";
                     Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg);
                     return response;
                 }
                 string[] strArray2 = strArray[i].Split(new char[] { '*' });
                 if (strArray2.Length != 2)
                 {
                     response.ErrorMsg = "解析行驶线路失败!";
                     Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg);
                     return response;
                 }
                 Point point = new Point {
                     Longitude = double.Parse(strArray2[0]),
                     Latitude = double.Parse(strArray2[1])
                 };
                 list2.Add(point);
             }
             alarm.Points = list2;
             alarm.PathName = str2;
             pathAlarmList.Add(alarm);
         }
         if ((pathAlarmList == null) || (pathAlarmList.Count < 0))
         {
             response.ErrorMsg = "路线信息集合为空!";
             Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg);
             return response;
         }
         pathAlarmList.OrderCode = CmdParam.OrderCode.设置偏移路线报警;
         Response result = RemotingClient.DownData_SelMultiPathAlarm((CmdParam.ParamType) ParamType, sCarValue, sPw, CmdParam.CommMode.未知方式, pathAlarmList);
         return this.execToResponse(result);
     }
     catch (Exception exception)
     {
         Record.execFileRecord("插件操作->设置偏移路线报警", exception.Message);
         response.ErrorMsg = exception.Message;
         return response;
     }
 }
예제 #2
0
 public GpsResponse iSetRegionAlarm(int ParamType, string sCarValue, string sPw, ArrayList RegionList)
 {
     GpsResponse response = new GpsResponse(-1L);
     try
     {
         int num = 0;
         string str = "";
         int num2 = 0;
         string str2 = "";
         RegionAlarmList regionAlarmList = new RegionAlarmList();
         string[] strArray = RegionList[0] as string[];
         string[] strArray2 = RegionList[1] as string[];
         int iRegionFeature = 0;
         string str3 = MainForm.myCarList.execChangeCarValue(ParamType, 1, sCarValue);
         if (string.IsNullOrEmpty(str3))
         {
             response.ErrorMsg = string.Format("目标车辆:{0}不存在", sCarValue);
             Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg);
             return response;
         }
         DataTable table = RemotingClient.Car_GetRegionInfo(str3, iRegionFeature);
         for (int i = 0; i < strArray.Length; i++)
         {
             int num5 = int.Parse(strArray2[i]);
             if (num5 >= 0)
             {
                 ArrayList list2 = new ArrayList();
                 RegionAlarm alarm = new RegionAlarm();
                 num2 = int.Parse(strArray[i]);
                 DataView view = new DataView(table, string.Format("RegionId='{0}'", num2), "", DataViewRowState.CurrentRows);
                 if (view.Count <= 0)
                 {
                     response.ErrorMsg = string.Format("下发区域不存在!", new object[0]);
                     Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg);
                     return response;
                 }
                 str = view[0]["regionName"].ToString();
                 alarm.newRegionId = num2;
                 alarm.PathName = str;
                 alarm.RegionType = num5;
                 alarm.RegionID = num2;
                 str2 = view[0]["regionDot"].ToString();
                 alarm.AlarmRegionDot = num5 + @"\" + str2.Replace("*", @"\").Trim(new char[] { '\\' });
                 string[] strArray3 = str2.Split(new char[] { '*' });
                 num += strArray3.Length;
                 for (int j = 0; j < (strArray3.Length - 1); j++)
                 {
                     if (string.IsNullOrEmpty(strArray3[j]))
                     {
                         response.ErrorMsg = "解析区域失败!";
                         Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg);
                         return response;
                     }
                     string[] strArray4 = strArray3[j].Split(new char[] { '\\' });
                     if (strArray4.Length < 2)
                     {
                         response.ErrorMsg = "解析区域失败!";
                         Record.execFileRecord("插件操作->设置区域报警", response.ErrorMsg);
                         return response;
                     }
                     Point point = new Point {
                         Longitude = double.Parse(strArray4[0]),
                         Latitude = double.Parse(strArray4[1])
                     };
                     list2.Add(point);
                     alarm.Points = list2;
                 }
                 regionAlarmList.Add(alarm);
             }
         }
         regionAlarmList.RegionFeature = iRegionFeature;
         regionAlarmList.OrderCode = CmdParam.OrderCode.设置区域报警;
         Response result = RemotingClient.DownData_SetRegionAlarm_FJYD((CmdParam.ParamType) ParamType, sCarValue, sPw, CmdParam.CommMode.未知方式, regionAlarmList);
         return this.execToResponse(result);
     }
     catch (Exception exception)
     {
         Record.execFileRecord("插件操作->设置区域报警", exception.Message);
         response.ErrorMsg = exception.Message;
         return response;
     }
 }
예제 #3
0
 public GpsResponse iSetCarChecked(string sCarId, bool bAdd)
 {
     GpsResponse response = new GpsResponse(-1L);
     try
     {
         string sCarNum = MainForm.myCarList.execChangeCarValue(1, 0, sCarId);
         int num = MainForm.myCarList.setCarChecked(sCarNum, true);
         if (num != 0)
         {
             response.ResultCode = num;
             response.ErrorMsg = "更新监控参数失败!";
             return response;
         }
         return new GpsResponse(0L);
     }
     catch (Exception exception)
     {
         Record.execFileRecord("插件操作->设置需要监控的车台终端", exception.Message);
         response.ErrorMsg = exception.Message;
         return response;
     }
 }