private void SetToBox(object sender, RoutedEventArgs e) { ///选取物料放入料箱,入库记录表添加数据 /// //DataRowView mySelectedElement = (DataRowView)datagridpo.SelectedItem; //WPF_SetToBox wPF_SetToBox = new WPF_SetToBox(mySelectedElement); //string sql = "select Box_ID from Box where Box_Capacity < 100 and Box_Status='可存放'"; //DataSet ds = MySQLHelper.GetDataSet(MySQLHelper.GetConn(), CommandType.Text, sql, null); //foreach (DataRow row in ds.Tables[0].Rows) //{ // wPF_SetToBox.combobox.Items.Add(row["Box_ID"].ToString());; //} //wPF_SetToBox.ShowDialog(); DataRowView mySelectedElement = (DataRowView)datagridpo.SelectedItem; WPF_SetToBox wPF_SetToBox = new WPF_SetToBox(mySelectedElement, "input_po", null); string sql = "select Box_ID from Box where Box_Capacity < 100 and Box_Status='可存放'"; DataSet ds = MySQLHelper.GetDataSet(MySQLHelper.GetConn(), CommandType.Text, sql, null); foreach (DataRow row in ds.Tables[0].Rows) { wPF_SetToBox.combobox.Items.Add(row["Box_ID"].ToString());; } wPF_SetToBox.ShowDialog(); }
private void In_bound(object sender, RoutedEventArgs e) { ///写入数据库 try { List <Model.Inbound> lists = (List <Model.Inbound>)datagridinbound.ItemsSource; int i = datagridinbound.SelectedIndex; DataRowView dataRowView = null; Model.Inbound list = lists[i]; WPF_SetToBox wPF_SetToBox = new WPF_SetToBox(dataRowView, "input_excel", list); string sql = "select Box_ID from Box where Box_Capacity < 100 and Box_Status='可存放'"; DataSet ds = MySQLHelper.GetDataSet(MySQLHelper.GetConn(), CommandType.Text, sql, null); foreach (DataRow row in ds.Tables[0].Rows) { wPF_SetToBox.combobox.Items.Add(row["Box_ID"].ToString());; } wPF_SetToBox.combobox.Items.Add("托板");; wPF_SetToBox.ShowDialog(); if (wPF_SetToBox.DialogResult == true)//第3步,然后对DialogResult进行判断 { lists.RemoveAt(i); datagridinbound.ItemsSource = null; datagridinbound.ItemsSource = lists; } } catch (InvalidCastException a) { MessageBox.Show("只有导入的入库excel才能进行入库操作"); } }