📄 frmmaterieloutsee.cs
字号:
this.groupBox2.TabIndex = 1;
this.groupBox2.TabStop = false;
//
// groupBox4
//
this.groupBox4.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox4.Controls.Add(this.dataGrid1);
this.groupBox4.Location = new System.Drawing.Point(0, 0);
this.groupBox4.Name = "groupBox4";
this.groupBox4.Size = new System.Drawing.Size(968, 224);
this.groupBox4.TabIndex = 0;
this.groupBox4.TabStop = false;
this.groupBox4.Text = "领料单(父)表";
//
// dataGrid1
//
this.dataGrid1.DataMember = "";
this.dataGrid1.DataSource = this.dataView1;
this.dataGrid1.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(3, 17);
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.ReadOnly = true;
this.dataGrid1.Size = new System.Drawing.Size(962, 204);
this.dataGrid1.TabIndex = 1;
//
// dataView1
//
this.dataView1.Table = this.materielOutDS11.仓库领料单历史;
//
// materielOutDS11
//
this.materielOutDS11.DataSetName = "MaterielOutDS1";
this.materielOutDS11.Locale = new System.Globalization.CultureInfo("en-US");
//
// groupBox3
//
this.groupBox3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.groupBox3.Controls.Add(this.dataGrid2);
this.groupBox3.Location = new System.Drawing.Point(0, 264);
this.groupBox3.Name = "groupBox3";
this.groupBox3.Size = new System.Drawing.Size(968, 160);
this.groupBox3.TabIndex = 2;
this.groupBox3.TabStop = false;
this.groupBox3.Text = "明细(子)表";
//
// dataGrid2
//
this.dataGrid2.DataMember = "";
this.dataGrid2.DataSource = this.dataView2;
this.dataGrid2.Dock = System.Windows.Forms.DockStyle.Fill;
this.dataGrid2.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid2.Location = new System.Drawing.Point(3, 17);
this.dataGrid2.Name = "dataGrid2";
this.dataGrid2.ReadOnly = true;
this.dataGrid2.Size = new System.Drawing.Size(962, 140);
this.dataGrid2.TabIndex = 3;
//
// dataView2
//
this.dataView2.Table = this.materielOutDS11.view_仓库领料单明细历史;
//
// sqlDataAdapter1
//
this.sqlDataAdapter1.SelectCommand = this.sqlSelectCommand1;
this.sqlDataAdapter1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "仓库领料单历史", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("编号", "编号"),
new System.Data.Common.DataColumnMapping("票号", "票号"),
new System.Data.Common.DataColumnMapping("领用日期", "领用日期"),
new System.Data.Common.DataColumnMapping("部门号", "部门号"),
new System.Data.Common.DataColumnMapping("制单人", "制单人"),
new System.Data.Common.DataColumnMapping("领料人", "领料人")})});
//
// sqlSelectCommand1
//
this.sqlSelectCommand1.CommandText = "SELECT 编号, 票号, 领用日期, 部门号, 制单人, 领料人 FROM 仓库领料单历史";
this.sqlSelectCommand1.Connection = this.sqlConnection1;
//
// sqlConnection1
//
this.sqlConnection1.ConnectionString = "workstation id=WINDOWSXP;packet size=4096;user id=sa;data source=\".\";persist secu" +
"rity info=False;initial catalog=jxcbook";
//
// sqlDataAdapter2
//
this.sqlDataAdapter2.SelectCommand = this.sqlSelectCommand2;
this.sqlDataAdapter2.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
new System.Data.Common.DataTableMapping("Table", "view_仓库领料单明细历史", new System.Data.Common.DataColumnMapping[] {
new System.Data.Common.DataColumnMapping("出库单号", "出库单号"),
new System.Data.Common.DataColumnMapping("物料编号", "物料编号"),
new System.Data.Common.DataColumnMapping("拼音编码", "拼音编码"),
new System.Data.Common.DataColumnMapping("品名", "品名"),
new System.Data.Common.DataColumnMapping("规格", "规格"),
new System.Data.Common.DataColumnMapping("单位", "单位"),
new System.Data.Common.DataColumnMapping("领用数量", "领用数量"),
new System.Data.Common.DataColumnMapping("订单号", "订单号"),
new System.Data.Common.DataColumnMapping("仓库", "仓库")})});
//
// sqlSelectCommand2
//
this.sqlSelectCommand2.CommandText = "SELECT 出库单号, 物料编号, 拼音编码, 品名, 规格, 单位, 领用数量, 订单号, 仓库 FROM view_仓库领料单明细历史";
this.sqlSelectCommand2.Connection = this.sqlConnection1;
//
// FrmMaterielOutSee
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(968, 430);
this.Controls.Add(this.groupBox3);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
this.Name = "FrmMaterielOutSee";
this.Text = "仓库领料单明细查询";
this.Load += new System.EventHandler(this.FrmMaterielOutSee_Load);
this.Closed += new System.EventHandler(this.FrmMaterielOutSee_Closed);
this.groupBox1.ResumeLayout(false);
this.groupBox2.ResumeLayout(false);
this.groupBox4.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataView1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.materielOutDS11)).EndInit();
this.groupBox3.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.dataView2)).EndInit();
this.ResumeLayout(false);
}
#endregion
private void FrmMaterielOutSee_Load(object sender, System.EventArgs e)
{
try
{
this.Cursor = Cursors.WaitCursor;
//填充数据集
sqlDataAdapter1.Fill(materielOutDS11);
sqlDataAdapter2.Fill(materielOutDS11);
//显示时,首先显示第一个领料单的明细
dataView2.RowFilter="出库单号='"+dataGrid1[0,0].ToString().Trim()+"'";
//明细数据根据选择的编号而变化
dataGrid1.CurrentCellChanged+=new EventHandler(dataGrid1_CurrentCellChanged);
}
catch(Exception Err)
{
MessageBox.Show("查询数据集记录为空:"+Err.Message,"信息提示",
MessageBoxButtons.OK,MessageBoxIcon.Information);
}
finally
{
this.Cursor = Cursors.Default;
}
}
//-------------显示领料单历史明细----------------
private void dataGrid1_CurrentCellChanged(object sender, EventArgs e)
{
int i=dataGrid1.CurrentRowIndex;
dataView2.RowFilter="出库单号='"+dataGrid1[i,0].ToString().Trim()+"'";
}
private void FrmMaterielOutSee_Closed(object sender, System.EventArgs e)
{
if(this.sqlConnection1.State==ConnectionState.Open)
{
this.sqlConnection1.Close();
}
}
private void button1_Click(object sender, System.EventArgs e)
{
try
{
this.Cursor = Cursors.WaitCursor;
string filter="";
if(textBox1.Text.Trim()!="")
{
filter+="部门号 like '"+textBox1.Text.Trim()+"%' AND ";
}
if(textBox3.Text.Trim()!="")
{
filter+="票号 like '"+textBox3.Text.Trim()+"%' AND ";
}
if(textBox4.Text.Trim()!="")
{
filter+="领用日期 like '"+textBox4.Text.Trim()+"%' AND ";
}
if(textBox5.Text.Trim()!="")
{
filter+="领料人 like '"+textBox5.Text.Trim()+"%' AND ";
}
int length=filter.Length;
if(length>0)
{
filter=filter.Substring(0,length-5);
}
dataView1.RowFilter=filter;
if(dataView1.Count>0)//有确定的领料数据再显示明细
{
dataView2.RowFilter="出库单号='"+dataGrid1[0,0].ToString().Trim()+"'";
}
}
catch(Exception Err)
{
MessageBox.Show("查询数据集记录操作失败:"+Err.Message,"信息提示",
MessageBoxButtons.OK,MessageBoxIcon.Information);
}
finally
{
this.Cursor = Cursors.Default;
this.sqlConnection1.Close();
}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -