frmSetMaterialName.cs 7.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Text;
  7. using System.Windows.Forms;
  8. using CoreFS.CA06;
  9. using System.Collections;
  10. using Core.Mes.Client.Common;
  11. namespace Core.LgMes.Client.LgJobMgt
  12. {
  13. public partial class frmSetMaterialName : Form
  14. {
  15. public frmSetMaterialName(string szWLM, string szLX)
  16. {
  17. InitializeComponent();
  18. this.m_szLX = szLX;
  19. this.label1.Text = "当前物料名: " + szWLM;
  20. }
  21. private DataTable m_dtMain = null;
  22. private string m_szLX = "1";
  23. public bool bChange = false;
  24. public string m_szWLMC = ""; //物料名称
  25. public string m_szWLBM = ""; //物料编码
  26. public string m_szWLLX = ""; //物料类型
  27. public OpeBase obMain; //服务端URL
  28. private void frmSetMaterialName_Load(object sender, EventArgs e)
  29. {
  30. if (this.m_szLX == "0")
  31. {
  32. this.rbFZL.Enabled = false;
  33. this.rbHJ.Checked = true;
  34. }
  35. if (this.m_szLX == "3")
  36. {
  37. rbFZL.Checked = true;
  38. rbWS.Visible = true;
  39. btReset.Visible = false;
  40. }
  41. GetDataSource();
  42. BindingGrid();
  43. }
  44. private void GetDataSource()
  45. {
  46. string strFl = ""; //辅料
  47. string strHj = ""; //合金
  48. string strWs = ""; //喂丝
  49. string strBh = ""; //保护渣
  50. try
  51. {
  52. ArrayList arry = new ArrayList();
  53. string strErr = "";
  54. //1 表示辅料、合金
  55. if (this.m_szLX == "1")
  56. {
  57. strFl = "FL";
  58. strHj = "HJ";
  59. }
  60. else if (this.m_szLX == "0") // 0 表示铁合金
  61. strHj = "HJ";
  62. else if (m_szLX == "3")
  63. {
  64. strFl = "FL";
  65. strHj = "HJ";
  66. strWs = "WS";
  67. }
  68. arry.Add("GetHndMtrInfo.Select");
  69. arry.Add(strFl);
  70. arry.Add(strHj);
  71. arry.Add(strWs);
  72. arry.Add(strBh);
  73. CommonClientToServer ccTs = new CommonClientToServer();
  74. ccTs.ob = obMain;
  75. //查询料斗物料配置信息
  76. DataSet ds = ccTs.ExecuteQueryFunctions("Core.LgMes.Server.LgJobMgt.ClassCommonModule",
  77. "GetHndMtrInfo", arry, out strErr);
  78. if (strErr == "" && ds != null)
  79. {
  80. this.m_dtMain = ds.Tables[0];
  81. }
  82. }
  83. catch (Exception ex)
  84. {
  85. string msg = ex.Message;
  86. }
  87. }
  88. private void BindingGrid()
  89. {
  90. this.ultraGrid1.DataSource = this.m_dtMain;
  91. this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELCODE"].Width = 0;
  92. this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELCODE"].Header.Caption = "物料编码";
  93. this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELCODE"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  94. this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELCODE"].Hidden = true;
  95. this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELFORSHORT"].Width = 130;
  96. this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELFORSHORT"].Header.Caption = "物料简称";
  97. this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELFORSHORT"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  98. this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELNAME"].Width = 200;
  99. this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELNAME"].Header.Caption = "物料全称";
  100. this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELNAME"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  101. this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELTYPE"].Width = 0;
  102. this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELTYPE"].Header.Caption = "物料类型";
  103. this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELTYPE"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  104. this.ultraGrid1.DisplayLayout.Bands[0].Columns["MATERIELTYPE"].Hidden = true;
  105. }
  106. private void rbFZL_Click(object sender, EventArgs e)
  107. {
  108. this.m_dtMain.DefaultView.RowFilter = "MATERIELTYPE='" + this.rbFZL.Tag.ToString() + "'";
  109. this.ultraGrid1.UpdateData();
  110. }
  111. private void rbHJ_Click(object sender, EventArgs e)
  112. {
  113. if (this.m_szLX != "0")
  114. {
  115. this.m_dtMain.DefaultView.RowFilter = "MATERIELTYPE='" + this.rbHJ.Tag.ToString() + "'";
  116. this.ultraGrid1.UpdateData();
  117. }
  118. }
  119. private void ultraGrid1_Click(object sender, EventArgs e)
  120. {
  121. if (this.ultraGrid1.ActiveRow != null)
  122. {
  123. this.label1.Text = "当前物料名: " + this.ultraGrid1.ActiveRow.Cells["MATERIELFORSHORT"].Value.ToString();
  124. }
  125. }
  126. private void btOK_Click(object sender, EventArgs e)
  127. {
  128. if (this.ultraGrid1.ActiveRow != null)
  129. {
  130. this.bChange = true;
  131. if (m_szWLMC == "RESET")
  132. {
  133. m_szWLBM = "";
  134. m_szWLMC = "";
  135. m_szWLLX = "";
  136. }
  137. else
  138. {
  139. m_szWLBM = this.ultraGrid1.ActiveRow.Cells["MATERIELCODE"].Value.ToString();
  140. this.m_szWLMC = this.ultraGrid1.ActiveRow.Cells["MATERIELFORSHORT"].Value.ToString();
  141. m_szWLLX = GetWLType();
  142. }
  143. }
  144. this.Close();
  145. }
  146. private void btReset_Click(object sender, EventArgs e)
  147. {
  148. this.label1.Text = "当前物料名: ";
  149. m_szWLMC = "RESET";
  150. }
  151. private void btClose_Click(object sender, EventArgs e)
  152. {
  153. this.Close();
  154. }
  155. private void ultraGrid1_DoubleClick(object sender, EventArgs e)
  156. {
  157. if (this.ultraGrid1.ActiveRow != null)
  158. {
  159. this.bChange = true;
  160. if (m_szWLMC == "RESET")
  161. {
  162. m_szWLBM = "";
  163. m_szWLMC = "";
  164. m_szWLLX = "";
  165. }
  166. else
  167. {
  168. m_szWLBM = this.ultraGrid1.ActiveRow.Cells["MATERIELCODE"].Value.ToString();
  169. this.m_szWLMC = this.ultraGrid1.ActiveRow.Cells["MATERIELFORSHORT"].Value.ToString();
  170. m_szWLLX = GetWLType();
  171. }
  172. }
  173. this.Close();
  174. }
  175. private string GetWLType()
  176. {
  177. if (rbFZL.Checked == true) m_szWLLX = "FL";
  178. if (rbHJ.Checked == true) m_szWLLX = "HJ";
  179. if (rbWS.Checked == true) m_szWLLX = "WS";
  180. return m_szWLLX;
  181. }
  182. private void rbWS_Click(object sender, EventArgs e)
  183. {
  184. this.m_dtMain.DefaultView.RowFilter = "MATERIELTYPE='" + this.rbWS.Tag.ToString() + "'";
  185. this.ultraGrid1.UpdateData();
  186. }
  187. }
  188. }