protected override IEnumerable <DistributionProductShow> SearchData() { var lp = VMGlobal.DistributionQuery.LinqOP; var brandIDs = VMGlobal.PoweredBrands.Select(o => o.ID); var childOrganizations = OrganizationListVM.CurrentOrganization.ChildrenOrganizations; var oids = childOrganizations.Select(o => o.ID); var stocktakeContext = lp.Search <BillStocktake>(o => oids.Contains(o.OrganizationID) && !o.IsDeleted && brandIDs.Contains(o.BrandID)); var detailsContext = lp.GetDataContext <BillStocktakeDetails>(); var productContext = lp.GetDataContext <ViewProduct>(); var data = from st in stocktakeContext from details in detailsContext where st.ID == details.BillID from product in productContext where product.ProductID == details.ProductID select new StocktakeEntityForAggregation { ID = st.ID, ProductID = product.ProductID, BrandID = product.BrandID, Code = st.Code, CreateTime = st.CreateTime.Date, Status = st.Status, StorageID = st.StorageID, StyleCode = product.StyleCode, Quantity = details.Quantity, OrganizationID = st.OrganizationID }; var filtedData = (IQueryable <StocktakeEntityForAggregation>)data.Where(FilterDescriptors); return(ReportDataContext.AggregateBill(filtedData)); }
protected override IEnumerable <ProductShow> SearchData() { var lp = VMGlobal.DistributionQuery.LinqOP; var brandIDs = VMGlobal.PoweredBrands.Select(o => o.ID); var storeoutContext = lp.GetDataContext <BillStoreOut>().Where(o => o.OrganizationID == VMGlobal.CurrentUser.OrganizationID && brandIDs.Contains(o.BrandID)); var detailsContext = lp.GetDataContext <BillStoreOutDetails>(); var productContext = lp.GetDataContext <ViewProduct>(); var data = from storeout in storeoutContext from details in detailsContext where storeout.ID == details.BillID from product in productContext where product.ProductID == details.ProductID //&& brandIDs.Contains(product.BrandID) select new StoreOIEntityForAggregation { ProductID = product.ProductID, BrandID = product.BrandID, StorageID = storeout.StorageID, CreateTime = storeout.CreateTime.Date, BillType = storeout.BillType, StyleCode = product.StyleCode, NameID = product.NameID, Quantity = details.Quantity }; data = (IQueryable <StoreOIEntityForAggregation>)data.Where(FilterDescriptors); return(ReportDataContext.AggregateBill(data)); }
protected override IEnumerable <DistributionProductShow> SearchData() { var lp = VMGlobal.DistributionQuery.LinqOP; var oids = OrganizationArray.Select(o => o.ID).ToArray(); var brandIDs = VMGlobal.PoweredBrands.Select(o => o.ID); var goodReturnContext = lp.Search <BillGoodReturn>(o => oids.Contains(o.OrganizationID) && brandIDs.Contains(o.BrandID)); var detailsContext = lp.GetDataContext <BillGoodReturnDetails>(); var productContext = lp.GetDataContext <ViewProduct>(); var data = from goodreturn in goodReturnContext from details in detailsContext where goodreturn.ID == details.BillID from product in productContext where product.ProductID == details.ProductID //&& brandIDs.Contains(product.BrandID) select new MultiStatusBillEntityForAggregation { ProductID = product.ProductID, BrandID = product.BrandID, CreateTime = goodreturn.CreateTime.Date, StyleCode = product.StyleCode, Quantity = details.Quantity, Status = goodreturn.Status, NameID = product.NameID, OrganizationID = goodreturn.OrganizationID }; data = (IQueryable <MultiStatusBillEntityForAggregation>)data.Where(FilterDescriptors); return(ReportDataContext.AggregateBill(data)); }
/// <summary> /// 发货单汇总 /// </summary> private DataTable SearchData() { var lp = VMGlobal.DistributionQuery.LinqOP; var oids = OrganizationArray.Select(o => o.ID).ToArray(); var deliveryContext = lp.Search <BillDelivery>(o => o.OrganizationID == VMGlobal.CurrentUser.OrganizationID); var deliveryDetailsContext = lp.GetDataContext <BillDeliveryDetails>(); var productContext = lp.GetDataContext <ViewProduct>(); var brandIDs = VMGlobal.PoweredBrands.Select(o => o.ID); //FilterBillWithBrand(deliveryContext, filters, brandIDs); //假如未设置机构条件,则默认下级所有机构 //if (!FilterConditionHelper.IsConditionSetted(filters, "ToOrganizationID")) //{ // var oids = OrganizationListVM.CurrentOrganization.ChildrenOrganizations.Select(o => o.ID).ToArray(); // orgContext = orgContext.Where(o => oids.Contains(o.ID)); //} var data = from delivery in deliveryContext from deDetails in deliveryDetailsContext where delivery.ID == deDetails.BillID && oids.Contains(delivery.ToOrganizationID) && brandIDs.Contains(delivery.BrandID) from product in productContext where product.ProductID == deDetails.ProductID //&& brandIDs.Contains(product.BrandID) select new BillDeliveryForAggregation { ProductID = product.ProductID, BrandID = product.BrandID, CreateTime = delivery.CreateTime.Date, //ProductCode = product.ProductCode, //BrandCode = product.BrandCode, StyleCode = product.StyleCode, //ColorCode = product.ColorCode, //SizeName = product.SizeName, //Price = product.Price, Quantity = deDetails.Quantity, Status = delivery.Status, NameID = product.NameID, Year = product.Year, Quarter = product.Quarter }; data = (IQueryable <BillDeliveryForAggregation>)data.Where(FilterDescriptors); return(new BillReportHelper().TransferSizeToHorizontal <DistributionProductShow>(ReportDataContext.AggregateBill(data))); }