private void M_DealTitle(string title, string id, WosSearcher tmpSearcher) { bool b = true; start: try { WosData wosData = tmpSearcher.SearchNoInit(title, randomTime); if (wosData != null) { double matchTmp = 0; string[] rdatas = wosData.getDataArray(); double.TryParse(rdatas[rdatas.Length - 1], out matchTmp); if (matchTmp >= matchOk) { try { DBConnector.OracleCon.SaveWosDataLong(wosData); } catch (Exception e) { OracleCon.SaveMatchDataError(title, id, e.Message); } try { DBConnector.OracleCon.SaveMatchData(wosData, title, id); } catch (Exception e) { OracleCon.SaveMatchDataError(title, id, e.Message); } } else { OracleCon.SaveMatchDataError(title, id, "no data match"); } } b = true; } catch (Exception e) { if (e.Message == "wos数据下载超时") { b = false; Logs.WriteLog(string.Format("{0}\r\n{1}\r\n{2}", title, e.Message, "请检查网络连接是否正常")); goto start; } b = true; OracleCon.SaveMatchDataError(title, id, e.Message); } finally { if (b) { tmpSearcher.isbusy = false; } } SetTitleIndex(id); }
/// <summary> /// 检索数据并保存到oracle库中 /// </summary> /// <param name="start"></param> /// <param name="end"></param> public void SearchDataToOracle(int start, int end) { DataTable dt_articles = OracleCon.SelectArticles(start, end); if (dt_articles.Rows.Count < 1) { SetTitleIndex(end.ToString()); return; } try { foreach (DataRow row in dt_articles.Rows) { string title = row["CITATION_TITLE"].ToString(); string id = row["INTERNAL_ID"].ToString(); int.TryParse(id, out nowIndex); if (string.IsNullOrEmpty(title)) { SetTitleIndex(id); OracleCon.SaveMatchDataError(title, id, "title is null"); continue; } if (dbSearcher.SearchOracle(title, id)) { SetTitleIndex(id); continue; } bool GetSearcher = false; WosSearcher tmpSearcher = null; while (!GetSearcher) { for (int i = 0; i < searchers.Count; i++) { if (!searchers[i].isbusy) { tmpSearcher = searchers[i]; GetSearcher = true; tmpSearcher.isbusy = true; break; } } } new DealTitle(M_DealTitle).BeginInvoke(title, id, tmpSearcher, null, null); } } catch (Exception e) { Logs.WriteLog(string.Format("{0}\r\n{1}", "SearchDataToOracle:" + nowIndex, e.Message)); return; } }