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

📄 mrpcal.cs

📁 生产管理信息系统
💻 CS
📖 第 1 页 / 共 2 页
字号:
			this.dataGrid1.ReadOnly = true;
			this.dataGrid1.Size = new System.Drawing.Size(624, 136);
			this.dataGrid1.TabIndex = 0;
			// 
			// dataSet31
			// 
			this.dataSet31.DataSetName = "DataSet3";
			this.dataSet31.Locale = new System.Globalization.CultureInfo("zh-CN");
			// 
			// groupBox3
			// 
			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(640, 224);
			this.groupBox3.TabIndex = 2;
			this.groupBox3.TabStop = false;
			this.groupBox3.Text = "MRP计算结果(物料需求)";
			// 
			// dataGrid2
			// 
			this.dataGrid2.CaptionVisible = false;
			this.dataGrid2.DataMember = "mrp物料需求计算";
			this.dataGrid2.DataSource = this.dataSet31;
			this.dataGrid2.HeaderForeColor = System.Drawing.SystemColors.ControlText;
			this.dataGrid2.Location = new System.Drawing.Point(8, 16);
			this.dataGrid2.Name = "dataGrid2";
			this.dataGrid2.ReadOnly = true;
			this.dataGrid2.Size = new System.Drawing.Size(624, 200);
			this.dataGrid2.TabIndex = 1;
			// 
			// da1
			// 
			this.da1.SelectCommand = this.sqlSelectCommand1;
			this.da1.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("MPS数量", "MPS数量"),
																																																   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 b.物料名称, a.物料编号, a.编号, a.年份, a.计划期, a.开始日期, a.结束日期, a.期初库存, a.需求数量, a.MPS数量" +
				", a.生产单数量, a.预计库存, a.记帐人, a.修改日期, a.审核人, a.审核日期, a.状态, a.备注 FROM 主生产计划 a INNER J" +
				"OIN 物料主文件 b ON a.物料编号 = b.物料编号";
			this.sqlSelectCommand1.Connection = this.sqlConnection1;
			// 
			// sqlConnection1
			// 
			this.sqlConnection1.ConnectionString = "workstation id=localhost;Integrated Security=SSPI;Database=mrpbook;";
			// 
			// da2
			// 
			this.da2.SelectCommand = this.sqlSelectCommand2;
			this.da2.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
																						  new System.Data.Common.DataTableMapping("Table", "mrp物料需求计算", 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 b.物料名称, a.物料编号, a.年份, a.计划期, a.期初库存, a.毛需求, a.预计入库, a.预计出库, a.预计库存, a.净需求," +
				" a.计划产出, a.计划投入 FROM mrp物料需求计算 a INNER JOIN 物料主文件 b ON a.物料编号 = b.物料编号";
			this.sqlSelectCommand2.Connection = this.sqlConnection1;
			// 
			// MRPCal
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
			this.ClientSize = new System.Drawing.Size(648, 493);
			this.Controls.Add(this.groupBox3);
			this.Controls.Add(this.groupBox2);
			this.Controls.Add(this.groupBox1);
			this.Name = "MRPCal";
			this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
			this.Text = "【MRP计算】";
			this.Load += new System.EventHandler(this.MRPCal_Load);
			this.groupBox1.ResumeLayout(false);
			this.groupBox2.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
			((System.ComponentModel.ISupportInitialize)(this.dataSet31)).EndInit();
			this.groupBox3.ResumeLayout(false);
			((System.ComponentModel.ISupportInitialize)(this.dataGrid2)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		//----------窗体创建时读入数据-----------
		private void MRPCal_Load(object sender, System.EventArgs e)
		{
			da1.Fill(dataSet31);
			
		}

		//------------计算MPR--------------
		private void btnCal_Click(object sender, System.EventArgs e)
		{
			if(dataSet31.主生产计划.Count==0)//如主生产计划为空,则不做任何操作
				return;
			
			string inStr1="0";//根据选择设置调用储存过程的参数
			string inStr2="0";
			string inStr3="0";
			if(checkBox1.Checked)
				inStr1="1";
			if(checkBox2.Checked)
				inStr2="1";
			if(checkBox3.Checked)
				inStr3="1";
			string strConn = "server=localhost;Integrated Security=SSPI;database=mrpbook";
			SqlConnection cn=new SqlConnection(strConn);
			cn.Open();
			SqlCommand cmd=cn.CreateCommand();
			cmd.CommandText="exec sf_mrp计算 '"+inStr1+"','"+inStr2+"','"+inStr3+"'";
			int exResult=cmd.ExecuteNonQuery();
			if(exResult!=-1)//允许发布MRP计算结果
			{
				MessageBox.Show("MRP计算成功,请发布计算结果");
				dataSet31.Clear();
				da1.Fill(dataSet31);
				da2.Fill(dataSet31);
				btnRelease.Enabled=true;
			}
            		
			
		}

		//------------发布MRP计算结果--------------
		private void btnRelease_Click(object sender, System.EventArgs e)
		{
			string strConn = "server=localhost;Integrated Security=SSPI;database=mrpbook";
			SqlConnection cn=new SqlConnection(strConn);
			cn.Open();
			SqlCommand cmd=cn.CreateCommand();
			cmd.CommandText="exec sf_mrp结果发布";
			int exResult=cmd.ExecuteNonQuery();
			if(exResult!=-1)
			{
				dataSet31.Clear();//刷新数据集
				da1.Fill(dataSet31);
				da2.Fill(dataSet31);
				btnRelease.Enabled=false;
			}
		}
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -