Ejemplo n.º 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(),
                })
            });
        }
        internal static IEnumerable <Expression <Func <InventoryShipmentOrder, InventoryShipmentOrderPickSheetReturn> > > SplitSelectPickSheet()
        {
            var key           = SelectKey();
            var item          = PickedInventoryItemProjectors.SplitSelectPickSheetItem().Merge(); //Necessary to avoid likely EF-Split bug in subsequent group selection. -RI 2015/04/15
            var customerNotes = CustomerProjectors.SelectNotes();
            var shipment      = ShipmentInformationProjectors.SelectShipmentInformation();

            return(new Projectors <InventoryShipmentOrder, InventoryShipmentOrderPickSheetReturn>
            {
                o => new InventoryShipmentOrderPickSheetReturn
                {
                    OrderType = o.OrderType,
                    InventoryShipmentOrderKeyReturn = key.Invoke(o),
                    MovementNumber = o.MoveNum,
                    PurchaseOrderNumber = o.PurchaseOrderNumber,
                    ShipmentInformation = shipment.Invoke(o.ShipmentInformation)
                },
                o => new InventoryShipmentOrderPickSheetReturn
                {
                    CustomerNotes = o.InventoryPickOrder.Items.Select(i => i.Customer).Distinct()
                                    .Where(c => c != null && c.Notes.Any())
                                    .Select(c => customerNotes.Invoke(c))
                },
                o => new InventoryShipmentOrderPickSheetReturn
                {
                    Items = o.PickedInventory.Items.Select(i => item.Invoke(i))
                }
            });
        }
Ejemplo n.º 3
0
        internal static Expression <Func <LotCustomerAllowance, LotCustomerAllowanceReturn> > Select()
        {
            var customerKey = CustomerProjectors.SelectKey();

            return(a => new LotCustomerAllowanceReturn
            {
                CustomerKeyReturn = customerKey.Invoke(a.Customer),
                CustomerName = a.Customer.Company.Name
            });
        }
        internal static Expression <Func <LotSalesOrderAllowance, LotCustomerOrderAllowanceReturn> > Select()
        {
            var customerOrderKeyReturn = SalesOrderProjectors.SelectKey();
            var customerKey            = CustomerProjectors.SelectKey();

            return(a => new LotCustomerOrderAllowanceReturn
            {
                SalesOrderKeyReturn = customerOrderKeyReturn.Invoke(a.SalesOrder),
                OrderNumber = a.SalesOrder.InventoryShipmentOrder.MoveNum,
                CustomerKeyReturn = customerKey.Invoke(a.SalesOrder.Customer),
                CustomerName = a.SalesOrder.Customer.Company.Name
            });
        }
        internal static IEnumerable <Expression <Func <InventoryShipmentOrder, InternalOrderAcknowledgementReturn> > > SplitSelectAcknowledgement(IQueryable <SalesOrder> salesOrders)
        {
            var key           = SelectKey();
            var shipment      = ShipmentInformationProjectors.SelectShipmentInformation();
            var pickOrderItem = InventoryPickOrderItemProjectors.SplitSelect();
            var customerNotes = CustomerProjectors.SelectNotes();
            var salesOrder    = SalesOrderProjectors.SelectWarehouseAcknowlegement();

            return(new Projectors <InventoryShipmentOrder, InternalOrderAcknowledgementReturn>
            {
                o => new InternalOrderAcknowledgementReturn
                {
                    InventoryShipmentOrderKeyReturn = key.Invoke(o),
                    MovementNumber = o.MoveNum,
                    OrderType = o.OrderType,
                    PurchaseOrderNumber = o.PurchaseOrderNumber,
                    DateReceived = o.DateReceived,
                    RequestedBy = o.RequestedBy,
                    TakenBy = o.TakenBy,
                    OriginFacility = o.SourceFacility.Name
                },
                o => new InternalOrderAcknowledgementReturn
                {
                    ShipmentInformation = shipment.Invoke(o.ShipmentInformation)
                },
                { pickOrderItem, p => Projector <InventoryShipmentOrder> .To(o => new InternalOrderAcknowledgementReturn
                    {
                        PickOrderItems = o.InventoryPickOrder.Items.Select(i => p.Invoke(i))
                    }) },
                o => new InternalOrderAcknowledgementReturn
                {
                    TotalQuantity = o.InventoryPickOrder.Items.Select(i => i.Quantity).DefaultIfEmpty(0).Sum(),
                    NetWeight = o.InventoryPickOrder.Items.Select(i => i.Quantity * i.PackagingProduct.Weight).DefaultIfEmpty(0).Sum(),
                    TotalGrossWeight = o.InventoryPickOrder.Items.Select(i => i.Quantity * (i.PackagingProduct.Weight + i.PackagingProduct.PackagingWeight)).DefaultIfEmpty(0).Sum(),
                    PalletWeight = o.InventoryPickOrder.Items.Select(i => i.Quantity * (i.PackagingProduct.PalletWeight)).DefaultIfEmpty(0).Sum(),
                    EstimatedShippingWeight = o.InventoryPickOrder.Items.Select(i => i.Quantity * (i.PackagingProduct.Weight + i.PackagingProduct.PackagingWeight + i.PackagingProduct.PalletWeight)).DefaultIfEmpty(0).Sum()
                },
                o => new InternalOrderAcknowledgementReturn
                {
                    CustomerNotes = o.InventoryPickOrder.Items.Select(i => i.Customer).Distinct()
                                    .Where(c => c != null && c.Notes.Any())
                                    .Select(c => customerNotes.Invoke(c))
                },
                o => new InternalOrderAcknowledgementReturn
                {
                    SalesOrder = salesOrders.Where(c => c.DateCreated == o.DateCreated && c.Sequence == o.Sequence)
                                 .Select(c => salesOrder.Invoke(c)).FirstOrDefault()
                }
            });
        }
Ejemplo n.º 6
0
        internal static Expression <Func <LotContractAllowance, LotContractAllowanceReturn> > Select()
        {
            var contractKey = ContractProjectors.SelectKey();
            var customerKey = CustomerProjectors.SelectKey();

            return(a => new LotContractAllowanceReturn
            {
                ContractKeyReturn = contractKey.Invoke(a.Contract),
                TermBegin = a.Contract.TermBegin,
                TermEnd = a.Contract.TermEnd,
                CustomerKeyReturn = customerKey.Invoke(a.Contract.Customer),
                CustomerName = a.Contract.Customer.Company.Name
            });
        }
Ejemplo n.º 7
0
        private static Expression <Func <PackSchedule, CustomerWithProductSpecReturn> > SelectCustomerSpec()
        {
            var customer = CustomerProjectors.SelectProductSpec();

            return(p => new[] { p.Customer }.Where(c => c != null).Select(c => customer.Invoke(c, p.ChileProductId)).FirstOrDefault());
        }
Ejemplo n.º 8
0
        internal static Expression <Func <PackSchedule, CompanyHeaderReturn> > SelectCustomerHeader()
        {
            var customer = CustomerProjectors.SelectCompanyHeader();

            return(p => new[] { p.Customer }.Where(c => c != null).Select(c => customer.Invoke(c)).FirstOrDefault());
        }