步步为盈
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

92 lines
3.3 KiB

using BBWY.Client.Helpers;
using BBWY.Client.Models.APIModel;
using BBWY.Client.Models.APIModel.Response;
using BBWY.Client.Models.FallWare;
using BBWY.Controls;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Printing;
using System.Reflection;
using System.Text;
using System.Threading;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
namespace BBWY.Client.Views.FallWare
{
/// <summary>
/// WareLSAcceptOrderWindow.xaml 的交互逻辑
/// </summary>
public partial class WareLSAcceptOrderWindow : BWindow
{
public WareLSAcceptOrderWindow(GetWareLSAcceptOrderResponse GetWareLSAcceptOrderResponse, List<GetWareLSOrderPurchase> GetWareLSOrderPurchases, int nowPageIndex, int totalPageIndex, string prewOrder
)
{
InitializeComponent();
this.GetWareLSAcceptOrderResponse = GetWareLSAcceptOrderResponse;
this.GetWareLSOrderPurchases = GetWareLSOrderPurchases;
this.NowPageIndex = nowPageIndex;
this.TotalPageIndex = totalPageIndex;
this.DataContext = this;
PrewOrder = prewOrder;
TotalSealBoxCount = GetWareLSOrderPurchases.Select(w=>w.SealBoxCount).Sum().Value;
this.UpdateLayout();
}
public GetWareLSAcceptOrderResponse GetWareLSAcceptOrderResponse { get; set; }
public List<GetWareLSOrderPurchase> GetWareLSOrderPurchases { get; set; }
public int NowPageIndex { get; set; }
public int TotalPageIndex { get; set; }
public string PrewOrder { get; set; }
/// <summary>
/// 总封箱数
/// </summary>
public int TotalSealBoxCount { get; set; }
///// <summary>
///// TC收货总箱数
///// </summary>
//public int TotalTCAcceptBoxCount { get; set; }
public void PrintLSOrder(string printName)
{
var localPrintServer = new LocalPrintServer();
if (string.IsNullOrEmpty(printName))
{
return;
}
var printQueue = localPrintServer.GetPrintQueue(printName);
if (printQueue.IsInError)
{
System.Windows.MessageBox.Show("打印机处于错误状态");
return;
}
MyPrintHelper.SetDefaultPrint(printName);//设置默认打印机
PrintDialog printDialog = new PrintDialog();
printDialog.PrintTicket.PageOrientation = PageOrientation.Portrait;//设置为横向打印 PageOrientation.Landscape Portrait为纵向
var pageWidth = (int)Math.Ceiling(printDialog.PrintableAreaWidth);
var pageHeight = (int)Math.Ceiling(printDialog.PrintableAreaHeight);
// printDialog.PrintTicket.PageMediaSize = new PageMediaSize(pageWidth, pageHeight);
//835 1166
this.Height = pageHeight+39;
this.Width = pageWidth;
this.print_lsOrder.Arrange(new Rect(new Point(0, 0), new Size(pageWidth, pageHeight)));
this.UpdateLayout();
printDialog.PrintVisual(this.print_lsOrder, "打印任务");
this.Close();
}
}
}