private void ProcessReturn(string deliveryCompany, string deliveryNumber)
        {
            //先读取发出信息,在系统找到相应信息,返回单号,有时会填写系统备注中
            var data = ServiceContainer.GetService <OrderService>().GetByAll("", "", "", "", DateTime.MinValue, DateTime.MinValue, "", "", OrderState.NONE, PopPayType.None, "", "", "", null, -1, deliveryNumber, 0, OrderCreateType.NONE, OrderType.NONE, "", 0, 0);

            if (data != null && data.Datas.Count > 0)
            {
                this.ProcessOrders(data.Datas.ToArray(), deliveryCompany, deliveryNumber, false);
                return;
            }

            //未找到信息
            DeliveryInViewModel vm = new DeliveryInViewModel
            {
                State            = "",
                DeliveryNumber   = deliveryNumber,
                DeliveryCompany  = deliveryCompany,
                Action           = "删除",
                SourceOrderGoods = null,
                OrderId          = 0,
                OrderGoodsInfo   = "",
                IsRefused        = false,
            };

            this.deliveryInViewModels.Add(vm);
            Speaker.Speak("退货未找到订单");
        }
 private void Delete_Click(object sender, RoutedEventArgs e)
 {
     try
     {
         DeliveryInViewModel order = (e.Source as Hyperlink).DataContext as DeliveryInViewModel;
         if (order == null)
         {
             return;
         }
         this.deliveryInViewModels.Remove(order);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message);
     }
 }
        private void ProcessOrders(Order[] orders, string deliveryCompany, string deliveryNumber, bool isRefused)
        {
            foreach (var or in orders)
            {
                //空包
                if (or.OrderGoodss == null || or.OrderGoodss.Count < 1)
                {
                    DeliveryInViewModel vm = new DeliveryInViewModel
                    {
                        State            = "",
                        DeliveryNumber   = deliveryNumber,
                        DeliveryCompany  = isRefused ? or.DeliveryCompany : deliveryCompany,
                        Action           = "删除",
                        SourceOrderGoods = null,
                        OrderId          = or.Id,
                        ShopId           = or.ShopId,
                        ReceiverMobile   = or.ReceiverMobile,
                        OrderGoodsInfo   = "",
                    };
                    this.deliveryInViewModels.Add(vm);
                    Speaker.Speak("已找到订单");
                    continue;
                }

                //实体包
                foreach (var og in or.OrderGoodss)
                {
                    DeliveryInViewModel vm = new DeliveryInViewModel
                    {
                        State            = "",
                        OrderGoodsInfo   = og.Vendor + " " + og.Number + " " + og.Edtion + " " + og.Color + " " + og.Size + " " + og.Count,
                        DeliveryNumber   = deliveryNumber,
                        DeliveryCompany  = isRefused ? or.DeliveryCompany : deliveryCompany,
                        Action           = "删除",
                        SourceOrderGoods = og,
                        OrderId          = or.Id,
                        ShopId           = or.ShopId,
                        IsRefused        = isRefused,
                        ReceiverMobile   = or.ReceiverMobile,
                    };
                    this.deliveryInViewModels.Add(vm);
                    Speaker.Speak("已找到订单");
                }
            }
        }