20 changed files with 906 additions and 124 deletions
@ -0,0 +1,34 @@ |
|||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Text; |
||||
|
|
||||
|
namespace BBWY.Client.Models.APIModel |
||||
|
{ |
||||
|
public class SetPackDetailV2Response |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// 套餐任务量
|
||||
|
/// </summary>
|
||||
|
public int ProcessTaskCount { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 打包完成时间(超时时间)
|
||||
|
/// </summary>
|
||||
|
public DateTime? PackCompletionOverTime { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 包装收益
|
||||
|
/// </summary>
|
||||
|
public decimal PackerFees { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 工序套餐名称
|
||||
|
/// </summary>
|
||||
|
public string ProcessComboName { get; set; } |
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 耗材名称列表
|
||||
|
/// </summary>
|
||||
|
public List<string> ConsumableNameList { get; set; } |
||||
|
} |
||||
|
} |
@ -0,0 +1,56 @@ |
|||||
|
<c:BWindow x:Class="BBWY.Client.Views.PackagingTask.PrintPackDetailWindow" |
||||
|
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.PackagingTask" |
||||
|
mc:Ignorable="d" |
||||
|
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" |
||||
|
Height="219" Width="378" |
||||
|
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" VerticalAlignment="Center"> |
||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 10"> |
||||
|
<TextBlock Margin="0 0 5 0" Style="{StaticResource middleTextBlock}" 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> |
||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="62 0 0 0"> |
||||
|
<TextBlock Margin="0 0 5 0" Style="{StaticResource middleTextBlock}" Text="份数:"/> |
||||
|
|
||||
|
<c:BTextBox Text="{Binding PrintCount}" Height="30" Width="200" /> |
||||
|
|
||||
|
</StackPanel> |
||||
|
</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,131 @@ |
|||||
|
using BBWY.Client.Models; |
||||
|
using BBWY.Client.Views.PackTask; |
||||
|
using BBWY.Client.Views.SplitTask; |
||||
|
using BBWY.Controls; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Collections.ObjectModel; |
||||
|
using System.Drawing.Printing; |
||||
|
using System.IO; |
||||
|
using System.Printing; |
||||
|
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; |
||||
|
using WebSocketSharp; |
||||
|
|
||||
|
namespace BBWY.Client.Views.PackagingTask |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// PrintPackDetailWindow.xaml 的交互逻辑
|
||||
|
/// </summary>
|
||||
|
public partial class PrintPackDetailWindow : BWindow |
||||
|
{ |
||||
|
public PrintPackDetailWindow(PackDetailWindow printWindow) |
||||
|
{ |
||||
|
InitializeComponent(); |
||||
|
InitPrintList(); |
||||
|
this.DataContext = this; |
||||
|
this.printWindow = printWindow; |
||||
|
} |
||||
|
|
||||
|
private PackTaskModel model; |
||||
|
PackDetailWindow printWindow; |
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 打印机列表
|
||||
|
/// </summary>
|
||||
|
public ObservableCollection<string> PrintList { get; set; } |
||||
|
public string PrintName { get; set; } |
||||
|
public int PrintCount { get => printCount; set { Set(ref printCount, value); } } |
||||
|
private int printCount = 1; |
||||
|
|
||||
|
|
||||
|
public void InitPrintList() |
||||
|
{ |
||||
|
|
||||
|
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) |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
} |
||||
|
private void BButton_Click(object sender, System.Windows.RoutedEventArgs e) |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
if (PrintName.IsNullOrEmpty()) |
||||
|
{ |
||||
|
MessageBox.Show("请选择打印设备"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (string.IsNullOrEmpty(PrintName)) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
var localPrintServer = new LocalPrintServer(); |
||||
|
var printQueue = localPrintServer.GetPrintQueue(PrintName); |
||||
|
if (printQueue.IsInError) |
||||
|
{ |
||||
|
System.Windows.MessageBox.Show("打印机处于错误状态"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
for (int i = 0; i < PrintCount; i++) |
||||
|
{ |
||||
|
printWindow.PrintBox(PrintName); |
||||
|
} |
||||
|
|
||||
|
this.Close(); |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,97 @@ |
|||||
|
<c:BWindow x:Class="BBWY.Client.Views.SomeArrival.PrintSomeArrivalWindow" |
||||
|
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.SomeArrival" |
||||
|
mc:Ignorable="d" |
||||
|
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" |
||||
|
Height="330" 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 Height="80"/> |
||||
|
<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 Orientation="Vertical" Grid.Row="2" HorizontalAlignment="Left" Margin="50 0 0 10"> |
||||
|
<StackPanel Orientation="Horizontal" Margin="0 10 0 10"> |
||||
|
<TextBlock Text="摆放货架:" Style="{StaticResource middleTextBlock}" /> |
||||
|
<Border BorderBrush="{StaticResource Border.Brush}" BorderThickness="1" CornerRadius="1" Height="30"> |
||||
|
<StackPanel Orientation="Horizontal"> |
||||
|
<Label Content="货架编号" BorderThickness="0 0 0 0" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Width="70"/> |
||||
|
<Border Width="1" Background="{StaticResource Border.Brush}" HorizontalAlignment="Left"/> |
||||
|
<ComboBox Height="30" HorizontalAlignment="Stretch" ItemsSource="{Binding ShelvesNumberList}" Text="{Binding ShelvesNumber}" BorderThickness="0" Margin="1" /> |
||||
|
|
||||
|
|
||||
|
</StackPanel> |
||||
|
</Border> |
||||
|
<Border BorderBrush="{StaticResource Border.Brush}" BorderThickness="1" CornerRadius="1" Height="30" Margin="10 0 0 0"> |
||||
|
<StackPanel Orientation="Horizontal"> |
||||
|
<Label Content="货架层数" BorderThickness="0 0 0 0" VerticalContentAlignment="Center" HorizontalContentAlignment="Center" Width="70"/> |
||||
|
<Border Width="1" Background="{StaticResource Border.Brush}" HorizontalAlignment="Left"/> |
||||
|
<ComboBox Height="30" HorizontalAlignment="Stretch" ItemsSource="{Binding FloorNumberList}" Text="{Binding FloorNumber}" BorderThickness="0" Margin="1" /> |
||||
|
|
||||
|
|
||||
|
</StackPanel> |
||||
|
</Border> |
||||
|
</StackPanel> |
||||
|
<c:BTextBox Text="{Binding RemarkMsg}" HorizontalContentAlignment="Left" VerticalContentAlignment="Top" WaterRemark="备注消息" VerticalAlignment="Top" MinHeight="100" TextWrapping="Wrap" AcceptsReturn="True" /> |
||||
|
|
||||
|
</StackPanel> |
||||
|
|
||||
|
|
||||
|
<StackPanel Grid.Row="1" Orientation="Vertical" VerticalAlignment="Center"> |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="50 0 0 10"> |
||||
|
<TextBlock Margin="0 0 5 0" Style="{StaticResource middleTextBlock}" 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> |
||||
|
<StackPanel Orientation="Horizontal" HorizontalAlignment="Left" Margin="62 0 0 0"> |
||||
|
<TextBlock Margin="0 0 5 0" Style="{StaticResource middleTextBlock}" Text="份数:"/> |
||||
|
|
||||
|
<c:BTextBox Text="{Binding PrintCount}" Height="30" Width="200" /> |
||||
|
|
||||
|
</StackPanel> |
||||
|
|
||||
|
|
||||
|
|
||||
|
</StackPanel> |
||||
|
|
||||
|
<Border Grid.Row="3" Height="1" VerticalAlignment="Top" BorderBrush="{StaticResource Border.Background}" BorderThickness="1"/> |
||||
|
<c:BButton Background="{StaticResource Button.Background}" Grid.Row="3" Content="打印" HorizontalAlignment="Right" Width="100" VerticalAlignment="Stretch" Click="BButton_Click" |
||||
|
/> |
||||
|
</Grid> |
||||
|
</c:BWindow> |
@ -0,0 +1,230 @@ |
|||||
|
using BBWY.Client.APIServices.QiKu; |
||||
|
using BBWY.Client.Extensions; |
||||
|
using BBWY.Client.Models; |
||||
|
using BBWY.Client.Views.SplitTask; |
||||
|
using BBWY.Controls; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Collections.ObjectModel; |
||||
|
using System.Drawing.Printing; |
||||
|
using System.IO; |
||||
|
using System.Printing; |
||||
|
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; |
||||
|
using WebSocketSharp; |
||||
|
|
||||
|
namespace BBWY.Client.Views.SomeArrival |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// PrintSomeArrivalWindow.xaml 的交互逻辑
|
||||
|
/// </summary>
|
||||
|
public partial class PrintSomeArrivalWindow : BWindow |
||||
|
{ |
||||
|
public PrintSomeArrivalWindow(PackTaskAbortService packTaskAbortService, PackTaskModel model, Action reFlashWindow, List<string> shelvesNumberList, List<int> floorNumberList) |
||||
|
{ |
||||
|
InitializeComponent(); |
||||
|
InitPrintList(); |
||||
|
this.DataContext = this; |
||||
|
this.model = model; |
||||
|
this.packTaskAbortService = packTaskAbortService; |
||||
|
|
||||
|
if (!model.ShelvesNumber.IsNullOrEmpty()) |
||||
|
ShelvesNumber = model.ShelvesNumber; |
||||
|
|
||||
|
if (model.FloorNumber != null) FloorNumber = model.FloorNumber; |
||||
|
|
||||
|
if (model.AbortRemark != null) RemarkMsg = model.AbortRemark; |
||||
|
FloorNumberList = floorNumberList; |
||||
|
ShelvesNumberList = shelvesNumberList; |
||||
|
ReFlashWindow = reFlashWindow; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
private string remarkMsg; |
||||
|
/// <summary>
|
||||
|
/// 货架
|
||||
|
/// </summary>
|
||||
|
public string RemarkMsg { get => remarkMsg; set { Set(ref remarkMsg, value); } } |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
Action ReFlashWindow; |
||||
|
PackTaskAbortService packTaskAbortService; |
||||
|
|
||||
|
private List<int> floorNumberList = new List<int> { 1, 2, 3, 4 }; |
||||
|
/// <summary>
|
||||
|
/// 层数列表
|
||||
|
/// </summary>
|
||||
|
public List<int> FloorNumberList { get => floorNumberList; set { Set(ref floorNumberList, value); } } |
||||
|
|
||||
|
private int? floorNumber; |
||||
|
/// <summary>
|
||||
|
///层数
|
||||
|
/// </summary>
|
||||
|
public int? FloorNumber { get => floorNumber; set { Set(ref floorNumber, value); } } |
||||
|
|
||||
|
|
||||
|
private List<string> shelvesNumberList; |
||||
|
/// <summary>
|
||||
|
/// 货架列表
|
||||
|
/// </summary>
|
||||
|
public List<string> ShelvesNumberList { get => shelvesNumberList; set { Set(ref shelvesNumberList, value); } } |
||||
|
|
||||
|
private string shelvesNumber; |
||||
|
/// <summary>
|
||||
|
/// 货架
|
||||
|
/// </summary>
|
||||
|
public string ShelvesNumber { get => shelvesNumber; set { Set(ref shelvesNumber, value); } } |
||||
|
|
||||
|
|
||||
|
|
||||
|
private PackTaskModel model; |
||||
|
|
||||
|
|
||||
|
|
||||
|
/// <summary>
|
||||
|
/// 打印机列表
|
||||
|
/// </summary>
|
||||
|
public ObservableCollection<string> PrintList { get; set; } |
||||
|
public string PrintName { get; set; } |
||||
|
public int PrintCount { get => printCount; set { Set(ref printCount, value); } } |
||||
|
private int printCount = 1; |
||||
|
|
||||
|
|
||||
|
public void InitPrintList() |
||||
|
{ |
||||
|
|
||||
|
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 void PrintBox() |
||||
|
{ |
||||
|
} |
||||
|
|
||||
|
private void BButton_Click(object sender, System.Windows.RoutedEventArgs e) |
||||
|
{ |
||||
|
if (PrintName.IsNullOrEmpty()) |
||||
|
{ |
||||
|
MessageBox.Show("请选择打印设备"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (string.IsNullOrEmpty(PrintName)) |
||||
|
{ |
||||
|
return; |
||||
|
} |
||||
|
var localPrintServer = new LocalPrintServer(); |
||||
|
var printQueue = localPrintServer.GetPrintQueue(PrintName); |
||||
|
if (printQueue.IsInError) |
||||
|
{ |
||||
|
System.Windows.MessageBox.Show("打印机处于错误状态"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
if (ShelvesNumber.IsNullOrEmpty() || FloorNumber==null ) |
||||
|
{ |
||||
|
MessageBox.Show("请输入摆放货架位置"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
var res = packTaskAbortService.SaveTaskShelves(model.TaskId, ShelvesNumber, FloorNumber,remarkMsg); |
||||
|
|
||||
|
if (res==null||!res.Success) |
||||
|
{ |
||||
|
MessageBox.Show(res.Msg ?? "未知错误!"); |
||||
|
return; |
||||
|
} |
||||
|
|
||||
|
model.ShelvesNumber = ShelvesNumber; |
||||
|
model.FloorNumber = FloorNumber; |
||||
|
model.AbortRemark = RemarkMsg; |
||||
|
|
||||
|
|
||||
|
SomeArrivalWindow window = new SomeArrivalWindow(model); |
||||
|
//window.ShowDialog();
|
||||
|
for (int i = 0; i < PrintCount; i++) |
||||
|
{ |
||||
|
window.Print(PrintName); |
||||
|
} |
||||
|
this.Close(); |
||||
|
|
||||
|
ReFlashWindow?.Invoke(); |
||||
|
|
||||
|
|
||||
|
try |
||||
|
{ |
||||
|
var applicationPath = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); |
||||
|
string printNames = System.IO.Path.Combine(applicationPath, "printName.init"); |
||||
|
try |
||||
|
{ |
||||
|
if (File.Exists(printNames)) |
||||
|
{ |
||||
|
File.Delete(printNames); |
||||
|
} |
||||
|
} |
||||
|
catch |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
File.WriteAllText(printNames, PrintName); |
||||
|
} |
||||
|
catch (Exception) |
||||
|
{ |
||||
|
|
||||
|
|
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
@ -0,0 +1,46 @@ |
|||||
|
<c:BWindow x:Class="BBWY.Client.Views.SomeArrival.SomeArrivalWindow" |
||||
|
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.SomeArrival" |
||||
|
xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" |
||||
|
mc:Ignorable="d" |
||||
|
CloseButtonVisibility="Visible" |
||||
|
WindowStartupLocation="CenterScreen" |
||||
|
CloseButtonColor="White" |
||||
|
MinButtonVisibility="Collapsed" |
||||
|
MaxButtonVisibility="Collapsed" |
||||
|
RightButtonGroupMargin="0,5,5,0" |
||||
|
Title="ExceptionTaskWindow" Height="567" Width="388"> |
||||
|
<Grid Visibility="Visible" > |
||||
|
<Grid x:Name="print_box" Height="492" Width="272"> |
||||
|
|
||||
|
<StackPanel Margin="10 10 10 10" Width="252" HorizontalAlignment="Center" Orientation="Vertical"> |
||||
|
<TextBlock FontSize="28" FontWeight="Bold"> |
||||
|
<Run Text="任务ID:"/> |
||||
|
|
||||
|
</TextBlock> |
||||
|
<TextBlock FontSize="60" FontWeight="Bold"> |
||||
|
|
||||
|
<Run Text="{Binding Model.TaskIdRemark}"/> |
||||
|
</TextBlock> |
||||
|
<StackPanel Orientation="Horizontal" Margin="0 10 0 10"> |
||||
|
<TextBlock Style="{StaticResource middleTextBlock}" Text="摆放货号: " FontSize="20" /> |
||||
|
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding Model.ShelvesNumber}" FontSize="20"/> |
||||
|
<TextBlock Style="{StaticResource middleTextBlock}" Text="号货架,第" FontSize="20"/> |
||||
|
<TextBlock Style="{StaticResource middleTextBlock}" Text="{Binding Model.FloorNumber}" FontSize="20"/> |
||||
|
<TextBlock Style="{StaticResource middleTextBlock}" Text="层" FontSize="20"/> |
||||
|
</StackPanel> |
||||
|
<TextBlock TextWrapping="Wrap" > |
||||
|
<Run Text="备注信息:"/> |
||||
|
<Run Text="{Binding Model.AbortRemark}"/> |
||||
|
</TextBlock> |
||||
|
|
||||
|
|
||||
|
</StackPanel> |
||||
|
</Grid> |
||||
|
|
||||
|
|
||||
|
</Grid> |
||||
|
</c:BWindow> |
@ -0,0 +1,62 @@ |
|||||
|
using BBWY.Client.Helpers; |
||||
|
using BBWY.Client.Models; |
||||
|
using BBWY.Controls; |
||||
|
using System; |
||||
|
using System.Collections.Generic; |
||||
|
using System.Printing; |
||||
|
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.SomeArrival |
||||
|
{ |
||||
|
/// <summary>
|
||||
|
/// SomeArrivalWindow.xaml 的交互逻辑
|
||||
|
/// </summary>
|
||||
|
public partial class SomeArrivalWindow : BWindow |
||||
|
{ |
||||
|
public SomeArrivalWindow(PackTaskModel model) |
||||
|
{ |
||||
|
InitializeComponent(); |
||||
|
|
||||
|
this.DataContext = this; |
||||
|
Model = model; |
||||
|
} |
||||
|
private PackTaskModel model; |
||||
|
|
||||
|
public PackTaskModel Model { get => model; set { Set(ref model, value); } } |
||||
|
|
||||
|
public string taskIdRemark; |
||||
|
public string TaskIdRemark { get => taskIdRemark; set { Set(ref taskIdRemark, value); } } |
||||
|
|
||||
|
|
||||
|
public string remarkMsg; |
||||
|
public string RemarkMsg { get => remarkMsg; set { Set(ref remarkMsg, value); } } |
||||
|
|
||||
|
public string exceptType; |
||||
|
public string ExceptType { get => exceptType; set { Set(ref exceptType, value); } } |
||||
|
public void Print(string printName) |
||||
|
{ |
||||
|
|
||||
|
MyPrintHelper.SetDefaultPrint(printName);//设置默认打印机
|
||||
|
PrintDialog printDialog = new PrintDialog(); |
||||
|
//Height="492" Width="272" 567 388
|
||||
|
printDialog.PrintTicket.PageOrientation = PageOrientation.ReversePortrait;//设置为横向打印 PageOrientation.Landscape Portrait为纵向 //设置纸张大小
|
||||
|
var pageWidth = (int)Math.Ceiling(printDialog.PrintableAreaWidth); |
||||
|
var pageHeight = (int)Math.Ceiling(printDialog.PrintableAreaHeight); |
||||
|
printDialog.PrintTicket.PageMediaSize = new PageMediaSize(pageWidth, pageHeight); |
||||
|
print_box.Height = pageHeight; |
||||
|
print_box.Width = pageWidth; |
||||
|
this.print_box.Arrange(new Rect(new System.Windows.Point(0, 0), new System.Windows.Size(pageWidth, pageHeight))); |
||||
|
this.UpdateLayout(); //刷新界面
|
||||
|
printDialog.PrintVisual(this.print_box, "打印任务"); |
||||
|
this.Close(); |
||||
|
} |
||||
|
} |
||||
|
} |
Loading…
Reference in new issue