Browse Source

修复打印问题

qianyi
连坤 林 2 years ago
parent
commit
ec5da9f2ba
  1. 21
      BBWY.Client/Models/PackTask/ConsumableModel.cs
  2. 8
      BBWY.Client/Models/PackTask/PackTaskModel.cs
  3. 2
      BBWY.Client/ViewModels/PackTask/ConsumableViewModel.cs
  4. 2
      BBWY.Client/Views/PackTask/Consumable.xaml
  5. 10
      BBWY.Client/Views/PackTask/PrintWindow.xaml.cs

21
BBWY.Client/Models/PackTask/ConsumableModel.cs

@ -46,7 +46,7 @@ namespace BBWY.Client.Models.PackTask
return;
}
ApiResponse<object> res = null;
if (Id > 0)
if (Id > 0)//修改
{
res = consumableService.Edit(new ConsuableRequest
{
@ -80,7 +80,11 @@ namespace BBWY.Client.Models.PackTask
if (res != null && res.Success)
{
var win = obj as System.Windows.Window;
if (ReflashDatas != null) ReflashDatas();
ViewModelLocator viewModel = new ViewModelLocator();
var con = viewModel.Consumable;
con.SearchConsumable();
//if (ReflashDatas != null) ReflashDatas();
win.Close();
}
else
@ -94,6 +98,9 @@ namespace BBWY.Client.Models.PackTask
var res = consumableService.Deleted(Id);
if (res.Success)
{
ViewModelLocator viewModel = new ViewModelLocator();
var con = viewModel.Consumable;
con.SearchConsumable();
list.Remove(this);
}
}
@ -102,7 +109,15 @@ namespace BBWY.Client.Models.PackTask
public void EditConsumable()
{
EditConsumable add = new EditConsumable(this);
EditConsumable add = new EditConsumable(new ConsumableModel(consumableService) {
Heigth=this.Heigth, Length=this.Length,
Id=this.Id, Name=this.Name, Weigth=this.Weigth,
Remark = this.Remark,
Width = this.Width ,
Price = this.Price
});
add.Show();
}

8
BBWY.Client/Models/PackTask/PackTaskModel.cs

@ -45,7 +45,7 @@ namespace BBWY.Client.Models
public ICommand UpdateTaskCommand { get; set; }
/// <summary>
/// 修改任务
/// 删除任务
/// </summary>
public ICommand DeletedTaskCommand { get; set; }
@ -208,8 +208,12 @@ namespace BBWY.Client.Models
var model = packTaskService.UpdateTaskStatus(taskId, 1);
if (model != null && model.Success)
{
ViewModelLocator viewModelLocator = new ViewModelLocator();
var wareHouse = viewModelLocator.WareHouseList;
wareHouse.SearchTaskList();
this.TaskStatus = TaskStateType.;
new TipsWindow("修改成功").Show();
// new TipsWindow("修改成功").Show();
}
}
/*

2
BBWY.Client/ViewModels/PackTask/ConsumableViewModel.cs

@ -82,7 +82,7 @@ namespace BBWY.Client.ViewModels.PackTask
}
private void SearchConsumable()
public void SearchConsumable()
{
Task.Factory.StartNew(() =>
{

2
BBWY.Client/Views/PackTask/Consumable.xaml

@ -155,7 +155,7 @@
</Grid>
<Grid Grid.Column="5">
<StackPanel Orientation="Horizontal" HorizontalAlignment="Center" VerticalAlignment="Center">
<c:BButton Background="Transparent" Foreground="Blue" Content="编辑" Command="{Binding EditConsumableCommand}" Margin="0 0 10 0"/>
<c:BButton Background="Transparent" Foreground="Blue" Content="编辑" Command="{Binding EditConsumableCommand}" CommandParameter="" Margin="0 0 10 0"/>
<c:BButton Background="Transparent" Foreground="Blue" Content="删除" Command="{Binding DeletedConsumableCommand}"
CommandParameter="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox}, Path=ItemsSource}"
/>

10
BBWY.Client/Views/PackTask/PrintWindow.xaml.cs

@ -145,15 +145,11 @@ namespace BBWY.Client.Views.PackTask
private void BButton_Click(object sender, RoutedEventArgs e)
{
int printCount = Convert.ToInt32(tbCount.Text);
string printName = cbPrints.Text;//选择的要打印的打印机名称
Task.Factory.StartNew(() => {
try
{
//string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
//string path = appPath + $"/Resources/LabelNames/{LabelName}.btw";
int printCount = Convert.ToInt32(tbCount.Text);//份数
string printName = cbPrints.Text;//选择的要打印的打印机名称
{
PrintDocument pd = new PrintDocument();
PrintDocument document = new PrintDocument();
document.PrinterSettings.PrinterName = printName;

Loading…
Cancel
Save