5ece3088de9bf035d2b321fcb847486f6f2c174b.svn-base 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235
  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 System.Collections;
  10. using CoreFS.CA06;
  11. using Infragistics.Win.UltraWinGrid;
  12. using Infragistics.Win;
  13. namespace Core.LZMes.Client.QCM
  14. {
  15. public partial class QCM0203 : FrmBase
  16. {
  17. public QCM0203()
  18. {
  19. InitializeComponent();
  20. }
  21. private void QCM0203_Load(object sender, EventArgs e)
  22. {
  23. this.comboBox4.SelectedIndex = 0;
  24. dateTimePicker1.Value = DateTime.Now.Date.AddDays(-1);
  25. ValueList v = new ValueList();
  26. v.ValueListItems.Add("1", "已判");
  27. v.ValueListItems.Add("0", "未判");
  28. this.ultraGrid1.DisplayLayout.Bands[0].Columns["JUDGE_STATUS"].ValueList = v.Clone();
  29. this.ultraGrid2.DisplayLayout.Bands[0].Columns["ISJUDGE"].ValueList = v.Clone();
  30. this.DoQuery();//查询
  31. }
  32. public override void ToolBar_Click(object sender, string ToolbarKey)
  33. {
  34. switch (ToolbarKey)
  35. {
  36. case "Query":
  37. this.DoQuery();
  38. break;
  39. case "InExport": // 导出实绩
  40. ClsControlPack.ExportDataWithSaveDialog2(ref ultraGrid1, this.Text);
  41. ClsControlPack.ExportDataWithSaveDialog2(ref ultraGrid2, this.Text);
  42. break;
  43. }
  44. }
  45. //查询订单
  46. private void DoQuery()
  47. {
  48. try
  49. {
  50. if (String.IsNullOrEmpty(comboBox4.Text))
  51. {
  52. MessageBox.Show("请选择按什么时间去查!");
  53. return;
  54. }
  55. this.dataSet1.Clear();
  56. this.dataSet2.Clear();
  57. String starttime = this.dateTimePicker1.Value.ToString("yyyy-MM-dd");
  58. String endtime = this.dateTimePicker2.Value.ToString("yyyy-MM-dd");
  59. string batchNo = this.textBox1.Text.Trim();
  60. string batchNo2 = this.BATCH_NO2.Text.Trim();
  61. string design_key = this.textBox3.Text.Trim();
  62. string psc_desc = this.textBox4.Text.Trim();
  63. string pline_name = this.PLINE_NAME.Text.Trim();
  64. string dateTimeName = this.comboBox4.Text.Trim();
  65. string materialNo = this.textBox2.Text.Trim();
  66. //if (this.dateTimePicker1.Value > this.dateTimePicker2.Value)
  67. //{
  68. // MessageBox.Show("日期查询条件开始日期大于结束日期!!!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  69. // return;
  70. //}
  71. //if (this.BATCH_NO2.Text.Trim() != null && !this.BATCH_NO2.Text.Trim().Equals(""))
  72. //{
  73. // if (this.textBox1.Text.Trim() == null || this.textBox1.Text.Equals(""))
  74. // {
  75. // MessageBox.Show("请输入轧批号开始范围!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  76. // this.textBox1.Focus();
  77. // return;
  78. // }
  79. //}
  80. //if (this.textBox1.Text.Trim() != null && !this.textBox1.Text.Trim().Equals(""))
  81. //{
  82. // if (this.BATCH_NO2.Text.Trim() == null || this.BATCH_NO2.Text.Equals(""))
  83. // {
  84. // MessageBox.Show("请输入轧批号结束范围!", "警告", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
  85. // this.BATCH_NO2.Focus();
  86. // return;
  87. // }
  88. //}
  89. //轧批号 小框框 是否勾选
  90. if (this.checkBox1.Checked)
  91. {
  92. starttime = "";
  93. endtime = "";
  94. }
  95. else
  96. {
  97. batchNo = "";
  98. batchNo2 = "";
  99. }
  100. if (this.checkBox2.Checked)
  101. {
  102. starttime = "";
  103. endtime = "";
  104. }
  105. else
  106. {
  107. materialNo = "";
  108. }
  109. CoreClientParam ccp = new CoreClientParam();
  110. ccp.ServerName = "QCM.JHY01.JHY0102.QuerryJhyQtly";
  111. ccp.MethodName = "Query";
  112. ccp.ServerParams = new object[] { batchNo, batchNo2, design_key, psc_desc, starttime, endtime, pline_name, dateTimeName, materialNo };
  113. ccp.SourceDataTable = this.dataSet1.Tables[0];
  114. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  115. foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  116. {
  117. ugr.Cells["Column1"].Value = ugr.Cells["THICK"].Value + "*" + ugr.Cells["WIDTH"].Value + "*" + ugr.Cells["LENGTH"].Value;
  118. }
  119. }
  120. catch (Exception ex)
  121. {
  122. System.Diagnostics.Debug.WriteLine(ex.ToString());
  123. MessageBox.Show("查询异常!","警告");
  124. }
  125. }
  126. //查询材质实绩
  127. private void DoQueryDetail(String SMP_NO)
  128. {
  129. try
  130. {
  131. this.dataSet2.Clear();
  132. CoreClientParam ccp = new CoreClientParam();
  133. ccp.ServerName = "QCM.JHY01.JHY0102.QuerryJhyQtly";
  134. ccp.MethodName = "getQltySampleItem";
  135. ccp.ServerParams = new object[] { SMP_NO };
  136. ccp.SourceDataTable = this.dataSet2.Tables[0];
  137. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  138. }
  139. catch (Exception ex)
  140. {
  141. System.Diagnostics.Debug.WriteLine(ex.ToString());
  142. MessageBox.Show("系统出错!请联系管理人员", "警告");
  143. }
  144. }
  145. private void ultraGrid1_AfterRowActivate(object sender, EventArgs e)
  146. {
  147. try
  148. {
  149. this.DoQueryDetail(this.ultraGrid1.ActiveRow.Cells["SMP_NO"].Value.ToString());
  150. }
  151. catch (Exception ex)
  152. {
  153. System.Diagnostics.Debug.WriteLine(ex.ToString());
  154. MessageBox.Show("系统出错!请联系管理人员", "警告");
  155. }
  156. }
  157. private void checkBox1_Click(object sender, EventArgs e)
  158. {
  159. if (this.checkBox1.Checked)
  160. {
  161. this.dateTimePicker1.Enabled = false;
  162. this.dateTimePicker2.Enabled = false;
  163. this.textBox1.Enabled = true;
  164. this.BATCH_NO2.Enabled = true;
  165. }
  166. else
  167. {
  168. if(!this.checkBox2.Checked){
  169. this.dateTimePicker1.Enabled = true;
  170. this.dateTimePicker2.Enabled = true;
  171. }
  172. this.textBox1.Enabled = false;
  173. this.BATCH_NO2.Enabled = false;
  174. }
  175. }
  176. private void checkBox2_Click(object sender, EventArgs e)
  177. {
  178. if (this.checkBox2.Checked)
  179. {
  180. this.dateTimePicker1.Enabled = false;
  181. this.dateTimePicker2.Enabled = false;
  182. this.textBox2.Enabled = true;
  183. }
  184. else
  185. {
  186. if (!this.checkBox1.Checked)
  187. {
  188. this.dateTimePicker1.Enabled = true;
  189. this.dateTimePicker2.Enabled = true;
  190. }
  191. this.textBox2.Enabled = false;
  192. }
  193. }
  194. #region 不合格项变颜色
  195. private void ultraGrid2_InitializeRow(object sender, InitializeRowEventArgs e)
  196. {
  197. if (e.Row.Cells["IS_PASS"].Value.ToString().Equals("1"))
  198. {
  199. e.Row.Appearance.ForeColor = Color.Red;// 红色 一行
  200. // e.Row.Cells["val1"].Appearance.ForeColor = Color.Red;//一个
  201. }
  202. }
  203. #endregion
  204. }
  205. }