select count(rd.package_id) packageCount,
sum(e.total_activity) as totalActivity,
sum(m.diamerter / 2 * m.diamerter / 2 * m.height) as totalVolumn
from RWIS_NUCLEAR_RUB_RECEPTION_D RD
inner join RWIS_NUCLEAR_RUB_RECEPTION R
on rd.recept_id = r.recept_id
inner join rwis_nuclear_bucket b
on rd.bucket_id = b.bucket_id
inner join RWIS_BASIC_MATERIAL m
on b.material_id = m.material_id
inner join RWIS_NUCLEAR_APPLY_DETAIL d
on rd.bucket_id = d.bucket_id
inner join RWIS_DISPSITE_CHECK_DETAIL c
on d.apply_detail_id = c.apply_detail_id
left join RWIS_DISPSITE_EVAL e
on c.detail_id = e.check_detail_id
where r.status = '2'
and r.stationcode = 'CC' and r.reception_date>='' and r.reception_date<=''
我自己写的但是不对
var nuclearRubReceptionDs = _currentUnitOfWork.NuclearRubReceptionDs.AsQueryable();
var nuclearRubReceptions = _currentUnitOfWork.NuclearRubReceptions.AsQueryable();
var nuclearBucket = _currentUnitOfWork.NuclearBuckets.AsQueryable();
var materialType = _currentUnitOfWork.MaterialTypes.AsQueryable();
var nuclearApplyDetail = _currentUnitOfWork.NuclearApplyDetails.AsQueryable();
var dispsiteCheckDetail = _currentUnitOfWork.DispsiteCheckDetails.AsQueryable();
var dispsiteEval = _currentUnitOfWork.DispsiteEvals.AsQueryable();
var query = from rd in nuclearRubReceptionDs
join r in nuclearRubReceptions on rd.ReceptId equals r.ReceptId
join b in nuclearBucket on rd.BucketId equals b.BucketId
join m in materialType on b.MaterialId equals m.MaterialId into m
join d in nuclearApplyDetail on rd.BucketId equals d.BucketId
join c in dispsiteCheckDetail on d.ApplyDetailId equals c.ApplyDetailId
join e in dispsiteEval on c.DetailId equals e.CheckDetailId into eEmpt
from e in eEmpt.DefaultIfEmpty()
select new WasteStatisticView
{
Code = "",
TotalActivity = eEmpt.Sum(t => t.TotalActivity),
TotalVolume = m.Sum(mm=>mm.Diamerter/2*mm.Diamerter/2*mm.Height),
TotalCount = rd.PackageId.Count(),
Stationcode=r.Stationcode,
CreateDate =r.CreateDate
};
return query;