并非所有过滤都在contions中。第一次检查项目是否有效或已停止评估,然后第二部分进行评估以检查项目的类型。检查数量值的最后一部分未进行评估并且传递了变量。
查询:
from i in items
join idt in itemDetails on i.Id equals idt.ItemId
join ip in itemPrice on i.Id equals ip.ItemId
join s in supplier on i.SupplierID equals s.Id
join so in salesOrderItems on i.Id equals so.ItemId into salesTable
from x in salesTable.DefaultIfEmpty()
where (i.ItemStatus == "ACT" || i.ItemStatus == "DISC" && i.StoreID == null)
&& (i.ItemType == stock || i.ItemType == part || i.ItemType == specialOrder)
&& (idt.ReorderQty >= sales || idt.WarrantyQty >= warranty || idt.NextOrderQty >= next || idt.ReorderPoint > reorderPoint || x.SalesOrderItemStatus == requests)