⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 frmmaterielinsee.cs

📁 制造业ERP系统搜集
💻 CS
📖 第 1 页 / 共 2 页
字号:
				| 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;
			// 
			// 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;
			// 
			// 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("验收员", "验收员"),
																																																			   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("扣率", "扣率"),
																																																					  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;
			// 
			// materielInDS11
			// 
			this.materielInDS11.DataSetName = "MaterielInDS1";
			this.materielInDS11.Locale = new System.Globalization.CultureInfo("en-US");
			// 
			// dataView1
			// 
			this.dataView1.Table = this.materielInDS11.进货单历史;
			// 
			// dataView2
			// 
			this.dataView2.Table = this.materielInDS11.view_进货单明细历史;
			// 
			// FrmMaterielInSee
			// 
			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 = "FrmMaterielInSee";
			this.Text = "物料进货单明细查询";
			this.Load += new System.EventHandler(this.FrmMaterielInSee_Load);
			this.Closed += new System.EventHandler(this.FrmMaterielInSee_Closed);
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			this.groupBox4.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
			this.groupBox3.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.materielInDS11)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dataView1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dataView2)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		private void FrmMaterielInSee_Load(object sender, System.EventArgs e)
		{
			try
			{
				this.Cursor = Cursors.WaitCursor;
				//填充数据集
				sqlDataAdapter1.Fill(materielInDS11);
				sqlDataAdapter2.Fill(materielInDS11);
				//显示时,首先显示第一个进货单的明细
				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 FrmMaterielInSee_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 + -