我有两个清单
清单A(CG300019159,CG300018158,FS300076458)列表B返回如下所示的分组列表 { “pallet_identifier”:“CG300018158”, “shipment_items”:[ …
您应该在组之前应用过滤器并选择,它会提高您的查询数量,因为您丢弃了不需要的所有内容。
entity = new List<GoodInWarehouseBM>((from consighdrs in mi9db.consighdrs.Where(i=> !getConsignmentbookedin.Contains(i.Id(id of item not sure which one it is)) join consigdests in mi9db.consigdests on consighdrs.consignment equals consigdests .consignment join consigliness in mi9db.consiglines on consigdests.condestint equals consigliness .condestint join productcodess in mi9db.productcodes on consigliness.varint equals productcodess.varint join products in mi9db.products on productcodess.prodint equals products.prodint where consigdests.destination == storeId && consighdrs.status == "T" && consighdrs.warehouse == "900" group new { consigdests, productcodess, consigliness, products } by consigdests.consignment into grp select new GoodInWarehouseBM { pallet_identifier = grp.Key, shipment_items = grp.Select(a => new GoodInWarehouseBM.ShipmentItems { sku = a.productcodess.variantcode, stock_qty = a.consigliness.issueqty, description = a.products.proddesc }).ToList() })).ToList();