JHY01.cs 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using CoreFS.CA06;
  10. using System.Collections;
  11. using System.Text.RegularExpressions;//正则表达式所在空间
  12. using Infragistics.Win.UltraWinGrid;
  13. namespace Core.LZMes.Client.UIB
  14. {
  15. public partial class JHY01 : FrmBase
  16. {
  17. public JHY01()
  18. {
  19. InitializeComponent();
  20. }
  21. public override void ToolBar_Click(object sender, string ToolbarKey)
  22. {
  23. switch (ToolbarKey)
  24. {
  25. case "Query":
  26. this.DoQuery();
  27. break;
  28. case "Save":
  29. this.DoSave();
  30. break;
  31. case "Get":
  32. this.GetCoil();
  33. break;
  34. case "Rcv":
  35. this.recvdata();
  36. break;
  37. }
  38. }
  39. string prodline = null;
  40. public void DoQuery()
  41. {
  42. OperateConditionRecode.WriteCondition("UIB100202_1", this.comboBox1.Text);
  43. this.dataSet1.Clear();
  44. ArrayList al = new ArrayList();
  45. //if (this.comboBox1.Text == "热轧")
  46. //{
  47. // al.Add("UIB100202_01.SELECT");
  48. //}
  49. //else if (this.comboBox1.Text == "连退")
  50. //{
  51. // al.Add("UIB100202_02.SELECT");
  52. //}
  53. //else if (this.comboBox1.Text == "酸洗")
  54. //{
  55. // al.Add("UIB100202_02.SELECT");
  56. //}
  57. //else if (this.comboBox1.Text == "中厚板")
  58. //{
  59. // al.Add("UIB100202_03.SELECT");
  60. //}
  61. //else if (this.comboBox1.Text == "优特钢")
  62. //{
  63. // al.Add("UIB100202_04.SELECT");
  64. //}
  65. if (this.comboBox2.Text == "未收")
  66. {
  67. al.Add("JHY01.SELECT");
  68. }
  69. else if (this.comboBox2.Text == "已收")
  70. {
  71. al.Add("JHY02.SELECT");
  72. }
  73. al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd"));
  74. al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd"));
  75. CoreClientParam ccp = new CoreClientParam();
  76. ccp.ServerName = "UIB.COM.ComDBQuery";
  77. ccp.MethodName = "doSimpleQuery";
  78. ccp.ServerParams = new object[] { al };
  79. ccp.SourceDataTable = this.dataSet1.Tables[0];
  80. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  81. if (this.comboBox2.Text == "未收")
  82. {
  83. ultraGrid1.DisplayLayout.Bands[0].Columns["COIL_STEEL_NO"].Hidden = true;
  84. }
  85. else
  86. {
  87. ultraGrid1.DisplayLayout.Bands[0].Columns["COIL_STEEL_NO"].Hidden = false;
  88. }
  89. }
  90. //钢印号确定
  91. public void DoSave()
  92. {
  93. try
  94. {
  95. prodline = this.comboBox1.Text;
  96. if (MessageBox.Show("确认进行" + prodline + "委托验收?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  97. return;
  98. Hashtable ht = ht = new Hashtable();
  99. ArrayList alSMPNO = new ArrayList();//存储试样号
  100. ArrayList alSMPCUTLOC = new ArrayList();//存储试样位置
  101. string strSMPNO = null;
  102. string strSMPCUTLOC = null;
  103. string cnt = "0";
  104. string str = null;
  105. if (prodline == "热轧")
  106. str = "R";
  107. else if (prodline == "连退" || prodline == "酸洗")
  108. str = "L";
  109. else if (prodline == "中厚板")
  110. str = "Z";
  111. else if (prodline == "优特钢")
  112. str = "Y";
  113. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  114. {
  115. if (Convert.ToBoolean(ugr.Cells["CHK"].Text))
  116. {
  117. cnt += 1;
  118. strSMPNO = strSMPNO + ugr.Cells["SMP_NO"].Text;
  119. strSMPCUTLOC = strSMPCUTLOC + ugr.Cells["SPECIMEN_NO"].Text;
  120. }
  121. }
  122. if (strSMPNO == null) return;
  123. CoreClientParam ccp = new CoreClientParam();
  124. ht.Add("i1", strSMPNO);
  125. ht.Add("i2", strSMPCUTLOC);
  126. ht.Add("i3", cnt);
  127. ht.Add("o4", "");
  128. //ht.Add("i4", "R");
  129. //ht.Add("i5", "");
  130. //ht.Add("o6", "");
  131. ccp.ServerName = "UIB.COM.ComDBProcedure";
  132. ccp.MethodName = "doXmlProcedure";
  133. ccp.ServerParams = new object[] { "JHY_01.CALL", ht };
  134. CoreClientParam rccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  135. ArrayList al = rccp.ReturnObject as ArrayList;
  136. if (al[0].ToString() != "YY")//确认是否存在问题
  137. {
  138. MessageBox.Show(al[0].ToString() , "提示");
  139. return;
  140. }
  141. this.DoQuery();
  142. }
  143. catch (Exception ex)
  144. {
  145. MessageBox.Show("系统异常,请与技术中心联系");
  146. }
  147. }
  148. //接口数据提取
  149. public void GetCoil()
  150. {
  151. try
  152. {
  153. string str = this.comboBox1.Text;
  154. if (MessageBox.Show("确定进行" + str + "对象数据提取?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  155. return;
  156. Hashtable ht = new Hashtable();
  157. ht.Add("i1", str);
  158. ht.Add("o2", "");
  159. CoreClientParam ccp = new CoreClientParam();
  160. ccp.ServerName = "UIB.JHY.JHyComCallProc";
  161. ccp.MethodName = "doSimpleProc";
  162. ccp.ServerParams = new object[] { "UIB100202_01.CALL", ht };
  163. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  164. this.DoQuery();
  165. }
  166. catch (Exception ex)
  167. {
  168. MessageBox.Show("系统异常,请与技术中心联系");
  169. }
  170. }
  171. public void recvdata()
  172. {
  173. try
  174. {
  175. string str = this.comboBox1.Text;
  176. if (MessageBox.Show("确定进行" + str + "中厚板数据提取?", "提示", MessageBoxButtons.OKCancel) == DialogResult.Cancel)
  177. return;
  178. Hashtable ht = new Hashtable();
  179. ht.Add("o1", "");
  180. CoreClientParam ccp = new CoreClientParam();
  181. ccp.ServerName = "UIB.JHY.JHyComCallProc";
  182. ccp.MethodName = "doSimpleProc";
  183. ccp.ServerParams = new object[] { "UIB100202_03.CALL", ht };
  184. // this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  185. CoreClientParam rccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  186. ArrayList al = rccp.ReturnObject as ArrayList;
  187. if (al[0].ToString() != "YY")//确认是否存在问题
  188. {
  189. MessageBox.Show(al[0].ToString(), "提示");
  190. return;
  191. }
  192. }
  193. catch (Exception ex)
  194. {
  195. MessageBox.Show("系统异常,请与技术中心联系");
  196. }
  197. }
  198. private void UIB100202_Load(object sender, EventArgs e)
  199. {
  200. try
  201. {
  202. this.comboBox1.Text = OperateConditionRecode.ReadCondition("UIB100202_1");
  203. }
  204. catch (Exception ex)
  205. {
  206. }
  207. // this.comboBox1.SelectedIndex = 0;
  208. }
  209. private void ultraGrid1_KeyDown(object sender, KeyEventArgs e)
  210. {
  211. try
  212. {
  213. if (e.KeyCode != Keys.Enter) return;//回车时,才保存数据
  214. if (this.ultraGrid1.ActiveCell == null) return;
  215. if (this.ultraGrid1.ActiveCell.Column.Key != "COIL_STEEL_NO")
  216. return;
  217. string str = this.ultraGrid1.ActiveRow.Cells["COIL_STEEL_NO"].Text;
  218. //钢印号格式验证
  219. Regex r = new Regex(@"^\d{4}$+");
  220. Match m = r.Match(str);
  221. if (!m.Success && str != "" )//str为空则表示清除钢印号
  222. {
  223. MessageBox.Show("钢印号格式错误(4位数字)", "提示");
  224. return;
  225. }
  226. ArrayList al = new ArrayList();
  227. al.Add("JHY_01.UPDATE");
  228. al.Add(this.ultraGrid1.ActiveRow.Cells["COIL_STEEL_NO"].Text);//钢印号
  229. al.Add(this.ultraGrid1.ActiveRow.Cells["SMP_NO"].Text);//试样号
  230. CoreClientParam ccp = new CoreClientParam();
  231. ccp.ServerName = "UIB.COM.ComDBSave";
  232. ccp.ServerParams = new object[] { al };
  233. ccp.MethodName = "doXmlSave";
  234. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  235. //if (str != "")
  236. //{
  237. // //下一行钢印号值+1
  238. // int steelNo = Convert.ToInt32(str);//钢印号
  239. // this.ultraGrid1.Rows[this.ultraGrid1.ActiveRow.Index + 1].Cells["COIL_STEEL_NO"].Value = Convert.ToString(steelNo + 1);
  240. //}
  241. ////跳转到下一行,并编辑钢印号
  242. //this.ultraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.NextRow);
  243. //this.ultraGrid1.ActiveRow.Cells["COIL_STEEL_NO"].Activate();
  244. //this.ultraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);
  245. //this.ultraGrid1.UpdateData();
  246. }
  247. catch (Exception ex)
  248. {
  249. MessageBox.Show("已到达行末!","提示");
  250. //System.Diagnostics.Debug.WriteLine(ex.ToString());
  251. }
  252. }
  253. private void checkBox1_CheckedChanged(object sender, EventArgs e)
  254. {
  255. try
  256. {
  257. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  258. {
  259. ugr.Cells["CHK"].Value = this.checkBox1.Checked;
  260. ugr.Update();
  261. }
  262. }
  263. catch (Exception ex)
  264. {
  265. System.Diagnostics.Debug.WriteLine(ex.ToString());
  266. }
  267. }
  268. private void checkBox2_CheckedChanged(object sender, EventArgs e)
  269. {
  270. try
  271. {
  272. if (this.checkBox2.Checked)
  273. {
  274. this.textBox1.Enabled = true;
  275. this.textBox2.Enabled = true;
  276. }
  277. else
  278. {
  279. this.textBox1.Enabled = false;
  280. this.textBox2.Enabled = false;
  281. }
  282. }
  283. catch (Exception ex)
  284. {
  285. }
  286. }
  287. private void textBox3_KeyDown(object sender, KeyEventArgs e)
  288. {
  289. if (e.KeyCode != Keys.Enter) return;//回车时,才保存数据
  290. this.button1_Click(null, new System.EventArgs());
  291. this.textBox3.Focus();
  292. }
  293. private void button1_Click(object sender, EventArgs e)
  294. {
  295. try
  296. {
  297. if (this.ultraGrid1.ActiveCell == null) return;
  298. //if (this.ultraGrid1.ActiveCell.Column.Key != "COIL_STEEL_NO")
  299. // return;
  300. string str = this.textBox3.Text;
  301. //钢印号格式验证
  302. Regex r = new Regex(@"^\d{4}$+");
  303. Match m = r.Match(str);
  304. if (!m.Success && str != "")//str为空则表示清除钢印号
  305. {
  306. MessageBox.Show("钢印号格式错误(4位数字)", "提示");
  307. return;
  308. }
  309. ArrayList al = new ArrayList();
  310. al.Add("JHY_01.UPDATE");
  311. al.Add(str);//钢印号
  312. al.Add(this.ultraGrid1.ActiveRow.Cells["SMP_NO"].Text);//试样号
  313. // al.Add(this.ultraGrid1.ActiveRow.Cells["SMP_CUT_LOC"].Text);//试样位置
  314. //this.ultraGrid1.ActiveRow.Index
  315. CoreClientParam ccp = new CoreClientParam();
  316. ccp.ServerName = "UIB.COM.ComDBQuery";
  317. ccp.ServerParams = new object[] { al };
  318. ccp.MethodName = "doSimpleSave";
  319. CoreClientParam rccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  320. string strRtn = rccp.ReturnInfo;
  321. //钢印号保存成功
  322. if (strRtn == "")
  323. {
  324. this.ultraGrid1.ActiveRow.Cells["COIL_STEEL_NO"].Value = str;
  325. }
  326. else
  327. {
  328. MessageBox.Show("钢印号输入失败!", "提示");
  329. }
  330. if (str != "")
  331. {
  332. this.ultraGrid1.ActiveRow.Cells["COIL_STEEL_NO"].Value = str;
  333. //下一行钢印号值+1
  334. int steelNo = Convert.ToInt32(str)+1;//钢印号
  335. this.textBox3.Text = Convert.ToString(steelNo);
  336. //this.ultraGrid1.Rows[this.ultraGrid1.ActiveRow.Index + 1].Activate();
  337. }
  338. //跳转到下一行,并编辑钢印号
  339. this.ultraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.NextRow);
  340. this.ultraGrid1.ActiveRow.Cells["COIL_STEEL_NO"].Activate();
  341. this.ultraGrid1.PerformAction(Infragistics.Win.UltraWinGrid.UltraGridAction.EnterEditMode);
  342. this.ultraGrid1.UpdateData();
  343. }
  344. catch (Exception ex)
  345. {
  346. }
  347. }
  348. private void JHY01_Load(object sender, EventArgs e)
  349. {
  350. this.comboBox2.Text = "未做";
  351. }
  352. }
  353. }