篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了csharp Epicor - 示例LINQ BPM w /一些左连接相关的知识,希望对你有一定的参考价值。
// Get PO Lines
var ttPOLines =
(from pod in Db.PODetail.With(LockHint.NoLock)
join por in Db.PORel.With(LockHint.NoLock)
on new { pod.Company, PONum = pod.PONUM, pod.POLine } equals new { por.Company, PONum = por.PONum, por.POLine }
join pl in Db.Plant.With(LockHint.NoLock)
on new { por.Company, PL = por.Plant } equals new { pl.Company, PL = pl.Plant1 }
join pc in Db.PartCost.With(LockHint.NoLock)
on new { pl.Company, CID = pl.PlantCostID, PartNum = pod.PartNum } equals new { pc.Company, CID = pc.CostID, PartNum = pc.PartNum }
/* Left Join on PartClass, just incase it does not exist */
join pcl in Db.PartClass.With(LockHint.NoLock)
on new { pod.Company, pod.ClassID } equals new { pcl.Company, pcl.ClassID }
into pclj
from pcl in pclj.DefaultIfEmpty()
/* Left Join on EntityGLC, just incase it does not exist */
join eg in Db.EntityGLC.With(LockHint.NoLock)
on new { por.Company, ClassID = pcl.ClassID, RelatedToFile = "PartClass" } equals new { eg.Company, ClassID = eg.Key1, RelatedToFile = eg.RelatedToFile }
into egj
from eg in egj.DefaultIfEmpty()
/* Left Join on GLCntrlAcct, just incase it does not exist */
join glca in Db.GLCntrlAcct.With(LockHint.NoLock)
on new { eg.Company, eg.GLControlCode, Context = "Inventory/Expense" } equals new { glca.Company, glca.GLControlCode, Context = glca.GLAcctContext }
into glcaj
from glca in glcaj.DefaultIfEmpty()
where
pod.Company == ttPOHeader_Row.Company
&& pod.PONUM == ttPOHeader_Row.PONum
select new {
pod.PartNum, pod.XOrderQty, pod.OrderQty, pod.IUM, pod.PUM, pod.LineDesc, pod.DocUnitCost, pod.CostPerCode,
pod.ClassID, ClassDescription = pcl != null ? pcl.Description : "",
por.PONum, por.POLine, por.PORelNum,
TotalStdCost = (pc.StdLaborCost + pc.StdBurdenCost + pc.StdMaterialCost + pc.StdSubContCost + pc.StdMtlBurCost),
GLAcct = glca != null ? glca.GLAccount : ""
/*GLAcct = tg != null ? (tg.SegValue2 + "-" + tg.SegValue1 + "-" + tg.SegValue3 + "-" + (tg.SegValue4 != "" ? tg.SegValue4 : string.Empty) ) : ""*/
}).ToList();
以上是关于csharp Epicor - 示例LINQ BPM w /一些左连接的主要内容,如果未能解决你的问题,请参考以下文章