示例#1
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(),
                })
            });
        }
示例#2
0
        internal static IEnumerable <Expression <Func <PackSchedule, ProductionPacketReturn> > > SplitSelectProductionPacket(IInventoryUnitOfWork inventoryUnitOfWork, DateTime currentDate, ILotKey batchKey = null)
        {
            var packScheduleKey          = SelectKey();
            var companyHeader            = CompanyProjectors.SelectHeader();
            var workType                 = WorkTypeProjectors.Select();
            var chileProduct             = ProductProjectors.SelectProduct();
            var productKeyName           = ProductProjectors.SelectProductKeyName();
            var productionBatchPredicate = batchKey != null?ProductionBatchPredicates.ByLotKey(batchKey) : b => true;

            return(ProductionBatchProjectors.SplitSelectProductionPacket(inventoryUnitOfWork, currentDate)
                   .Select(b => Projector <PackSchedule> .To(p => new ProductionPacketReturn
            {
                Batches = p.ProductionBatches.Where(a => productionBatchPredicate.Invoke(a)).Select(a => b.Invoke(a))
            }))
                   .ToAppendedList(Projector <PackSchedule> .To(p => new ProductionPacketReturn
            {
                PackScheduleKeyReturn = packScheduleKey.Invoke(p),
                PSNum = p.PSNum,
                DateCreated = p.DateCreated,
                SummaryOfWork = p.SummaryOfWork
            }),
                                   Projector <PackSchedule> .To(p => new ProductionPacketReturn
            {
                ChileProduct = chileProduct.Invoke(p.ChileProduct.Product),
                PackagingProduct = productKeyName.Invoke(p.PackagingProduct.Product)
            }),
                                   Projector <PackSchedule> .To(p => new ProductionPacketReturn
            {
                ProductionLineDescription = p.ProductionLineLocation.Description,
                WorkType = workType.Invoke(p.WorkType),
                Customer = new[] { p.Customer }.Where(c => c != null).Select(c => companyHeader.Invoke(c.Company)).FirstOrDefault()
            })));
        }
示例#3
0
        internal static Expression <Func <PackSchedule, ProductionRecapBatch> > SelectProductionRecap()
        {
            var packScheduleKey = SelectKey();
            var workType        = WorkTypeProjectors.Select();

            return(p => new ProductionRecapBatch
            {
                PSNum = p.PSNum,
                PackScheduleKeyReturn = packScheduleKey.Invoke(p),
                WorkType = workType.Invoke(p.WorkType)
            });
        }
示例#4
0
        internal static IEnumerable <Expression <Func <ProductionBatch, ProductionBatchDetailReturn> > > SplitSelectDetail(Data.Interfaces.UnitsOfWork.IProductionUnitOfWork productionUnitOfWork, DateTime currentDate)
        {
            if (productionUnitOfWork == null)
            {
                throw new ArgumentNullException("productionUnitOfWork");
            }

            var packScheduleKey      = PackScheduleProjectors.SelectKey();
            var productKey           = ProductProjectors.SelectProductKey();
            var chileProduct         = ProductProjectors.SelectChileProductWithIngredients();
            var workType             = WorkTypeProjectors.Select();
            var notebook             = NotebookProjectors.Select();
            var pickedChile          = PickedInventoryProjectors.SelectPickedChileInventoryItem(productionUnitOfWork);
            var pickedPackaging      = PickedInventoryProjectors.SelectPickedPackagingInventoryItem(productionUnitOfWork);
            var pickedAdditve        = PickedInventoryProjectors.SelectPickedAdditiveInventoryItem(productionUnitOfWork);
            var pickedItemProjectors = PickedInventoryItemProjectors.SplitSelect(productionUnitOfWork, currentDate);

            return(new[]
            {
                SelectSummary().Merge(b => new ProductionBatchDetailReturn
                {
                    HasProductionBeenCompleted = b.ProductionHasBeenCompleted,
                }).ExpandAll(),
                Projector <ProductionBatch> .To(b => new ProductionBatchDetailReturn
                {
                    PackScheduleKeyReturn = packScheduleKey.Invoke(b.PackSchedule),
                    ChileProductKeyReturn = productKey.Invoke(b.Production.ResultingChileLot.ChileProduct.Product),
                    ChileProductName = b.Production.ResultingChileLot.ChileProduct.Product.Name,
                    ChileProductWithIngredients = chileProduct.Invoke(b.Production.ResultingChileLot.ChileProduct)
                }),
                Projector <ProductionBatch> .To(b => new ProductionBatchDetailReturn
                {
                    WorkType = workType.Invoke(b.PackSchedule.WorkType),
                    InstructionsNotebook = notebook.Invoke(b.InstructionNotebook)
                }),
                Projector <ProductionBatch> .To(b => new ProductionBatchDetailReturn
                {
                    PickedChileItems = pickedChile.Invoke(b.Production.PickedInventory),
                    PickedPackagingItems = pickedPackaging.Invoke(b.Production.PickedInventory),
                    PickedAdditiveItems = pickedAdditve.Invoke(b.Production.PickedInventory)
                })
            }.ToAppendedList(pickedItemProjectors.Select(p => Projector <ProductionBatch> .To(b => new ProductionBatchDetailReturn
            {
                PickedInventoryItems = b.Production.PickedInventory.Items.Select(i => p.Invoke(i))
            }))));
        }