273e0172e6c21cbc802cabaf4f9f124e7a515f84.svn-base 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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 System.Collections;
  10. using CoreFS.CA06;
  11. using Infragistics.Win.UltraWinGrid;
  12. namespace Core.LZMes.Client.UIK
  13. {
  14. public partial class UICO20190 : FrmBase
  15. {
  16. // public static UIK020030 s = null;
  17. public UICO20190()
  18. {
  19. InitializeComponent();
  20. // s = this;
  21. }
  22. private void UICO20190_Load(object sender, EventArgs e)
  23. {
  24. //CoreClientParam ccp = new CoreClientParam();
  25. //ccp.ServerName = "UIK.UIK02.UIK020040";
  26. //ccp.MethodName = "queryRollManaNo";
  27. //ccp = this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  28. //ArrayList list = (ArrayList)(ccp.ReturnObject);
  29. //if (list != null)
  30. //{
  31. // int listSize = list.Count;
  32. // Infragistics.Win.ValueListItem[] valueListItems = new Infragistics.Win.ValueListItem[listSize];
  33. // for (int i = 0; i < listSize; i++)
  34. // {
  35. // Infragistics.Win.ValueListItem item = new Infragistics.Win.ValueListItem();
  36. // string[] param = (string[])list[i];
  37. // item.DataValue = param[1];
  38. // item.DisplayText = param[1]; ;
  39. // valueListItems[i] = item;
  40. // }
  41. // this.ultraComboEditor1.Items.AddRange(valueListItems);
  42. // this.ultraComboEditor1.SelectedIndex = 0;
  43. //}
  44. //this.ultraComboEditor2.SelectedIndex = 0;
  45. }
  46. public override void ToolBar_Click(object sender, string ToolbarKey)
  47. {
  48. switch (ToolbarKey)
  49. {
  50. case "Query":
  51. this.DoQuery();
  52. break;
  53. case "Export":
  54. this.DoExport();
  55. break;
  56. case "Exit":
  57. this.Close();
  58. break;
  59. }
  60. }
  61. /// <summary>
  62. ///
  63. /// </summary>
  64. ///
  65. public void DoQuery()
  66. {
  67. //string rollManaNo = this.ultraComboEditor1.Text.Trim();
  68. string beginTime = ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "";
  69. string endTime = ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") : "";
  70. string coilNo = textBox9.Text.Trim();
  71. if ( ("".Equals(beginTime) || "".Equals(endTime)) && "".Equals(coilNo))
  72. {
  73. MessageBox.Show("请选择查询条件!" , "提示");
  74. return;
  75. }
  76. this.dataSet1.Clear();
  77. ArrayList al = new ArrayList();
  78. al.Add("UIC020190_01.SELECT");
  79. al.Add(beginTime);
  80. al.Add(endTime);
  81. CoreClientParam ccp = new CoreClientParam();
  82. ccp.ServerName = "UIB.COM.ComDBQuery";
  83. ccp.MethodName = "doSimpleQuery";
  84. ccp.ServerParams = new object[] { al };
  85. ccp.IfShowErrMsg = false;
  86. ccp.SourceDataTable = this.dataSet1.Tables[0];
  87. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  88. //统计钢卷数量,钢卷总重量
  89. double coilWgtSum = 0, actWgt1=0, coilWgtSum1=0;
  90. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid1.Rows)
  91. {
  92. double actWgt = 0;
  93. try
  94. {
  95. actWgt = double.Parse(ugr.Cells["WGT"].Value.ToString().Trim());
  96. }
  97. catch (Exception e)
  98. {
  99. }
  100. coilWgtSum += actWgt;
  101. }
  102. //this.textBox1.Text = coilCount.ToString();
  103. this.textBox2.Text = (coilWgtSum / 1000).ToString();
  104. // this.textBox3.Text = (coilWgtSum1 / 1000).ToString();
  105. }
  106. private void DoExport()
  107. {
  108. try
  109. {
  110. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  111. {
  112. string fileName = this.saveFileDialog1.FileName;
  113. ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  114. //System.Diagnostics.Process.Start(fileName);
  115. }
  116. }
  117. catch (Exception EX)
  118. {
  119. MessageBox.Show(EX.ToString());
  120. }
  121. }
  122. private void ultraGrid1_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e)
  123. {
  124. try
  125. {
  126. ultraGrid1.ActiveCell.SelectAll();
  127. }
  128. catch
  129. {
  130. }
  131. }
  132. }
  133. }