|
@@ -100,8 +100,9 @@ namespace wispro.sp.utility
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <param name="ReportName">报告名称</param>
|
|
/// <param name="ReportName">报告名称</param>
|
|
/// <param name="isModifyDate">是否手动修改日期范围</param>
|
|
/// <param name="isModifyDate">是否手动修改日期范围</param>
|
|
- public static void DownloadReport(string ReportName,bool isModifyDate)
|
|
|
|
|
|
+ public static DataTable DownloadReport(string ReportName,bool isModifyDate)
|
|
{
|
|
{
|
|
|
|
+ DataTable retDatatable;
|
|
string strFileSavePath = ConfigHelper.GetSectionValue("IPEasySetting:DownloadFileSavePath");
|
|
string strFileSavePath = ConfigHelper.GetSectionValue("IPEasySetting:DownloadFileSavePath");
|
|
bool isheadless = (ConfigHelper.GetSectionValue("IPEasySetting:isHeadless") == "true");
|
|
bool isheadless = (ConfigHelper.GetSectionValue("IPEasySetting:isHeadless") == "true");
|
|
string Account = ConfigHelper.GetSectionValue("IPEasySetting:Account");
|
|
string Account = ConfigHelper.GetSectionValue("IPEasySetting:Account");
|
|
@@ -199,13 +200,34 @@ namespace wispro.sp.utility
|
|
var ihg_export = driver.FindElement(By.Name("ihg_export"));
|
|
var ihg_export = driver.FindElement(By.Name("ihg_export"));
|
|
driver.SwitchTo().Frame(ihg_export);
|
|
driver.SwitchTo().Frame(ihg_export);
|
|
driver.FindElement(By.Id("btnSubmit")).Click();
|
|
driver.FindElement(By.Id("btnSubmit")).Click();
|
|
|
|
+
|
|
|
|
+ //切换到弹出的下载报表界面,点击下载按钮
|
|
|
|
+ System.Threading.Thread.Sleep(3000);
|
|
|
|
+ driver.SwitchTo().DefaultContent();
|
|
|
|
+ var frameDownload = driver.FindElement(By.Name("DownloadList"));
|
|
|
|
+ driver.SwitchTo().Frame(frameDownload);
|
|
|
|
+ var firstTr = driver.FindElement(By.TagName("tr"));
|
|
|
|
+ var tdStatus = firstTr.FindElement(By.XPath("//td")).FindElement(By.XPath("following-sibling::td[4]"));
|
|
|
|
+ string strStatus = tdStatus.Text;
|
|
|
|
+ while (strStatus.Trim() != "导出成功!")
|
|
|
|
+ {
|
|
|
|
+ System.Threading.Thread.Sleep(5000);
|
|
|
|
+ firstTr = driver.FindElement(By.TagName("tr"));
|
|
|
|
+ tdStatus = firstTr.FindElement(By.XPath("//td")).FindElement(By.XPath("following-sibling::td[4]"));
|
|
|
|
+ strStatus = tdStatus.Text;
|
|
|
|
+ }
|
|
|
|
|
|
- string strFilePath = System.IO.Path.Combine(strFileSavePath, $"{ReportName.Trim()}.xlsx");
|
|
|
|
|
|
+ firstTr = driver.FindElement(By.TagName("tr"));
|
|
|
|
+ firstTr.FindElement(By.XPath("//td/a[@title='下载']")).Click();
|
|
|
|
+ //System.Threading.Thread.Sleep(5000);
|
|
|
|
+ //btnDownload.Click();
|
|
|
|
|
|
|
|
+ string strFilePath = System.IO.Path.Combine(strFileSavePath, $"{ReportName.Trim()}.xlsx");
|
|
|
|
+
|
|
int iwaiting = 0;
|
|
int iwaiting = 0;
|
|
while (true)
|
|
while (true)
|
|
{
|
|
{
|
|
-
|
|
|
|
|
|
+
|
|
System.IO.FileInfo file = new System.IO.FileInfo(strFilePath.Replace("~", "_"));
|
|
System.IO.FileInfo file = new System.IO.FileInfo(strFilePath.Replace("~", "_"));
|
|
if (!file.Exists || file.Length == 0)
|
|
if (!file.Exists || file.Length == 0)
|
|
{
|
|
{
|
|
@@ -223,6 +245,14 @@ namespace wispro.sp.utility
|
|
break;
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ //删除下载记录
|
|
|
|
+ firstTr = driver.FindElement(By.TagName("tr"));
|
|
|
|
+ firstTr.FindElement(By.XPath("//td/a[@title='删除']")).Click();
|
|
|
|
+
|
|
|
|
+ //System.IO.FileInfo file = new System.IO.FileInfo(strFilePath.Replace("~", "_"));
|
|
|
|
+ retDatatable = NPOIExcel.ExcelToDataTable(strFilePath.Replace("~", "_"),true);
|
|
|
|
+ System.IO.File.Delete(strFilePath.Replace("~", "_"));
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
catch (Exception ex)
|
|
{
|
|
{
|
|
@@ -232,7 +262,10 @@ namespace wispro.sp.utility
|
|
{
|
|
{
|
|
killChromProcess();
|
|
killChromProcess();
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ return retDatatable;
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
@@ -429,6 +462,7 @@ namespace wispro.sp.utility
|
|
retObject.FinishedDate = DoItemLink.FindElement(By.XPath("following-sibling::td[7]")).Text; //处理事项完成日
|
|
retObject.FinishedDate = DoItemLink.FindElement(By.XPath("following-sibling::td[7]")).Text; //处理事项完成日
|
|
retObject.DoPersons = DoItemLink.FindElement(By.XPath("following-sibling::td[8]")).Text; //处理人
|
|
retObject.DoPersons = DoItemLink.FindElement(By.XPath("following-sibling::td[8]")).Text; //处理人
|
|
retObject.DoItemMemo = DoItemLink.FindElement(By.XPath("following-sibling::td[9]")).Text; //处理事项备注
|
|
retObject.DoItemMemo = DoItemLink.FindElement(By.XPath("following-sibling::td[9]")).Text; //处理事项备注
|
|
|
|
+ retObject.Reviewer = DoItemLink.FindElement(By.XPath("following-sibling::td[10]")).Text; //核稿人
|
|
|
|
|
|
DoItemLink.Click();
|
|
DoItemLink.Click();
|
|
break;
|
|
break;
|
|
@@ -445,6 +479,7 @@ namespace wispro.sp.utility
|
|
retObject.FinishedDate = DoItemLink.FindElement(By.XPath("following-sibling::td[7]")).Text; //处理事项完成日
|
|
retObject.FinishedDate = DoItemLink.FindElement(By.XPath("following-sibling::td[7]")).Text; //处理事项完成日
|
|
retObject.DoPersons = DoItemLink.FindElement(By.XPath("following-sibling::td[8]")).Text; //处理人
|
|
retObject.DoPersons = DoItemLink.FindElement(By.XPath("following-sibling::td[8]")).Text; //处理人
|
|
retObject.DoItemMemo = DoItemLink.FindElement(By.XPath("following-sibling::td[9]")).Text; //处理事项备注
|
|
retObject.DoItemMemo = DoItemLink.FindElement(By.XPath("following-sibling::td[9]")).Text; //处理事项备注
|
|
|
|
+ retObject.Reviewer = DoItemLink.FindElement(By.XPath("following-sibling::td[10]")).Text; //核稿人
|
|
|
|
|
|
|
|
|
|
DoItemLink.Click();
|
|
DoItemLink.Click();
|