private static IEnumerable <Expression <Func <LotProductionResults, ProductionResultReturn> > > SplitSelectReturn()
        {
            var productionLocationKey = LocationProjectors.SelectLocationKey();
            var lotKey     = LotProjectors.SelectLotKey <LotProductionResults>();
            var productKey = ProductProjectors.SelectProductKey();

            return(new[]
            {
                SelectBase().Merge(r => new ProductionResultReturn
                {
                    LotKeyReturn = lotKey.Invoke(r),
                    DateTimeEntered = r.DateTimeEntered,
                    ProductionStartDate = r.ProductionBegin
                }).ExpandAll(),

                Projector <LotProductionResults> .To(r => new ProductionResultReturn
                {
                    User = r.Employee.UserName,
                    ProductionLocationKeyReturn = productionLocationKey.Invoke(r.ProductionLineLocation)
                }),

                Projector <LotProductionResults> .To(r => new ProductionResultReturn
                {
                    ChileProductName = r.Production.ResultingChileLot.ChileProduct.Product.Name,
                    ChileProductKeyReturn = productKey.Invoke(r.Production.ResultingChileLot.ChileProduct.Product)
                })
            });
        }
        internal static IEnumerable <Expression <Func <PickedInventoryItem, PickSheetItemReturn> > > SplitSelectPickSheetItem()
        {
            var key              = SelectKey();
            var lotKey           = LotProjectors.SelectLotKey <Lot>();
            var locationKey      = LocationProjectors.SelectLocationKey();
            var loBac            = LotProjectors.SelectLoBac();
            var lotProduct       = LotProjectors.SelectDerivedProduct();
            var packagingProduct = ProductProjectors.SelectPackagingProduct();
            var treatment        = InventoryTreatmentProjectors.SelectInventoryTreatment();

            return(new Projectors <PickedInventoryItem, PickSheetItemReturn>
            {
                i => new PickSheetItemReturn
                {
                    LocationKeyReturn = locationKey.Invoke(i.FromLocation),
                    Description = i.FromLocation.Description,
                    PickedInventoryItemKeyReturn = key.Invoke(i),
                    LotKeyReturn = lotKey.Invoke(i.Lot),
                    Quantity = i.Quantity,
                    LoBac = loBac.Invoke(i.Lot),
                    CustomerProductCode = i.CustomerProductCode
                },
                i => new PickSheetItemReturn
                {
                    LotProduct = lotProduct.Invoke(i.Lot),
                    InventoryTreatment = treatment.Invoke(i.Treatment)
                },
                i => new PickSheetItemReturn
                {
                    PackagingProduct = packagingProduct.Invoke(i.PackagingProduct),
                    NetWeight = i.Quantity * i.PackagingProduct.Weight
                }
            });
        }
Пример #3
0
        internal static IEnumerable <Expression <Func <PackSchedule, PackScheduleSummaryReturn> > > SplitSelectSummary()
        {
            var productionLocationKey = LocationProjectors.SelectLocationKey();
            var workTypeKey           = WorkTypeProjectors.SelectWorkTypeKey();
            var productKey            = ProductProjectors.SelectProductKey();
            var company = CustomerProjectors.SelectCompanyHeader();

            return(new[]
            {
                SelectBaseParameters().Merge(p => new PackScheduleSummaryReturn
                {
                    DateCreated = p.DateCreated,
                    ScheduledProductionDate = p.ScheduledProductionDate,
                    ProductionDeadline = p.ProductionDeadline,
                    OrderNumber = p.OrderNumber
                }).ExpandAll(),
                Projector <PackSchedule> .To(p => new PackScheduleSummaryReturn
                {
                    WorkTypeKeyReturn = workTypeKey.Invoke(p.WorkType),
                    ChileProductKeyReturn = productKey.Invoke(p.ChileProduct.Product),
                    ChileProductName = p.ChileProduct.Product.Name,
                }),
                Projector <PackSchedule> .To(p => new PackScheduleSummaryReturn
                {
                    ProductionLocationKeyReturn = productionLocationKey.Invoke(p.ProductionLineLocation),
                    Customer = new[] { p.Customer }.Where(c => c != null).Select(c => company.Invoke(c)).FirstOrDefault(),
                })
            });
        }
Пример #4
0
        private static Expression <Func <ChileLotProduction, MillAndWetdownReturn> > SelectBase()
        {
            var lotKey                = LotProjectors.SelectLotKey <ChileLotProduction>();
            var productKey            = ProductProjectors.SelectProductKey();
            var productionLocationKey = LocationProjectors.SelectLocationKey();

            return(m => new MillAndWetdownReturn
            {
                OutputChileLotKeyReturn = lotKey.Invoke(m),
                ChileProductKeyReturn = productKey.Invoke(m.ResultingChileLot.ChileProduct.Product),
                ProductionLineLocationKeyReturn = productionLocationKey.Invoke(m.Results.ProductionLineLocation),

                ShiftKey = m.Results.ShiftKey,
                ProductionLineDescription = m.Results.ProductionLineLocation.Description,
                ChileProductName = m.ResultingChileLot.ChileProduct.Product.Name,

                ProductionBegin = m.Results.ProductionBegin,
                ProductionEnd = m.Results.ProductionEnd,
                TotalProductionTimeMinutes = EntityFunctions.DiffMinutes(m.Results.ProductionBegin, m.Results.ProductionEnd) ?? 0,
                TotalWeightProduced = m.Results.ResultItems.Any() ? (int)m.Results.ResultItems.Sum(i => i.PackagingProduct.Weight * i.Quantity) : 0,
                TotalWeightPicked = m.PickedInventory.Items.Any() ? (int)m.PickedInventory.Items.Sum(i => i.PackagingProduct.Weight * i.Quantity) : 0
            });
        }