frmrepairehis.cs 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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 Infragistics.Win.UltraWinGrid;
  9. using CoreFS.CA06;
  10. namespace Core.LgMes.Client.LgDeviceManager
  11. {
  12. public partial class frmrepairehis : FrmLgDevFunctions
  13. {
  14. public frmrepairehis(OpeBase oba)
  15. {
  16. InitializeComponent();
  17. ob = oba;
  18. }
  19. private DataSet _dsMain;
  20. public string potno = "1";
  21. private void frmrepairehis_Load(object sender, EventArgs e)
  22. {
  23. this.txtNoLadle.Text = potno;
  24. this.udteStart.DateTime = DateTime.Today;
  25. this.udteEnd.DateTime = DateTime.Today;
  26. InitData1();
  27. }
  28. /// <summary>
  29. /// 维修记录查询
  30. /// </summary>
  31. private void GetTableData()
  32. {
  33. string strWhere = " where TOOLTYPEID = '0'";
  34. string strFrom = this.udteStart.DateTime.ToString("yyyyMMdd");
  35. string strTo = this.udteEnd.DateTime.ToString("yyyyMMdd");
  36. strWhere += " and to_char(REPAIRTIME,'yyyyMMdd') between '" + strFrom + "' and '" + strTo + "'";
  37. if (potno != "")
  38. {
  39. strWhere += string.Format(" and REPAIRTOOLID = '{0}' ", potno);
  40. }
  41. try
  42. {
  43. _dsMain = QueryToFunions("Core.LgMes.Server.LgDeviceManager.potmanger", "GetRepairHis", strWhere,ob);
  44. try
  45. {
  46. ((DataSet)uGrdpairehis.DataSource).Tables[0].Rows.Clear();
  47. }
  48. catch (Exception)
  49. {
  50. }
  51. if (_dsMain.Tables[0].Rows.Count > 0)
  52. {
  53. this.uGrdpairehis.DataSource = _dsMain;
  54. }
  55. }
  56. catch { }
  57. }
  58. /// <summary>
  59. /// UltraGrid样式设置
  60. /// </summary>
  61. private void InitData1()
  62. {
  63. try
  64. {
  65. UltraGridBand band = this.uGrdpairehis.DisplayLayout.Bands[0];
  66. band.Columns["REPAIRTOOLID"].Header.Caption = "钢包号";
  67. band.Columns["REPAIRTOOLID"].Width = 75;
  68. band.Columns["REPAIRPART"].Header.Caption = "维修位置";
  69. band.Columns["REPAIRPART"].Width = 85;
  70. band.Columns["REPAIRPART"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  71. band.Columns["REASON"].Header.Caption = "维修原因";
  72. band.Columns["REASON"].Width = 75;
  73. band.Columns["REASON"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  74. band.Columns["REPAIRTYPE"].Header.Caption = "维修类别";
  75. band.Columns["REPAIRTYPE"].Width = 75;
  76. band.Columns["REPAIRTYPE"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  77. band.Columns["REPAIRTIME"].Header.Caption = "维修开始时间";
  78. band.Columns["REPAIRTIME"].Width = 150;
  79. band.Columns["REPAIRTIME"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  80. band.Columns["REPAIRTIME"].Format = "yyyy-MM-dd HH:mm:ss";
  81. band.Columns["REPAIREDTIME"].Header.Caption = "维修结束时间";
  82. band.Columns["REPAIREDTIME"].Width = 150;
  83. band.Columns["REPAIREDTIME"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  84. band.Columns["REPAIREDTIME"].Format = "yyyy-MM-dd HH:mm:ss";
  85. band.Columns["REPTIME"].Header.Caption = "维修时间";
  86. band.Columns["REPTIME"].Width = 80;
  87. band.Columns["REPTIME"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  88. band.Columns["MATERIALREPLACING"].Header.Caption = "耐材厂家";
  89. band.Columns["MATERIALREPLACING"].Width = 80;
  90. band.Columns["MATERIALREPLACING"].CellActivation = Infragistics.Win.UltraWinGrid.Activation.NoEdit;
  91. }
  92. catch
  93. { }
  94. }
  95. /// <summary>
  96. /// 窗体菜单
  97. /// </summary>
  98. /// <param name="sender"></param>
  99. /// <param name="e"></param>
  100. private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
  101. {
  102. switch (e.ClickedItem.Name)
  103. {
  104. case "QUERY":
  105. {
  106. potno = this.txtNoLadle.Text.Trim();
  107. GetTableData();
  108. break;
  109. }
  110. case "ALL":
  111. {
  112. potno = "";
  113. GetTableData();
  114. break;
  115. }
  116. case "EXPORT":
  117. {
  118. try
  119. {
  120. Core.Mes.Client.Common.Globals.ulGridToExcel(uGrdpairehis, Text);
  121. }
  122. catch (Exception ex)
  123. {
  124. MessageBox.Show(ex.Message);
  125. }
  126. break;
  127. }
  128. case "CLOSE":
  129. {
  130. this.Close();
  131. break;
  132. }
  133. default:
  134. break;
  135. }
  136. }
  137. }
  138. }