コード例 #1
0
ファイル: PickJob.cs プロジェクト: ewin66/WmMiddleware
        public void RunUnitOfWork(string jobKey)
        {
            var orders = SourceRepository.GetOrders().ToList();

            if (orders.Any())
            {
                _logger.Debug("Processing " + orders.Count + " orders.");
                _orderHistoryRepository.Save(orders.SelectMany(o => o.CreateHistories("Order picked.", "Pick Job")));
                foreach (var order in orders)
                {
                    var map = new OmsManhattanOrderMap
                    {
                        Company        = order.Company,
                        Created        = DateTime.Now,
                        OmsOrderNumber = order.OrderNumber,
                        WmOrderNumber  = order.ControlNumber
                    };

                    _omsManhattanOrderMapRepository.InsertOmsManhattanOrderMapRepository(map);
                }

                DestinationRepository.SaveOrders(orders);
                SourceRepository.SetAsProcessed(orders);
            }
            else
            {
                _logger.Debug("No orders to run");
            }
        }
コード例 #2
0
        private void SendEmail(IEnumerable <Models.ShipmentCancellationEmail> cancellation,
                               OmsManhattanOrderMap orderMap,
                               ShipmentCancellationEmailDistribution distribution)
        {
            var smptServer =
                _configurationManager.GetKey <string>(ConfigurationKey.SmptServer);

            var message = new MailMessage
            {
                From       = new MailAddress("*****@*****.**"),
                IsBodyHtml = true,
                Subject    = string.Concat(@"Cancelled\Incomplete Shipment - Cancelled - ", orderMap.OmsOrderNumber)
            };

            foreach (var toAddress in distribution.DistributionList.Split(new [] { ';' }, StringSplitOptions.RemoveEmptyEntries))
            {
                message.To.Add(new MailAddress(toAddress.Trim()));
            }

            if (distribution.AdministrationSiteLink == string.Empty)
            {
                message.Body = "<p>Order Number " + orderMap.OmsOrderNumber + " was not shipped complete. The following items were cancelled and not shipped on the order:</p>Order Number: " + orderMap.OmsOrderNumber + "<br />";
            }
            else
            {
                message.Body = "<p>Order Number <a href=\"" + distribution.AdministrationSiteLink + orderMap.OmsOrderNumber + "\">" + orderMap.OmsOrderNumber + "</a>  was not shipped complete. The following items were cancelled and not shipped on the order:</p>";
            }

            message.Body += "</table>";

            message.Body += @"<table style='border: 1px solid black;'>
                                <tr>
                                        <th style='border: 1px solid black;' bgcolor='#b3b3b3'>Line</th>
                                        <th style='border: 1px solid black;' bgcolor='#b3b3b3'>Item</th>
                                        <th style='border: 1px solid black;' bgcolor='#b3b3b3'>SKU</th>
                                        <th style='border: 1px solid black;' bgcolor='#b3b3b3'>Pick Quantity</th>
                                        <th style='border: 1px solid black;' bgcolor='#b3b3b3'>Shipped Quantity</th>
                                </tr>";

            foreach (var cancel in cancellation)
            {
                message.Body += "<tr style='border: 1px solid black;'><td style='border: 1px solid black;'>" + cancel.LineNumber +
                                "</td><td style='border: 1px solid black;'>" + cancel.Style +
                                "</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td><td style='border: 1px solid black;'>" + cancel.StockKeepingUnit +
                                "</td>" +
                                "<td style='border: 1px solid black;'>" + cancel.PickQuantity.Replace(".0000", string.Empty) + "</td>" +
                                "<td style='border: 1px solid black;'>" + cancel.ShippedQuantity.Replace(".0000", string.Empty) + "</td>" +
                                "</tr>";
            }

            message.Body += "</table>";

            using (var client = new SmtpClient(smptServer))
            {
                client.Send(message);
            }
        }
コード例 #3
0
        public void RunUnitOfWork(string jobKey)
        {
            var orders = SourceRepository.GetOrders().ToList();

            if (orders.Any())
            {
                _logger.Debug("Processing " + orders.Count + " orders.");
                foreach (var order in orders)
                {
                    var map = new OmsManhattanOrderMap
                    {
                        Company        = order.Company,
                        Created        = DateTime.Now,
                        OmsOrderNumber = order.ControlNumber,
                        WmOrderNumber  = order.OrderNumber
                    };

                    _omsManhattanOrderMapRepository.InsertOmsManhattanOrderMapRepository(map);

                    _orderHistoryRepository.Save(order.CreateHistories("Processing pickticket confirmation.", "Aurora Pick Confirmation Job"));

                    SetAuroraPickTicketInformation(order);
                }

                DestinationRepository.SaveOrders(orders);

                var processed = orders.Select(s => new PickTicketConfirmationOrderProcessing {
                    ControlNumber = s.ControlNumber, OrderNumber = s.OrderNumber, ProcessedDate = DateTime.Now
                }).ToList();
                _pickTicketProcessingRepository.InsertPickTicketProcessing(processed);
            }
            else
            {
                _logger.Debug("No orders to run");
            }
        }