4410a63ed4a6b3c7ae675f1388386401ea77e001.svn-base 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262
  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 Infragistics.Win.UltraWinGrid;
  12. using Infragistics.Win;
  13. using System.Diagnostics;
  14. namespace Core.LZMes.Client.UIK
  15. {
  16. public partial class UIK050090 : FrmBase
  17. {
  18. public UIK050090()
  19. {
  20. InitializeComponent();
  21. }
  22. public override void ToolBar_Click(object sender, string ToolbarKey)
  23. {
  24. switch (ToolbarKey)
  25. {
  26. case "Query":
  27. this.DoQuery();
  28. break;
  29. case "Export":
  30. this.DoExport();
  31. break;
  32. }
  33. }
  34. private void DoQuery()
  35. {
  36. try
  37. {
  38. string starttiem = "";
  39. string endtime = "";
  40. bool flag = true;
  41. string coilNo = this.textBox2.Text.ToString().Trim();
  42. //if (coilNo != "")
  43. //{
  44. // try
  45. // {
  46. // if (coilNo.Length != 13)
  47. // {
  48. // MessageBox.Show("钢卷输入有误!");
  49. // return;
  50. // }
  51. // }
  52. // catch (Exception ex)
  53. // {
  54. // MessageBox.Show("钢卷输入有误!");
  55. // return;
  56. // }
  57. //}
  58. string ordNo = this.textBox1.Text.ToString().Trim();
  59. string seqNo = this.textBox3.Text.ToString().Trim();
  60. if (this.ultraCheckEditor1.Checked == false)
  61. {
  62. starttiem = this.ultraCalendarSTRATTIME.DateTime.ToString("yyyyMMdd");
  63. endtime = this.ultraCalendarENDTIME.DateTime.ToString("yyyyMMdd");
  64. this.dataSet3.Tables[0].Clear();
  65. CoreClientParam ccp = new CoreClientParam();
  66. ccp.ServerName = "UIK.UIK05.UIK050080";
  67. ccp.MethodName = "Query_Coil_State";
  68. ccp.ServerParams = new object[] { starttiem, endtime, flag, coilNo, ordNo, seqNo };
  69. ccp.SourceDataTable = this.dataSet3.Tables[0];
  70. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  71. DataRowCollection drs1 = dataSet3.Tables[0].Rows;
  72. if (drs1.Count <= 0)
  73. {
  74. MessageBox.Show("该时间内没有入库待机钢卷");
  75. return;
  76. }
  77. }
  78. else
  79. {
  80. starttiem = "";
  81. endtime = "";
  82. flag = false;
  83. this.dataSet3.Tables[0].Clear();
  84. CoreClientParam ccp2 = new CoreClientParam();
  85. ccp2.ServerName = "UIK.UIK05.UIK050080";
  86. ccp2.MethodName = "Query_Coil_State";
  87. ccp2.ServerParams = new object[] { starttiem, endtime, flag, coilNo, ordNo, seqNo };
  88. ccp2.SourceDataTable = this.dataSet3.Tables[0];
  89. this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
  90. DataRowCollection drs2 = dataSet3.Tables[0].Rows;
  91. if (drs2.Count <= 0)
  92. {
  93. MessageBox.Show("该时间内没有入库待机钢卷");
  94. return;
  95. }
  96. }
  97. }
  98. catch (Exception EX)
  99. {
  100. MessageBox.Show(EX.ToString());
  101. }
  102. }
  103. private void DoExport()
  104. {
  105. try
  106. {
  107. if (this.ultraGrid3.Rows.Count == 0)
  108. {
  109. MessageBox.Show("没有可以导出入库钢卷数据", "提示");
  110. return;
  111. }
  112. if (this.saveFileDialog2.ShowDialog(this) == DialogResult.OK)
  113. {
  114. string fName = this.saveFileDialog2.FileName;
  115. this.ultraGridExcelExporter1.Export(this.ultraGrid3, fName);
  116. Process.Start(fName);
  117. }
  118. }
  119. catch (Exception ex)
  120. {
  121. System.Diagnostics.Debug.WriteLine(ex.ToString());
  122. }
  123. }
  124. private void ultraGrid3_DoubleClickRow(object sender, Infragistics.Win.UltraWinGrid.DoubleClickRowEventArgs e)
  125. {
  126. try
  127. {
  128. Infragistics.Win.UltraWinGrid.UltraGrid uGrid = (Infragistics.Win.UltraWinGrid.UltraGrid)sender;
  129. int index = uGrid.ActiveRow.Index;
  130. string coilno = uGrid.ActiveRow.Cells["OLD_SAMPL_NO"].Text.Trim();
  131. string ordno = uGrid.ActiveRow.Cells["OLD_ORD_NO"].Text.Trim();
  132. string ordseq = uGrid.ActiveRow.Cells["OLD_ORD_SEQ"].Text.Trim();
  133. CoreClientParam ccp = new CoreClientParam();
  134. CoreClientParam ccp2 = new CoreClientParam();
  135. if (ordno == "" && coilno == "")
  136. {
  137. MessageBox.Show("钢卷信息不完整,无法查询!");
  138. return;
  139. }
  140. else
  141. {
  142. this.dataSet1.Tables[0].Clear();
  143. this.dataSet2.Tables[0].Clear();
  144. ccp.ServerName = "UIK.UIK05.UIK050090";
  145. ccp.MethodName = "DoQueryCaiZhi";
  146. ccp.ServerParams = new object[] { coilno };
  147. ccp.SourceDataTable = this.dataSet1.Tables[0];
  148. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  149. DataRowCollection drc1 = this.dataSet1.Tables[0].Rows;
  150. if (drc1.Count <= 0)
  151. {
  152. MessageBox.Show("无该钢卷的材质实绩信息");
  153. }
  154. else
  155. {
  156. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  157. {
  158. //不合格材质项目显示红色
  159. string QVAL = ugr.Cells["QLTY_VAL_WK"].Text;
  160. string QMIN = ugr.Cells["QLTY_MIN"].Text;
  161. string QMAX = ugr.Cells["QLTY_MAX"].Text;
  162. if (QVAL != null && QVAL != "")
  163. {
  164. if (QMIN != null && QMIN != "" && double.Parse(QVAL) < double.Parse(QMIN))
  165. {
  166. ugr.Cells["QLTY_VAL_WK"].Appearance.BackColor = Color.Red;
  167. }
  168. if (QMAX != null && QMAX != "" && double.Parse(QVAL) > double.Parse(QMAX))
  169. {
  170. ugr.Cells["QLTY_VAL_WK"].Appearance.BackColor = Color.Red;
  171. }
  172. }
  173. else if ((QMAX != null && QMAX != "") || (QMIN != null && QMIN != ""))
  174. {
  175. ugr.Cells["QLTY_VAL_WK"].Appearance.BackColor = Color.Red;
  176. }
  177. }
  178. }
  179. ccp2.ServerName = "UIK.UIK05.UIK050090";
  180. ccp2.MethodName = "DoQueryChengFen";
  181. ccp2.ServerParams = new object[] { coilno, ordno, ordseq };
  182. ccp2.SourceDataTable = this.dataSet2.Tables[0];
  183. this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
  184. DataRowCollection drc2 = this.dataSet2.Tables[0].Rows;
  185. if (drc2.Count <= 0)
  186. {
  187. MessageBox.Show("无该钢卷的成分实绩信息");
  188. }
  189. else
  190. {
  191. foreach (UltraGridRow ugr in this.ultraGrid2.Rows)
  192. {
  193. //不合格元素显示红色
  194. string CVAL = ugr.Cells["CHEM_VAL"].Text;
  195. string CMIN = ugr.Cells["CHEM_MIN"].Text;
  196. string CMAX = ugr.Cells["CHEM_MAX"].Text;
  197. if (CVAL != null && CVAL != "")
  198. {
  199. if (CMIN != null && CMIN != "" && double.Parse(CVAL) < double.Parse(CMIN))
  200. {
  201. ugr.Cells["CHEM_VAL"].Appearance.BackColor = Color.Red;
  202. }
  203. if (CMAX != null && CMAX != "" && double.Parse(CVAL) > double.Parse(CMAX))
  204. {
  205. ugr.Cells["CHEM_VAL"].Appearance.BackColor = Color.Red;
  206. }
  207. }
  208. else if ((CMAX != null && CMAX != "") || (CMIN != null && CMIN != ""))
  209. {
  210. ugr.Cells["CHEM_VAL"].Appearance.BackColor = Color.Red;
  211. }
  212. }
  213. }
  214. return;
  215. }
  216. }
  217. catch (Exception ex)
  218. {
  219. MessageBox.Show("系统信息错误!");
  220. return;
  221. }
  222. }
  223. private void UIK050090_Load(object sender, EventArgs e)
  224. {
  225. this.ultraCheckEditor1.Checked = false;
  226. }
  227. private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
  228. {
  229. if (this.ultraCheckEditor1.Checked == true)
  230. {
  231. this.ultraCalendarSTRATTIME.Enabled = false;
  232. this.ultraCalendarENDTIME.Enabled = false;
  233. }
  234. if (this.ultraCheckEditor1.Checked == false)
  235. {
  236. this.ultraCalendarENDTIME.Enabled = true;
  237. this.ultraCalendarSTRATTIME.Enabled = true;
  238. }
  239. }
  240. }
  241. }