private List <ObjDetailInfo> GetDetailResults(List <string> ids) { MyLog4Net.Container.Instance.Log.DebugWithDebugView("CommProtocol start GetDetailResults"); StringBuilder sb = new StringBuilder(); sb.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); sb.AppendLine("<root>"); sb.AppendLine("<Version>1.0.0.1</Version>");//<!-- 版本号,用于版本号校验 --> sb.AppendLine("<ObjNum>" + ids.Count + "</ObjNum>"); sb.AppendLine("<ObjKeyList>"); foreach (var item in ids) { sb.AppendLine("<ObjKey>" + item + "</ObjKey>"); } sb.AppendLine("</ObjKeyList>"); StringBuilder temp = new StringBuilder(); foreach (var item in detailfileds) { temp.Append(item + ","); } sb.AppendLine("<ResultFileds>" + temp.ToString().TrimEnd(',') + "</ResultFileds>");//<!-- 目标详情字段 --> sb.AppendLine("</root>"); string message = sb.ToString(); string rsp = Send("OBJ_DETAIL_INFO_GET_REQ", message); if (string.IsNullOrEmpty(rsp)) { MyLog4Net.Container.Instance.Log.DebugWithDebugView(string.Format("CommServices GetDetailResults ret IsNullOrEmpty")); return(new List <ObjDetailInfo>()); } System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument(); xdoc.LoadXml(rsp); List <ObjDetailInfo> retval = new List <ObjDetailInfo>(); var nodelist = xdoc.SelectNodes("//root/Body/ObjDetailInfoList/ObjDetailInfo"); foreach (System.Xml.XmlNode node in nodelist) { ObjDetailInfo de = AppUtil.Common.XMLSerilize.DeserilizeObject <ObjDetailInfo>(node.OuterXml); retval.Add(de); } MyLog4Net.Container.Instance.Log.DebugWithDebugView(string.Format("CommServices GetDetailResults retval Count:{0}", retval.Count)); return(retval); }
public List <ObjDetailInfo> CompareSearch(Parameters searchparam, out long TotalCount) { MyLog4Net.Container.Instance.Log.DebugWithDebugView("CommProtocol start CompareSearch"); TotalCount = 0; StringBuilder sb = new StringBuilder(); sb.AppendLine("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>"); sb.AppendLine("<root>"); sb.AppendLine("<Version>1.0.0.1</Version>"); //<!-- 版本号,用于版本号校验 --> sb.AppendLine("<DeviceID>" + searchparam.DeviceID + "</DeviceID>"); sb.AppendLine("<StartTime>" + searchparam.StartTime.ToString("yyyy-MM-dd HH:mm:ss.fff") + "</StartTime>"); //<!-- 检索开始时间 --> sb.AppendLine("<EndTime>" + searchparam.EndTime.ToString("yyyy-MM-dd HH:mm:ss.fff") + "</EndTime>"); //<!-- 检索结束时间 --> sb.AppendLine("<Similar>" + searchparam.Similar.ToString() + "</Similar>"); string ResultNumRange = ""; searchparam.ResultNumRange.ForEach(item => ResultNumRange += item + ","); ResultNumRange = ResultNumRange.TrimEnd(','); sb.AppendLine("<ResultNumRange>" + ResultNumRange + "</ResultNumRange>"); sb.AppendLine("<Devicetype>" + searchparam.Devicetype + "</Devicetype>"); sb.AppendLine("<AlgorithmFilterType>" + searchparam.AlgorithmFilterType + "</AlgorithmFilterType>"); //sb.AppendLine("<ObjType>" + searchparam.ObjType + "</ObjType>"); //string UpBodyColor = ""; //searchparam.UpBodyColor.ForEach(item => { if (item > 0) UpBodyColor += item + ","; }); //UpBodyColor = UpBodyColor.TrimEnd(','); //sb.AppendLine("<UpBodyColor>" + UpBodyColor + "</UpBodyColor>"); //string DownBodyColor = ""; //searchparam.DownBodyColor.ForEach(item => { if (item > 0)DownBodyColor += item + ","; }); //DownBodyColor = DownBodyColor.TrimEnd(','); //sb.AppendLine("<DownBodyColor>" + DownBodyColor + "</DownBodyColor>"); string GlobRect = string.Format("{0},{1},{2},{3}", searchparam.GlobRect.X, searchparam.GlobRect.Y, searchparam.GlobRect.Width, searchparam.GlobRect.Height); sb.AppendLine("<GlobRect>" + GlobRect + "</GlobRect>"); string PartRect = string.Format("{0},{1},{2},{3}", searchparam.PartRect.X, searchparam.PartRect.Y, searchparam.PartRect.Width, searchparam.PartRect.Height); sb.AppendLine("<PartRect>" + PartRect + "</PartRect>"); sb.AppendLine("<PlateNo>" + searchparam.PlateNo + "</PlateNo>"); //string CarColorNos = ""; //searchparam.CarColorNos.ForEach(item =>{ if (item > 0) CarColorNos += item + ","; }); //CarColorNos = CarColorNos.TrimEnd(','); //sb.AppendLine("<CarColorNos>" + CarColorNos + "</CarColorNos>"); //string PlateColorNos = ""; //searchparam.PlateColorNos.ForEach(item =>{ if (item > 0) PlateColorNos += item + ","; }); //PlateColorNos = PlateColorNos.TrimEnd(','); //sb.AppendLine("<PlateColorNos>" + PlateColorNos + "</PlateColorNos>"); //string CarTypeNos = ""; //searchparam.CarTypeNos.ForEach(item => { if (item > 0)CarTypeNos += item + ","; }); //CarTypeNos = CarTypeNos.TrimEnd(','); //sb.AppendLine("<CarTypeNos>" + CarTypeNos + "</CarTypeNos>"); //string CarTypeDetailNos = ""; //searchparam.CarTypeDetailNos.ForEach(item =>{ if (item > 0) CarTypeDetailNos += item + ","; }); //CarTypeDetailNos = CarTypeDetailNos.TrimEnd(','); //sb.AppendLine("<CarTypeDetailNos>" + CarTypeDetailNos + "</CarTypeDetailNos>"); //string CarLabelNos = ""; //searchparam.CarLabelNos.ForEach(item =>{ if (item > 0) CarLabelNos += item + ","; }); //CarLabelNos = CarLabelNos.TrimEnd(','); //sb.AppendLine("<CarLabelNos>" + CarLabelNos + "</CarLabelNos>"); //string CarLabelDetailNos = ""; //searchparam.CarLabelDetailNos.ForEach(item => { if (item > 0)CarLabelDetailNos += item + ","; }); //CarLabelDetailNos = CarLabelDetailNos.TrimEnd(','); //sb.AppendLine("<CarLabelDetailNos>" + CarLabelDetailNos + "</CarLabelDetailNos>"); //string PlateNumRows = ""; //searchparam.PlateNumRows.ForEach(item => { if (item > 0)PlateNumRows += item + ","; }); //PlateNumRows = PlateNumRows.TrimEnd(','); //sb.AppendLine("<PlateNumRows>" + PlateNumRows + "</PlateNumRows>"); //sb.AppendLine("<DriverIsPhoneing>"+(searchparam.DriverIsPhoneing>=0?searchparam.DriverIsPhoneing.ToString():"")+"</DriverIsPhoneing>"); //sb.AppendLine("<DriverIsSafebelt>" + (searchparam.DriverIsSafebelt >= 0 ? searchparam.DriverIsSafebelt.ToString() : "") + "</DriverIsSafebelt>"); //sb.AppendLine("<PassengerIsSafebelt>" + (searchparam.PassengerIsSafebelt >= 0 ? searchparam.PassengerIsSafebelt.ToString() : "") + "</PassengerIsSafebelt>"); //sb.AppendLine("<DriverIsSunVisor>" + (searchparam.DriverIsSunVisor >= 0 ? searchparam.DriverIsSunVisor.ToString() : "") + "</DriverIsSunVisor>"); //sb.AppendLine("<PassengerIsSunVisor>" + (searchparam.PassengerIsSunVisor >= 0 ? searchparam.PassengerIsSunVisor.ToString() : "") + "</PassengerIsSunVisor>"); StringBuilder temp = new StringBuilder(); foreach (var item in detailfileds) { temp.Append(item + ","); } sb.AppendLine("<ResultFileds>" + temp.ToString().TrimEnd(',') + "</ResultFileds>");//<!-- 目标详情字段 --> sb.AppendLine("<PictureData>" + searchparam.PictureData + "</PictureData>"); sb.AppendLine("<PlateNoWeight>" + searchparam.PlateNoWeight + "</PlateNoWeight>"); sb.AppendLine("</root>"); string message = sb.ToString(); string rsp = Send("COMBINE_SEARCH_REQ", message); if (string.IsNullOrEmpty(rsp)) { MyLog4Net.Container.Instance.Log.DebugWithDebugView(string.Format("CommServices CompareSearch ret IsNullOrEmpty")); return(new List <ObjDetailInfo>()); } System.Xml.XmlDocument xdoc = new System.Xml.XmlDocument(); xdoc.LoadXml(rsp); var TotalObjNum = xdoc.SelectSingleNode("//root/Body/TotalObjNum"); TotalCount = Convert.ToInt64(TotalObjNum.InnerText); List <ObjDetailInfo> retval = new List <ObjDetailInfo>(); var nodelist = xdoc.SelectNodes("//root/Body/ObjDetailInfoList/ObjDetailInfo"); foreach (System.Xml.XmlNode node in nodelist) { ObjDetailInfo de = AppUtil.Common.XMLSerilize.DeserilizeObject <ObjDetailInfo>(node.OuterXml); retval.Add(de); } MyLog4Net.Container.Instance.Log.DebugWithDebugView(string.Format("CommServices CompareSearch retval TotalMatch:{1}, Count:{0}", retval.Count, TotalCount)); return(retval); }