UIK050040.cs 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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 UIK050040 : FrmBase
  14. {
  15. public UIK050040()
  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. bool flag = false;
  37. string beginTime = "";
  38. string endTime = "";
  39. CoreClientParam ccp = new CoreClientParam();
  40. CoreClientParam ccp2 = new CoreClientParam();
  41. DataTable dt = new DataTable();
  42. DataTable dt2 = new DataTable();
  43. //if (this.ultraTextzgNum.Text == "" && this.ultraCheckEditor1.Checked == false)
  44. //{
  45. // MessageBox.Show("请选择查询条件!");
  46. //}
  47. //else
  48. //{
  49. if (this.ultraCheckEditor1.Checked)
  50. {
  51. this.ultraTextzgNum.Clear();
  52. this.ultraCheckEditor1.Checked = false;
  53. ccp.ServerName = "UIK.UIK05.UIK050040";
  54. ccp.MethodName = "DoQueryShang";
  55. ccp.ServerParams = new object[] { zgNum, flag, beginTime, endTime };
  56. ccp.SourceDataTable = dt;
  57. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  58. this.ultraGrid1.DataSource = dt;
  59. ccp2.ServerName = "UIK.UIK05.UIK050040";
  60. ccp2.MethodName = "DoQueryXia";
  61. ccp2.ServerParams = new object[] { zgNum, flag, beginTime, endTime };
  62. ccp2.SourceDataTable = dt2;
  63. this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
  64. this.ultraGrid2.DataSource = dt2;
  65. if (dt.Rows.Count <= 0)
  66. {
  67. MessageBox.Show("暂无记录!");
  68. }
  69. return;
  70. }
  71. else
  72. {
  73. flag = true;
  74. zgNum = this.ultraTextzgNum.Text;
  75. beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd000000") : "";
  76. endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd999999") : "";
  77. this.ultraTextzgNum.Clear();
  78. this.ultraCheckEditor1.Checked = false;
  79. ccp.ServerName = "UIK.UIK05.UIK050040";
  80. if (zgNum != "")
  81. {
  82. ccp.MethodName = "DoQueryShang";
  83. }
  84. else
  85. {
  86. ccp.MethodName = "DoQueryShang1";
  87. }
  88. ccp.ServerParams = new object[] { zgNum, flag, beginTime, endTime };
  89. ccp.SourceDataTable = dt;
  90. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  91. this.ultraGrid1.DataSource = dt;
  92. ccp2.ServerName = "UIK.UIK05.UIK050040";
  93. if (zgNum != "")
  94. {
  95. ccp2.MethodName = "DoQueryXia";
  96. }
  97. else
  98. {
  99. ccp2.MethodName = "DoQueryXia1";
  100. }
  101. //ccp2.MethodName = "DoQueryXia1";
  102. ccp2.ServerParams = new object[] { zgNum, flag, beginTime, endTime };
  103. ccp2.SourceDataTable = dt2;
  104. this.ExecuteQueryToDataTable(ccp2, CoreInvokeType.Internal);
  105. this.ultraGrid2.DataSource = dt2;
  106. if (dt.Rows.Count <= 0)
  107. {
  108. MessageBox.Show("该轧辊顺序号记录不存在,请查证后查询!");
  109. }
  110. return;
  111. }
  112. }
  113. // }
  114. catch (Exception Ex)
  115. {
  116. MessageBox.Show(Ex.ToString());
  117. }
  118. }
  119. private void DoExport()
  120. {
  121. try
  122. {
  123. if (this.ultraGrid1.Rows.Count == 0)
  124. {
  125. MessageBox.Show("没有可以导出的数据", "提示");
  126. return;
  127. }
  128. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  129. {
  130. string fName = this.saveFileDialog1.FileName;
  131. this.ultraGridExcelExporter1.Export(this.ultraGrid1, fName);
  132. System.Diagnostics.Process.Start(fName);
  133. }
  134. //if (this.saveFileDialog2.ShowDialog(this) == DialogResult.OK)
  135. //{
  136. // string fName1 = this.saveFileDialog2.FileName;
  137. // this.ultraGridExcelExporter2.Export(this.ultraGrid2, fName1);
  138. // System.Diagnostics.Process.Start(fName1);
  139. //}
  140. }
  141. catch (Exception ex)
  142. {
  143. System.Diagnostics.Debug.WriteLine(ex.ToString());
  144. }
  145. }
  146. private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
  147. {
  148. try
  149. {
  150. if (this.ultraCheckEditor1.Checked)
  151. {
  152. this.ultraTextzgNum.Enabled = false;
  153. }
  154. if (!this.ultraCheckEditor1.Checked)
  155. {
  156. this.ultraTextzgNum.Enabled = true;
  157. }
  158. }
  159. catch (Exception Ex)
  160. {
  161. MessageBox.Show(Ex.ToString());
  162. }
  163. }
  164. }
  165. }