到货分析总体匹配率算法修改
This commit is contained in:
@@ -17,12 +17,13 @@ namespace BLL
|
||||
{
|
||||
using (Model.SGGLDB db = new Model.SGGLDB(Funs.ConnString))
|
||||
{
|
||||
string PipeArea= WarehouseCode == "工厂预制"?"1":"2";
|
||||
///所需材料数量列表
|
||||
var NeedOutMateriaList = from x in db.HJGL_PipeLineMat
|
||||
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
join z in db.HJGL_Pipeline on x.PipelineId equals z.PipelineId
|
||||
where z.ProjectId == projectid && (string.IsNullOrEmpty(materialCode) || x.MaterialCode .Contains( materialCode))
|
||||
group x by x.MaterialCode
|
||||
where z.ProjectId == projectid && (string.IsNullOrEmpty(materialCode) || x.MaterialCode .Contains( materialCode)) && z.PipeArea== PipeArea
|
||||
group x by x.MaterialCode
|
||||
into g
|
||||
select new
|
||||
{
|
||||
@@ -31,18 +32,23 @@ namespace BLL
|
||||
};
|
||||
///实际材料入库数量列表
|
||||
var RealInMateriaList = from x in db.Tw_InputDetail
|
||||
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
join master in db.Tw_InputMaster on x.InputMasterId equals master.Id
|
||||
join y in db.HJGL_MaterialCodeLib on x.MaterialCode equals y.MaterialCode
|
||||
where master.ProjectId== projectid && master.WarehouseCode== WarehouseCode
|
||||
group x by x.MaterialCode
|
||||
into g
|
||||
where (string.IsNullOrEmpty(materialCode) || g.Key.Contains( materialCode))
|
||||
where (string.IsNullOrEmpty(materialCode) || g.Key.Contains( materialCode))
|
||||
select new
|
||||
{
|
||||
g.Key,
|
||||
RealNum = g.Sum(x => x.ActNum) ?? 0,
|
||||
};
|
||||
//库存数量
|
||||
var tw_MaterialStock=from x in db.Tw_MaterialStock
|
||||
where x.WarehouseCode==WarehouseCode
|
||||
select x;
|
||||
where x.WarehouseCode==WarehouseCode && x.ProjectId== projectid
|
||||
select x;
|
||||
|
||||
|
||||
var StatisticsList =(from x in NeedOutMateriaList
|
||||
join y in RealInMateriaList on x.Key equals y.Key into gg
|
||||
from y in gg.DefaultIfEmpty()
|
||||
|
||||
Reference in New Issue
Block a user