feat(hjgl): 优化焊口查询并同步更新相关数据模型
为支持焊口查询页面和静态页的新展示与交互能力, 同步调整了材料匹配统计逻辑、数据模型映射及前端构建产物。 同时补充实名制服务和数据库脚本,保证接口、页面与数据结构保持一致。
This commit is contained in:
@@ -27,42 +27,54 @@ namespace BLL
|
||||
NeedNum = g.Sum(x => x.Number) ?? 0,
|
||||
};
|
||||
///实际材料入库数量列表
|
||||
var RealInMateriaList = from x in db.Tw_InputDetail
|
||||
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
|
||||
var RealInMateriaList = (from x in db.Tw_InputDetail
|
||||
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))
|
||||
select new
|
||||
{
|
||||
g.Key,
|
||||
RealNum = g.Sum(x => x.ActNum) ?? 0,
|
||||
};
|
||||
where (string.IsNullOrEmpty(materialCode) || g.Key.Contains(materialCode))
|
||||
select new
|
||||
{
|
||||
g.Key,
|
||||
RealNum = g.Sum(x => x.ActNum) ?? 0,
|
||||
}).ToList();
|
||||
//库存数量
|
||||
var tw_MaterialStock = from x in db.Tw_MaterialStock
|
||||
where x.WarehouseCode == WarehouseCode && x.ProjectId == projectid
|
||||
select x;
|
||||
var tw_MaterialStock = (from x in db.Tw_MaterialStock
|
||||
where x.WarehouseCode == WarehouseCode && x.ProjectId == projectid
|
||||
select x).ToList();
|
||||
|
||||
var needMateriaList = NeedOutMateriaList.ToList();
|
||||
var materialCodeList = needMateriaList.Select(x => x.Key)
|
||||
.Union(RealInMateriaList.Select(x => x.Key))
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
var StatisticsList = (from x in NeedOutMateriaList
|
||||
join y in RealInMateriaList on x.Key equals y.Key into gg
|
||||
from y in gg.DefaultIfEmpty()
|
||||
join z in db.HJGL_MaterialCodeLib on x.Key equals z.MaterialCode into zz
|
||||
from z in zz.DefaultIfEmpty()
|
||||
join m in tw_MaterialStock on x.Key equals m.PipeLineMatCode into mm
|
||||
from m in mm.DefaultIfEmpty()
|
||||
var materialInfoList = (from x in db.HJGL_MaterialCodeLib
|
||||
where materialCodeList.Contains(x.MaterialCode)
|
||||
select x).ToList();
|
||||
|
||||
var StatisticsList = (from code in materialCodeList
|
||||
join x in needMateriaList on code equals x.Key into needGroup
|
||||
from x in needGroup.DefaultIfEmpty()
|
||||
join y in RealInMateriaList on code equals y.Key into realGroup
|
||||
from y in realGroup.DefaultIfEmpty()
|
||||
join z in materialInfoList on code equals z.MaterialCode into infoGroup
|
||||
from z in infoGroup.DefaultIfEmpty()
|
||||
join m in tw_MaterialStock on code equals m.PipeLineMatCode into stockGroup
|
||||
from m in stockGroup.DefaultIfEmpty()
|
||||
orderby code
|
||||
select new Tw_ArrivalStatisticsOutPut
|
||||
{
|
||||
MaterialCode = x.Key,
|
||||
MaterialCode = code,
|
||||
StockNum = m == null ? 0 : (decimal)m.StockNum,
|
||||
NeedNum = x.NeedNum,
|
||||
NeedNum = x == null ? 0 : x.NeedNum,
|
||||
RealNum = y == null ? 0 : y.RealNum,
|
||||
MaterialName = z.MaterialName,
|
||||
MaterialSpec = z.MaterialSpec,
|
||||
MaterialUnit = z.MaterialUnit,
|
||||
MaterialDef = z.MaterialDef,
|
||||
MatchRate = (x.NeedNum == 0 ? 0 : Math.Round((y == null ? 0 : y.RealNum) / x.NeedNum, 4, MidpointRounding.ToEven)),
|
||||
MaterialName = z == null ? null : z.MaterialName,
|
||||
MaterialSpec = z == null ? null : z.MaterialSpec,
|
||||
MaterialUnit = z == null ? null : z.MaterialUnit,
|
||||
MaterialDef = z == null ? null : z.MaterialDef,
|
||||
MatchRate = (x == null || x.NeedNum == 0 ? 0 : Math.Round((y == null ? 0 : y.RealNum) / x.NeedNum, 4, MidpointRounding.ToEven)),
|
||||
}).ToList();
|
||||
foreach (var item in StatisticsList)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user