移交管理5-8导入
This commit is contained in:
@@ -162,17 +162,6 @@ namespace FineUIPro.Web.Transfer
|
||||
ir = pds.Rows.Count;
|
||||
if (pds != null && ir > 0)
|
||||
{
|
||||
var oldViewInfos = from x in Funs.DB.Comprehensive_InspectionEquipment
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x;
|
||||
|
||||
var units = from x in Funs.DB.Base_Unit
|
||||
join y in Funs.DB.Project_ProjectUnit on x.UnitId equals y.UnitId
|
||||
where y.ProjectId == this.CurrUser.LoginProjectId
|
||||
select x;
|
||||
|
||||
var cns = from x in Funs.DB.Base_CNProfessional select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
{
|
||||
string row4 = pds.Rows[i][4].ToString();
|
||||
@@ -334,24 +323,43 @@ namespace FineUIPro.Web.Transfer
|
||||
if (pds != null && ir > 0)
|
||||
{
|
||||
List<Model.Transfer_Instrumentation> list = new List<Model.Transfer_Instrumentation>();
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
|
||||
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);
|
||||
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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user