예제 #1
0
        private void Line_TrackingCodeTextBox_TextChanged(object sender, TextChangedEventArgs e)
        {
            TextBox tb = (TextBox)sender;

            if (tb.Text.Length == 13)
            {
                using (var db = new MTSDB())
                {
                    var tl = (from t in db.ToLine
                              where t.SMN == Line_TrackingCodeTextBox.Text
                              select t).SingleOrDefault();

                    if (tl == null)
                    {
                        MessageBox.Show("Part Not Found!! Please Verify", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                        Line_TrackingCodeTextBox.Clear();
                        return;
                    }


                    CurrentPart = tl.Part;
                    CurrentPart.ImageReference = "./Images/" + CurrentPart.PartNo + ".png";
                }

                this.Dispatcher.BeginInvoke(DispatcherPriority.Background,
                                            new Action(() =>
                {
                    DisplayParts.Clear();
                    DisplayParts.Add(CurrentPart);
                    Stores_PartGrid.DataContext = null;
                    Stores_PartGrid.DataContext = DisplayParts;
                    Line_ReturnQtyTextBox.Focus();
                }));
            }
        }
예제 #2
0
        private void Line_UpdateButton_Click(object sender, RoutedEventArgs e)
        {
            using (var db = new MTSDB())
            {
                var tl = (from t in db.ToLine
                          where t.SMN == Line_TrackingCodeTextBox.Text
                          select t).SingleOrDefault();

                if (tl == null)
                {
                    MessageBox.Show("Part Not Found!! Please Verify", "Error", MessageBoxButton.OK, MessageBoxImage.Error);
                    Line_TrackingCodeTextBox.Clear();
                    return;
                }

                CurrentPart = tl.Part;

                int qty = 0;
                if (int.TryParse(Line_ReturnQtyTextBox.Text, out qty) == false || (qty == 0))
                {
                    MessageBox.Show("Please Verify Quantity", "Alert", MessageBoxButton.OK, MessageBoxImage.Exclamation);
                    return;
                }

                FromLine fl = new FromLine();
                fl.ToLineRecord   = tl;
                fl.Quantity       = qty;
                fl.Part           = tl.Part;
                fl.Timestamp      = DateTime.Now;
                tl.Balance       -= qty;
                tl.Part.Quantity += qty;
                tl.Part.FromLineRecords.Add(fl);
                db.SaveChanges();

                MessageBox.Show("Inventory Updated", "Information", MessageBoxButton.OK, MessageBoxImage.Information);
                this.Dispatcher.BeginInvoke(DispatcherPriority.Background,
                                            new Action(() =>
                {
                    Line_ReturnQtyTextBox.Clear();
                    Line_TrackingCodeTextBox.Clear();
                    DisplayParts.Clear();
                    Stores_PartGrid.DataContext = null;
                    Stores_PartGrid.DataContext = DisplayParts;
                }));
            }
        }
예제 #3
0
        private void GotKeyboardFocus(object sender, KeyboardFocusChangedEventArgs e)
        {
            Stores_PartGrid.DataContext = null;
            this.Dispatcher.BeginInvoke(DispatcherPriority.Background,
                                        new Action(() =>
            {
                PickList_PartComboBox.Text         = "";
                PickList_PartComboBox.SelectedItem = null;
                PickList_QtyTextBox.Clear();
                PickList_SUNTextBox.Clear();

                Line_PartComboBox.Text         = "";
                Line_PartComboBox.SelectedItem = null;
                Line_ReleaseQtyTextBox.Clear();

                Line_TrackingCodeTextBox.Clear();
                Line_ReturnQtyTextBox.Clear();

                Scrap_PartNoCombobox.Text         = "";
                Scrap_PartNoCombobox.SelectedItem = null;
                Scrap_QtyTextBox.Clear();
                Scrap_ReasonTextBox.Clear();
            }));
        }