cc50709e11b2c324130bb9c947a2c0c0a2946e9e.svn-base 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  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 UICO20210 : FrmBase
  15. {
  16. // public static UIK020030 s = null;
  17. public UICO20210()
  18. {
  19. InitializeComponent();
  20. // s = this;
  21. }
  22. private void UICO20210_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("UIC020210_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. int coilCount = (int)dataSet1.Tables[0].Compute("count(OLD_SAMPL_NO)", "");
  90. double coilWgtSum = 0, actWgt1 = 0, coilWgtSum1 = 0, coilWgtSum2 = 0;
  91. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid1.Rows)
  92. {
  93. double actWgt = 0, actWgt2 = 0;
  94. string status = ugr.Cells["EXTSHAPE_QUALITY"].Value.ToString().Trim();
  95. try
  96. {
  97. actWgt = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  98. actWgt2 = double.Parse(ugr.Cells["COIL_RT"].Value.ToString().Trim());
  99. if ("FA".Equals(status))
  100. {
  101. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  102. coilWgtSum1 += actWgt1;
  103. }
  104. }
  105. catch (Exception e)
  106. {
  107. }
  108. coilWgtSum += actWgt;
  109. coilWgtSum2 += actWgt2;
  110. }
  111. this.textBox1.Text = coilCount.ToString();
  112. this.textBox2.Text = (coilWgtSum / 1000).ToString();
  113. this.textBox3.Text = (coilWgtSum1 / 1000).ToString();
  114. this.textBox4.Text = (Math.Round(coilWgtSum2/1000,2)).ToString();
  115. }
  116. private void DoExport()
  117. {
  118. try
  119. {
  120. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  121. {
  122. string fileName = this.saveFileDialog1.FileName;
  123. ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  124. //System.Diagnostics.Process.Start(fileName);
  125. }
  126. }
  127. catch (Exception EX)
  128. {
  129. MessageBox.Show(EX.ToString());
  130. }
  131. }
  132. private void ultraGrid1_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e)
  133. {
  134. try
  135. {
  136. ultraGrid1.ActiveCell.SelectAll();
  137. }
  138. catch
  139. {
  140. }
  141. }
  142. }
  143. }