public IResult <IInventoryShipmentOrderDetailReturn <IPickOrderDetailReturn <IPickOrderItemReturn>, IPickOrderItemReturn> > GetInterWarehouseOrder(string warehouseOrderKey) { if (warehouseOrderKey == null) { throw new ArgumentNullException("warehouseOrderKey"); } var orderKeyResult = KeyParserHelper.ParseResult <IInventoryShipmentOrderKey>(warehouseOrderKey); if (!orderKeyResult.Success) { return(orderKeyResult.ConvertTo <IInventoryShipmentOrderDetailReturn <IPickOrderDetailReturn <IPickOrderItemReturn>, IPickOrderItemReturn> >()); } var predicate = InventoryShipmentOrderPredicates.ByOrderType(InventoryShipmentOrderTypeEnum.InterWarehouseOrder); predicate = predicate.And(new InventoryShipmentOrderKey(orderKeyResult.ResultingObject).FindByPredicate).ExpandAll(); var select = InventoryShipmentOrderProjectors.SplitSelectInventoryShipmentOrderDetail(_inventoryShipmentOrderUnitOfWork, _timeStamper.CurrentTimeStamp.Date, InventoryOrderEnum.TransWarehouseMovements); var order = _inventoryShipmentOrderUnitOfWork.InventoryShipmentOrderRepository.Filter(predicate).SplitSelect(select).FirstOrDefault(); if (order == null) { return(new InvalidResult <IInventoryShipmentOrderDetailReturn <IPickOrderDetailReturn <IPickOrderItemReturn>, IPickOrderItemReturn> >(null, string.Format(UserMessages.InterWarehouseOrderNotFound, warehouseOrderKey))); } return(new SuccessResult <IInventoryShipmentOrderDetailReturn <IPickOrderDetailReturn <IPickOrderItemReturn>, IPickOrderItemReturn> >(order)); }
public IResult <IInventoryShipmentOrderCertificateOfAnalysisReturn> GetInventoryShipmentOrderCertificateOfAnalysis(string orderKey) { var orderKeyResult = KeyParserHelper.ParseResult <IInventoryShipmentOrderKey>(orderKey); if (!orderKeyResult.Success) { return(orderKeyResult.ConvertTo <IInventoryShipmentOrderCertificateOfAnalysisReturn>()); } var predicate = orderKeyResult.ResultingObject.ToInventoryShipmentOrderKey().FindByPredicate; var select = InventoryShipmentOrderProjectors.SplitSelectCertificateOfAnalysisReturn(); var order = _inventoryShipmentOrderUnitOfWork.InventoryShipmentOrderRepository.Filter(predicate).SplitSelect(select).FirstOrDefault(); if (order == null) { return(new InvalidResult <IInventoryShipmentOrderCertificateOfAnalysisReturn>(null, string.Format(UserMessages.InventoryShipmentOrderNotFound, orderKey))); } if (order.OrderType == InventoryShipmentOrderTypeEnum.SalesOrder) { var customerOrderKey = new SalesOrderKey(orderKeyResult.ResultingObject); var customerOrder = _inventoryShipmentOrderUnitOfWork.SalesOrderRepository.FindByKey(customerOrderKey, o => o.Customer.Company); if (customerOrder == null) { return(new InvalidResult <IInventoryShipmentOrderCertificateOfAnalysisReturn>(null, string.Format(UserMessages.SalesOrderNotFound, customerOrderKey))); } order.DestinationName = customerOrder.Customer == null ? null : customerOrder.Customer.Company.Name; } return(new SuccessResult <IInventoryShipmentOrderCertificateOfAnalysisReturn>(order)); }
public IResult <IInventoryShipmentOrderPickSheetReturn> GetInventoryShipmentOrderPickSheet(string orderKey) { var orderKeyResult = KeyParserHelper.ParseResult <IInventoryShipmentOrderKey>(orderKey); if (!orderKeyResult.Success) { return(orderKeyResult.ConvertTo <IInventoryShipmentOrderPickSheetReturn>()); } var predicate = new InventoryShipmentOrderKey(orderKeyResult.ResultingObject).FindByPredicate; var select = InventoryShipmentOrderProjectors.SplitSelectPickSheet().Merge(); var order = _inventoryShipmentOrderUnitOfWork.InventoryShipmentOrderRepository.Filter(predicate).Select(select).FirstOrDefault(); if (order == null) { return(new InvalidResult <IInventoryShipmentOrderPickSheetReturn>(null, string.Format(UserMessages.InventoryShipmentOrderNotFound, orderKey))); } if (order.OrderType == InventoryShipmentOrderTypeEnum.SalesOrder) { var customerOrderKey = new SalesOrderKey(orderKeyResult.ResultingObject); var customerOrder = _inventoryShipmentOrderUnitOfWork.SalesOrderRepository.FindByKey(customerOrderKey); if (customerOrder == null) { return(new InvalidResult <IInventoryShipmentOrderPickSheetReturn>(null, string.Format(UserMessages.SalesOrderNotFound, customerOrderKey))); } order.ShipFromOrSoldToShippingLabel = customerOrder.SoldTo; } return(new SuccessResult <IInventoryShipmentOrderPickSheetReturn>(order)); }
public IResult <IQueryable <IInventoryShipmentOrderSummaryReturn> > GetInterWarehouseOrders(FilterInterWarehouseOrderParameters parameters) { var predicate = parameters.ParseToPredicate(); if (!predicate.Success) { return(predicate.ConvertTo <IQueryable <IInventoryShipmentOrderSummaryReturn> >()); } var select = InventoryShipmentOrderProjectors.SelectInventoryShipmentOrderSummary(); var query = _inventoryShipmentOrderUnitOfWork.InventoryShipmentOrderRepository.Filter(predicate.ResultingObject).AsExpandable().Select(select); return(new SuccessResult <IQueryable <IInventoryShipmentOrderSummaryReturn> >(query)); }
public IResult <IInventoryShipmentOrderBillOfLadingReturn> GetInventoryShipmentOrderBillOfLading(string orderKey) { var orderKeyResult = KeyParserHelper.ParseResult <IInventoryShipmentOrderKey>(orderKey); if (!orderKeyResult.Success) { return(orderKeyResult.ConvertTo <IInventoryShipmentOrderBillOfLadingReturn>()); } var predicate = new InventoryShipmentOrderKey(orderKeyResult.ResultingObject).FindByPredicate; var select = InventoryShipmentOrderProjectors.SplitSelectBillOfLading(); var order = _inventoryShipmentOrderUnitOfWork.InventoryShipmentOrderRepository.Filter(predicate).SplitSelect(select).FirstOrDefault(); if (order == null) { return(new InvalidResult <IInventoryShipmentOrderBillOfLadingReturn>(null, string.Format(UserMessages.InventoryShipmentOrderNotFound, orderKey))); } return(new SuccessResult <IInventoryShipmentOrderBillOfLadingReturn>(order)); }
internal IResult <IPendingOrderDetails> Get(DateTime startDate, DateTime endDate) { startDate = startDate.ToSimpleDate(); endDate = endDate.ToSimpleDate(); if (startDate > endDate) { var tempDate = endDate; endDate = startDate; startDate = tempDate; } var newStartDate = endDate.AddDays(1); var newEndDate = endDate.AddDays(30); var byDateRange = InventoryShipmentOrderPredicates.ByShipmentDateRange(startDate, endDate); Expression <Func <InventoryShipmentOrder, bool> > customerOrder = o => o.OrderType == InventoryShipmentOrderTypeEnum.SalesOrder && o.OrderStatus != OrderStatus.Void; var scheduledAmount = GetOrderedWeight(_inventoryShipmentOrderUnitOfWork .InventoryShipmentOrderRepository .Filter(byDateRange.AndExpanded(customerOrder))); var shippedAmount = GetOrderedWeight(_inventoryShipmentOrderUnitOfWork .InventoryShipmentOrderRepository .Filter(byDateRange.AndExpanded(customerOrder).AndExpanded(o => o.ShipmentInformation.Status == ShipmentStatus.Shipped))); var remainingAmount = GetOrderedWeight(_inventoryShipmentOrderUnitOfWork .InventoryShipmentOrderRepository .Filter(byDateRange.AndExpanded(customerOrder).AndExpanded(o => o.ShipmentInformation.Status != ShipmentStatus.Shipped))); var newAmount = GetOrderedWeight(_inventoryShipmentOrderUnitOfWork .InventoryShipmentOrderRepository .Filter(InventoryShipmentOrderPredicates.ByShipmentDateRange(newStartDate, newEndDate).AndExpanded(customerOrder))); var pendingCustomerOrders = _inventoryShipmentOrderUnitOfWork .SalesOrderRepository .Filter(o => o.InventoryShipmentOrder.ShipmentInformation.Status != ShipmentStatus.Shipped && o.InventoryShipmentOrder.OrderStatus != OrderStatus.Void) .Select(SalesOrderProjectors.SelectPendingOrderDetails()) .ToList(); var pendingWarehouseOrders = _inventoryShipmentOrderUnitOfWork .InventoryShipmentOrderRepository .Filter(o => (o.OrderType == InventoryShipmentOrderTypeEnum.InterWarehouseOrder || o.OrderType == InventoryShipmentOrderTypeEnum.ConsignmentOrder) && o.ShipmentInformation.Status != ShipmentStatus.Shipped && o.OrderStatus != OrderStatus.Void) .Select(InventoryShipmentOrderProjectors.SelectPendingWarehouseOrder()) .ToList(); pendingWarehouseOrders.ForEach(o => o.Initialize()); return(new SuccessResult <IPendingOrderDetails>(new PendingOrderDetails { Now = DateTime.Now.ToSimpleDate(), StartDate = startDate, EndDate = endDate, NewStartDate = newStartDate, NewEndDate = newEndDate, ScheduledAmount = (int)scheduledAmount, ShippedAmount = (int)shippedAmount, RemainingAmount = (int)remainingAmount, NewAmount = (int)newAmount, PendingCustomerOrders = pendingCustomerOrders, PendingWarehouseOrders = pendingWarehouseOrders })); }
public IResult <IQueryable <IShipmentOrderSummaryReturn> > GetShipments() { var query = _inventoryShipmentOrderUnitOfWork.InventoryShipmentOrderRepository.All().SplitSelect(InventoryShipmentOrderProjectors.SplitSelectSummary()); return(new SuccessResult <IQueryable <IShipmentOrderSummaryReturn> >(query)); }