frmhothisNEW.cs 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. using System;
  2. using System.Data;
  3. using System.Drawing;
  4. using System.Collections;
  5. using System.ComponentModel;
  6. using System.Windows.Forms;
  7. using System.Diagnostics;
  8. //using Core.Mes.ClientFrameWork;
  9. using Infragistics.Win.UltraWinGrid;
  10. using CoreFS.CA06;
  11. using Core.Mes.Client.Common;
  12. namespace Core.LgMes.Client.LgDeviceManager
  13. {
  14. public partial class frmhothisNEW : frmStyleBase
  15. {
  16. OpeBase ob = null;
  17. public frmhothisNEW(OpeBase oba)
  18. {
  19. InitializeComponent();
  20. ob = oba;
  21. }
  22. private DataSet _dsMain;
  23. public string potno = "1";
  24. private void frmhothisNEW_Load(object sender, EventArgs e)
  25. {
  26. this.textBox1.Text = potno;
  27. this.ultraDateTimeEditor1.DateTime = DateTime.Today;
  28. this.ultraDateTimeEditor2.DateTime = DateTime.Today;
  29. //GetTableData();
  30. InitData1();
  31. }
  32. /// <烘烤信息>
  33. /// 烘烤信息
  34. /// </summary>
  35. private void GetTableData()
  36. {
  37. string sqlstr = "";
  38. string strsql = "";
  39. string strFrom = this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd");
  40. string strTo = this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd");
  41. if (this.textBox1.Text.Trim().ToString() != "")
  42. {
  43. sqlstr = "and FIRINGTOOLID = '" + textBox1.Text.Trim().ToString() + "'and BEGINTIME >=to_date('" + strFrom + "', 'yyyy-mm-dd hh24:mi:ss') and ENDTIME <= to_date('" + strTo + "', 'yyyy-mm-dd hh24:mi:ss')";
  44. }
  45. else
  46. {
  47. sqlstr = "and BEGINTIME >=to_date('" + strFrom + "', 'yyyy-mm-dd hh24:mi:ss') and ENDTIME <= to_date('" + strTo + "', 'yyyy-mm-dd hh24:mi:ss')";
  48. }
  49. if (potno !="")
  50. {
  51. strsql = "SELECT FIRINGTOOLID,OVENID,to_char(BEGINTIME, 'yyyy-mm-dd hh24:mi:ss') WORKBEGINTIME,"
  52. + "to_char(ENDTIME, 'yyyy-mm-dd hh24:mi:ss') WORKENDTIME,"
  53. + "round((case when ENDTIME is null then sysdate "
  54. + "else ENDTIME end - BEGINTIME) * 24 * 60) HOTTIME "
  55. + "FROM DEV_TOOLFIRINGDETAIL "
  56. + "where TOOLTYPE = '0'" + sqlstr + ""
  57. + "order by length(FIRINGTOOLID), FIRINGTOOLID, WORKBEGINTIME desc";
  58. }
  59. else
  60. {
  61. strsql = "SELECT FIRINGTOOLID,OVENID,to_char(BEGINTIME, 'yyyy-mm-dd hh24:mi:ss') WORKBEGINTIME,"
  62. + "to_char(ENDTIME, 'yyyy-mm-dd hh24:mi:ss') WORKENDTIME,"
  63. + "round((case when ENDTIME is null then sysdate "
  64. + "else ENDTIME end - BEGINTIME) * 24 * 60) HOTTIME "
  65. + "FROM DEV_TOOLFIRINGDETAIL "
  66. + "where TOOLTYPE = '0'"
  67. + "order by length(FIRINGTOOLID), FIRINGTOOLID, WORKBEGINTIME desc";
  68. }
  69. //string strWhere = " to_char(BEGINTIME,'yyyyMMdd') between '" + strFrom + "' and '" + strTo + "' ";
  70. //if (potno != "")
  71. //{
  72. // strWhere += string.Format(" and FIRINGTOOLID = '{0} ' ", potno);
  73. //}
  74. try
  75. {
  76. //string strOut = "";
  77. //_dsMain = (DataSet)Core.Mes.ClientFrameWork.ClientCommon._RemotingHelp.ExecuteMethod("LgDeviceManager", "Core.LgMes.Server.LgDeviceManager.potmanger", "GetHotRecLog", new object[] { strWhere }, out strOut);
  78. //this.ultraGrid1.DataSource = _dsMain;
  79. CoreClientParam ccp = new CoreClientParam();
  80. ccp.ServerName = "Core.LgMes.Server.DEV.Methods.DEVPublicMethods";
  81. ccp.MethodName = "QueryMethods";
  82. ccp.ServerParams = new Object[] {strsql};//查询条件
  83. DataTable dt = new DataTable();
  84. ccp.SourceDataTable = dt;
  85. ob.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);//
  86. DataSet ds = new DataSet();
  87. ds.Tables.Add(dt);
  88. ultraGrid2.DataSource = ds;
  89. }
  90. catch (Exception ex)
  91. {
  92. string strMsg = ex.Message;
  93. }
  94. }
  95. private void InitData1()
  96. {
  97. try
  98. {
  99. UltraGridBand band = this.ultraGrid1.DisplayLayout.Bands[0];
  100. band.Columns[0].Header.Caption = "钢包号";
  101. band.Columns[0].Width = 60;
  102. band.Columns[1].Header.Caption = "烘烤位置";
  103. band.Columns[1].Width = 60;
  104. band.Columns[1].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  105. band.Columns[2].Header.Caption = "开始时间";
  106. band.Columns[2].Width = 150;
  107. band.Columns[2].CellAppearance.ForeColor = Color.Black;
  108. band.Columns[2].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  109. band.Columns[3].Header.Caption = "结束时间";
  110. band.Columns[3].Width = 150;
  111. band.Columns[3].CellAppearance.ForeColor = Color.Black;
  112. band.Columns[3].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  113. band.Columns[4].Header.Caption = "烘烤时间";
  114. band.Columns[4].Width = 65;
  115. band.Columns[4].CellAppearance.ForeColor = Color.Black;
  116. band.Columns[4].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  117. }
  118. catch
  119. { }
  120. }
  121. private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  122. {
  123. switch (e.ClickedItem.Name)
  124. {
  125. case "QUERY":
  126. {
  127. potno = this.textBox1.Text.Trim();
  128. GetTableData();
  129. break;
  130. }
  131. case "ALL":
  132. {
  133. potno = "";
  134. GetTableData();
  135. break;
  136. }
  137. case "EXPORT":
  138. {
  139. try
  140. {
  141. string StrfileName = string.Format(System.Windows.Forms.Application.StartupPath + "\\Report\\{0}.xls", "钢包烘烤记录");
  142. //this.GridExcelExporter.Export(this.ultraGrid1, StrfileName);
  143. ProcessStartInfo p = new ProcessStartInfo(StrfileName);
  144. p.WorkingDirectory = System.IO.Path.GetDirectoryName(StrfileName);
  145. Process.Start(p);
  146. }
  147. catch (Exception ex)
  148. {
  149. MessageBox.Show(ex.Message);
  150. }
  151. break;
  152. }
  153. case "CLOSE":
  154. {
  155. this.Close();
  156. break;
  157. }
  158. default:
  159. break;
  160. }
  161. }
  162. }
  163. }