提交修改

This commit is contained in:
2023-08-14 09:52:20 +08:00
parent 02fcf5be10
commit b7f7cb608d
4 changed files with 148 additions and 338 deletions
@@ -180,113 +180,103 @@ 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
&& x.InspectionMachineCode == pds.Rows[i][1].ToString().Trim()
).FirstOrDefault();
if (oldViewInfo == null)
string row1 = pds.Rows[i][1].ToString();
if (string.IsNullOrEmpty(row1))
{
string row1 = pds.Rows[i][1].ToString();
if (string.IsNullOrEmpty(row1))
{
result += (i + 2).ToString() + "," + "报验编号" + "," + "此项为必填项!" + "|";
}
result += (i + 2).ToString() + "," + "报验编号" + "," + "此项为必填项!" + "|";
}
string row2 = pds.Rows[i][2].ToString();
if (string.IsNullOrEmpty(row2))
{
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))
string row3 = pds.Rows[i][3].ToString();
if (!string.IsNullOrEmpty(row3))
{
var cn = cns.Where(x => x.ProfessionalName == row3.Trim()).FirstOrDefault();
if (cn == null)
{
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))
{
if (row4 != "施工" && row4 != "计量")
{
result += (i + 2).ToString() + "," + "类型" + "," + "[" + row4 + "]错误!" + "|";
}
}
string row6 = pds.Rows[i][6].ToString();
if (!string.IsNullOrEmpty(row6))
{
try
{
DateTime date = Convert.ToDateTime(row6.Trim());
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "下次检验日期" + "," + "[" + row6 + "]错误!" + "|";
}
}
string row8 = pds.Rows[i][8].ToString().Trim();
if (!string.IsNullOrEmpty(row8))
{
if (row8 != "是" && row8 != "否")
{
result += (i + 2).ToString() + "," + "是否在校验期内" + "," + "[" + row8 + "]错误!" + "|";
}
}
string row9 = pds.Rows[i][9].ToString();
if (!string.IsNullOrEmpty(row9))
{
try
{
DateTime date = Convert.ToDateTime(row9.Trim());
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "报验日期" + "," + "[" + row9 + "]错误!" + "|";
}
}
string row10 = pds.Rows[i][10].ToString();
if (!string.IsNullOrEmpty(row10))
{
if (row10 != "是" && row10 != "否")
{
result += (i + 2).ToString() + "," + "是否在场" + "," + "[" + row10 + "]错误!" + "|";
}
}
string row11 = pds.Rows[i][11].ToString();
if (!string.IsNullOrEmpty(row11))
{
try
{
int unitsCount = Convert.ToInt32(row11);
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "台数" + "," + "[" + row11 + "]错误!" + "|";
}
}
string row12 = pds.Rows[i][12].ToString();
if (!string.IsNullOrEmpty(row12))
{
try
{
DateTime leaveDate = Convert.ToDateTime(row12);
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "离场时间" + "," + "[" + row12 + "]错误!" + "|";
}
result += (i + 2).ToString() + "," + "专业名称" + "," + "[" + row3 + "]不存在!" + "|";
}
}
else
string row4 = pds.Rows[i][4].ToString();
if (!string.IsNullOrEmpty(row4))
{
result += (i + 2).ToString() + "," + "报验编号" + "," + "该单位机具报验编号已存在!" + "|";
if (row4 != "施工" && row4 != "计量")
{
result += (i + 2).ToString() + "," + "类型" + "," + "[" + row4 + "]错误!" + "|";
}
}
string row6 = pds.Rows[i][6].ToString();
if (!string.IsNullOrEmpty(row6))
{
try
{
DateTime date = Convert.ToDateTime(row6.Trim());
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "下次检验日期" + "," + "[" + row6 + "]错误!" + "|";
}
}
string row8 = pds.Rows[i][8].ToString().Trim();
if (!string.IsNullOrEmpty(row8))
{
if (row8 != "是" && row8 != "否")
{
result += (i + 2).ToString() + "," + "是否在校验期内" + "," + "[" + row8 + "]错误!" + "|";
}
}
string row9 = pds.Rows[i][9].ToString();
if (!string.IsNullOrEmpty(row9))
{
try
{
DateTime date = Convert.ToDateTime(row9.Trim());
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "报验日期" + "," + "[" + row9 + "]错误!" + "|";
}
}
string row10 = pds.Rows[i][10].ToString();
if (!string.IsNullOrEmpty(row10))
{
if (row10 != "是" && row10 != "否")
{
result += (i + 2).ToString() + "," + "是否在场" + "," + "[" + row10 + "]错误!" + "|";
}
}
string row11 = pds.Rows[i][11].ToString();
if (!string.IsNullOrEmpty(row11))
{
try
{
int unitsCount = Convert.ToInt32(row11);
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "台数" + "," + "[" + row11 + "]错误!" + "|";
}
}
string row12 = pds.Rows[i][12].ToString();
if (!string.IsNullOrEmpty(row12))
{
try
{
DateTime leaveDate = Convert.ToDateTime(row12);
}
catch (Exception)
{
result += (i + 2).ToString() + "," + "离场时间" + "," + "[" + row12 + "]错误!" + "|";
}
}
}
@@ -446,65 +436,54 @@ 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
&& x.InspectionMachineCode == pds.Rows[i][1].ToString().Trim() && x.InspectionMachineName == pds.Rows[i][2].ToString().Trim()
).FirstOrDefault();
if (oldViewInfo == null)
Model.Comprehensive_InspectionMachine Ins = new Model.Comprehensive_InspectionMachine();
Ins.ProjectId = this.CurrUser.LoginProjectId;
Ins.UnitId = unitInfo.UnitId;
Ins.InspectionMachineCode = pds.Rows[i][1].ToString().Trim();
Ins.InspectionMachineName = pds.Rows[i][2].ToString().Trim();
if (!string.IsNullOrEmpty(pds.Rows[i][3].ToString().Trim()))
{
Model.Comprehensive_InspectionMachine Ins = new Model.Comprehensive_InspectionMachine();
Ins.ProjectId = this.CurrUser.LoginProjectId;
Ins.UnitId = unitInfo.UnitId;
Ins.InspectionMachineCode = pds.Rows[i][1].ToString().Trim();
Ins.InspectionMachineName = pds.Rows[i][2].ToString().Trim();
if (!string.IsNullOrEmpty(pds.Rows[i][3].ToString().Trim()))
{
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.InspectionType = pds.Rows[i][4].ToString().Trim();
}
else
{
Ins.InspectionType = "施工";
}
Ins.SpecificationModel = pds.Rows[i][5].ToString().Trim();
if (!string.IsNullOrEmpty(pds.Rows[i][6].ToString().Trim()))
{
Ins.NextTestDate = Convert.ToDateTime(pds.Rows[i][6].ToString().Trim());
}
Ins.TestCycle = pds.Rows[i][7].ToString().Trim();
Ins.IsOnSite = pds.Rows[i][8].ToString().Trim() == "是" ? true : false;
if (!string.IsNullOrEmpty(pds.Rows[i][9].ToString().Trim()))
{
Ins.InspectionDate = Convert.ToDateTime(pds.Rows[i][9].ToString().Trim());
}
Ins.IsOnSite = pds.Rows[i][10].ToString().Trim() == "是" ? true : false;
if (!string.IsNullOrEmpty(pds.Rows[i][11].ToString().Trim()))
{
Ins.UnitsCount = Convert.ToInt32(pds.Rows[i][11].ToString().Trim());
}
if (!string.IsNullOrEmpty(pds.Rows[i][12].ToString().Trim()))
{
Ins.LeaveDate = Convert.ToDateTime(pds.Rows[i][12].ToString().Trim());
}
Ins.InspectionMachineId = SQLHelper.GetNewID(typeof(Model.Comprehensive_InspectionMachine));
Ins.CompileMan = this.CurrUser.UserId;
Ins.CompileDate = DateTime.Now.Date;
BLL.InspectionMachineService.AddInspectionMachine(Ins);
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.InspectionType = pds.Rows[i][4].ToString().Trim();
}
else
{
result += (i + 2).ToString() + "," + "报验编号" + "," + "该单位报验编号已存在!" + "|";
Ins.InspectionType = "施工";
}
Ins.SpecificationModel = pds.Rows[i][5].ToString().Trim();
if (!string.IsNullOrEmpty(pds.Rows[i][6].ToString().Trim()))
{
Ins.NextTestDate = Convert.ToDateTime(pds.Rows[i][6].ToString().Trim());
}
Ins.TestCycle = pds.Rows[i][7].ToString().Trim();
Ins.IsOnSite = pds.Rows[i][8].ToString().Trim() == "是" ? true : false;
if (!string.IsNullOrEmpty(pds.Rows[i][9].ToString().Trim()))
{
Ins.InspectionDate = Convert.ToDateTime(pds.Rows[i][9].ToString().Trim());
}
Ins.IsOnSite = pds.Rows[i][10].ToString().Trim() == "是" ? true : false;
if (!string.IsNullOrEmpty(pds.Rows[i][11].ToString().Trim()))
{
Ins.UnitsCount = Convert.ToInt32(pds.Rows[i][11].ToString().Trim());
}
if (!string.IsNullOrEmpty(pds.Rows[i][12].ToString().Trim()))
{
Ins.LeaveDate = Convert.ToDateTime(pds.Rows[i][12].ToString().Trim());
}
Ins.InspectionMachineId = SQLHelper.GetNewID(typeof(Model.Comprehensive_InspectionMachine));
Ins.CompileMan = this.CurrUser.UserId;
Ins.CompileDate = DateTime.Now.Date;
BLL.InspectionMachineService.AddInspectionMachine(Ins);
}
else
@@ -512,7 +491,7 @@ namespace FineUIPro.Web.CQMS.Comprehensive
result += (i + 2).ToString() + "," + "单位名称" + "," + "[" + row0 + "]不存在!" + "|";
}
}
}
else