修改试车内容

This commit is contained in:
2023-07-28 11:14:32 +08:00
parent 54b40b1791
commit 976625dc9b
23 changed files with 2263 additions and 231 deletions
@@ -296,7 +296,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
var columVerify = HasRepeatData(ds.Tables[0], new string[] { "A" });
if (columVerify)
{
ShowNotify("模板中存在管道号相同的数据!", MessageBoxIcon.Warning);
ShowNotify("模板中存在管道号相同或管道号为空的数据!", MessageBoxIcon.Warning);
return;
}
var pipingCodes = GetColumnValues<string>(ds.Tables[0], "A");
@@ -312,28 +312,31 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
//数据导入
for (int i = 3; i < ds.Tables[0].Rows.Count; i++)
{
if (ds.Tables[0].Rows[i][0] == null) continue;
if (string.IsNullOrWhiteSpace(ds.Tables[0].Rows[i][0].ToString()))
{
ShowNotify($"第{i}行管道号为空", MessageBoxIcon.Warning);
return;
}
PreRun_PropertySysPiping model = new PreRun_PropertySysPiping();
model.PropertyId = Guid.NewGuid().ToString();
model.SystemId = tvControlItem.SelectedNodeID;
model.ProjectId = this.CurrUser.LoginProjectId;
model.PipingCode = ds.Tables[0].Rows[i][0].ToString();
model.Diameter = ds.Tables[0].Rows[i][1] != null ? ds.Tables[0].Rows[i][1].ToString() : string.Empty;
model.MaterialLevel = ds.Tables[0].Rows[i][2] != null ? ds.Tables[0].Rows[i][2].ToString() : string.Empty;
model.AdiabatType = ds.Tables[0].Rows[i][3] != null ? ds.Tables[0].Rows[i][3].ToString() : string.Empty;
model.AdiabatThickness = ds.Tables[0].Rows[i][4] != null ? ds.Tables[0].Rows[i][4].ToString() : string.Empty;
model.MediumState = ds.Tables[0].Rows[i][5] != null ? ds.Tables[0].Rows[i][5].ToString() : string.Empty;
model.DrawingNo = ds.Tables[0].Rows[i][6] != null ? ds.Tables[0].Rows[i][6].ToString() : string.Empty;
model.PipingStart = ds.Tables[0].Rows[i][7] != null ? ds.Tables[0].Rows[i][7].ToString() : string.Empty;
model.PipingEnd = ds.Tables[0].Rows[i][8] != null ? ds.Tables[0].Rows[i][8].ToString() : string.Empty;
model.PipingLevel = ds.Tables[0].Rows[i][9] != null ? ds.Tables[0].Rows[i][9].ToString() : string.Empty;
model.NormalTemperature = ds.Tables[0].Rows[i][10] != null ? ds.Tables[0].Rows[i][10].ToString() : string.Empty;
model.NormalPressure = ds.Tables[0].Rows[i][11] != null ? ds.Tables[0].Rows[i][11].ToString() : string.Empty;
model.DesignTemperature = ds.Tables[0].Rows[i][12] != null ? ds.Tables[0].Rows[i][12].ToString() : string.Empty;
model.DesignPressure = ds.Tables[0].Rows[i][13] != null ? ds.Tables[0].Rows[i][13].ToString() : string.Empty;
model.PaintLevel = ds.Tables[0].Rows[i][14] != null ? ds.Tables[0].Rows[i][14].ToString() : string.Empty;
model.Remark = ds.Tables[0].Rows[i][15] != null ? ds.Tables[0].Rows[i][15].ToString() : string.Empty;
model.Diameter = ds.Tables[0].Rows[i][7] != null ? ds.Tables[0].Rows[i][7].ToString() : string.Empty;
model.MaterialLevel = ds.Tables[0].Rows[i][9] != null ? ds.Tables[0].Rows[i][9].ToString() : string.Empty;
model.AdiabatType = ds.Tables[0].Rows[i][14] != null ? ds.Tables[0].Rows[i][14].ToString() : string.Empty;
model.AdiabatThickness = ds.Tables[0].Rows[i][17] != null ? ds.Tables[0].Rows[i][17].ToString() : string.Empty;
model.MediumState = ds.Tables[0].Rows[i][19] != null ? ds.Tables[0].Rows[i][19].ToString() : string.Empty;
model.DrawingNo = ds.Tables[0].Rows[i][21] != null ? ds.Tables[0].Rows[i][21].ToString() : string.Empty;
model.PipingStart = ds.Tables[0].Rows[i][28] != null ? ds.Tables[0].Rows[i][28].ToString() : string.Empty;
model.PipingEnd = ds.Tables[0].Rows[i][34] != null ? ds.Tables[0].Rows[i][34].ToString() : string.Empty;
model.PipingLevel = ds.Tables[0].Rows[i][40] != null ? ds.Tables[0].Rows[i][40].ToString() : string.Empty;
model.NormalTemperature = ds.Tables[0].Rows[i][42] != null ? ds.Tables[0].Rows[i][42].ToString() : string.Empty;
model.NormalPressure = ds.Tables[0].Rows[i][44] != null ? ds.Tables[0].Rows[i][44].ToString() : string.Empty;
model.DesignTemperature = ds.Tables[0].Rows[i][46] != null ? ds.Tables[0].Rows[i][46].ToString() : string.Empty;
model.DesignPressure = ds.Tables[0].Rows[i][48] != null ? ds.Tables[0].Rows[i][48].ToString() : string.Empty;
model.PaintLevel = ds.Tables[0].Rows[i][50] != null ? ds.Tables[0].Rows[i][50].ToString() : string.Empty;
model.Remark = ds.Tables[0].Rows[i][53] != null ? ds.Tables[0].Rows[i][53].ToString() : string.Empty;
model.AddUser = this.CurrUser.UserId;
model.AddTime = DateTime.Now;
model.Sort = i - 2;
@@ -524,13 +527,7 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
ShowNotify("请获取正确模板!", MessageBoxIcon.Warning);
return;
}
var columVerify = HasRepeatData(ds.Tables[0], new string[] { "A" });
if (columVerify)
{
ShowNotify("模板中存在设备位号相同的数据!", MessageBoxIcon.Warning);
return;
}
var tagNumbers = GetColumnValues<string>(ds.Tables[0], "A");
var tagNumbers = GetColumnValues<string>(ds.Tables[0], "D");
var removeNumbers = new List<string>() { "设备位号", "" };
tagNumbers.RemoveAll(a => removeNumbers.Contains(a));
var existTechnologys = Funs.DB.PreRun_TechnologySysPiping.Where(a => tagNumbers.Contains(a.TagNumber) && a.SystemId == tvControlItem.SelectedNodeID && a.ProjectId == this.CurrUser.LoginProjectId).ToList();
@@ -539,30 +536,83 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
ShowNotify($"设备位号({string.Join(",", existTechnologys.ConvertAll(s => s.TagNumber))})已存在!", MessageBoxIcon.Warning);
return;
}
string nameSpecificationStr = string.Empty;
string materialStr = string.Empty;
PreRun_TechnologySysPiping model = new PreRun_TechnologySysPiping();
List<PreRun_TechnologySysPiping> list = new List<PreRun_TechnologySysPiping>();
//数据导入
for (int i = 2; i < ds.Tables[0].Rows.Count; i++)
{
if (ds.Tables[0].Rows[i][0] == null) continue;
if (string.IsNullOrWhiteSpace(ds.Tables[0].Rows[i][3].ToString()))
{
if (model == null)
{
ShowNotify($"{i}行数据存在错误!", MessageBoxIcon.Warning);
return;
}
else
{
if (!string.IsNullOrWhiteSpace(ds.Tables[0].Rows[i][8].ToString()))
{
nameSpecificationStr += "\n" + ds.Tables[0].Rows[i][8].ToString();
}
if (!string.IsNullOrWhiteSpace(ds.Tables[0].Rows[i][32].ToString()))
{
materialStr += "\n" + ds.Tables[0].Rows[i][32].ToString();
}
}
}
else
{
if (model != null && list.Count(x => x.TagNumber == model.TagNumber) > 0)
{
list.Where(x => x.TagNumber == model.TagNumber).ToList().ForEach(p =>
{
p.Materials = materialStr;
p.NameSpecifications = nameSpecificationStr;
});
}
model = new PreRun_TechnologySysPiping();
model.TechnologyId = Guid.NewGuid().ToString();
model.SystemId = tvControlItem.SelectedNodeID;
model.ProjectId = this.CurrUser.LoginProjectId;
model.TagNumber = ds.Tables[0].Rows[i][3].ToString();
model.NameSpecifications = ds.Tables[0].Rows[i][8] != null ? ds.Tables[0].Rows[i][8].ToString() : string.Empty;
model.DrawingNo = ds.Tables[0].Rows[i][24] != null ? ds.Tables[0].Rows[i][24].ToString() : string.Empty;
model.Materials = ds.Tables[0].Rows[i][32] != null ? ds.Tables[0].Rows[i][32].ToString() : string.Empty;
model.NumOperate = ds.Tables[0].Rows[i][41] != null ? ds.Tables[0].Rows[i][41].ToString() : string.Empty;
model.NumStandby = ds.Tables[0].Rows[i][43] != null ? ds.Tables[0].Rows[i][43].ToString() : string.Empty;
model.WeightSingle = ds.Tables[0].Rows[i][45] != null ? ds.Tables[0].Rows[i][45].ToString() : string.Empty;
model.WeightTotal = ds.Tables[0].Rows[i][48] != null ? ds.Tables[0].Rows[i][48].ToString() : string.Empty;
model.Remark = ds.Tables[0].Rows[i][51] != null ? ds.Tables[0].Rows[i][51].ToString() : string.Empty;
model.AddUser = this.CurrUser.UserId;
model.AddTime = DateTime.Now;
model.Sort = i - 1;
materialStr = model.Materials;
nameSpecificationStr = model.NameSpecifications;
list.Add(model);
}
//最后一条数据累加
if (i == ds.Tables[0].Rows.Count - 1)
{
if (model != null && list.Count(x => x.TagNumber == model.TagNumber) > 0)
{
list.Where(x => x.TagNumber == model.TagNumber).ToList().ForEach(p =>
{
p.Materials = materialStr;
p.NameSpecifications = nameSpecificationStr;
});
}
}
PreRun_TechnologySysPiping model = new PreRun_TechnologySysPiping();
model.TechnologyId = Guid.NewGuid().ToString();
model.SystemId = tvControlItem.SelectedNodeID;
model.ProjectId = this.CurrUser.LoginProjectId;
model.TagNumber = ds.Tables[0].Rows[i][0].ToString();
model.NameSpecifications = ds.Tables[0].Rows[i][1] != null ? ds.Tables[0].Rows[i][1].ToString() : string.Empty;
model.DrawingNo = ds.Tables[0].Rows[i][2] != null ? ds.Tables[0].Rows[i][2].ToString() : string.Empty;
model.Materials = ds.Tables[0].Rows[i][3] != null ? ds.Tables[0].Rows[i][3].ToString() : string.Empty;
model.NumOperate = ds.Tables[0].Rows[i][4] != null ? ds.Tables[0].Rows[i][4].ToString() : string.Empty;
model.NumStandby = ds.Tables[0].Rows[i][5] != null ? ds.Tables[0].Rows[i][5].ToString() : string.Empty;
model.WeightSingle = ds.Tables[0].Rows[i][6] != null ? ds.Tables[0].Rows[i][6].ToString() : string.Empty;
model.WeightTotal = ds.Tables[0].Rows[i][7] != null ? ds.Tables[0].Rows[i][7].ToString() : string.Empty;
model.Remark = ds.Tables[0].Rows[i][8] != null ? ds.Tables[0].Rows[i][8].ToString() : string.Empty;
model.AddUser = this.CurrUser.UserId;
model.AddTime = DateTime.Now;
model.Sort = i - 1;
list.Add(model);
}
if (list.GroupBy(x => x.TagNumber).Count() != list.Count)
{
ShowNotify("模板中存在设备位号相同的数据!", MessageBoxIcon.Warning);
return;
}
Funs.DB.PreRun_TechnologySysPiping.InsertAllOnSubmit(list);
Funs.DB.SubmitChanges();
}
@@ -953,9 +1003,9 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
var result = true;
if (ds.Tables[0].Rows[1][0].ToString() != "管道号") result = false;
if (ds.Tables[0].Rows[1][1].ToString() != "公称") result = false;
if (ds.Tables[0].Rows[1][2].ToString() != "管道材料等级") result = false;
if (ds.Tables[0].Rows[1][3].ToString() != "绝热伴热") result = false;
if (ds.Tables[0].Rows[1][7].ToString() != "公称") result = false;
if (ds.Tables[0].Rows[1][9].ToString() != "管道材料等级") result = false;
if (ds.Tables[0].Rows[1][14].ToString() != "绝热伴热") result = false;
return result;
}
@@ -969,10 +1019,10 @@ namespace FineUIPro.Web.TestRun.BeforeTestRun
{
var result = true;
if (ds.Tables[0].Rows[0][0].ToString() != "设备位号") result = false;
if (ds.Tables[0].Rows[0][1].ToString() != "设备名称和规格") result = false;
if (ds.Tables[0].Rows[0][2].ToString() != "图号或型号") result = false;
if (ds.Tables[0].Rows[0][3].ToString() != "制造材料") result = false;
if (ds.Tables[0].Rows[0][3].ToString() != "设备位号") result = false;
if (ds.Tables[0].Rows[0][8].ToString() != "设备名称和规格") result = false;
if (ds.Tables[0].Rows[0][24].ToString() != "图号或型号") result = false;
if (ds.Tables[0].Rows[0][32].ToString() != "制造材料") result = false;
return result;
}