FrmGeneralStatistics.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144
  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 Core.Mes.Client.Comm.Control;
  11. using Core.StlMes.Client.YdmPipeManage.Tool;
  12. using Core.Mes.Client.Comm.Server;
  13. using Core.StlMes.Client.YdmPipeManage;
  14. using System.Collections;
  15. using Infragistics.Win.UltraWinGrid;
  16. namespace Core.StlMes.Client.YdmPipeReport
  17. {
  18. public partial class FrmGeneralStatistics : FrmBase
  19. {
  20. public FrmGeneralStatistics()
  21. {
  22. InitializeComponent();
  23. }
  24. public override void ToolBar_Click(object sender, string ToolbarKey)
  25. {
  26. switch (ToolbarKey)
  27. {
  28. case "Query":
  29. //queryData();
  30. queryDataB();
  31. break;
  32. case "Export":
  33. exportData();
  34. break;
  35. case "Close":
  36. this.Close();
  37. break;
  38. }
  39. }
  40. /// <summary>
  41. /// 查询
  42. /// </summary>
  43. private void queryData()
  44. {
  45. string[] arr = null;
  46. ArrayList parm = new ArrayList();
  47. string bathYear = dtBathYear.Value.ToString("yyyyMM");
  48. try
  49. {
  50. this.Cursor = Cursors.WaitCursor; //控制鼠标的样式为等待
  51. if (Constant.WaitingForm == null)
  52. {
  53. Constant.WaitingForm = new WaitingForm();
  54. }
  55. Constant.WaitingForm.ShowToUser = true;
  56. Constant.WaitingForm.Show();
  57. Constant.WaitingForm.Update();
  58. arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds,ob);
  59. parm.Add(bathYear);
  60. parm.Add(bathYear);
  61. parm.Add(bathYear);
  62. parm.Add(bathYear);
  63. parm.Add(bathYear);
  64. parm.Add(bathYear);
  65. parm.Add(bathYear);
  66. DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmGeneralStatistics.doQuery", new object[] { parm,arr }, ob);
  67. GridHelper.CopyDataToDatatable(ref ds,ref dataTable1,true);
  68. this.SetStaticsInfo();
  69. CommonMethod.SetGridSumArea(this.ultraGrid1);
  70. this.Cursor = Cursors.Default;
  71. Constant.WaitingForm.ShowToUser = false;
  72. Constant.WaitingForm.Close();
  73. Constant.WaitingForm = null;
  74. }
  75. catch (Exception e)
  76. {
  77. this.Cursor = Cursors.Default;
  78. Constant.WaitingForm.ShowToUser = false;
  79. Constant.WaitingForm.Close();
  80. Constant.WaitingForm = null;
  81. }
  82. }
  83. /// <summary>
  84. /// 查询
  85. /// </summary>
  86. private void queryDataB()
  87. {
  88. string[] arr = BaseMethod.InitPermissions(this.ValidDataPurviewIds, ob);
  89. string bathYear = dtBathYear.Value.ToString("yyyyMM");
  90. DataTable ds = ServerHelper.GetData("com.steering.pss.ydm.Report.FrmGeneralStatistics.doQueryDataB", new object[] { bathYear, arr }, ob);
  91. GridHelper.CopyDataToDatatable(ref ds, ref dataTable1, true);
  92. this.SetStaticsInfo();
  93. CommonMethod.SetGridSumArea(this.ultraGrid1);
  94. }
  95. private void SetStaticsInfo()
  96. {
  97. try
  98. {
  99. if (this.ultraGrid1.Rows.Count == 0)
  100. {
  101. this.ultraGrid1.DisplayLayout.Bands[0].Summaries.Clear();
  102. }
  103. else
  104. {
  105. ArrayList alist = new ArrayList();
  106. alist.Add("ONDAYINWGT");
  107. alist.Add("INALLWGT");
  108. alist.Add("ONDAYOUTWGT");
  109. alist.Add("SUMWGT");
  110. alist.Add("RAILWAYWGT");
  111. alist.Add("TARGETWGT");
  112. alist.Add("ENDWGT");
  113. alist.Add("INCREMENTWGT");
  114. CommonMethod.SetStaticsInfoSum(ref this.ultraGrid1, alist, true);
  115. }
  116. }
  117. catch { }
  118. }
  119. /// <summary>
  120. /// 导出
  121. /// </summary>
  122. private void exportData()
  123. {
  124. GridHelper.ulGridToExcel(this.ultraGrid1, "收发存综合统计");
  125. }
  126. private void ultraGrid1_InitializeLayout(object sender, Infragistics.Win.UltraWinGrid.InitializeLayoutEventArgs e)
  127. {
  128. e.Layout.Override.DefaultRowHeight = 45;
  129. e.Layout.Override.RowSizing = RowSizing.Free;
  130. this.ultraGrid1.DisplayLayout.Override.RowSizing = RowSizing.Free;
  131. }
  132. private void FrmGeneralStatistics_Load(object sender, EventArgs e)
  133. {
  134. dtBathYear.Value = DateTime.Parse(DateTime.Now.ToString("yyyy-MM"));
  135. }
  136. }
  137. }