全厂移交统计表

This commit is contained in:
2024-01-30 16:01:53 +08:00
parent fdf500e8d0
commit 183af3a610
15 changed files with 650 additions and 373 deletions
@@ -106,7 +106,7 @@ namespace FineUIPro.Web.Transfer
oleDBConnString = "Provider=Microsoft.Jet.OLEDB.4.0;";
oleDBConnString += "Data Source=";
oleDBConnString += fileName;
oleDBConnString += ";Extended Properties=Excel 8.0;";
oleDBConnString += ";Extended Properties='Excel 8.0';";
OleDbConnection oleDBConn = null;
OleDbDataAdapter oleAdMaster = null;
DataTable m_tableName = new DataTable();
@@ -181,7 +181,7 @@ namespace FineUIPro.Web.Transfer
}
}
string row5 = pds.Rows[i][5].ToString();
if (!string.IsNullOrEmpty(row4))
if (!string.IsNullOrEmpty(row5))
{
try
{
@@ -329,40 +329,46 @@ namespace FineUIPro.Web.Transfer
List<Model.Transfer_Instrumentation> list = new List<Model.Transfer_Instrumentation>();
for (int i = 1; i < ir; i++)
{
//查询第一列,没查到的情况下作导入处理
var modelOnly = Funs.DB.Transfer_Instrumentation.FirstOrDefault(x => x.INSTRUMENTATION == pds.Rows[i][0].ToString().Trim()
&& x.ProjectId==CurrUser.LoginProjectId);
if (modelOnly == null)
if (!string.IsNullOrEmpty(pds.Rows[i][0].ToString().Trim()))
{
Model.Transfer_Instrumentation model = new Model.Transfer_Instrumentation();
model.Id = Guid.NewGuid().ToString();
model.ProjectId = CurrUser.LoginProjectId;
model.INSTRUMENTATION = pds.Rows[i][0].ToString().Trim();
model.SystemName = pds.Rows[i][1].ToString().Trim();
model.Subsystem = pds.Rows[i][2].ToString().Trim();
model.Test_Package = pds.Rows[i][3].ToString().Trim();
DateTime t1, t2;
if (DateTime.TryParse(pds.Rows[i][4].ToString(), out t1) && !string.IsNullOrEmpty(pds.Rows[i][4].ToString()))
model.Test_Package_START = t1;
if (DateTime.TryParse(pds.Rows[i][5].ToString(), out t2) && !string.IsNullOrEmpty(pds.Rows[i][5].ToString()))
model.Test_Package_FINISH = t2;
//查询第一列,没查到的情况下作导入处理
var modelOnly = Funs.DB.Transfer_Instrumentation.FirstOrDefault(x => x.INSTRUMENTATION == pds.Rows[i][0].ToString().Trim()
&& x.ProjectId == CurrUser.LoginProjectId);
if (modelOnly == null)
{
Model.Transfer_Instrumentation model = new Model.Transfer_Instrumentation();
model.Id = Guid.NewGuid().ToString();
model.ProjectId = CurrUser.LoginProjectId;
model.INSTRUMENTATION = pds.Rows[i][0].ToString().Trim();
model.SystemName = pds.Rows[i][1].ToString().Trim();
model.Subsystem = pds.Rows[i][2].ToString().Trim();
model.Test_Package = pds.Rows[i][3].ToString().Trim();
DateTime t1, t2;
if (DateTime.TryParse(pds.Rows[i][4].ToString(), out t1) && !string.IsNullOrEmpty(pds.Rows[i][4].ToString()))
model.Test_Package_START = t1;
if (DateTime.TryParse(pds.Rows[i][5].ToString(), out t2) && !string.IsNullOrEmpty(pds.Rows[i][5].ToString()))
model.Test_Package_FINISH = t2;
model.FINAL_Status = pds.Rows[i][6].ToString().Trim();
list.Add(model);
}
else
{
//修改
modelOnly.INSTRUMENTATION = pds.Rows[i][0].ToString().Trim();
modelOnly.SystemName = pds.Rows[i][1].ToString().Trim();
modelOnly.Subsystem = pds.Rows[i][2].ToString().Trim();
modelOnly.Test_Package = pds.Rows[i][3].ToString().Trim();
DateTime t1, t2;
if (DateTime.TryParse(pds.Rows[i][4].ToString(), out t1) && !string.IsNullOrEmpty(pds.Rows[i][4].ToString()))
modelOnly.Test_Package_START = t1;
if (DateTime.TryParse(pds.Rows[i][5].ToString(), out t2) && !string.IsNullOrEmpty(pds.Rows[i][5].ToString()))
modelOnly.Test_Package_FINISH = t2;
modelOnly.FINAL_Status = pds.Rows[i][6].ToString().Trim();
Funs.DB.SubmitChanges();
}
model.FINAL_Status = pds.Rows[i][6].ToString().Trim();
list.Add(model);
}
else {
//修改
modelOnly.INSTRUMENTATION = pds.Rows[i][0].ToString().Trim();
modelOnly.SystemName = pds.Rows[i][1].ToString().Trim();
modelOnly.Subsystem = pds.Rows[i][2].ToString().Trim();
modelOnly.Test_Package = pds.Rows[i][3].ToString().Trim();
DateTime t1, t2;
if (DateTime.TryParse(pds.Rows[i][4].ToString(), out t1) && !string.IsNullOrEmpty(pds.Rows[i][4].ToString()))
modelOnly.Test_Package_START = t1;
if (DateTime.TryParse(pds.Rows[i][5].ToString(), out t2) && !string.IsNullOrEmpty(pds.Rows[i][5].ToString()))
modelOnly.Test_Package_FINISH = t2;
modelOnly.FINAL_Status = pds.Rows[i][6].ToString().Trim();
Funs.DB.SubmitChanges();
}
}
if (list.Count > 0)