Ejemplo n.º 1
0
        internal static IEnumerable <Expression <Func <ProductionBatch, ProductionPacketBatchReturn> > > SplitSelectProductionPacket(IInventoryUnitOfWork inventoryUnitOfWork, DateTime currentDate)
        {
            if (inventoryUnitOfWork == null)
            {
                throw new ArgumentNullException("inventoryUnitOfWork");
            }

            var lotKey       = LotProjectors.SelectLotKey <ProductionBatch>();
            var pickedItem   = PickedInventoryItemProjectors.SplitSelect(inventoryUnitOfWork, currentDate);
            var instructions = NotebookProjectors.Select();

            return(pickedItem.Select(p => Projector <ProductionBatch> .To(b => new ProductionPacketBatchReturn
            {
                PickedItems = b.Production.PickedInventory.Items.Select(i => p.Invoke(i))
            }))
                   .ToAppendedList(b => new ProductionPacketBatchReturn
            {
                LotKeyReturn = lotKey.Invoke(b),
                Notes = b.Production.ResultingChileLot.Lot.Notes,
                TargetParameters = new ProductionBatchTargetParametersReturn
                {
                    BatchTargetWeight = b.TargetParameters.BatchTargetWeight,
                    BatchTargetAsta = b.TargetParameters.BatchTargetAsta,
                    BatchTargetScoville = b.TargetParameters.BatchTargetScoville,
                    BatchTargetScan = b.TargetParameters.BatchTargetScan
                }
            },
                                   b => new ProductionPacketBatchReturn
            {
                Instructions = instructions.Invoke(b.InstructionNotebook)
            }));
        }
Ejemplo n.º 2
0
        internal static IEnumerable <Expression <Func <InventoryAdjustment, InventoryAdjustmentReturn> > > SplitSelect(ILotUnitOfWork lotUnitOfWork)
        {
            if (lotUnitOfWork == null)
            {
                throw new ArgumentNullException("lotUnitOfWork");
            }

            var key        = SelectKey();
            var notebook   = NotebookProjectors.Select();
            var selectItem = InventoryAdjustmentItemProjectors.Select(lotUnitOfWork);

            return(new[]
            {
                Projector <InventoryAdjustment> .To(a => new InventoryAdjustmentReturn
                {
                    InventoryAdjustmentKeyReturn = key.Invoke(a),

                    AdjustmentDate = a.AdjustmentDate,
                    User = a.Employee.UserName,
                    TimeStamp = a.TimeStamp,

                    Notebook = notebook.Invoke(a.Notebook)
                }),
                Projector <InventoryAdjustment> .To(a => new InventoryAdjustmentReturn
                {
                    Items = a.Items.Select(i => selectItem.Invoke(i))
                })
            });
        }
Ejemplo n.º 3
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))
            }))));
        }
Ejemplo n.º 4
0
        internal static IEnumerable <Expression <Func <Contract, ContractDetailReturn> > > SelectDetail()
        {
            var item     = ContractItemProjectors.Select();
            var notebook = NotebookProjectors.Select();

            return(SelectContractBase().Select(c => c.Merge(Projector <Contract> .To(n => new ContractDetailReturn {
            })))
                   .ToAppendedList(Projector <Contract> .To(c => new ContractDetailReturn
            {
                NotesToPrint = c.NotesToPrint,
                ContactAddress = c.ContactAddress,
                Comments = notebook.Invoke(c.Comments)
            }))
                   .ToAppendedList(item.Select(itemProjector => Projector <Contract> .To(c => new ContractDetailReturn
            {
                ContractItems = c.ContractItems.Select(i => itemProjector.Invoke(i))
            }))));
        }