private void btnPrint_Click(object sender, RoutedEventArgs e)
        {
            if (this.OrderReturns.Count < 1)
            {
                MessageBox.Show("没有需要打印的数据");
                return;
            }

            try
            {
                string printer = LocalConfigService.GetValue(SystemNames.CONFIG_PRINTER_A4, "");
                if (string.IsNullOrWhiteSpace(printer))
                {
                    throw new Exception("请在系统配置里面,配置要使用的打印机");
                }

                if (MessageBox.Show("是否使用打印机:" + printer + Environment.NewLine + "打印?", "提示", MessageBoxButton.YesNo, MessageBoxImage.Question) != MessageBoxResult.Yes)
                {
                    return;
                }

                var           pd            = PrintUtil.GetPrinter(printer);
                VendorService vs            = ServiceContainer.GetService <VendorService>();
                var           goodsCountDoc = new OrderReturnOutPrintDocument();

                List <GoodsCount> counts = new List <GoodsCount>();
                foreach (var item in this.OrderReturns)
                {
                    string[] infos = item.Source.GoodsInfo.Split(new char[] { ' ', ',' }, StringSplitOptions.RemoveEmptyEntries);
                    if (infos.Length < 4)
                    {
                        MessageBox.Show("退货信息不正确,请检查:" + item.Source.Id);
                        continue;
                    }
                    var vendor = vs.GetByAll(infos[0], "", "", "", 0, 0).First;
                    if (vendor == null)
                    {
                        vendor = vs.GetByAll(infos[0] + infos[1], "", "", "", 0, 0).First;
                    }

                    if (vendor == null)
                    {
                        MessageBox.Show("退货信息厂家找不到,请检查:" + item.Source.Id);
                        continue;
                    }

                    GoodsCount count = null;
                    if (infos.Length >= 5)
                    {
                        count = counts.FirstOrDefault(
                            obj => obj.Vendor == VendorService.FormatVendorName(infos[0]) && obj.Number == infos[1] &&
                            obj.Edtion == infos[2] && obj.Color == infos[3] && obj.Size == infos[4]);
                    }
                    else
                    {
                        count = counts.FirstOrDefault(
                            obj => obj.Vendor == VendorService.FormatVendorName(infos[0]) && obj.Number == infos[1] &&
                            obj.Color == infos[2] && obj.Size == infos[3]);
                    }

                    if (count == null)
                    {
                        count = new GoodsCount
                        {
                            Vendor       = infos[0].Trim(),
                            Number       = infos[1].Trim(),
                            Money        = (int)(item.Source.GoodsMoney / item.Source.Count),
                            Count        = 0,
                            FirstPayTime = item.Source.ProcessTime,
                        };

                        if (infos.Length >= 5)
                        {
                            count.Edtion = infos[2].Trim();
                            count.Color  = infos[3].Trim();
                            count.Size   = infos[4].Trim();
                        }
                        else
                        {
                            count.Edtion = "";
                            count.Color  = infos[2].Trim();
                            count.Size   = infos[3].Trim();
                        }
                        count.Address = vendor.MarketAddressShort;
                        count.Vendor  = VendorService.FormatVendorName(count.Vendor);
                        counts.Add(count);
                    }
                    foreach (var c in counts.Where(obj => obj.Vendor == count.Vendor && obj.Number == count.Number &&
                                                   obj.Edtion == count.Edtion))
                    {
                        //取消最大金额值
                        if (c.Money < count.Money)
                        {
                            c.Money = count.Money;
                        }
                        else
                        {
                            count.Money = c.Money;
                        }
                    }

                    if (count.FirstPayTime >= item.Source.ProcessTime)
                    {
                        count.FirstPayTime = item.Source.ProcessTime;
                    }

                    count.Count += item.Source.Count;
                }
                IComparer <GoodsCount> comparer = new OrderGoodsCountSortByDoor();
                counts.Sort(comparer); //拿货地址
                counts.Sort(comparer); //货号
                counts.Sort(comparer); //版本
                counts.Sort(comparer); //颜色
                counts.Sort(comparer); //尺码
                goodsCountDoc.PageSize = new Size(793, 1122.24);
                goodsCountDoc.SetGoodsCount(counts.ToArray());
                pd.PrintDocument(goodsCountDoc, "退货统计");
                foreach (var item in this.OrderReturns)
                {
                    this.OrderReturnService.Update(item.Source);
                }
                MessageBox.Show("打印完成");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "打印出错");
            }
        }