diff --git a/BBWY.Client/APIServices/PackTaskService.cs b/BBWY.Client/APIServices/PackTaskService.cs index 468975aa..ff12be0f 100644 --- a/BBWY.Client/APIServices/PackTaskService.cs +++ b/BBWY.Client/APIServices/PackTaskService.cs @@ -329,7 +329,7 @@ namespace BBWY.Client.APIServices /// /// /// - public ApiResponse CompeteSealBox( List CompeteSealBoxs) + public ApiResponse CompeteSealBox( CompeteSealBox CompeteSealBoxs) { return SendRequest(globalContext.QKApiHost, "api/PackTask/CompeteSealBox", new { @@ -346,11 +346,14 @@ namespace BBWY.Client.APIServices /// /// 任务Id /// - public long TaskId { get; set; } + public long[] TaskId { get; set; } /// /// 仓库Id /// public string WareId { get; set; } + + public int BoxCount { get; set; } + } diff --git a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs index 14cc413c..4f5df699 100644 --- a/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs +++ b/BBWY.Client/ViewModels/PackTask/WareHouseListViewModel.cs @@ -21,6 +21,7 @@ using NPOI.SS.Formula.Functions; using GalaSoft.MvvmLight.Messaging; using BBWY.Client.Models.APIModel; using BBWY.Client.Models.PackTask; +using BBWY.Client.Views.SealBox; namespace BBWY.Client.ViewModels.PackTask { @@ -261,6 +262,17 @@ namespace BBWY.Client.ViewModels.PackTask UpdateTaskStateCommand = new RelayCommand(UpdateTaskState); CompeteSealBoxCommand = new RelayCommand(CompeteSealBox); + + SetSealBoxCommand = new RelayCommand(SetSealBox); + } + + private void SetSealBox(object obj) + { + SetSealBoxWindow setSealBoxWindow = new SetSealBoxWindow(); + setSealBoxWindow.SendBoxCount= boxCount => { + BoxCount = boxCount; + }; + setSealBoxWindow.ShowDialog(); } @@ -302,27 +314,34 @@ namespace BBWY.Client.ViewModels.PackTask /// public ICommand TaskPageIndexChangedCommand { get; set; } + /// + /// 设置分箱数量 + /// + public ICommand SetSealBoxCommand { get; set; } + BatchPurchaseService batchPurchaseService; + + public int BoxCount { get; set; } + private void CompeteSealBox(object obj) { - var objList = obj as SealBoxModel; - List CompeteSealBoxs = new List(); - string wareId = objList.WareId; - foreach (var item in objList.SealBoxSkus) - { - CompeteSealBoxs.Add(new APIServices.CompeteSealBox - { - WareId = wareId, - TaskId = item.TaskId, + if (BoxCount<=0) + { + System.Windows.MessageBox.Show("请先设置封箱数量"); + return; + } - }); + var objList = obj as SealBoxModel; - } - var res = packTaskService.CompeteSealBox(CompeteSealBoxs); + CompeteSealBox competeSealBox = new CompeteSealBox(); + competeSealBox.WareId = objList.WareId; + competeSealBox.BoxCount = BoxCount; + competeSealBox.TaskId = objList.SealBoxSkus.Select(s => s.TaskId).ToArray(); + var res = packTaskService.CompeteSealBox(competeSealBox); if (res != null && res.Success) { SearchTaskList(); diff --git a/BBWY.Client/Views/PackTask/TipsWindow.xaml b/BBWY.Client/Views/PackTask/TipsWindow.xaml index 09662e26..ca4a72bf 100644 --- a/BBWY.Client/Views/PackTask/TipsWindow.xaml +++ b/BBWY.Client/Views/PackTask/TipsWindow.xaml @@ -30,7 +30,7 @@ + Text="请设置合格证内容" BorderBrush="White" VerticalAlignment="Center" HorizontalAlignment="Center"/> diff --git a/BBWY.Client/Views/PackTask/TipsWindow.xaml.cs b/BBWY.Client/Views/PackTask/TipsWindow.xaml.cs index 9ccf50a9..3b5a4dc2 100644 --- a/BBWY.Client/Views/PackTask/TipsWindow.xaml.cs +++ b/BBWY.Client/Views/PackTask/TipsWindow.xaml.cs @@ -20,7 +20,7 @@ namespace BBWY.Client.Views.PackTask public partial class TipsWindow : BWindow { private DispatcherTimer timer; - public TipsWindow(string Content,int waitTime=2) + public TipsWindow(string Content, int waitTime =3) { InitializeComponent(); tbContent.Text = Content; @@ -31,16 +31,38 @@ namespace BBWY.Client.Views.PackTask timer.Tick += OnTimerTick; timer.Start(); + this.Closed += TipsWindow_Closed; } + private void TipsWindow_Closed(object sender, EventArgs e) + { + IsClosed = true; + } + + private bool IsClosed; private void OnTimerTick(object sender, EventArgs e) { timer.Stop(); - Close(); + + CloseWindow(); } + + object closeWindow = new object(); + private void CloseWindow() + { + if (IsClosed) + return; + lock (closeWindow) + { + if (!IsClosed) + Close(); + } + + } + private void BButton_Click(object sender, RoutedEventArgs e) { - this.Close(); + CloseWindow(); } } } diff --git a/BBWY.Client/Views/PackTask/WaitSealBoxControl.xaml b/BBWY.Client/Views/PackTask/WaitSealBoxControl.xaml index 3fe553c7..e9d6efa6 100644 --- a/BBWY.Client/Views/PackTask/WaitSealBoxControl.xaml +++ b/BBWY.Client/Views/PackTask/WaitSealBoxControl.xaml @@ -4,7 +4,7 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:local="clr-namespace:BBWY.Client.Views.PackTask" - mc:Ignorable="d" + mc:Ignorable="d" Background="white" xmlns:c="clr-namespace:BBWY.Controls;assembly=BBWY.Controls" xmlns:ctr="clr-namespace:BBWY.Client.Converters" xmlns:sys="clr-namespace:System;assembly=mscorlib" @@ -33,19 +33,22 @@ + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/BBWY.Client/Views/SealBox/SetSealBoxWindow.xaml.cs b/BBWY.Client/Views/SealBox/SetSealBoxWindow.xaml.cs new file mode 100644 index 00000000..704c5da2 --- /dev/null +++ b/BBWY.Client/Views/SealBox/SetSealBoxWindow.xaml.cs @@ -0,0 +1,49 @@ +using BBWY.Controls; +using System; +using System.Collections.Generic; +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.SealBox +{ + /// + /// SetSealBoxWindow.xaml 的交互逻辑 + /// + public partial class SetSealBoxWindow : BWindow + { + public SetSealBoxWindow() + { + InitializeComponent(); + } + + + public Action SendBoxCount { get; set; } + private void BButton_Click(object sender, RoutedEventArgs e) + { + int boxCount = 0; + try + { + boxCount = Convert.ToInt32(tbSealBoxCount.Text); + } + catch (Exception) + { + MessageBox.Show("请输入数字!"); + return; + } + + + + //todo: 打印单子 + if (SendBoxCount != null) SendBoxCount(boxCount); + + + } + } +}