五环焊接拍片数、合格数汇总逻辑

This commit is contained in:
2025-06-27 10:37:04 +08:00
parent 4d1f663dc2
commit cf3e980b10
5 changed files with 104 additions and 63 deletions
@@ -86,30 +86,29 @@ namespace BLL
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
var table = new Project_HJGLData_Defect
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
DefectName = newtable.DefectName,
DefectNum = newtable.DefectNum
};
db.Project_HJGLData_Defect.InsertOnSubmit(table);
db.SubmitChanges();
}
var table = new Project_HJGLData_Defect
{
Id = newtable.Id,
ProjectId = newtable.ProjectId,
UnitId = newtable.UnitId,
CollCropCode = newtable.CollCropCode,
UnitName = newtable.UnitName,
ReportDate = newtable.ReportDate,
DefectName = newtable.DefectName,
DefectNum = newtable.DefectNum
};
db.Project_HJGLData_Defect.InsertOnSubmit(table);
db.SubmitChanges();
}
public static void AddBulkProject_HJGLData_Defect(List<Project_HJGLData_Defect> newtables)
{
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
{
db.Project_HJGLData_Defect.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
db.Project_HJGLData_Defect.InsertAllOnSubmit(newtables);
db.SubmitChanges();
}
public static void UpdateProject_HJGLData_Defect(Project_HJGLData_Defect newtable)
@@ -384,15 +384,21 @@ namespace BLL
// where y.ProjectId == projectid
// select x.CHT_TotalFilm).ToList().Sum());
int result = 0;
var getD2 = (from x in Funs.DB.HJGL_FL_Data
where x.ProjectId == projectid
orderby x.CompileDate descending
select x).FirstOrDefault();
if (getD2 != null)
{
result = Funs.GetNewIntOrZero(getD2.OneTimeFilmAmount.Split('.')[0]);
}
//int result = 0;
//var getD2 = (from x in Funs.DB.HJGL_FL_Data
// where x.ProjectId == projectid
// orderby x.CompileDate descending
// select x).FirstOrDefault();
//if (getD2 != null)
//{
// result = Funs.GetNewIntOrZero(getD2.OneTimeFilmAmount.Split('.')[0]);
//}
int result = Convert.ToInt32((from x in Funs.DB.ProcessControl_NondestructiveTest_New
where x.ProjectId == projectid && x.ProfessionalName == "工艺管道"
orderby x.CreateDate descending
select x.TotalQuantity
).FirstOrDefault());
return result;
}
/// <summary>
@@ -403,16 +409,26 @@ namespace BLL
{
//int result = Convert.ToInt32((from x in Funs.DB.CH_CheckItem
// join y in Funs.DB.CH_Check on x.CHT_CheckID equals y.CHT_CheckID
// where y.ProjectId == projectid
// where
// select x.CHT_PassFilm).ToList().Sum());
//int result = 0;
//var getD2 = (from x in Funs.DB.HJGL_FL_Data
// where x.ProjectId == projectid
// orderby x.CompileDate descending
// select x).FirstOrDefault();
//if (getD2 != null)
//{
// result = Funs.GetNewIntOrZero(getD2.OneTimeFilmQualifiedAmount.Split('.')[0]);
//}
int result = 0;
var getD2 = (from x in Funs.DB.HJGL_FL_Data
where x.ProjectId == projectid
orderby x.CompileDate descending
select x).FirstOrDefault();
if (getD2 != null)
var ndt = (from x in db.ProcessControl_NondestructiveTest_New where x.ProjectId == projectid && x.ProfessionalName == "工艺管道" orderby x.CreateDate descending select x).FirstOrDefault();
if (ndt != null)
{
result = Funs.GetNewIntOrZero(getD2.OneTimeFilmQualifiedAmount.Split('.')[0]);
if (ndt.TotalQuantity.HasValue)
{
result = Convert.ToInt32(ndt.TotalQuantity.Value * Funs.GetNewDecimalOrZero(ndt.TotalRate) / 100);
}
}
return result;
}