Beispiel #1
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()
            })));
        }
Beispiel #2
0
        internal static IEnumerable <Expression <Func <PackSchedule, PackScheduleDetailReturn> > > SplitSelectDetail()
        {
            var productKey        = ProductProjectors.SelectProductKey();
            var productionBatches = ProductionBatchProjectors.SelectSummary();

            return(SplitSelectSummary().Select(ConvertSummaryToDetail)
                   .ToListWithModifiedElement(0, e => e.Merge(p => new PackScheduleDetailReturn
            {
                SummaryOfWork = p.SummaryOfWork,
            }).ExpandAll())
                   .ToAppendedList(
                       Projector <PackSchedule> .To(p => new PackScheduleDetailReturn
            {
                PackagingProductKeyReturn = productKey.Invoke(p.PackagingProduct.Product),
                PackagingProductName = p.PackagingProduct.Product.Name,
                PackagingWeight = p.PackagingProduct.Weight,
            }),
                       Projector <PackSchedule> .To(p => new PackScheduleDetailReturn
            {
                ProductionBatches = p.ProductionBatches.Select(b => productionBatches.Invoke(b))
            })));
        }