20240429 修改综合管理导入导出
This commit is contained in:
@@ -126,7 +126,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
oleDBConn.Close();
|
||||
oleDBConn.Dispose();
|
||||
|
||||
AddDatasetToSQL(ds.Tables[0], 13);
|
||||
AddDatasetToSQL(ds.Tables[0], 15);
|
||||
hdCheckResult.Text = "1";
|
||||
}
|
||||
catch (Exception exc)
|
||||
@@ -172,28 +172,21 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
select x;
|
||||
|
||||
var cns = from x in Funs.DB.Base_CNProfessional select x;
|
||||
|
||||
var unitWorks = from x in Funs.DB.WBS_UnitWork
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.SuperUnitWork == null
|
||||
select x;
|
||||
|
||||
var posts = from x in Funs.DB.Base_Post select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
Model.Comprehensive_InspectionPerson oldViewInfo = new Model.Comprehensive_InspectionPerson();
|
||||
string row0 = pds.Rows[i][0].ToString().Trim();
|
||||
var unitInfo = units.Where(y => y.UnitName == row0).FirstOrDefault();
|
||||
if (unitInfo != null && !string.IsNullOrEmpty(row0))
|
||||
{
|
||||
/*oldViewInfo = oldViewInfos.Where(x => x.UnitId == unitInfo.UnitId
|
||||
&& x.PersonName == pds.Rows[i][2].ToString().Trim()
|
||||
&& x.InspectionPersonCode == pds.Rows[i][1].ToString().Trim()
|
||||
).FirstOrDefault();
|
||||
if (oldViewInfo == null)
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "报验编号" + "," + "该单位人员报验编号已存在!" + "|";
|
||||
}*/
|
||||
string row1 = pds.Rows[i][1].ToString();
|
||||
if (string.IsNullOrEmpty(row1))
|
||||
{
|
||||
@@ -219,23 +212,24 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
string row4 = pds.Rows[i][4].ToString();
|
||||
if (!string.IsNullOrEmpty(row4))
|
||||
{
|
||||
var post = posts.Where(x => x.PostName == row4.Trim()).FirstOrDefault();
|
||||
if (post == null)
|
||||
string[] reunit = row4.Split(',');
|
||||
foreach (string unitWork in reunit)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "工种" + "," + "[" + row4 + "]不存在!" + "|";
|
||||
var u = unitWorks.Where(x => x.UnitWorkName == unitWork.Trim()).FirstOrDefault();
|
||||
if (u == null)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "单位工程名称" + "," + "[" + unitWork.Trim() + "]不存在!" + "|";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string row7 = pds.Rows[i][7].ToString();
|
||||
if (!string.IsNullOrEmpty(row7))
|
||||
string row5 = pds.Rows[i][5].ToString();
|
||||
if (!string.IsNullOrEmpty(row5))
|
||||
{
|
||||
try
|
||||
var post = posts.Where(x => x.PostName == row5.Trim()).FirstOrDefault();
|
||||
if (post == null)
|
||||
{
|
||||
DateTime date = Convert.ToDateTime(row7.Trim());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "有效期" + "," + "[" + row7 + "]错误!" + "|";
|
||||
result += (i + 2).ToString() + "," + "工种" + "," + "[" + row5 + "]不存在!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -248,36 +242,69 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "批准时间" + "," + "[" + row8 + "]错误!" + "|";
|
||||
result += (i + 2).ToString() + "," + "有效期" + "," + "[" + row8 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
string row9 = pds.Rows[i][9].ToString().Trim();
|
||||
string row9 = pds.Rows[i][9].ToString();
|
||||
if (!string.IsNullOrEmpty(row9))
|
||||
{
|
||||
if (row9 != "是" && row9 != "否")
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "是否在场" + "," + "[" + row9 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
string row10 = pds.Rows[i][10].ToString();
|
||||
if (!string.IsNullOrEmpty(row10))
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime date = Convert.ToDateTime(row10.Trim());
|
||||
DateTime date = Convert.ToDateTime(row9.Trim());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "离场时间" + "," + "[" + row10 + "]错误!" + "|";
|
||||
result += (i + 2).ToString() + "," + "批准时间" + "," + "[" + row9 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
string row10 = pds.Rows[i][10].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(row10))
|
||||
{
|
||||
if (row10 != "是" && row10 != "否")
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "是否在场" + "," + "[" + row10 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
string row11 = pds.Rows[i][11].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(row11))
|
||||
{
|
||||
if (row11 != "是" && row11 != "否")
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "培训" + "," + "[" + row11 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
|
||||
string row12 = pds.Rows[i][12].ToString();
|
||||
if (string.IsNullOrEmpty(row12))
|
||||
if (!string.IsNullOrEmpty(row12))
|
||||
{
|
||||
try
|
||||
{
|
||||
DateTime date = Convert.ToDateTime(row12.Trim());
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "离场时间" + "," + "[" + row12 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
string row14 = pds.Rows[i][14].ToString();
|
||||
if (string.IsNullOrEmpty(row14))
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标志编号" + "," + "此项为必填项!" + "|";
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
int t = Convert.ToInt32(row14);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
result += (i + 2).ToString() + "," + "标志编号" + "," + "[" + row14 + "]错误!" + "|";
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -388,7 +415,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
oleDBConn.Close();
|
||||
oleDBConn.Dispose();
|
||||
|
||||
AddDatasetToSQL2(ds.Tables[0], 13);
|
||||
AddDatasetToSQL2(ds.Tables[0], 15);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@@ -426,9 +453,15 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
select x;
|
||||
|
||||
var cns = from x in Funs.DB.Base_CNProfessional select x;
|
||||
|
||||
var unitWorks = from x in Funs.DB.WBS_UnitWork
|
||||
where x.ProjectId == this.CurrUser.LoginProjectId
|
||||
&& x.SuperUnitWork == null
|
||||
select x;
|
||||
|
||||
var posts = from x in Funs.DB.Base_Post select x;
|
||||
|
||||
for (int i = 0; i < ir; i++)
|
||||
for (int i = 1; i < ir; i++)
|
||||
{
|
||||
Model.Comprehensive_InspectionPerson oldViewInfo = new Model.Comprehensive_InspectionPerson();
|
||||
string row0 = pds.Rows[i][0].ToString().Trim();
|
||||
@@ -436,7 +469,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
if (unitInfo != null && !string.IsNullOrEmpty(row0))
|
||||
{
|
||||
oldViewInfo = oldViewInfos.Where(x => x.UnitId == unitInfo.UnitId
|
||||
&& x.RemarkCode == pds.Rows[i][12].ToString().Trim()
|
||||
&& x.RemarkCode == Funs.GetNewInt(pds.Rows[i][14].ToString().Trim())
|
||||
).FirstOrDefault();
|
||||
if (oldViewInfo == null)
|
||||
{
|
||||
@@ -450,37 +483,37 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
Ins.CNProfessionalId = Funs.DB.Base_CNProfessional.First(e => e.ProfessionalName == pds.Rows[i][3].ToString().Trim()).CNProfessionalId;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][4].ToString().Trim()))
|
||||
{
|
||||
Ins.PostId = Funs.DB.Base_Post.First(e => e.PostName == pds.Rows[i][4].ToString().Trim()).PostId;
|
||||
Ins.UnitWorkId = BLL.UnitWorkService.GetUnitWorkIdsByUnitWorkNames(this.CurrUser.LoginProjectId, pds.Rows[i][4].ToString().Trim());
|
||||
}
|
||||
|
||||
Ins.CertificateNumber = pds.Rows[i][5].ToString().Trim();
|
||||
Ins.QualifiedProjectCode = pds.Rows[i][6].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][7].ToString().Trim()))
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][5].ToString().Trim()))
|
||||
{
|
||||
Ins.ValidityDate = Convert.ToDateTime(pds.Rows[i][7].ToString().Trim());
|
||||
Ins.PostId = Funs.DB.Base_Post.First(e => e.PostName == pds.Rows[i][5].ToString().Trim()).PostId;
|
||||
}
|
||||
|
||||
Ins.CertificateNumber = pds.Rows[i][6].ToString().Trim();
|
||||
Ins.QualifiedProjectCode = pds.Rows[i][7].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][8].ToString().Trim()))
|
||||
{
|
||||
Ins.ApprovalTime = Convert.ToDateTime(pds.Rows[i][8].ToString().Trim());
|
||||
Ins.ValidityDate = Convert.ToDateTime(pds.Rows[i][8].ToString().Trim());
|
||||
}
|
||||
Ins.IsOnSite = pds.Rows[i][9].ToString().Trim() == "是" ? true : false;
|
||||
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][10].ToString().Trim()))
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][9].ToString().Trim()))
|
||||
{
|
||||
Ins.DepartureTime = Convert.ToDateTime(pds.Rows[i][10].ToString().Trim());
|
||||
Ins.ApprovalTime = Convert.ToDateTime(pds.Rows[i][9].ToString().Trim());
|
||||
}
|
||||
Ins.Remark = pds.Rows[i][11].ToString().Trim();
|
||||
Ins.RemarkCode = pds.Rows[i][12].ToString().Trim();
|
||||
Ins.IsOnSite = pds.Rows[i][10].ToString().Trim() == "是" ? true : false;
|
||||
Ins.IsTrain= pds.Rows[i][11].ToString().Trim() == "是" ? true : false;
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][12].ToString().Trim()))
|
||||
{
|
||||
Ins.DepartureTime = Convert.ToDateTime(pds.Rows[i][12].ToString().Trim());
|
||||
}
|
||||
Ins.Remark = pds.Rows[i][13].ToString().Trim();
|
||||
Ins.RemarkCode =Funs.GetNewInt(pds.Rows[i][14].ToString().Trim());
|
||||
|
||||
Ins.InspectionPersonId = SQLHelper.GetNewID(typeof(Model.Comprehensive_InspectionPerson));
|
||||
Ins.CompileMan = this.CurrUser.UserId;
|
||||
Ins.CompileDate = DateTime.Now.Date;
|
||||
Ins.Status = BLL.Const.Comprehensive_Compile;
|
||||
Ins.IsTrain = true;
|
||||
BLL.InspectionPersonService.AddInspectionPerson(Ins);
|
||||
if (pds.Rows[i][4].ToString().Trim() == "焊工")
|
||||
{
|
||||
@@ -510,36 +543,37 @@ namespace FineUIPro.Web.CQMS.Comprehensive
|
||||
{
|
||||
oldViewInfo.CNProfessionalId = Funs.DB.Base_CNProfessional.First(e => e.ProfessionalName == pds.Rows[i][3].ToString().Trim()).CNProfessionalId;
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][4].ToString().Trim()))
|
||||
{
|
||||
oldViewInfo.PostId = Funs.DB.Base_Post.First(e => e.PostName == pds.Rows[i][4].ToString().Trim()).PostId;
|
||||
oldViewInfo.UnitWorkId = BLL.UnitWorkService.GetUnitWorkIdsByUnitWorkNames(this.CurrUser.LoginProjectId, pds.Rows[i][4].ToString().Trim());
|
||||
}
|
||||
|
||||
oldViewInfo.CertificateNumber = pds.Rows[i][5].ToString().Trim();
|
||||
oldViewInfo.QualifiedProjectCode = pds.Rows[i][6].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][7].ToString().Trim()))
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][5].ToString().Trim()))
|
||||
{
|
||||
oldViewInfo.ValidityDate = Convert.ToDateTime(pds.Rows[i][7].ToString().Trim());
|
||||
oldViewInfo.PostId = Funs.DB.Base_Post.First(e => e.PostName == pds.Rows[i][5].ToString().Trim()).PostId;
|
||||
}
|
||||
|
||||
oldViewInfo.CertificateNumber = pds.Rows[i][6].ToString().Trim();
|
||||
oldViewInfo.QualifiedProjectCode = pds.Rows[i][7].ToString().Trim();
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][8].ToString().Trim()))
|
||||
{
|
||||
oldViewInfo.ApprovalTime = Convert.ToDateTime(pds.Rows[i][8].ToString().Trim());
|
||||
oldViewInfo.ValidityDate = Convert.ToDateTime(pds.Rows[i][8].ToString().Trim());
|
||||
}
|
||||
oldViewInfo.IsOnSite = pds.Rows[i][9].ToString().Trim() == "是" ? true : false;
|
||||
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][10].ToString().Trim()))
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][9].ToString().Trim()))
|
||||
{
|
||||
oldViewInfo.DepartureTime = Convert.ToDateTime(pds.Rows[i][10].ToString().Trim());
|
||||
oldViewInfo.ApprovalTime = Convert.ToDateTime(pds.Rows[i][9].ToString().Trim());
|
||||
}
|
||||
oldViewInfo.Remark = pds.Rows[i][11].ToString().Trim();
|
||||
oldViewInfo.RemarkCode= pds.Rows[i][12].ToString().Trim();
|
||||
oldViewInfo.IsOnSite = pds.Rows[i][10].ToString().Trim() == "是" ? true : false;
|
||||
oldViewInfo.IsTrain = pds.Rows[i][11].ToString().Trim() == "是" ? true : false;
|
||||
if (!string.IsNullOrEmpty(pds.Rows[i][12].ToString().Trim()))
|
||||
{
|
||||
oldViewInfo.DepartureTime = Convert.ToDateTime(pds.Rows[i][12].ToString().Trim());
|
||||
}
|
||||
oldViewInfo.Remark = pds.Rows[i][13].ToString().Trim();
|
||||
oldViewInfo.RemarkCode = Funs.GetNewInt(pds.Rows[i][14].ToString().Trim());
|
||||
|
||||
oldViewInfo.InspectionPersonId = SQLHelper.GetNewID(typeof(Model.Comprehensive_InspectionPerson));
|
||||
oldViewInfo.CompileMan = this.CurrUser.UserId;
|
||||
oldViewInfo.CompileDate = DateTime.Now.Date;
|
||||
oldViewInfo.Status = BLL.Const.Comprehensive_Compile;
|
||||
oldViewInfo.IsTrain = true;
|
||||
BLL.InspectionPersonService.UpdateInspectionPerson(oldViewInfo);
|
||||
if (pds.Rows[i][4].ToString().Trim() == "焊工")
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user