巨石化纤
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.

92 lines
2.8 KiB

using SSWMS.Common;
using System;
using System.Data;
using System.Windows.Controls;
namespace SSWMS.Client.UC
{
public partial class ucWareHouseQuery : UserControl
{
public ucWareHouseQuery()
{
InitializeComponent();
}
public delegate void U_WareHouseChangedHandler();
public event U_WareHouseChangedHandler U_WareHouseChanged;
public string sWarehouseCode = string.Empty;
public string U_WAREHOUSE_CODE
{
get { return this.cbWarehouse.SelectedValue.ToString(); }
}
public int U_CELL_Z
{
get { return Convert.ToInt32(this.cbCellZ.SelectedValue); }
}
public void U_InitControl()
{
try
{
this.cbWarehouse.DisplayMemberPath = "NAME";
this.cbWarehouse.SelectedValuePath = "VALUE";
this.cbWarehouse.ItemsSource = SystemCodeData.DicDataView["WAREHOUSE_CODE"];
if (this.cbWarehouse.Items.Count > 0)
{
if (string.IsNullOrWhiteSpace(sWarehouseCode))
{
this.cbWarehouse.SelectedIndex = 0;
}
else
{
for (int i = 0; i < this.cbWarehouse.Items.Count; ++i)
{
if ((this.cbWarehouse.Items[i] as DataRowView)["VALUE"].ToString() == sWarehouseCode)
{
this.cbWarehouse.SelectedIndex = i;
break;
}
}
}
}
}
catch (Exception ex)
{
MessageDialog.ShowException(ex);
}
}
public void cbWarehouse_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
try
{
this.cbCellZ.DisplayMemberPath = "NAME";
this.cbCellZ.SelectedValuePath = "VALUE";
this.cbCellZ.ItemsSource = SystemCodeData.DicDataView[
string.Format("WAREHOUSE_CODE_{0}", this.cbWarehouse.SelectedValue.ToString())];
if (this.cbCellZ.Items.Count > 0)
{
this.cbCellZ.SelectedIndex = 0;
}
}
catch (Exception ex)
{
MessageDialog.ShowException(ex);
}
}
private void cbCellZ_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
if (this.cbCellZ.SelectedItem != null)
{
if (this.U_WareHouseChanged != null)
{
this.U_WareHouseChanged();
}
}
}
}
}