UIK050060.cs 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242
  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. namespace Core.LZMes.Client.UIK
  12. {
  13. public partial class UIK050060 : FrmBase
  14. {
  15. public UIK050060()
  16. {
  17. InitializeComponent();
  18. }
  19. public override void ToolBar_Click(object sender, string ToolbarKey)
  20. {
  21. switch (ToolbarKey)
  22. {
  23. case "Query"://查询换上轧辊实绩
  24. this.DoQuery();
  25. break;
  26. case "Export"://查询换上轧辊实绩
  27. this.DoExport();
  28. break;
  29. }
  30. }
  31. private void DoQuery()
  32. {
  33. try
  34. {
  35. string zgNum = "";
  36. string zgAr = "";
  37. string beginTime = "";
  38. string endTime = "";
  39. bool flag = false;
  40. CoreClientParam ccp = new CoreClientParam();
  41. CoreClientParam ccp2 = new CoreClientParam();
  42. DataTable dt = new DataTable();
  43. DataTable dt2 = new DataTable();
  44. //if (this.zgNum.Text == "" && this.zgArea.Text == "" && this.ultraCheckEditor1.Checked == false)
  45. //{
  46. // MessageBox.Show("请选择查询条件!");
  47. //}
  48. //else
  49. //{
  50. if (this.ultraCheckEditor1.Checked)
  51. {
  52. this.zgArea.Clear();
  53. this.zgNum.Clear();
  54. this.ultraCheckEditor1.Checked = false;
  55. ccp.ServerName = "UIK.UIK05.UIK050060";
  56. ccp.MethodName = "DoQuery";
  57. ccp.ServerParams = new object[] { zgNum, zgAr, flag,beginTime,endTime };
  58. ccp.SourceDataTable = dt;
  59. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  60. this.ultraGrid1.DataSource = dt;
  61. if (dt.Rows.Count <= 0)
  62. {
  63. MessageBox.Show("暂无记录!");
  64. }
  65. return;
  66. }
  67. else
  68. {
  69. flag = true;
  70. if (this.zgArea.Text == "" || this.zgNum.Text == "")
  71. {
  72. if (this.zgNum.Text == "")
  73. {
  74. zgAr = this.zgArea.Text;
  75. beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : "";
  76. endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : "";
  77. this.zgArea.Clear();
  78. this.zgNum.Clear();
  79. this.ultraCheckEditor1.Checked = false;
  80. ccp.ServerName = "UIK.UIK05.UIK050060";
  81. ccp.MethodName = "DoQuery";
  82. ccp.ServerParams = new object[] { zgNum, zgAr, flag,beginTime,endTime };
  83. ccp.SourceDataTable = dt;
  84. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  85. this.ultraGrid1.DataSource = dt;
  86. if (dt.Rows.Count <= 0)
  87. {
  88. MessageBox.Show("该区域的记录不存在!");
  89. }
  90. return;
  91. }
  92. if (this.zgArea.Text == "")
  93. {
  94. zgNum = this.zgNum.Text;
  95. beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : "";
  96. endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : "";
  97. this.zgArea.Clear();
  98. this.zgNum.Clear();
  99. this.ultraCheckEditor1.Checked = false;
  100. ccp.ServerName = "UIK.UIK05.UIK050060";
  101. ccp.MethodName = "DoQuery";
  102. ccp.ServerParams = new object[] { zgNum, zgAr, flag,beginTime,endTime };
  103. ccp.SourceDataTable = dt;
  104. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  105. this.ultraGrid1.DataSource = dt;
  106. if (dt.Rows.Count <= 0)
  107. {
  108. MessageBox.Show("该轧辊顺序号记录不存在,请查证后查询!");
  109. }
  110. return;
  111. }
  112. }
  113. if (this.zgArea.Text == "" && this.zgNum.Text == "")
  114. {
  115. beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : "";
  116. endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : "";
  117. this.zgArea.Clear();
  118. this.zgNum.Clear();
  119. this.ultraCheckEditor1.Checked = false;
  120. ccp.ServerName = "UIK.UIK05.UIK050060";
  121. ccp.MethodName = "DoQuery";
  122. ccp.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
  123. ccp.SourceDataTable = dt;
  124. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  125. this.ultraGrid1.DataSource = dt;
  126. if (dt.Rows.Count <= 0)
  127. {
  128. MessageBox.Show("该区域的记录不存在!");
  129. }
  130. return;
  131. }
  132. else
  133. {
  134. zgNum = this.zgNum.Text;
  135. zgAr = this.zgArea.Text;
  136. beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : "";
  137. endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : "";
  138. this.zgArea.Clear();
  139. this.zgNum.Clear();
  140. this.ultraCheckEditor1.Checked = false;
  141. ccp.ServerName = "UIK.UIK05.UIK050060";
  142. ccp.MethodName = "DoQuery";
  143. ccp.ServerParams = new object[] { zgNum, zgAr, flag, beginTime, endTime };
  144. ccp.SourceDataTable = dt;
  145. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  146. this.ultraGrid1.DataSource = dt;
  147. if (dt.Rows.Count <= 0)
  148. {
  149. MessageBox.Show("记录不存在,请查证后查询!");
  150. }
  151. return;
  152. }
  153. }
  154. }
  155. // }
  156. catch (Exception Ex)
  157. {
  158. MessageBox.Show(Ex.ToString());
  159. }
  160. }
  161. private void DoExport()
  162. {
  163. try
  164. {
  165. if (this.ultraGrid1.Rows.Count == 0)
  166. {
  167. MessageBox.Show("没有可以导出的数据", "提示");
  168. return;
  169. }
  170. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  171. {
  172. string fName = this.saveFileDialog1.FileName;
  173. this.ultraGridExcelExporter1.Export(this.ultraGrid1, fName);
  174. System.Diagnostics.Process.Start(fName);
  175. }
  176. }
  177. catch (Exception ex)
  178. {
  179. System.Diagnostics.Debug.WriteLine(ex.ToString());
  180. }
  181. }
  182. private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
  183. {
  184. try
  185. {
  186. if (this.ultraCheckEditor1.Checked)
  187. {
  188. this.zgNum.Enabled = false;
  189. this.zgArea.Enabled = false;
  190. }
  191. if (!this.ultraCheckEditor1.Checked)
  192. {
  193. this.zgNum.Enabled = true;
  194. this.zgArea.Enabled = true;
  195. }
  196. }
  197. catch (Exception Ex)
  198. {
  199. MessageBox.Show(Ex.ToString());
  200. }
  201. }
  202. }
  203. }