private void DataGrid_List_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            string newValue = (e.EditingElement as TextBox).Text.Trim();

            if (string.IsNullOrWhiteSpace(newValue))
            {
                return;
            }
            string     header = e.Column.Header.ToString();
            Model_圆片仓库 m      = this.DataGrid_List.SelectedCells[0].Item as Model_圆片仓库;

            if (header == this.DataGridTextColumn_编号.Header.ToString())
            {
                Model_圆片资料 w = new ViewModel.MeansOfProduction.Vm_圆片().ReadInfo(newValue);
                if (w != null)
                {
                    m.Guid = w.Guid;
                    m.编号   = w.编号;
                    m.直径   = w.直径;
                    m.厚度   = w.厚度;
                }
                else
                {
                    MessageBox.Show("找不到编号对应的品名");
                    m.编号 = "";
                    this.DataGrid_List.CurrentCell = new DataGridCellInfo(this.DataGrid_List.SelectedCells[0].Item, this.DataGrid_List.Columns[0]);
                }
            }
            else if (header == this.DataGridTextColumn_数量.Header.ToString())
            {
                Int64 quantity = 0;
                Int64.TryParse(newValue, out quantity);
                m.数量 = quantity;
            }
            else if (header == this.DataGridTextColumn_入库半成品编号.Header.ToString())
            {
                Model_ProductionManagement_OutsideProcessBatch pm = new OutsideProcessBatchInputConsole().ReadProductInfo(newValue);
                if (pm.ProductGuid != new Guid())
                {
                    m.半成品Guid = pm.ProductGuid;
                    m.半成品品名   = pm.ProductName;
                }
                else
                {
                    MessageBox.Show("找不到编号对应的品名");
                    m.入库半成品编号 = "";
                    this.DataGrid_List.CurrentCell = new DataGridCellInfo(this.DataGrid_List.SelectedCells[0].Item, this.DataGrid_List.Columns[5]);
                }
            }
            else if (header == this.DataGridTextColumn_半成品数量.Header.ToString())
            {
                Int64 quantity = 0;
                Int64.TryParse(newValue, out quantity);
                m.半成品数量 = quantity;
            }
        }
Beispiel #2
0
        private void TextBox_Processors_PreviewKeyDown(object sender, KeyEventArgs e)
        {
            TextBox tb = sender as TextBox;

            if (tb.IsFocused)
            {
                if (e.Key == Key.Enter)
                {
                    string No = tb.Text;
                    Model_ProductionManagement_OutsideProcessBatch m = new OutsideProcessBatchInputConsole().ReadProcessorsInfo(No);
                    if (m.ProcessorsGuid != new Guid())
                    {
                        ProcessorsGuid = m.ProcessorsGuid;
                        tb.Text        = m.ProcessorsName;
                    }
                    else
                    {
                        ProcessorsGuid = new Guid();
                        tb.Text        = "";
                    }
                }
            }
        }
Beispiel #3
0
        private void DataGrid_CellEditEnding(object sender, DataGridCellEditEndingEventArgs e)
        {
            Model_ProductionManagement_OutsideProcessBatch model = this.DataGrid.SelectedCells[0].Item as Model_ProductionManagement_OutsideProcessBatch;
            string newValue = (e.EditingElement as TextBox).Text.Trim();
            string Header   = e.Column.Header.ToString();

            if (Header == "产品编号")
            {
                Model_ProductionManagement_OutsideProcessBatch m = new OutsideProcessBatchInputConsole().ReadProductInfo(newValue);
                if (m.ProductGuid == new Guid())
                {
                    DataGrid.CurrentCell = new DataGridCellInfo(DataGrid.SelectedCells[0].Item, DataGrid.Columns[0]);
                    data[data.IndexOf(model)].ProductGuid = new Guid();
                    data[data.IndexOf(model)].ProductName = "";
                    data[data.IndexOf(model)].Material    = "";
                }
                else if (m.HasPolishing == false)
                {
                    DataGrid.CurrentCell = new DataGridCellInfo(DataGrid.SelectedCells[0].Item, DataGrid.Columns[0]);
                    data[data.IndexOf(model)].ProductGuid = new Guid();
                    data[data.IndexOf(model)].ProductName = "";
                    data[data.IndexOf(model)].Material    = "";
                    data[data.IndexOf(model)].Remark      = "该产品没有抛光工序,请重新录入。";
                }
                else
                {
                    data[data.IndexOf(model)].ProductGuid = m.ProductGuid;
                    data[data.IndexOf(model)].ProductName = m.ProductName;
                    data[data.IndexOf(model)].Material    = m.Material;
                    if (data[data.IndexOf(model)].Remark == "该产品没有抛光工序,请重新录入。")
                    {
                        data[data.IndexOf(model)].Remark = "";
                    }
                }
            }
        }