FrmMonitoring.cs 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. using Core.Mes.Client.Comm.Control;
  2. using Core.Mes.Client.Comm.Server;
  3. using CoreFS.CA06;
  4. using System;
  5. using System.Collections;
  6. using System.Collections.Generic;
  7. using System.ComponentModel;
  8. using System.Data;
  9. using System.Drawing;
  10. using System.Linq;
  11. using System.Text;
  12. using System.Windows.Forms;
  13. namespace Core.StlMes.Client.YdmStuffReport
  14. {
  15. public partial class FrmMonitoring : FrmBase
  16. {
  17. public FrmMonitoring()
  18. {
  19. InitializeComponent();
  20. }
  21. private void FrmMonitoring_Load(object sender, EventArgs e)
  22. {
  23. this.dataYearMoth.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM"));
  24. }
  25. /// <summary>
  26. /// 重写基类方法
  27. /// </summary>
  28. /// <param name="sender"></param>
  29. /// <param name="ToolbarKey"></param>
  30. public override void ToolBar_Click(object sender, string ToolbarKey)
  31. {
  32. switch (ToolbarKey)
  33. {
  34. case "Query":
  35. queryData();
  36. break;
  37. case "Export":
  38. exportData();
  39. break;
  40. case "Close":
  41. this.Close();
  42. break;
  43. }
  44. }
  45. /// <summary>
  46. /// 查询
  47. /// </summary>
  48. private void queryData()
  49. {
  50. string bathYearMoth = this.dataYearMoth.Value.ToString("yyyyMM");
  51. try
  52. {
  53. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  54. if (Constant.WaitingForm == null)
  55. {
  56. Constant.WaitingForm = new WaitingForm();
  57. }
  58. Constant.WaitingForm.ShowToUser = true;
  59. Constant.WaitingForm.Show();
  60. Constant.WaitingForm.Update();
  61. DataTable dt = ServerHelper.GetData("Core.LgMes.Server.Stuffmanage.Report.FrmMonitoring.queryData", new object[] { bathYearMoth }, ob);
  62. GridHelper.CopyDataToDatatable(ref dt, ref dataTable1, true);
  63. this.SetStaticsInfo();
  64. CommonMethod.SetGridSumArea(this.ultraGrid1);
  65. this.Cursor = Cursors.Default;
  66. Constant.WaitingForm.ShowToUser = false;
  67. Constant.WaitingForm.Close();
  68. Constant.WaitingForm = null;
  69. }
  70. catch (Exception e)
  71. {
  72. this.Cursor = Cursors.Default;
  73. Constant.WaitingForm.ShowToUser = false;
  74. Constant.WaitingForm.Close();
  75. Constant.WaitingForm = null;
  76. }
  77. }
  78. private void SetStaticsInfo()
  79. {
  80. try
  81. {
  82. if (this.ultraGrid1.Rows.Count == 0)
  83. {
  84. this.ultraGrid1.DisplayLayout.Bands[0].Summaries.Clear();
  85. }
  86. else
  87. {
  88. ArrayList alist = new ArrayList();
  89. alist.Add("LGCOUNT");
  90. alist.Add("LGWEIGHT");
  91. alist.Add("ZRCOUNT");
  92. alist.Add("ZRWEIGHT");
  93. alist.Add("CZCOUNT");
  94. alist.Add("CZWEIGHT");
  95. alist.Add("ZCCOUNT");
  96. alist.Add("ZCWEIGHT");
  97. alist.Add("ZGCOUNT");
  98. alist.Add("ZGWEIGHT");
  99. alist.Add("CZCOUNT1");
  100. alist.Add("CZWEIGHT1");
  101. CommonMethod.SetStaticsInfoSum(ref this.ultraGrid1, alist, true);
  102. }
  103. }
  104. catch { }
  105. }
  106. /// <summary>
  107. /// 导出
  108. /// </summary>
  109. private void exportData()
  110. {
  111. GridHelper.ulGridToExcel(ultraGrid1, "炼钢-制造部-轧管监控汇总");
  112. }
  113. }
  114. }