From e652aec88f3503746c0bf21263d7fc6d09b654e9 Mon Sep 17 00:00:00 2001 From: "506583276@qq.com" <506583276@qq.com> Date: Wed, 9 Aug 2023 16:45:25 +0800 Subject: [PATCH] 1 --- .../PackTask/WareHouseListViewModel.cs | 36 ++++++++++--------- .../StorePickProductWindow.xaml.cs | 15 +++++--- 2 files changed, 29 insertions(+), 22 deletions(-) diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index 7f02373f..f45661d7 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -903,26 +903,28 @@ namespace BBWY.Client.ViewModels.PackTask return; } - StorePickProductWindow sorePickProductWindow = new StorePickProductWindow(data.Data); + StorePickProductWindow sorePickProductWindow = new StorePickProductWindow(data.Data, (count, UserName) => { + + var res = packTaskService.StoreGetBySelfV2(taskId,count,UserName); + if (res == null) + { + return false; + } + if (!res.Success) + { + System.Windows.MessageBox.Show(res.Msg, "错误信息"); + return false; + } + + + Task.Factory.StartNew(() => SearchTaskList()); + + return true; + }); sorePickProductWindow.ShowDialog(); - if (sorePickProductWindow.DialogResult == null || !sorePickProductWindow.DialogResult.Value) - { - return; - } - var res = packTaskService.StoreGetBySelfV2(taskId, sorePickProductWindow.Count, sorePickProductWindow.UserName); - if (res == null) - { - return; - } - if (!res.Success) - { - System.Windows.MessageBox.Show(res.Msg, "错误信息"); - return; - } - sorePickProductWindow.Close(); - Task.Factory.StartNew(() => SearchTaskList()); + } private void DeletedTask(object obj) diff --git a/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml.cs b/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml.cs index a603a207..6ce46085 100644 --- a/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml.cs +++ b/BBWY.Client/Views/StorePickSelf/StorePickProductWindow.xaml.cs @@ -3,6 +3,7 @@ using BBWY.Client.Models.PackTask; using BBWY.Controls; using System; using System.Collections.Generic; +using System.IO.Packaging; using System.Text; using System.Threading.Tasks; using System.Windows; @@ -21,9 +22,10 @@ namespace BBWY.Client.Views.StorePickSelf /// public partial class StorePickProductWindow : BWindow { - public StorePickProductWindow(StoreGetSelfResponse model) + public StorePickProductWindow(StoreGetSelfResponse model, Func SaveData) { - StoreGetSelfResponse=model; + this. SaveData=SaveData; + StoreGetSelfResponse =model; InitializeComponent(); this.DataContext = this; } @@ -42,10 +44,13 @@ namespace BBWY.Client.Views.StorePickSelf public StoreGetSelfResponse StoreGetSelfResponse { get=> storeGetSelfResponse; set {Set(ref storeGetSelfResponse,value); } } private void BButton_Click(object sender, RoutedEventArgs e) { - this.DialogResult = true; - + if (SaveData != null&& SaveData(Count, UserName)) + { + this.Close(); + } + } - + private Func SaveData { get; set; } private void BButton_Click_1(object sender, RoutedEventArgs e) { Count = StoreGetSelfResponse.PickMaxCount;