提交代码

This commit is contained in:
2023-10-16 09:23:49 +08:00
parent d61950897d
commit bf642afbd5
10 changed files with 1260 additions and 114 deletions
@@ -256,6 +256,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
string IsXls = Path.GetExtension(this.fileData.FileName).ToString().Trim().ToLower();
if (IsXls != ".xls" && IsXls != ".xlsx")
{
fileData.Reset();
ShowNotify("excel文件类型错误!", MessageBoxIcon.Warning);
return;
}
@@ -277,6 +278,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
DataSet ds = NPOIHelper.ExcelToDataSet(fileName, out string message, false);
if (ds == null)
{
fileData.Reset();
ShowNotify("模板错误,请从系统下载正确的模板!", MessageBoxIcon.Warning);
return;
}
@@ -290,12 +292,14 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
var fileVerify = PropertyVerifyFile(ds);
if (!fileVerify)
{
fileData.Reset();
ShowNotify("请获取正确模板!", MessageBoxIcon.Warning);
return;
}
var columVerify = HasRepeatData(ds.Tables[0], new string[] { "A" });
if (columVerify)
{
fileData.Reset();
ShowNotify("模板中存在管道号相同或管道号为空的数据!", MessageBoxIcon.Warning);
return;
}
@@ -317,6 +321,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
{
if (string.IsNullOrWhiteSpace(ds.Tables[0].Rows[i][0].ToString()))
{
fileData.Reset();
ShowNotify($"第{i}行管道号为空", MessageBoxIcon.Warning);
return;
}
@@ -350,13 +355,16 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
}
else
{
fileData.Reset();
ShowNotify("文件无数据!", MessageBoxIcon.Warning);
}
fileData.Reset();
ZxtgdBrid();
ShowNotify("导入成功!", MessageBoxIcon.Success);
}
catch (Exception ex)
{
fileData.Reset();
ShowNotify(ex.Message, MessageBoxIcon.Warning);
}
}
@@ -494,6 +502,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
string IsXls = Path.GetExtension(this.filegyData.FileName).ToString().Trim().ToLower();
if (IsXls != ".xls" && IsXls != ".xlsx")
{
filegyData.Reset();
ShowNotify("excel文件类型错误!", MessageBoxIcon.Warning);
return;
}
@@ -515,6 +524,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
DataSet ds = NPOIHelper.ExcelToDataSet(fileName, out string message, false);
if (ds == null)
{
filegyData.Reset();
ShowNotify("模板错误,请从系统下载正确的模板!", MessageBoxIcon.Warning);
return;
}
@@ -528,6 +538,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
var fileVerify = TechnologyVerifyFile(ds);
if (!fileVerify)
{
filegyData.Reset();
ShowNotify("请获取正确模板!", MessageBoxIcon.Warning);
return;
}
@@ -554,6 +565,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
{
if (model == null)
{
filegyData.Reset();
ShowNotify($"{i}行数据存在错误!", MessageBoxIcon.Warning);
return;
}
@@ -616,6 +628,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
}
if (list.GroupBy(x => x.TagNumber).Count() != list.Count)
{
filegyData.Reset();
ShowNotify("模板中存在设备位号相同的数据!", MessageBoxIcon.Warning);
return;
}
@@ -625,13 +638,16 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
}
else
{
filegyData.Reset();
ShowNotify("文件无数据!", MessageBoxIcon.Warning);
}
filegyData.Reset();
ZxtgyBrid();
ShowNotify("导入成功!", MessageBoxIcon.Success);
}
catch (Exception ex)
{
filegyData.Reset();
ShowNotify(ex.Message, MessageBoxIcon.Warning);
}
}