UIC020160.cs 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  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.Diagnostics;
  11. using System.Collections;
  12. using Infragistics.Win.UltraWinGrid;
  13. namespace Core.LZMes.Client.UIC
  14. {
  15. public partial class UIC020160 : FrmBase
  16. {
  17. public UIC020160()
  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 "Export":
  29. this.DoExport();
  30. break;
  31. case "Exit":
  32. this.Close();
  33. break;
  34. }
  35. }
  36. private void DoExport()
  37. {
  38. try
  39. {
  40. if (this.ultraGrid1.Rows.Count == 0)
  41. {
  42. MessageBox.Show("没有可以导出的数据", "提示");
  43. return;
  44. }
  45. saveFileDialog1.FileName = "酸轧停扎时间" + DateTime.Today.ToShortDateString() + "_01";
  46. saveFileDialog1.Filter = "表格(*.xls)|*.xls";
  47. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  48. {
  49. string fName = this.saveFileDialog1.FileName;
  50. this.ultraGridExcelExporter1.Export(ultraGrid1, fName);
  51. Process.Start(fName);
  52. }
  53. }
  54. catch (Exception ex)
  55. {
  56. System.Diagnostics.Debug.WriteLine(ex.ToString());
  57. }
  58. }
  59. public void DoQuery()
  60. {
  61. try
  62. {
  63. ArrayList al = new ArrayList();
  64. if (this.ultraComboEditor1.Text.Trim() == "原料库")
  65. {
  66. al.Add("UIC020160_01.SELECT");
  67. }
  68. else if (this.ultraComboEditor1.Text.Trim() == "中间库")
  69. {
  70. al.Add("UIC020160_02.SELECT");
  71. }
  72. else if (this.ultraComboEditor1.Text.Trim() == "成品库")
  73. {
  74. al.Add("UIC020160_03.SELECT");
  75. }
  76. string stime = "20090101000000";
  77. string etime = "99999999999999";
  78. if (this.checkBox3.Checked)
  79. {
  80. stime = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMddHHmmss").Trim();
  81. etime = this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd").Trim() + "999999";
  82. }
  83. al.Add(stime);
  84. al.Add(etime);
  85. //查询详细停轧时间
  86. this.dataSet1.Tables[0].Clear();
  87. CoreClientParam ccp = new CoreClientParam();
  88. ccp.ServerName = "UIB.COM.ComDBQuery";
  89. ccp.MethodName = "doSimpleQuery";
  90. ccp.ServerParams = new object[] { al };
  91. ccp.SourceDataTable = this.dataSet1.Tables[0];
  92. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  93. //if (this.ultraGrid1.Rows.Count > 0)
  94. //{
  95. // DateTime a;
  96. // string b = "";
  97. // foreach (UltraGridRow ugr in this.ultraGrid1.Rows)
  98. // {
  99. // b = ugr.Cells["TIMESTART"].Text.ToString();
  100. // a = DateTime.Parse(b);
  101. // if (a.Hour>=0 && a.Hour<8)
  102. // {
  103. // ugr.Cells["BC"].Value = "晚班";
  104. // }
  105. // else if (a.Hour >= 8 && a.Hour < 16)
  106. // {
  107. // ugr.Cells["BC"].Value = "早班";
  108. // }
  109. // else if (a.Hour >= 16 && a.Hour < 24)
  110. // {
  111. // ugr.Cells["BC"].Value = "中班";
  112. // }
  113. // }
  114. //}
  115. }
  116. catch (Exception ex)
  117. {
  118. System.Diagnostics.Debug.WriteLine(ex.ToString());
  119. }
  120. }
  121. private void label2_Click(object sender, EventArgs e)
  122. {
  123. }
  124. private void UIC020150_Load(object sender, EventArgs e)
  125. {
  126. }
  127. }
  128. }