Пример #1
0
        public IEnumerable <PixInventoryAdjustment> GetUnprocessedInventoryAdjustments()
        {
            var inventoryAdjustmentCriteria = new PerpetualInventoryTransactionCriteria
            {
                ProcessType     = ProcessType.InventoryAdjustment,
                TransactionType = TransactionType.InventoryAdjustment
            };

            var pixInventoryAdjustements = _perpetualInventoryTransferRepository.FindPerpetualInventoryTransfers(inventoryAdjustmentCriteria);

            return(pixInventoryAdjustements.Select(pixInventoryAdjustement => new PixInventoryAdjustment(pixInventoryAdjustement)).ToList());
        }
Пример #2
0
        public IEnumerable <PixReturn> GetUnprocessedReturns()
        {
            var returnCriteria = new PerpetualInventoryTransactionCriteria
            {
                TransactionCode = TransactionCode.Return,
                TransactionType = TransactionType.QuantityAdjust,
                ProcessType     = ProcessType.Return
            };

            var pixReturns = _perpetualInventoryTransferRepository.FindPerpetualInventoryTransfers(returnCriteria);

            return(pixReturns.Select(pixReturn => new PixReturn(pixReturn)).ToList());
        }
Пример #3
0
        private void NotifyReceivedPurchaseOrders()
        {
            _log.Info("Searching for received purchase orders");
            var criteria = new PerpetualInventoryTransactionCriteria()
            {
                ProcessType     = ProcessType.PurchaseOrderReceiptNotification,
                TransactionType = TransactionType.QuantityAdjust
            };

            var poReceiptRecords    = _repository.FindPerpetualInventoryTransfers(criteria);
            var adjustmentsToIgnore = poReceiptRecords.Where(adj => String.IsNullOrWhiteSpace(adj.Ponumber)).ToList();

            MarkNotificationRecordsAsProcessed(adjustmentsToIgnore, ProcessType.PurchaseOrderReceiptNotification);

            var recordsWithPos = poReceiptRecords.Except(adjustmentsToIgnore).ToList();
            var distinctPos    = recordsWithPos.Select(item => item.Ponumber).Distinct().ToList();

            foreach (var poNumber in distinctPos)
            {
                var receiptRecord             = recordsWithPos.First(r => r.Ponumber == poNumber);
                var inventoryAdjustmentsForPo = _repository.FindPerpetualInventoryTransfers(
                    new PerpetualInventoryTransactionCriteria()
                {
                    ProcessType         = ProcessType.PurchaseOrderReceiptNotification,
                    PurchaseOrderNumber = poNumber,
                    TransactionType     = TransactionType.InventoryAdjustment
                });

                var firstPoInventoryAdjustment = recordsWithPos
                                                 .Where(r => r.Ponumber == poNumber)
                                                 .OrderBy(r => MainframeExtensions.ParseDateTime(r.DateCreated, r.TimeCreated))
                                                 .First();
                var receiptList = SumPixItems(inventoryAdjustmentsForPo);
                var receipt     = new PurchaseOrderReceiptEvent(
                    firstPoInventoryAdjustment.Ponumber,
                    MainframeExtensions.ParseDateTime(firstPoInventoryAdjustment.DateCreated, firstPoInventoryAdjustment.TimeCreated),
                    receiptList
                    );
                try
                {
                    _apiAccess.PurchaseOrderReceived(receipt);
                }
                catch (Exception ex)
                {
                    _log.Exception("Failed to notify service of PO Receipt", ex);
                }
                var toMarkComplete = inventoryAdjustmentsForPo.Concat(new[] { receiptRecord }).ToList();
                MarkNotificationRecordsAsProcessed(toMarkComplete, ProcessType.PurchaseOrderReceiptNotification);
            }
        }
Пример #4
0
        private void NotifyInventoryAdjustments()
        {
            _log.Info("Searching for inventory adjustments");
            var criteria = new PerpetualInventoryTransactionCriteria()
            {
                ProcessType     = ProcessType.InventoryAdjustmentNotification,
                TransactionType = TransactionType.InventoryAdjustment
            };

            IEnumerable <ManhattanPerpetualInventoryTransfer> items = _repository.FindPerpetualInventoryTransfers(criteria);
            var nonPoStockedAdjustments = items.Where(item => String.IsNullOrWhiteSpace(item.Ponumber));
            var poStockedAdjustments    = items.Except(nonPoStockedAdjustments).ToList();

            if (nonPoStockedAdjustments.Any())
            {
                NotifyPhysicalInventoryChanged(nonPoStockedAdjustments);
            }
            if (poStockedAdjustments.Any())
            {
                NotifyStockedPurchaseOrders(poStockedAdjustments);
            }
        }
        public IEnumerable <ManhattanPerpetualInventoryTransfer> FindPerpetualInventoryTransfers(PerpetualInventoryTransactionCriteria criteria)
        {
            var searchArguments = new DynamicParameters();

            if (!string.IsNullOrEmpty(criteria.TransactionType))
            {
                searchArguments.Add("@TransactionType", criteria.TransactionType, DbType.String);
            }

            if (!string.IsNullOrEmpty(criteria.TransactionType))
            {
                searchArguments.Add("@TransactionCode", criteria.TransactionCode, DbType.String);
            }

            if (!string.IsNullOrEmpty(criteria.ProcessType))
            {
                searchArguments.Add("@ProcessType", criteria.ProcessType, DbType.String);
            }

            if (!string.IsNullOrEmpty(criteria.PurchaseOrderNumber))
            {
                searchArguments.Add("@Ponumber", criteria.PurchaseOrderNumber, DbType.String);
            }
            using (var connection = DatabaseConnectionFactory.GetWarehouseManagementTransactionConnection())
            {
                return(connection.Query <ManhattanPerpetualInventoryTransfer>("sp_FindManhattanPerpetualInventoryTransfers",
                                                                              searchArguments,
                                                                              commandType: CommandType.StoredProcedure,
                                                                              commandTimeout: 120));
            }
        }