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()
                }
            });
        }
        internal static IEnumerable <Expression <Func <InventoryPickOrder, InventoryPickOrderReturn> > > SplitSelectDetails()
        {
            var key = SelectKey();

            return(new Projectors <InventoryPickOrder, InventoryPickOrderReturn>
            {
                o => new InventoryPickOrderReturn
                {
                    InventoryPickOrderKeyReturn = key.Invoke(o)
                },
                { InventoryPickOrderItemProjectors.SplitSelect(), s => o => new InventoryPickOrderReturn
                  {
                      PickOrderItems = o.Items.Select(i => s.Invoke(i))
                  } }
            });
        }
예제 #3
0
        internal static IEnumerable <Expression <Func <SalesOrderItem, SalesOrderItemReturn> > > SplitSelect()
        {
            var key             = SelectKey();
            var contractItemKey = SelectContractItemKey();

            return(new Projectors <SalesOrderItem, SalesOrderItemReturn>
            {
                { InventoryPickOrderItemProjectors.SplitSelect(), p => p.Translate().To <SalesOrderItem, SalesOrderItemReturn>(i => i.InventoryPickOrderItem) },
                i => new SalesOrderItemReturn
                {
                    SalesOrderItemKeyReturn = key.Invoke(i),
                    ContractItemKeyReturn = contractItemKey.Invoke(i),

                    PriceBase = i.PriceBase,
                    PriceFreight = i.PriceFreight,
                    PriceTreatment = i.PriceTreatment,
                    PriceWarehouse = i.PriceWarehouse,
                    PriceRebate = i.PriceRebate
                }
            });
        }