using System; using System.Collections.Generic; using System.Linq; 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; using CentralControl.DBDAO; using CentralControl.BaseData; namespace XGL.FormItem { /// /// FormLocator.xaml 的交互逻辑 /// public partial class FormLocator : Window { public delegate string OptCarDelegate(CarRealInfo car); public event OptCarDelegate optCarEvent; FormShowSelect form; private CarRealInfo CarInfo { get; set; } public FormLocator() { InitializeComponent(); } public FormLocator(CarRealInfo carinfo) { InitializeComponent(); this.CarInfo = carinfo; } private void Window_Loaded(object sender, RoutedEventArgs e) { this.lblCarNo.Content = this.CarInfo.CarNo; this.lblLocatorNo.Content = this.CarInfo.LocatorId != 0 ? this.CarInfo.LocatorId : 0; this.lblMaterialNo.Content = this.CarInfo.MaterialNo; this.lblMaterialNm.Content = this.CarInfo.MaterialBarNo; this.lblMaterialNum.Content = this.CarInfo.HadNumber.ToString(); this.CarInfo.MaterialBarNo = "D3"; if (this.CarInfo.IsProOutLocator == 1) { this.btnOutLocator.IsChecked = true; } else if (this.CarInfo.IsProOutLocator == 2) { this.btnBackLocator.IsChecked = true; } else { this.btnNoOpt.IsChecked = true; this.btnWarehouseA.IsChecked = true; } if (this.CarInfo.LocatorId > 9) { this.btnWarehouseC.Visibility = Visibility.Hidden; } else { this.btnWarehouseC.Visibility = Visibility.Visible; } } private void BtnclearLocator_Click(object sender, RoutedEventArgs e) { this.lblLocatorNo.Content = ""; this.CarInfo.LocatorId = 0; } private void BtnclearCar_Click(object sender, RoutedEventArgs e) { this.lblCarNo.Content = ""; //this.CarInfo.CarNo = 0; } private void BtnclearMaterial_Click(object sender, RoutedEventArgs e) { this.lblMaterialNo.Content = ""; this.lblMaterialNm.Content = ""; this.CarInfo.MaterialBarNo = ""; this.CarInfo.MaterialNo = ""; } private void BtnselectLocator_Click(object sender, RoutedEventArgs e) { if (form != null) { form.Close(); form = null; } form = new FormShowSelect(0); form.optItemEvent += SelectLocatorItem; form.Show(); } private void SelectMaterialItem(string val1, string val2) { this.lblMaterialNo.Content = val1.Trim(); this.lblMaterialNm.Content = val2.Trim(); this.CarInfo.MaterialBarNo = val2.Trim(); ; this.CarInfo.MaterialNo = val1.Trim(); } private void SelectLocatorItem(string val1, string val2) { this.lblLocatorNo.Content = val2.Trim(); this.CarInfo.LocatorId = Convert.ToInt32(val1); } private void BtnselectCar_Click(object sender, RoutedEventArgs e) { } private void BtnselecMaterial_Click(object sender, RoutedEventArgs e) { if (form != null) { form.Close(); form = null; } form = new FormShowSelect(1); form.optItemEvent += SelectMaterialItem; form.Show(); } private void BtnSaveSetting_Click(object sender, RoutedEventArgs e) { try { string msg = ""; if (optCarEvent != null) { if (this.CarInfo.IsOutLocator == 2) { msg = "当前小车已经出库,不能重复出库!"; MessageBox.Show(msg); return; } msg = optCarEvent(this.CarInfo); MessageBox.Show(msg); this.Close(); } } catch (Exception ex) { MessageBox.Show("出库异常!" + ex.ToString()); return; } } private void BtnCancelSetting_Click(object sender, RoutedEventArgs e) { this.Close(); } private void BtnOutLocator_Click(object sender, RoutedEventArgs e) { this.CarInfo.IsProOutLocator = 1; } private void BtnBackLocator_Click(object sender, RoutedEventArgs e) { this.CarInfo.IsProOutLocator = 2; } private void BtnNoOpt_Checked(object sender, RoutedEventArgs e) { this.CarInfo.IsProOutLocator = 0; } private void BtnWareHouseA_Click(object sender, RoutedEventArgs e) { this.CarInfo.MaterialBarNo = "D3"; } private void BtnWareHouseB_Click(object sender, RoutedEventArgs e) { this.CarInfo.MaterialBarNo = "TV"; } private void BtnWareHouseC_Click(object sender, RoutedEventArgs e) { this.CarInfo.MaterialBarNo = "TQ"; } } }