焊接拍片数、合格数汇总
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using FineUIPro;
|
||||
using Model;
|
||||
using Newtonsoft.Json;
|
||||
using NPOI.SS.Formula.Functions;
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
@@ -543,31 +544,36 @@ namespace BLL
|
||||
// //UnitName = UnitService.getUnitNamesUnitIds(x.UnitIds),
|
||||
// }).ToList();
|
||||
|
||||
List<CHCheckItemOutput> list =new List<CHCheckItemOutput>();
|
||||
var ndtLists = from x in Funs.DB.ProcessControl_NondestructiveTest_New where x.ProfessionalName == "工艺管道" select x;
|
||||
List<CHCheckItemOutput> list = new List<CHCheckItemOutput>();
|
||||
var ndtLists = (from x in Funs.DB.ProcessControl_NondestructiveTest_New where BeUnderConstructionList.Contains(x.ProjectId) select x).ToList();
|
||||
|
||||
if (ndtLists.Count() > 0)
|
||||
{
|
||||
//取每个项目、单位、专业最新的一条数据
|
||||
var datalist = ndtLists.GroupBy(r => new { r.ProjectId, r.UnitId, r.ProfessionalName }).Select(g => g.OrderByDescending(r => r.CreateDate).First()).ToList();
|
||||
foreach (var project in BeUnderConstructionList)
|
||||
{
|
||||
var ndt = (from x in ndtLists
|
||||
where x.ProjectId == project
|
||||
orderby x.CreateDate descending
|
||||
select x).FirstOrDefault();
|
||||
if (ndt != null)
|
||||
decimal a = 0, b = 0;
|
||||
var projectDataList = datalist.Where(x => x.ProjectId == project);
|
||||
foreach (var item in projectDataList)
|
||||
{
|
||||
if (ndt.TotalQuantity.HasValue)
|
||||
if (item.TotalQuantity.HasValue)
|
||||
{
|
||||
list.Add(new CHCheckItemOutput {
|
||||
Id = ndt.Id,
|
||||
ProjectId = project,
|
||||
//UnitId = y.UnitId,
|
||||
CHT_TotalFilm = ndt.TotalQuantity,
|
||||
CHT_PassFilm = Convert.ToInt32(ndt.TotalQuantity.Value * Funs.GetNewDecimalOrZero(ndt.TotalRate) / 100)
|
||||
});
|
||||
a += Math.Floor(item.TotalQuantity.Value * Funs.GetNewDecimalOrZero(item.TotalRate) / 100);
|
||||
b += item.TotalQuantity.Value;
|
||||
}
|
||||
}
|
||||
list.Add(new CHCheckItemOutput
|
||||
{
|
||||
Id = project,
|
||||
ProjectId = project,
|
||||
//UnitId = y.UnitId,
|
||||
CHT_TotalFilm = (int)Math.Round(b),
|
||||
CHT_PassFilm = (int)Math.Round(a)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user