You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
65 lines
2.0 KiB
65 lines
2.0 KiB
2 years ago
|
using BBWY.Client.Models;
|
||
|
using BBWY.Controls;
|
||
|
using System.Collections.Generic;
|
||
|
using System.Linq;
|
||
|
using System.Windows;
|
||
|
|
||
|
namespace BBWY.Client.Views.BatchPurchase
|
||
|
{
|
||
|
/// <summary>
|
||
|
/// PackSkuSplitCountAndStoreWindow.xaml 的交互逻辑
|
||
|
/// </summary>
|
||
|
public partial class PackSkuSplitCountAndStoreWindow : BWindow
|
||
|
{
|
||
|
public int Quantity { get; set; }
|
||
|
|
||
|
public StoreResponse Store { get; set; }
|
||
|
|
||
|
private IList<StoreResponse> storeList;
|
||
|
|
||
|
public PackSkuSplitCountAndStoreWindow(int quantity, StoreResponse store, IList<StoreResponse> storeList)
|
||
|
{
|
||
|
InitializeComponent();
|
||
|
this.Quantity = quantity;
|
||
|
this.Store = store;
|
||
|
this.storeList = storeList;
|
||
|
this.Loaded += PackSkuSplitCountAndStoreWindow_Loaded;
|
||
|
}
|
||
|
|
||
|
private void PackSkuSplitCountAndStoreWindow_Loaded(object sender, System.Windows.RoutedEventArgs e)
|
||
|
{
|
||
|
this.txtQuantity.Text = Quantity.ToString();
|
||
|
this.cbx_stroeList.ItemsSource = storeList;
|
||
|
if (Store != null)
|
||
|
this.cbx_stroeList.SelectedItem = storeList.FirstOrDefault(s => s.Id == Store.Id);
|
||
|
else
|
||
|
this.cbx_stroeList.SelectedItem = storeList.FirstOrDefault();
|
||
|
}
|
||
|
|
||
|
private void btn_save_Click(object sender, System.Windows.RoutedEventArgs e)
|
||
|
{
|
||
|
if (!int.TryParse(txtQuantity.Text, out int q))
|
||
|
{
|
||
|
MessageBox.Show("件数不正确", "提示");
|
||
|
return;
|
||
|
}
|
||
|
if (q <= 0)
|
||
|
{
|
||
|
MessageBox.Show("件数不正确", "提示");
|
||
|
return;
|
||
|
}
|
||
|
if (cbx_stroeList.SelectedItem == null)
|
||
|
{
|
||
|
MessageBox.Show("请选择一个仓库", "提示");
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
this.Quantity = q;
|
||
|
this.Store = cbx_stroeList.SelectedItem as StoreResponse;
|
||
|
|
||
|
this.DialogResult = true;
|
||
|
this.Close();
|
||
|
}
|
||
|
}
|
||
|
}
|