MRPHistory.cs
上传用户:hjieqiu
上传日期:2013-05-11
资源大小:16494k
文件大小:18k
源码类别:

企业管理

开发平台:

C#

  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. namespace 生产管理系统
  7. {
  8. /// <summary>
  9. /// MRPHistory 的摘要说明。
  10. /// </summary>
  11. public class MRPHistory : System.Windows.Forms.Form
  12. {
  13. private System.Windows.Forms.GroupBox groupBox2;
  14. private System.Windows.Forms.DataGrid dataGrid1;
  15. private System.Windows.Forms.GroupBox groupBox1;
  16. private System.Windows.Forms.Label label6;
  17. private System.Windows.Forms.Button btnSearch;
  18. private System.Windows.Forms.Label label7;
  19. private System.Windows.Forms.Label label1;
  20. private System.Windows.Forms.TextBox txt1;
  21. private System.Windows.Forms.TextBox txt3;
  22. private System.Windows.Forms.TextBox txt2;
  23. private System.Data.SqlClient.SqlDataAdapter da1;
  24. private System.Data.SqlClient.SqlCommand sqlSelectCommand1;
  25. private System.Data.SqlClient.SqlConnection sqlConnection1;
  26. private 生产管理系统.DataSet3 dataSet31;
  27. private System.Data.DataView dataView1;
  28. private System.Windows.Forms.TextBox textBox1;
  29. private System.Windows.Forms.TextBox textBox2;
  30. private System.Windows.Forms.TextBox txt5;
  31. private System.Windows.Forms.TextBox txt4;
  32. private System.Windows.Forms.TextBox textBox3;
  33. private System.Windows.Forms.TextBox txt6;
  34. private System.Windows.Forms.Label label2;
  35. private System.Windows.Forms.Label label3;
  36. private System.Windows.Forms.Label label4;
  37. private System.Windows.Forms.Label label5;
  38. private System.Windows.Forms.Label label8;
  39. private System.Windows.Forms.Label label9;
  40. private System.Windows.Forms.TextBox textBox4;
  41. private System.Windows.Forms.TextBox textBox5;
  42. private System.Windows.Forms.TextBox textBox6;
  43. private System.Windows.Forms.Label label10;
  44. private System.Windows.Forms.Label label11;
  45. private System.Windows.Forms.Label label12;
  46. /// <summary>
  47. /// 必需的设计器变量。
  48. /// </summary>
  49. private System.ComponentModel.Container components = null;
  50. public MRPHistory()
  51. {
  52. //
  53. // Windows 窗体设计器支持所必需的
  54. //
  55. InitializeComponent();
  56. //
  57. // TODO: 在 InitializeComponent 调用后添加任何构造函数代码
  58. //
  59. }
  60. /// <summary>
  61. /// 清理所有正在使用的资源。
  62. /// </summary>
  63. protected override void Dispose( bool disposing )
  64. {
  65. if( disposing )
  66. {
  67. if(components != null)
  68. {
  69. components.Dispose();
  70. }
  71. }
  72. base.Dispose( disposing );
  73. }
  74. #region Windows 窗体设计器生成的代码
  75. /// <summary>
  76. /// 设计器支持所需的方法 - 不要使用代码编辑器修改
  77. /// 此方法的内容。
  78. /// </summary>
  79. private void InitializeComponent()
  80. {
  81. System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(MRPHistory));
  82. this.da1 = new System.Data.SqlClient.SqlDataAdapter();
  83. this.sqlSelectCommand1 = new System.Data.SqlClient.SqlCommand();
  84. this.sqlConnection1 = new System.Data.SqlClient.SqlConnection();
  85. this.groupBox2 = new System.Windows.Forms.GroupBox();
  86. this.textBox1 = new System.Windows.Forms.TextBox();
  87. this.dataView1 = new System.Data.DataView();
  88. this.dataSet31 = new 生产管理系统.DataSet3();
  89. this.textBox2 = new System.Windows.Forms.TextBox();
  90. this.txt5 = new System.Windows.Forms.TextBox();
  91. this.txt4 = new System.Windows.Forms.TextBox();
  92. this.textBox3 = new System.Windows.Forms.TextBox();
  93. this.txt6 = new System.Windows.Forms.TextBox();
  94. this.label2 = new System.Windows.Forms.Label();
  95. this.label3 = new System.Windows.Forms.Label();
  96. this.label4 = new System.Windows.Forms.Label();
  97. this.label5 = new System.Windows.Forms.Label();
  98. this.label8 = new System.Windows.Forms.Label();
  99. this.label9 = new System.Windows.Forms.Label();
  100. this.textBox4 = new System.Windows.Forms.TextBox();
  101. this.textBox5 = new System.Windows.Forms.TextBox();
  102. this.textBox6 = new System.Windows.Forms.TextBox();
  103. this.label10 = new System.Windows.Forms.Label();
  104. this.label11 = new System.Windows.Forms.Label();
  105. this.label12 = new System.Windows.Forms.Label();
  106. this.dataGrid1 = new System.Windows.Forms.DataGrid();
  107. this.groupBox1 = new System.Windows.Forms.GroupBox();
  108. this.txt3 = new System.Windows.Forms.TextBox();
  109. this.label6 = new System.Windows.Forms.Label();
  110. this.btnSearch = new System.Windows.Forms.Button();
  111. this.txt2 = new System.Windows.Forms.TextBox();
  112. this.label7 = new System.Windows.Forms.Label();
  113. this.txt1 = new System.Windows.Forms.TextBox();
  114. this.label1 = new System.Windows.Forms.Label();
  115. this.groupBox2.SuspendLayout();
  116. ((System.ComponentModel.ISupportInitialize)(this.dataView1)).BeginInit();
  117. ((System.ComponentModel.ISupportInitialize)(this.dataSet31)).BeginInit();
  118. ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
  119. this.groupBox1.SuspendLayout();
  120. this.SuspendLayout();
  121. // 
  122. // da1
  123. // 
  124. this.da1.SelectCommand = this.sqlSelectCommand1;
  125. this.da1.TableMappings.AddRange(new System.Data.Common.DataTableMapping[] {
  126.   new System.Data.Common.DataTableMapping("Table", "mrp物料需求历史", new System.Data.Common.DataColumnMapping[] {
  127.    new System.Data.Common.DataColumnMapping("物料名称", "物料名称"),
  128.    new System.Data.Common.DataColumnMapping("发布编号", "发布编号"),
  129.    new System.Data.Common.DataColumnMapping("发布时间", "发布时间"),
  130.    new System.Data.Common.DataColumnMapping("物料编号", "物料编号"),
  131.    new System.Data.Common.DataColumnMapping("年份", "年份"),
  132.    new System.Data.Common.DataColumnMapping("计划期", "计划期"),
  133.    new System.Data.Common.DataColumnMapping("期初库存", "期初库存"),
  134.    new System.Data.Common.DataColumnMapping("毛需求", "毛需求"),
  135.    new System.Data.Common.DataColumnMapping("预计入库", "预计入库"),
  136.    new System.Data.Common.DataColumnMapping("预计出库", "预计出库"),
  137.    new System.Data.Common.DataColumnMapping("预计库存", "预计库存"),
  138.    new System.Data.Common.DataColumnMapping("净需求", "净需求"),
  139.    new System.Data.Common.DataColumnMapping("计划产出", "计划产出"),
  140.    new System.Data.Common.DataColumnMapping("计划投入", "计划投入")})});
  141. // 
  142. // sqlSelectCommand1
  143. // 
  144. this.sqlSelectCommand1.CommandText = "SELECT b.物料名称, a.发布编号, a.发布时间, a.物料编号, a.年份, a.计划期, a.期初库存, a.毛需求, a.预计入库, a.预计出库" +
  145. ", a.预计库存, a.净需求, a.计划产出, a.计划投入 FROM mrp物料需求历史 a INNER JOIN 物料主文件 b ON a.物料编号 = " +
  146. "b.物料编号";
  147. this.sqlSelectCommand1.Connection = this.sqlConnection1;
  148. // 
  149. // sqlConnection1
  150. // 
  151. this.sqlConnection1.ConnectionString = "workstation id=localhost;Integrated Security=SSPI;Database=mrpbook;";
  152. // 
  153. // groupBox2
  154. // 
  155. this.groupBox2.Controls.Add(this.textBox1);
  156. this.groupBox2.Controls.Add(this.textBox2);
  157. this.groupBox2.Controls.Add(this.txt5);
  158. this.groupBox2.Controls.Add(this.txt4);
  159. this.groupBox2.Controls.Add(this.textBox3);
  160. this.groupBox2.Controls.Add(this.txt6);
  161. this.groupBox2.Controls.Add(this.label2);
  162. this.groupBox2.Controls.Add(this.label3);
  163. this.groupBox2.Controls.Add(this.label4);
  164. this.groupBox2.Controls.Add(this.label5);
  165. this.groupBox2.Controls.Add(this.label8);
  166. this.groupBox2.Controls.Add(this.label9);
  167. this.groupBox2.Controls.Add(this.textBox4);
  168. this.groupBox2.Controls.Add(this.textBox5);
  169. this.groupBox2.Controls.Add(this.textBox6);
  170. this.groupBox2.Controls.Add(this.label10);
  171. this.groupBox2.Controls.Add(this.label11);
  172. this.groupBox2.Controls.Add(this.label12);
  173. this.groupBox2.Location = new System.Drawing.Point(0, 64);
  174. this.groupBox2.Name = "groupBox2";
  175. this.groupBox2.Size = new System.Drawing.Size(544, 120);
  176. this.groupBox2.TabIndex = 1;
  177. this.groupBox2.TabStop = false;
  178. // 
  179. // textBox1
  180. // 
  181. this.textBox1.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataView1, "年份"));
  182. this.textBox1.Enabled = false;
  183. this.textBox1.Location = new System.Drawing.Point(72, 56);
  184. this.textBox1.Name = "textBox1";
  185. this.textBox1.ReadOnly = true;
  186. this.textBox1.TabIndex = 72;
  187. this.textBox1.Text = "";
  188. // 
  189. // dataView1
  190. // 
  191. this.dataView1.Table = this.dataSet31.mrp物料需求历史;
  192. // 
  193. // dataSet31
  194. // 
  195. this.dataSet31.DataSetName = "DataSet3";
  196. this.dataSet31.Locale = new System.Globalization.CultureInfo("zh-CN");
  197. // 
  198. // textBox2
  199. // 
  200. this.textBox2.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataView1, "物料编号"));
  201. this.textBox2.Enabled = false;
  202. this.textBox2.Location = new System.Drawing.Point(72, 26);
  203. this.textBox2.Name = "textBox2";
  204. this.textBox2.ReadOnly = true;
  205. this.textBox2.TabIndex = 71;
  206. this.textBox2.Text = "";
  207. // 
  208. // txt5
  209. // 
  210. this.txt5.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataView1, "计划期"));
  211. this.txt5.Enabled = false;
  212. this.txt5.Location = new System.Drawing.Point(256, 56);
  213. this.txt5.Name = "txt5";
  214. this.txt5.ReadOnly = true;
  215. this.txt5.TabIndex = 74;
  216. this.txt5.Text = "";
  217. // 
  218. // txt4
  219. // 
  220. this.txt4.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataView1, "物料名称"));
  221. this.txt4.Enabled = false;
  222. this.txt4.Location = new System.Drawing.Point(256, 26);
  223. this.txt4.Name = "txt4";
  224. this.txt4.ReadOnly = true;
  225. this.txt4.TabIndex = 70;
  226. this.txt4.Text = "";
  227. // 
  228. // textBox3
  229. // 
  230. this.textBox3.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataView1, "期初库存"));
  231. this.textBox3.Enabled = false;
  232. this.textBox3.Location = new System.Drawing.Point(72, 88);
  233. this.textBox3.Name = "textBox3";
  234. this.textBox3.ReadOnly = true;
  235. this.textBox3.TabIndex = 69;
  236. this.textBox3.Text = "";
  237. // 
  238. // txt6
  239. // 
  240. this.txt6.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataView1, "毛需求"));
  241. this.txt6.Enabled = false;
  242. this.txt6.Location = new System.Drawing.Point(256, 88);
  243. this.txt6.Name = "txt6";
  244. this.txt6.ReadOnly = true;
  245. this.txt6.TabIndex = 73;
  246. this.txt6.Text = "";
  247. // 
  248. // label2
  249. // 
  250. this.label2.Location = new System.Drawing.Point(33, 61);
  251. this.label2.Name = "label2";
  252. this.label2.Size = new System.Drawing.Size(32, 16);
  253. this.label2.TabIndex = 66;
  254. this.label2.Text = "年份";
  255. // 
  256. // label3
  257. // 
  258. this.label3.Location = new System.Drawing.Point(18, 31);
  259. this.label3.Name = "label3";
  260. this.label3.Size = new System.Drawing.Size(56, 16);
  261. this.label3.TabIndex = 63;
  262. this.label3.Text = "物料编号";
  263. // 
  264. // label4
  265. // 
  266. this.label4.Location = new System.Drawing.Point(216, 62);
  267. this.label4.Name = "label4";
  268. this.label4.Size = new System.Drawing.Size(48, 16);
  269. this.label4.TabIndex = 67;
  270. this.label4.Text = "计划期";
  271. // 
  272. // label5
  273. // 
  274. this.label5.Location = new System.Drawing.Point(203, 30);
  275. this.label5.Name = "label5";
  276. this.label5.Size = new System.Drawing.Size(56, 16);
  277. this.label5.TabIndex = 65;
  278. this.label5.Text = "物料名称";
  279. // 
  280. // label8
  281. // 
  282. this.label8.Location = new System.Drawing.Point(16, 92);
  283. this.label8.Name = "label8";
  284. this.label8.Size = new System.Drawing.Size(56, 16);
  285. this.label8.TabIndex = 64;
  286. this.label8.Text = "期初库存";
  287. // 
  288. // label9
  289. // 
  290. this.label9.Location = new System.Drawing.Point(216, 93);
  291. this.label9.Name = "label9";
  292. this.label9.Size = new System.Drawing.Size(48, 16);
  293. this.label9.TabIndex = 68;
  294. this.label9.Text = "毛需求";
  295. // 
  296. // textBox4
  297. // 
  298. this.textBox4.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataView1, "预计库存"));
  299. this.textBox4.Enabled = false;
  300. this.textBox4.Location = new System.Drawing.Point(424, 56);
  301. this.textBox4.Name = "textBox4";
  302. this.textBox4.ReadOnly = true;
  303. this.textBox4.TabIndex = 74;
  304. this.textBox4.Text = "";
  305. // 
  306. // textBox5
  307. // 
  308. this.textBox5.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataView1, "预计出库"));
  309. this.textBox5.Enabled = false;
  310. this.textBox5.Location = new System.Drawing.Point(424, 26);
  311. this.textBox5.Name = "textBox5";
  312. this.textBox5.ReadOnly = true;
  313. this.textBox5.TabIndex = 70;
  314. this.textBox5.Text = "";
  315. // 
  316. // textBox6
  317. // 
  318. this.textBox6.DataBindings.Add(new System.Windows.Forms.Binding("Text", this.dataView1, "净需求"));
  319. this.textBox6.Enabled = false;
  320. this.textBox6.Location = new System.Drawing.Point(424, 88);
  321. this.textBox6.Name = "textBox6";
  322. this.textBox6.ReadOnly = true;
  323. this.textBox6.TabIndex = 73;
  324. this.textBox6.Text = "";
  325. // 
  326. // label10
  327. // 
  328. this.label10.Location = new System.Drawing.Point(371, 62);
  329. this.label10.Name = "label10";
  330. this.label10.Size = new System.Drawing.Size(56, 16);
  331. this.label10.TabIndex = 67;
  332. this.label10.Text = "预计库存";
  333. // 
  334. // label11
  335. // 
  336. this.label11.Location = new System.Drawing.Point(373, 32);
  337. this.label11.Name = "label11";
  338. this.label11.Size = new System.Drawing.Size(56, 16);
  339. this.label11.TabIndex = 65;
  340. this.label11.Text = "预计出库";
  341. // 
  342. // label12
  343. // 
  344. this.label12.Location = new System.Drawing.Point(384, 96);
  345. this.label12.Name = "label12";
  346. this.label12.Size = new System.Drawing.Size(56, 16);
  347. this.label12.TabIndex = 68;
  348. this.label12.Text = "净需求";
  349. // 
  350. // dataGrid1
  351. // 
  352. this.dataGrid1.CaptionVisible = false;
  353. this.dataGrid1.DataMember = "";
  354. this.dataGrid1.DataSource = this.dataView1;
  355. this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
  356. this.dataGrid1.Location = new System.Drawing.Point(0, 192);
  357. this.dataGrid1.Name = "dataGrid1";
  358. this.dataGrid1.ReadOnly = true;
  359. this.dataGrid1.Size = new System.Drawing.Size(544, 224);
  360. this.dataGrid1.TabIndex = 2;
  361. // 
  362. // groupBox1
  363. // 
  364. this.groupBox1.Controls.Add(this.txt3);
  365. this.groupBox1.Controls.Add(this.label6);
  366. this.groupBox1.Controls.Add(this.btnSearch);
  367. this.groupBox1.Controls.Add(this.txt2);
  368. this.groupBox1.Controls.Add(this.label7);
  369. this.groupBox1.Controls.Add(this.txt1);
  370. this.groupBox1.Controls.Add(this.label1);
  371. this.groupBox1.Location = new System.Drawing.Point(0, 8);
  372. this.groupBox1.Name = "groupBox1";
  373. this.groupBox1.Size = new System.Drawing.Size(544, 56);
  374. this.groupBox1.TabIndex = 31;
  375. this.groupBox1.TabStop = false;
  376. // 
  377. // txt3
  378. // 
  379. this.txt3.Location = new System.Drawing.Point(440, 24);
  380. this.txt3.Name = "txt3";
  381. this.txt3.TabIndex = 7;
  382. this.txt3.Text = "";
  383. // 
  384. // label6
  385. // 
  386. this.label6.Location = new System.Drawing.Point(392, 27);
  387. this.label6.Name = "label6";
  388. this.label6.Size = new System.Drawing.Size(48, 16);
  389. this.label6.TabIndex = 5;
  390. this.label6.Text = "计划期";
  391. // 
  392. // btnSearch
  393. // 
  394. this.btnSearch.Image = ((System.Drawing.Image)(resources.GetObject("btnSearch.Image")));
  395. this.btnSearch.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
  396. this.btnSearch.Location = new System.Drawing.Point(16, 20);
  397. this.btnSearch.Name = "btnSearch";
  398. this.btnSearch.Size = new System.Drawing.Size(72, 24);
  399. this.btnSearch.TabIndex = 3;
  400. this.btnSearch.Text = " 搜索";
  401. this.btnSearch.Click += new System.EventHandler(this.btnSearch_Click);
  402. // 
  403. // txt2
  404. // 
  405. this.txt2.Location = new System.Drawing.Point(280, 24);
  406. this.txt2.Name = "txt2";
  407. this.txt2.TabIndex = 6;
  408. this.txt2.Text = "";
  409. // 
  410. // label7
  411. // 
  412. this.label7.Location = new System.Drawing.Point(248, 28);
  413. this.label7.Name = "label7";
  414. this.label7.Size = new System.Drawing.Size(32, 16);
  415. this.label7.TabIndex = 4;
  416. this.label7.Text = "年份";
  417. // 
  418. // txt1
  419. // 
  420. this.txt1.Location = new System.Drawing.Point(160, 24);
  421. this.txt1.Name = "txt1";
  422. this.txt1.Size = new System.Drawing.Size(80, 21);
  423. this.txt1.TabIndex = 6;
  424. this.txt1.Text = "";
  425. // 
  426. // label1
  427. // 
  428. this.label1.Location = new System.Drawing.Point(109, 27);
  429. this.label1.Name = "label1";
  430. this.label1.Size = new System.Drawing.Size(56, 16);
  431. this.label1.TabIndex = 4;
  432. this.label1.Text = "物料编号";
  433. // 
  434. // MRPHistory
  435. // 
  436. this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
  437. this.ClientSize = new System.Drawing.Size(552, 421);
  438. this.Controls.Add(this.dataGrid1);
  439. this.Controls.Add(this.groupBox2);
  440. this.Controls.Add(this.groupBox1);
  441. this.Name = "MRPHistory";
  442. this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
  443. this.Text = "【MRP历史查询】";
  444. this.Load += new System.EventHandler(this.MRPHistory_Load);
  445. this.groupBox2.ResumeLayout(false);
  446. ((System.ComponentModel.ISupportInitialize)(this.dataView1)).EndInit();
  447. ((System.ComponentModel.ISupportInitialize)(this.dataSet31)).EndInit();
  448. ((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
  449. this.groupBox1.ResumeLayout(false);
  450. this.ResumeLayout(false);
  451. }
  452. #endregion
  453. //-------------根据输入数据查询MRP计算记录-------------
  454. private void btnSearch_Click(object sender, System.EventArgs e)
  455. {
  456. string strFilter="";
  457. if(txt1.Text.Trim() != "")//设置表的过滤条件
  458. strFilter += "物料编号 like '%" + txt1.Text.Trim() + "%' and ";
  459. if(txt2.Text.Trim() != "")
  460. strFilter += "年份= '" + txt2.Text.Trim() + "' and ";
  461. if(txt3.Text.Trim() != "")
  462. strFilter += "计划期='" + txt3.Text.Trim() + "' and ";
  463. if(strFilter != "")    // 存在查询条件
  464. strFilter = strFilter.Substring(0,strFilter.Length-5);
  465. dataView1.RowFilter=strFilter;
  466. }
  467. //--------------窗体创建时,读入全部数据---------------
  468. private void MRPHistory_Load(object sender, System.EventArgs e)
  469. {
  470. da1.Fill(dataSet31);
  471. }
  472. }
  473. }