예제 #1
0
        private static List <TransferControlMaster> MapTransforControlFromManhattanFile(string controlFile)
        {
            var transferControlMasterRepository = new DataFileRepository <TransferControlMaster>();
            var masterControlMapping            = transferControlMasterRepository.Get(controlFile).ToList();

            return(masterControlMapping);
        }
 public IList <ManhattanPickTicketInstruction> GetManhattanPickTicketInstructions(string instructionsFileLocation)
 {
     if (instructionsFileLocation == null)
     {
         throw new ArgumentNullException("instructionsFileLocation");
     }
     return(_instructionRepository.Get(instructionsFileLocation).ToList());
 }
 public IList <ManhattanPickTicketDetail> GetManhattanPickTicketDetails(string detailsFileLocation)
 {
     if (detailsFileLocation == null)
     {
         throw new ArgumentNullException("detailsFileLocation");
     }
     return(_detailRepository.Get(detailsFileLocation).ToList());
 }
 public IList <ManhattanPickTicketHeader> GetManhattanPickTicketHeaders(string headerFileLocation)
 {
     if (headerFileLocation == null)
     {
         throw new ArgumentNullException("headerFileLocation");
     }
     return(_headerRepository.Get(headerFileLocation).ToList());
 }
예제 #5
0
        protected override void ProcessFiles(ICollection <TransferControlFile> transferControlFiles)
        {
            if (transferControlFiles.Count != 1)
            {
                throw new ArgumentOutOfRangeException("transferControlFiles", "Expected one file, found " + transferControlFiles.Count);
            }

            var file          = transferControlFiles.First();
            var pixRepository = new DataFileRepository <ManhattanPerpetualInventoryTransfer>();
            var pixList       = pixRepository.Get(file.FileLocation).ToList();

            _perpetualInventoryTransferRepository.InsertPerpetualInventoryTransfer(pixList);
            LogInsert(pixList, file);
        }
예제 #6
0
        private void ProcessFile(TransferControlFile file)
        {
            var shipmentHeaderRespository = new DataFileRepository <ManhattanShipmentHeader>();
            var shipmentDetailRespository = new DataFileRepository <ManhattanShipmentLineItem>();
            var cartonHeaderRespository   = new DataFileRepository <ManhattanShipmentCartonHeader>();
            var cartonDetailRespository   = new DataFileRepository <ManhattanShipmentCartonDetail>();

            var fileInfo = new FileInfo(file.FileLocation);
            var fileType = fileInfo.Name.Substring(0, 2);

            switch (fileType)
            {
            case ManhattanDataFileType.ShipmentHeader:
                var shipmentHeader = shipmentHeaderRespository.Get(fileInfo.FullName).ToList();
                _shipmentRepository.InsertShipmentHeaders(shipmentHeader);
                LogInsert(shipmentHeader, file);
                break;

            case ManhattanDataFileType.ShipmentDetail:
                var shipmentDetail = shipmentDetailRespository.Get(fileInfo.FullName).ToList();
                _shipmentRepository.InsertShipmentLineItems(shipmentDetail);
                LogInsert(shipmentDetail, file);
                break;

            case ManhattanDataFileType.CartonHeader:
                var cartonHeader = cartonHeaderRespository.Get(fileInfo.FullName).ToList();
                _shipmentRepository.InsertShipmentCartonHeaders(cartonHeader);
                LogInsert(cartonHeader, file);
                break;

            case ManhattanDataFileType.CartonDetail:
                var cartonDetail = cartonDetailRespository.Get(fileInfo.FullName).ToList();
                _shipmentRepository.InsertShipmentCartonDetails(cartonDetail);
                LogInsert(cartonDetail, file);
                break;
            }
        }
예제 #7
0
        protected override void ProcessFiles(ICollection <TransferControlFile> transferControlFiles)
        {
            if (transferControlFiles.Count != 1)
            {
                throw new ArgumentOutOfRangeException("transferControlFiles",
                                                      "Expected one file, found " + transferControlFiles.Count);
            }

            //1) STL INVENTORY UPDATE - Clean PIX/Shipments before loading the sync file.
            var stlInventoryUpdateJob = new StlInventoryUpdateJob(_log,
                                                                  _stlInventoryUpdateRepository,
                                                                  _shipmentInventoryAdjustmentRepository,
                                                                  _perpetualInventoryTransferRepository,
                                                                  _pixInventoryAdjustmentRepository);

            stlInventoryUpdateJob.RunUnitOfWork("Stl Inventory Update");

            var transferControlFile = transferControlFiles.First();

            var pixRepository = new DataFileRepository <ManhattanInventorySync>();
            var inventorySync = pixRepository.Get(transferControlFile.FileLocation).ToList();

            //2) Load the I5 sync file into our RAW Table.
            _inventorySyncRepository.InsertInventorySync(inventorySync);

            if (inventorySync.Count > 0)
            {
                _inventorySyncRepository.SetAsReceived(new InventorySyncProcessing
                {
                    TransactionNumber    = inventorySync.First().TransactionNumber,
                    ReceivedDate         = DateTime.Now,
                    ManhattanDateCreated = inventorySync.First().DateCreated,
                    ManhattanTimeCreated = inventorySync.First().TimeCreated
                });
            }

            LogInsert(inventorySync, transferControlFile);


            //3)VALIDATION - ABORT THE SYNC IF THE LAST APPLIED PIX/SHIPMENT HAS TIMESTAMP GREATER THAN OUR SYNC FILE'S (scenario would cause inaccurate inventory)
            var inventorySyncStatus = _inventorySyncRepository.GetInventorySyncStatus(inventorySync.First().TransactionNumber);

            if (!inventorySyncStatus.IsValid)
            {
                _log.Debug(string.Format("Inventory Sync {0} is Stale - {1}", inventorySync.First().TransactionNumber, inventorySyncStatus.Message));
                EmailAuditSummary(null, inventorySync.First().TransactionNumber);
            }
            else
            {
                //4) Load the Sync data into Stl Inventory Table.
                var latestManhattanInventorySync = _stlInventoryRepository.GetLatestManhattanInventorySync().ToList();

                if (latestManhattanInventorySync.Count > 0)
                {
                    using (var transactionScope = Scope.CreateTransactionScope())
                    {
                        _stlInventoryRepository.InsertStlInventory(latestManhattanInventorySync);

                        _log.Debug("Inserted " + latestManhattanInventorySync.Count() + " records from latest InventorySync data");

                        _inventorySyncRepository.SetAsProcessed(new InventorySyncProcessing
                        {
                            TransactionNumber = latestManhattanInventorySync.First().ManhattanInventorySyncTransactionNumber,
                            ProcessedDate     = latestManhattanInventorySync.First().InventoryDate
                        });

                        transactionScope.Complete();
                    }

                    var logBuilder = new StringBuilder();
                    logBuilder.AppendLine("---AUDIT REPORT---");

                    var auditEntries = _stlInventoryRepository.GetStlInventorySyncAudit().ToList();
                    if (auditEntries.Count > 0)
                    {
                        logBuilder.AppendLine("STATUS | SKU | QUANTITY");

                        foreach (var entry in auditEntries)
                        {
                            logBuilder.AppendLine(string.Format("{0} | {1} | {2}", entry.Status, entry.Upc, entry.Quantity));
                        }
                    }
                    else
                    {
                        logBuilder.AppendLine("SYNC MATCHES CURRENT INVENTORY");
                    }
                    _log.Debug(logBuilder.ToString());

                    EmailAuditSummary(auditEntries, latestManhattanInventorySync.First().ManhattanInventorySyncTransactionNumber);
                }
                else
                {
                    _log.Debug("No sync data for StlInventory!!!");
                }
            }
        }