2023-10-12

This commit is contained in:
2023-10-12 19:33:22 +08:00
parent 7d87e48818
commit d1c7977da2
24 changed files with 688 additions and 237 deletions
@@ -181,97 +181,100 @@ namespace FineUIPro.Web.CQMS.Comprehensive
var unitInfo = units.Where(y => y.UnitName == row0).FirstOrDefault();
if (unitInfo != null && !string.IsNullOrEmpty(row0))
{
oldViewInfo = oldViewInfos.Where(x => x.UnitId == unitInfo.UnitId
/*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)
{
string row1 = pds.Rows[i][1].ToString();
if (string.IsNullOrEmpty(row1))
{
result += (i + 2).ToString() + "," + "报验编号" + "," + "此项为必填项!" + "|";
}
string row2 = pds.Rows[i][2].ToString();
if (string.IsNullOrEmpty(row2))
{
result += (i + 2).ToString() + "," + "姓名" + "," + "此项为必填项!" + "|";
}
string row3 = pds.Rows[i][3].ToString();
if (!string.IsNullOrEmpty(row3))
{
var cn = cns.Where(x => x.ProfessionalName == row3.Trim()).FirstOrDefault();
if (cn == null)
{
result += (i + 2).ToString() + "," + "专业名称" + "," + "[" + row3 + "]不存在!" + "|";
}
}
string row4 = pds.Rows[i][4].ToString();
if (!string.IsNullOrEmpty(row4))
{
var post = posts.Where(x => x.PostName == row4.Trim()).FirstOrDefault();
if (post == null)
{
result += (i + 2).ToString() + "," + "工种" + "," + "[" + row4 + "]不存在!" + "|";
}
}
string row7 = pds.Rows[i][7].ToString();
if (!string.IsNullOrEmpty(row7))
{
try
{
DateTime date = Convert.ToDateTime(row7.Trim());
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "有效期" + "," + "[" + row7 + "]错误!" + "|";
}
}
string row8 = pds.Rows[i][8].ToString();
if (!string.IsNullOrEmpty(row8))
{
try
{
DateTime date = Convert.ToDateTime(row8.Trim());
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "批准时间" + "," + "[" + row8 + "]错误!" + "|";
}
}
string row9 = pds.Rows[i][9].ToString().Trim();
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());
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "离场时间" + "," + "[" + row10 + "]错误!" + "|";
}
}
}
else
{
result += (i + 2).ToString() + "," + "报验编号" + "," + "该单位人员报验编号已存在!" + "|";
}*/
string row1 = pds.Rows[i][1].ToString();
if (string.IsNullOrEmpty(row1))
{
result += (i + 2).ToString() + "," + "报验编号" + "," + "此项为必填项!" + "|";
}
string row2 = pds.Rows[i][2].ToString();
if (string.IsNullOrEmpty(row2))
{
result += (i + 2).ToString() + "," + "姓名" + "," + "此项为必填项!" + "|";
}
string row3 = pds.Rows[i][3].ToString();
if (!string.IsNullOrEmpty(row3))
{
var cn = cns.Where(x => x.ProfessionalName == row3.Trim()).FirstOrDefault();
if (cn == null)
{
result += (i + 2).ToString() + "," + "专业名称" + "," + "[" + row3 + "]不存在!" + "|";
}
}
string row4 = pds.Rows[i][4].ToString();
if (!string.IsNullOrEmpty(row4))
{
var post = posts.Where(x => x.PostName == row4.Trim()).FirstOrDefault();
if (post == null)
{
result += (i + 2).ToString() + "," + "工种" + "," + "[" + row4 + "]不存在!" + "|";
}
}
string row7 = pds.Rows[i][7].ToString();
if (!string.IsNullOrEmpty(row7))
{
try
{
DateTime date = Convert.ToDateTime(row7.Trim());
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "有效期" + "," + "[" + row7 + "]错误!" + "|";
}
}
string row8 = pds.Rows[i][8].ToString();
if (!string.IsNullOrEmpty(row8))
{
try
{
DateTime date = Convert.ToDateTime(row8.Trim());
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "批准时间" + "," + "[" + row8 + "]错误!" + "|";
}
}
string row9 = pds.Rows[i][9].ToString().Trim();
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());
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "离场时间" + "," + "[" + row10 + "]错误!" + "|";
}
}
}
else
@@ -496,7 +499,83 @@ namespace FineUIPro.Web.CQMS.Comprehensive
}
else
{
result += (i + 2).ToString() + "," + "报验编号" + "," + "该单位人员报验编号已存在!" + "|";
oldViewInfo.ProjectId = this.CurrUser.LoginProjectId;
oldViewInfo.UnitId = unitInfo.UnitId;
oldViewInfo.InspectionPersonCode = pds.Rows[i][1].ToString().Trim();
oldViewInfo.PersonName = pds.Rows[i][2].ToString().Trim();
if (!string.IsNullOrEmpty(pds.Rows[i][3].ToString().Trim()))
{
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.CertificateNumber = pds.Rows[i][5].ToString().Trim();
oldViewInfo.QualifiedProjectCode = pds.Rows[i][6].ToString().Trim();
if (!string.IsNullOrEmpty(pds.Rows[i][7].ToString().Trim()))
{
oldViewInfo.ValidityDate = Convert.ToDateTime(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.IsOnSite = pds.Rows[i][9].ToString().Trim() == "是" ? true : false;
if (!string.IsNullOrEmpty(pds.Rows[i][10].ToString().Trim()))
{
oldViewInfo.DepartureTime = Convert.ToDateTime(pds.Rows[i][10].ToString().Trim());
}
oldViewInfo.Remark = pds.Rows[i][11].ToString().Trim();
oldViewInfo.CompileMan = this.CurrUser.UserId;
oldViewInfo.CompileDate = DateTime.Now.Date;
oldViewInfo.IsTrain = true;
BLL.InspectionPersonService.UpdateInspectionPerson(oldViewInfo);
if (pds.Rows[i][4].ToString().Trim() == "焊工")
{
var welder = PersonManageService.GetBSWelderByProjectIdUnitIdAndWED_Code(CurrUser.LoginProjectId, oldViewInfo.UnitId, pds.Rows[i][1].ToString().Trim());
if (welder==null)
{
welder = new Model.BS_Welder();
welder.WED_Unit = oldViewInfo.UnitId;
welder.WED_Name = oldViewInfo.PersonName;
welder.WED_Code = pds.Rows[i][1].ToString().Trim();
welder.LimitDate = oldViewInfo.ValidityDate;
welder.LeaveDate = oldViewInfo.DepartureTime; // Convert.ToDateTime(this.txtDepartureTime.Text.ToString());
welder.PostDate = oldViewInfo.ApprovalTime;// Convert.ToDateTime(this.txtApprovalTime.Text.ToString());
welder.WED_WorkCode = oldViewInfo.CertificateNumber;// this.txtCertificateNumber.Text.Trim();
welder.WED_Class = oldViewInfo.QualifiedProjectCode;// this.txtQualifiedProjectCode.Text.Trim();
welder.WED_IfOnGuard = oldViewInfo.IsOnSite;
welder.WED_Remark = oldViewInfo.Remark;
welder.ProjectId = this.CurrUser.LoginProjectId;
// 焊工部分
BLL.PersonManageService.AddBSWelder(welder);
}
else
{
welder.WED_Unit = oldViewInfo.UnitId;
welder.WED_Name = oldViewInfo.PersonName;
welder.WED_Code = pds.Rows[i][1].ToString().Trim();
welder.LimitDate = oldViewInfo.ValidityDate;
welder.LeaveDate = oldViewInfo.DepartureTime; // Convert.ToDateTime(this.txtDepartureTime.Text.ToString());
welder.PostDate = oldViewInfo.ApprovalTime;// Convert.ToDateTime(this.txtApprovalTime.Text.ToString());
welder.WED_WorkCode = oldViewInfo.CertificateNumber;// this.txtCertificateNumber.Text.Trim();
welder.WED_Class = oldViewInfo.QualifiedProjectCode;// this.txtQualifiedProjectCode.Text.Trim();
welder.WED_IfOnGuard = oldViewInfo.IsOnSite;
welder.WED_Remark = oldViewInfo.Remark;
welder.ProjectId = this.CurrUser.LoginProjectId;
// 焊工部分
BLL.PersonManageService.UpdateBSWelder(welder);
}
}
//result += (i + 2).ToString() + "," + "报验编号" + "," + "该单位人员报验编号已存在!" + "|";
}
}
else