private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { try { dataGridView2.DataSource = pm.GetMaterialProductRelationByProduct(dataGridView1.Rows[e.RowIndex].Cells["产品编号"].Value.ToString()); textBox产品.Text = dataGridView1.Rows[e.RowIndex].Cells["产品编号"].Value.ToString(); dataGridView2.Update(); } catch (Exception ex) {}; }
private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e) { try { dataGrid产品.DataSource = pm.GetAllProductsByNameEX("产品编号", dataGrid未生产.Rows[e.RowIndex].Cells["产品编号"].Value.ToString()); dataGrid产品原料关系.DataSource = pm.GetMaterialProductRelationByProduct(dataGrid未生产.Rows[e.RowIndex].Cells["产品编号"].Value.ToString()); dataGrid产品.Update(); dataGrid产品原料关系.Update(); textBox产品.Text = dataGrid未生产.Rows[e.RowIndex].Cells["产品编号"].Value.ToString(); textBox领料产品.Text = dataGrid未生产.Rows[e.RowIndex].Cells["产品编号"].Value.ToString(); int pCount = int.Parse(dataGrid未生产.Rows[e.RowIndex].Cells["产品数量"].Value.ToString()); int fCount = int.Parse(dataGrid未生产.Rows[e.RowIndex].Cells["已完成生产数"].Value.ToString()); textBox产品数量.Text = (pCount - fCount).ToString(); textBox订单编号.Text = dataGrid未生产.Rows[e.RowIndex].Cells["编号"].Value.ToString(); } catch (Exception ex) { MessageBox.Show(ex.Message); }; }
private void dataGridView产品订单数据_CellClick(object sender, DataGridViewCellEventArgs e) { //根据产品编号查询数据 //dataGridView1.Rows[e.RowIndex].Cells["产品编号"].Value.ToString() try { selectedOrderRowIdx = e.RowIndex; var selectedRow = dataGridView产品订单数据.Rows[selectedOrderRowIdx]; var prodResult = pm.GetAllProductsByNameEX("产品编号", selectedRow.Cells["产品编号"].Value.ToString()); dataGridView参数修正.DataSource = prodResult; dataGridView产品原料关系.DataSource = pm.GetMaterialProductRelationByProduct(selectedRow.Cells["产品编号"].Value.ToString()); dataGridView参数修正.Update(); dataGridView产品原料关系.Update(); // label库存数.Text = prodResult.Rows[0]["库存数量"].ToString(); selectedProdCount = int.Parse(selectedRow.Cells["数量"].Value.ToString()); //////// } catch (Exception ex) { MessageBox.Show(ex.Message); }; }