31 changed files with 2704 additions and 1586 deletions
@ -0,0 +1,62 @@ |
|||||
|
<c:BWindow x:Class="BBWY.Client.Views.FallWare.PrintBoxWindow" |
||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" |
||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" |
||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" |
||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" |
||||
|
xmlns:local="clr-namespace:BBWY.Client.Views.FallWare" |
||||
|
mc:Ignorable="d" |
||||
|
Style="{StaticResource bwstyle}" |
||||
|
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" |
||||
|
Height="219" Width="378" |
||||
|
xmlns:b="http://schemas.microsoft.com/xaml/behaviors" |
||||
|
xmlns:ctr="clr-namespace:BBWY.Client.Converters" |
||||
|
xmlns:cmodel="clr-namespace:BBWY.Client.Models" |
||||
|
xmlns:sys="clr-namespace:System;assembly=mscorlib" |
||||
|
CloseButtonVisibility="Visible" |
||||
|
CloseButtonColor="{StaticResource WindowButtonColor}" |
||||
|
MinButtonVisibility="Collapsed" |
||||
|
MaxButtonVisibility="Collapsed" |
||||
|
RightButtonGroupMargin="0,5,5,0"> |
||||
|
<!-- DataContext="{Binding CreateSetBarCodeView,Source={StaticResource Locator}}"--> |
||||
|
<Window.Resources> |
||||
|
<ResourceDictionary > |
||||
|
<ResourceDictionary.MergedDictionaries> |
||||
|
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/SkinDefault.xaml"/> |
||||
|
<ResourceDictionary Source="pack://application:,,,/HandyControl;component/Themes/Theme.xaml"/> |
||||
|
|
||||
|
</ResourceDictionary.MergedDictionaries> |
||||
|
</ResourceDictionary> |
||||
|
</Window.Resources> |
||||
|
<Grid> |
||||
|
<Grid.RowDefinitions> |
||||
|
<RowDefinition Height="30"/> |
||||
|
<RowDefinition/> |
||||
|
<RowDefinition Height="40"/> |
||||
|
</Grid.RowDefinitions> |
||||
|
<Border BorderThickness="0,0,0,1" BorderBrush="{StaticResource MainMenu.BorderBrush}" |
||||
|
Background="{StaticResource Border.Background}"> |
||||
|
<TextBlock Text="打印箱唛" HorizontalAlignment="Center" VerticalAlignment="Center"/> |
||||
|
</Border> |
||||
|
|
||||
|
<StackPanel Grid.Row="1" Orientation="Vertical" > |
||||
|
<StackPanel Orientation="Horizontal" Margin=" 0 50 0 0" HorizontalAlignment="Center"> |
||||
|
<TextBlock Margin="0 0 5 0" VerticalAlignment="Center" Text="打印机:"/> |
||||
|
|
||||
|
<Border BorderBrush="{StaticResource Border.Brush}" VerticalAlignment="Center" BorderThickness="1" Height="30"> |
||||
|
<ComboBox x:Name="cbPrints" BorderThickness="0" Height="25" Width="200" VerticalAlignment="Center" HorizontalAlignment="Left" ItemsSource="{Binding PrintList}" Text="{Binding PrintName}" /> |
||||
|
</Border> |
||||
|
|
||||
|
</StackPanel> |
||||
|
<CheckBox Name="cbx_allsomebox" Content="打印所有同揽收单的箱唛" HorizontalAlignment="Left" Margin="66 10 0 0"/> |
||||
|
|
||||
|
</StackPanel> |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
<Border Grid.Row="2" Height="1" VerticalAlignment="Top" BorderBrush="{StaticResource Border.Background}" BorderThickness="1"/> |
||||
|
<c:BButton Background="{StaticResource Button.Background}" Grid.Row="2" Content="打印" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch" Click="BButton_Click" |
||||
|
/> |
||||
|
</Grid> |
||||
|
</c:BWindow> |
||||
|
|
@ -0,0 +1,120 @@ |
|||||
|
using BBWY.Client.APIServices; |
||||
|
using BBWY.Client.Models; |
||||
|
using BBWY.Client.Models.FallWare; |
||||
|
using BBWY.Controls; |
||||
|
using NPOI.Util; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Collections.ObjectModel; |
||||
|
using System.Drawing.Printing; |
||||
|
using System.IO; |
||||
|
using System.Reflection; |
||||
|
using System.Text; |
||||
|
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>
|
||||
|
/// PrintBoxWindow.xaml 的交互逻辑
|
||||
|
/// </summary>
|
||||
|
public partial class PrintBoxWindow : BWindow |
||||
|
{ |
||||
|
public PrintBoxWindow(JDWareBoxModel model, WareType WareType) |
||||
|
{ |
||||
|
JDWareBoxModel =model ; this.WareType = WareType; |
||||
|
InitializeComponent(); |
||||
|
this.DataContext = this; |
||||
|
InitPrintList(); |
||||
|
} |
||||
|
public void InitPrintList() |
||||
|
{ |
||||
|
//TaskImage = MyPrintHelper.GetBarcodeImage(TaskId.ToString(), 300, 60);
|
||||
|
|
||||
|
//BarcodeImage = MyPrintHelper.GetBarcodeImage(SkuId, 300, 60);
|
||||
|
|
||||
|
|
||||
|
PrintList = new ObservableCollection<string>(); |
||||
|
var printingNames = PrinterSettings.InstalledPrinters;//获取本机的打印机数据
|
||||
|
int index = -1; |
||||
|
int selectIndex = 0; |
||||
|
foreach (string name in printingNames) |
||||
|
{ |
||||
|
if (name == "Microsoft XPS Document Writer" || name == "Microsoft Print to PDF" || name == "Fax") |
||||
|
{ |
||||
|
continue; |
||||
|
} |
||||
|
index++; |
||||
|
if (name.Contains("Deli")) |
||||
|
{ |
||||
|
selectIndex = index; |
||||
|
} |
||||
|
PrintList.Add(name); |
||||
|
} |
||||
|
try |
||||
|
{ |
||||
|
var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); |
||||
|
string printNames = System.IO.Path.Combine(applicationPath, "printName.init"); |
||||
|
if (File.Exists(printNames)) |
||||
|
{ |
||||
|
PrintName = File.ReadAllText(printNames); |
||||
|
} |
||||
|
else |
||||
|
{ |
||||
|
if (PrintList.Count > 0) |
||||
|
{ |
||||
|
PrintName = PrintList[0].ToString(); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
catch (Exception) |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
public string PrintName { get; set; } |
||||
|
public int PrintCount { get; set; } = 1; |
||||
|
|
||||
|
|
||||
|
|
||||
|
public JDWareBoxModel JDWareBoxModel { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 箱唛类型
|
||||
|
/// </summary>
|
||||
|
public WareType WareType { get; set; } |
||||
|
/// <summary>
|
||||
|
/// 打印机列表
|
||||
|
/// </summary>
|
||||
|
public ObservableCollection<string> PrintList { get; set; } |
||||
|
|
||||
|
private void BButton_Click(object sender, RoutedEventArgs e) |
||||
|
{ |
||||
|
if (WareType== WareType.京仓) |
||||
|
{ |
||||
|
SetJDWareBoxWindow jdWindow = new SetJDWareBoxWindow(JDWareBoxModel); |
||||
|
jdWindow.Show(); |
||||
|
//jdWindow.WindowState = WindowState.Maximized;
|
||||
|
jdWindow.PrintBox(PrintName); |
||||
|
} |
||||
|
|
||||
|
if (WareType== WareType.云仓|| WareType== WareType.聚水潭齐越仓) |
||||
|
{ |
||||
|
SetCloudWareBoxWindow cloudWareWindow = new SetCloudWareBoxWindow(JDWareBoxModel, WareType); |
||||
|
cloudWareWindow.Visibility = Visibility.Hidden; |
||||
|
cloudWareWindow.Show(); |
||||
|
|
||||
|
cloudWareWindow.PrintBox(PrintName); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue