|
@@ -1,4 +1,6 @@
|
|
|
using System;
|
|
|
+using System.Data;
|
|
|
+using System.Dynamic;
|
|
|
using System.Linq;
|
|
|
using OpenQA.Selenium;
|
|
|
|
|
@@ -201,5 +203,139 @@ namespace wispro.sp.utility
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
+ /// <summary>
|
|
|
+ /// 获取案件处理事项记录
|
|
|
+ /// </summary>
|
|
|
+ /// <param name="caseNo"></param>
|
|
|
+ /// <param name="doItemName"></param>
|
|
|
+ /// <returns></returns>
|
|
|
+ public static dynamic GetPerformanctRecord(string caseNo,string doItemName)
|
|
|
+ {
|
|
|
+ string strFileSavePath = ConfigHelper.GetSectionValue("IPEasySetting:DownloadFileSavePath");
|
|
|
+ bool isheadless = (ConfigHelper.GetSectionValue("IPEasySetting:isHeadless") == "true");
|
|
|
+ string Account = ConfigHelper.GetSectionValue("IPEasySetting:Account");
|
|
|
+ string Password = ConfigHelper.GetSectionValue("IPEasySetting:Password");
|
|
|
+
|
|
|
+ OpenQA.Selenium.Chrome.ChromeOptions options = new OpenQA.Selenium.Chrome.ChromeOptions();
|
|
|
+
|
|
|
+
|
|
|
+ options.AddUserProfilePreference("download.default_directory", strFileSavePath);
|
|
|
+ options.AddUserProfilePreference("intl.accept_languages", "nl");
|
|
|
+ options.AddUserProfilePreference("disable-popup-blocking", "true");
|
|
|
+ options.AddUserProfilePreference("profile", new { default_content_setting_values = new { images = 2 } });
|
|
|
+
|
|
|
+ if (isheadless)
|
|
|
+ {
|
|
|
+ options.AddArgument("headless");
|
|
|
+ }
|
|
|
+
|
|
|
+ dynamic retObject = new ExpandoObject();
|
|
|
+
|
|
|
+ retObject.CaseNo = caseNo;
|
|
|
+ retObject.DoItem = doItemName;
|
|
|
+
|
|
|
+
|
|
|
+ using (IWebDriver driver = new OpenQA.Selenium.Chrome.ChromeDriver(ConfigHelper.GetSectionValue("IPEasySetting:ChormeDriverPath"), options))
|
|
|
+ {
|
|
|
+
|
|
|
+ driver.Manage().Timeouts().ImplicitWait = TimeSpan.FromSeconds(10);
|
|
|
+ driver.Manage().Timeouts().PageLoad = TimeSpan.FromSeconds(100);
|
|
|
+
|
|
|
+ //进入登录界面
|
|
|
+ driver.Navigate().GoToUrl("http://47.106.221.167/Login.aspx");
|
|
|
+
|
|
|
+ //输入用户名和密码
|
|
|
+ driver.FindElement(By.Id("txtUser")).SendKeys(Account);
|
|
|
+ driver.FindElement(By.Id("txtPwd")).SendKeys(Password);
|
|
|
+
|
|
|
+ //点击登录按钮
|
|
|
+ driver.FindElement(By.Id("btnLogin")).Click();
|
|
|
+
|
|
|
+ //关闭提示遮罩层
|
|
|
+ driver.FindElement(By.Id("jpwClose")).Click();
|
|
|
+
|
|
|
+ //点击顶部菜单栏中的案件管理菜单
|
|
|
+ driver.FindElement(By.Name("71A7CC35-F597-40E1-9FEF-BE622A3A3B63")).Click();
|
|
|
+
|
|
|
+ //点击左侧 查询 菜单
|
|
|
+ driver.FindElement(By.Name("c3266ab3-521a-4815-8aaf-7dd0bc5a76af")).Click();
|
|
|
+
|
|
|
+ //切换到自定义报表Frame
|
|
|
+ driver.SwitchTo().Frame(1);
|
|
|
+
|
|
|
+ var inputSearch = driver.FindElement(By.Id("case_volume"));
|
|
|
+ inputSearch.SendKeys(caseNo);
|
|
|
+
|
|
|
+ var btnSearch = driver.FindElement(By.Id("btn_Search"));
|
|
|
+ btnSearch.Click();
|
|
|
+
|
|
|
+ var caseLink = driver.FindElement(By.XPath($"//a[contains(text(),'{caseNo}')]"));
|
|
|
+ caseLink.Click();
|
|
|
+ System.Threading.Thread.Sleep(500);
|
|
|
+
|
|
|
+ driver.SwitchTo().ParentFrame().SwitchTo().Frame(2);
|
|
|
+ //driver.SwitchTo().ParentFrame().SwitchTo().Frame(driver.FindElement(By.XPath("//iframe[contains(@src,'CaseInfo.aspx']")));
|
|
|
+ var DoItemLink = driver.FindElement(By.XPath($"//td[contains(text(),'{doItemName}')]"));
|
|
|
+ retObject.CaseStage = DoItemLink.FindElement(By.XPath("following-sibling::td[1]")).Text; //案件阶段
|
|
|
+ retObject.DoItemState = DoItemLink.FindElement(By.XPath("following-sibling::td[2]")).Text; //处理事项处理状态
|
|
|
+ //var td4 = DoItemLink.FindElement(By.XPath("following-sibling::td[3]")).Text; //配案日
|
|
|
+ retObject.InternalDate = DoItemLink.FindElement(By.XPath("following-sibling::td[4]")).Text; //内部期限
|
|
|
+ retObject.CustomerLimitDate = DoItemLink.FindElement(By.XPath("following-sibling::td[5]")).Text; //客户期限
|
|
|
+ //var td7 = DoItemLink.FindElement(By.XPath("following-sibling::td[6]")).Text; //官方期限
|
|
|
+ retObject.FinishedDate = DoItemLink.FindElement(By.XPath("following-sibling::td[7]")).Text; //处理事项完成日
|
|
|
+ retObject.DoPersons = DoItemLink.FindElement(By.XPath("following-sibling::td[8]")).Text; //处理人
|
|
|
+ retObject.DoItemMemo = DoItemLink.FindElement(By.XPath("following-sibling::td[9]")).Text; //处理事项备注
|
|
|
+ DoItemLink.Click();
|
|
|
+
|
|
|
+ retObject.FinalizationDate = driver.FindElement(By.Id("p_proc_info__finish_doc_date")).GetAttribute("value"); //定稿日
|
|
|
+ //retObject.FinalizationDate = driver.FindElement(By.Id("p_proc_info__cus_due_date")).GetAttribute("value"); //客户完成日[定稿日]
|
|
|
+ retObject.ReturnDate = driver.FindElement(By.Id("p_proc_info__back_date")).GetAttribute("value"); //返稿日
|
|
|
+ retObject.Reviewer = driver.FindElement(By.Id("p_proc_info__revise_user")).GetAttribute("value"); //核稿人
|
|
|
+ retObject.DoItemCoefficient = driver.FindElement(By.Id("p_proc_info__proc_coefficient")).GetAttribute("value"); //处理事项系数
|
|
|
+
|
|
|
+ driver.FindElement(By.Id("libase")).Click();
|
|
|
+ retObject.CaseName = driver.FindElement(By.Id("p_case_info__case_name")).GetAttribute("value"); //案件名称
|
|
|
+ retObject.CustomerName = driver.FindElement(By.Id("p_case_info__customer_id")).GetAttribute("value"); //客户名称
|
|
|
+ retObject.BusinessType = driver.FindElement(By.Id("p_case_info__business_type_id")).GetAttribute("value"); //业务类型
|
|
|
+
|
|
|
+ retObject.CaseState = GetSelectText(driver.FindElement(By.Id("p_case_info__case_status_id")));
|
|
|
+ retObject.ApplicationType = GetSelectText(driver.FindElement(By.Id("p_case_info__apply_type_id")));
|
|
|
+
|
|
|
+
|
|
|
+ retObject.CaseType = driver.FindElement(By.Id("p_case_info__case_type_id")).GetAttribute("value"); //案件类型
|
|
|
+ retObject.EntrustingDate = driver.FindElement(By.Id("p_case_info__charge_date")).GetAttribute("value"); //委案日期
|
|
|
+ retObject.CaseMemo = driver.FindElement(By.Id("p_case_info__remark")).GetAttribute("value"); //案件备注
|
|
|
+
|
|
|
+ driver.FindElement(By.XPath($"//span[contains(text(),'扩展信息')]")).Click();
|
|
|
+ //select[@id='p_case_info__case_coefficient_id']
|
|
|
+ retObject.CaseCoefficient = GetSelectText(driver.FindElement(By.Id("p_case_info__case_coefficient_id")));
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ return retObject;
|
|
|
+ }
|
|
|
+
|
|
|
+ private static string GetSelectText(IWebElement element)
|
|
|
+ {
|
|
|
+ var strValue = element.GetAttribute("value");
|
|
|
+
|
|
|
+ if (string.IsNullOrEmpty(strValue))
|
|
|
+ {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+
|
|
|
+ var ops = element.FindElements(By.TagName("option"));
|
|
|
+ foreach (var op in ops)
|
|
|
+ {
|
|
|
+ if (op.GetAttribute("value") == strValue)
|
|
|
+ {
|
|
|
+ return op.Text;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return null;
|
|
|
+
|
|
|
+ }
|
|
|
}
|
|
|
}
|