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
@@ -431,59 +431,115 @@ namespace FineUIPro.Web.CQMS.Comprehensive
for (int i = 0; i < ir; i++)
{
Model.Comprehensive_InspectionMachine oldViewInfo = new Model.Comprehensive_InspectionMachine();
string row0 = pds.Rows[i][0].ToString().Trim();
var unitInfo = units.Where(y => y.UnitName == row0).FirstOrDefault();
if (unitInfo != null && !string.IsNullOrEmpty(row0))
{
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 oldViewInfo = new Model.Comprehensive_InspectionMachine();
oldViewInfo = oldViewInfos.FirstOrDefault(x => x.UnitId == unitInfo.UnitId
&& x.InspectionMachineCode == pds.Rows[i][1].ToString().Trim());
if (oldViewInfo==null)
{
Ins.CNProfessionalId = Funs.DB.Base_CNProfessional.First(e => e.ProfessionalName == pds.Rows[i][3].ToString().Trim()).CNProfessionalId;
}
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();
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);
}
else
{
Ins.InspectionType = "施工";
oldViewInfo.ProjectId = this.CurrUser.LoginProjectId;
oldViewInfo.UnitId = unitInfo.UnitId;
oldViewInfo.InspectionMachineCode = pds.Rows[i][1].ToString().Trim();
oldViewInfo.InspectionMachineName = 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.InspectionType = pds.Rows[i][4].ToString().Trim();
}
else
{
oldViewInfo.InspectionType = "施工";
}
oldViewInfo.SpecificationModel = pds.Rows[i][5].ToString().Trim();
if (!string.IsNullOrEmpty(pds.Rows[i][6].ToString().Trim()))
{
oldViewInfo.NextTestDate = Convert.ToDateTime(pds.Rows[i][6].ToString().Trim());
}
oldViewInfo.TestCycle = pds.Rows[i][7].ToString().Trim();
oldViewInfo.IsOnSite = pds.Rows[i][8].ToString().Trim() == "是" ? true : false;
if (!string.IsNullOrEmpty(pds.Rows[i][9].ToString().Trim()))
{
oldViewInfo.InspectionDate = Convert.ToDateTime(pds.Rows[i][9].ToString().Trim());
}
oldViewInfo.IsOnSite = pds.Rows[i][10].ToString().Trim() == "是" ? true : false;
if (!string.IsNullOrEmpty(pds.Rows[i][11].ToString().Trim()))
{
oldViewInfo.UnitsCount = Convert.ToInt32(pds.Rows[i][11].ToString().Trim());
}
if (!string.IsNullOrEmpty(pds.Rows[i][12].ToString().Trim()))
{
oldViewInfo.LeaveDate = Convert.ToDateTime(pds.Rows[i][12].ToString().Trim());
}
oldViewInfo.CompileMan = this.CurrUser.UserId;
oldViewInfo.CompileDate = DateTime.Now.Date;
BLL.InspectionMachineService.UpdateInspectionMachine(oldViewInfo);
}
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