// parameters: // strBrowseInfoStyle 返回的特性。cols 返回实体记录的浏览列 public LibraryServerResult GetCallNumberSearchResult( SessionInfo sessioninfo, string strArrangeGroupName, string strResultSetName, long lStart, long lCount, string strBrowseInfoStyle, string strLang, out CallNumberSearchResult[] searchresults) { string strError = ""; searchresults = null; LibraryServerResult result = new LibraryServerResult(); // int nRet = 0; long lRet = 0; if (String.IsNullOrEmpty(strArrangeGroupName) == true) { strError = "strArrangeGroupName参数值不能为空"; goto ERROR1; } if (strArrangeGroupName[0] == '!') { string strTemp = GetArrangeGroupName(strArrangeGroupName.Substring(1)); if (strTemp == null) { strError = "馆藏地点名 " + strArrangeGroupName.Substring(1) + " 没有找到对应的排架体系名"; goto ERROR1; } strArrangeGroupName = strTemp; } RmsChannel channel = sessioninfo.Channels.GetChannel(this.WsUrl); if (channel == null) { result.Value = -1; result.ErrorInfo = "get channel error"; result.ErrorCode = ErrorCode.SystemError; return result; } if (String.IsNullOrEmpty(strResultSetName) == true) strResultSetName = "default"; bool bCols = StringUtil.IsInList("cols", strBrowseInfoStyle); string strBrowseStyle = "keyid,id,key"; if (bCols == true) strBrowseStyle += ",cols,format:cfgs/browse_callnumber"; Record[] origin_searchresults = null; // lRet = channel.DoGetSearchResult( strResultSetName, lStart, lCount, strBrowseStyle, // "id", strLang, null, out origin_searchresults, out strError); if (lRet == -1) goto ERROR1; long lResultCount = lRet; searchresults = new CallNumberSearchResult[origin_searchresults.Length]; for (int i = 0; i < origin_searchresults.Length; i++) { CallNumberSearchResult item = new CallNumberSearchResult(); Record record = origin_searchresults[i]; item.ItemRecPath = record.Path; searchresults[i] = item; string strLocation = ""; item.CallNumber = BuildAccessNoKeyString(record.Keys, out strLocation); if (bCols == true && record.Cols != null) { if (record.Cols.Length > 0) item.ParentID = record.Cols[0]; if (record.Cols.Length > 1) item.Location = record.Cols[1]; if (record.Cols.Length > 2) item.Barcode = record.Cols[2]; } if (string.IsNullOrEmpty(item.Location) == true) item.Location = strLocation; // 用从keys中得来的代替。可能有大小写的差异 --- keys中都是大写 #if NO if (bCols == true) { // 继续填充其余成员 string strXml = ""; string strMetaData = ""; byte[] timestamp = null; string strOutputPath = ""; lRet = channel.GetRes(item.ItemRecPath, out strXml, out strMetaData, out timestamp, out strOutputPath, out strError); if (lRet == -1) { item.ErrorInfo = "获取记录 '" + item.ItemRecPath + "' 出错: " + strError; continue; } XmlDocument dom = new XmlDocument(); try { dom.LoadXml(strXml); } catch (Exception ex) { item.ErrorInfo = "记录 '" + item.ItemRecPath + "' XML装载到DOM时出错: " + ex.Message; continue; } /* item.CallNumber = DomUtil.GetElementText(dom.DocumentElement, "accessNo"); * */ item.ParentID = DomUtil.GetElementText(dom.DocumentElement, "parent"); item.Location = DomUtil.GetElementText(dom.DocumentElement, "location"); item.Barcode = DomUtil.GetElementText(dom.DocumentElement, "barcode"); } #endif } result.Value = lResultCount; return result; ERROR1: result.Value = -1; result.ErrorCode = ErrorCode.SystemError; result.ErrorInfo = strError; return result; }
// parameters: // strBrowseInfoStyle 返回的特性。cols 返回实体记录的浏览列 public LibraryServerResult GetCallNumberSearchResult( SessionInfo sessioninfo, string strArrangeGroupName, string strResultSetName, long lStart, long lCount, string strBrowseInfoStyle, string strLang, out CallNumberSearchResult[] searchresults) { string strError = ""; searchresults = null; LibraryServerResult result = new LibraryServerResult(); // int nRet = 0; long lRet = 0; if (String.IsNullOrEmpty(strArrangeGroupName) == true) { strError = "strArrangeGroupName参数值不能为空"; goto ERROR1; } if (strArrangeGroupName[0] == '!') { string strTemp = GetArrangeGroupName(strArrangeGroupName.Substring(1)); if (strTemp == null) { strError = "馆藏地点名 " + strArrangeGroupName.Substring(1) + " 没有找到对应的排架体系名"; goto ERROR1; } strArrangeGroupName = strTemp; } RmsChannel channel = sessioninfo.Channels.GetChannel(this.WsUrl); if (channel == null) { result.Value = -1; result.ErrorInfo = "get channel error"; result.ErrorCode = ErrorCode.SystemError; return(result); } if (String.IsNullOrEmpty(strResultSetName) == true) { strResultSetName = "default"; } bool bCols = StringUtil.IsInList("cols", strBrowseInfoStyle); string strBrowseStyle = "keyid,id,key"; if (bCols == true) { strBrowseStyle += ",cols,format:cfgs/browse_callnumber"; } Record[] origin_searchresults = null; // lRet = channel.DoGetSearchResult( strResultSetName, lStart, lCount, strBrowseStyle, // "id", strLang, null, out origin_searchresults, out strError); if (lRet == -1) { goto ERROR1; } long lResultCount = lRet; searchresults = new CallNumberSearchResult[origin_searchresults.Length]; for (int i = 0; i < origin_searchresults.Length; i++) { CallNumberSearchResult item = new CallNumberSearchResult(); Record record = origin_searchresults[i]; item.ItemRecPath = record.Path; searchresults[i] = item; string strLocation = ""; item.CallNumber = BuildAccessNoKeyString(record.Keys, out strLocation); if (bCols == true && record.Cols != null) { if (record.Cols.Length > 0) { item.ParentID = record.Cols[0]; } if (record.Cols.Length > 1) { item.Location = record.Cols[1]; } if (record.Cols.Length > 2) { item.Barcode = record.Cols[2]; } } if (string.IsNullOrEmpty(item.Location) == true) { item.Location = strLocation; // 用从keys中得来的代替。可能有大小写的差异 --- keys中都是大写 } #if NO if (bCols == true) { // 继续填充其余成员 string strXml = ""; string strMetaData = ""; byte[] timestamp = null; string strOutputPath = ""; lRet = channel.GetRes(item.ItemRecPath, out strXml, out strMetaData, out timestamp, out strOutputPath, out strError); if (lRet == -1) { item.ErrorInfo = "获取记录 '" + item.ItemRecPath + "' 出错: " + strError; continue; } XmlDocument dom = new XmlDocument(); try { dom.LoadXml(strXml); } catch (Exception ex) { item.ErrorInfo = "记录 '" + item.ItemRecPath + "' XML装载到DOM时出错: " + ex.Message; continue; } /* * item.CallNumber = DomUtil.GetElementText(dom.DocumentElement, * "accessNo"); * */ item.ParentID = DomUtil.GetElementText(dom.DocumentElement, "parent"); item.Location = DomUtil.GetElementText(dom.DocumentElement, "location"); item.Barcode = DomUtil.GetElementText(dom.DocumentElement, "barcode"); } #endif } result.Value = lResultCount; return(result); ERROR1: result.Value = -1; result.ErrorCode = ErrorCode.SystemError; result.ErrorInfo = strError; return(result); }