UIC020180.cs 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  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 UICO20180 : FrmBase
  15. {
  16. // public static UIK020030 s = null;
  17. public UICO20180()
  18. {
  19. InitializeComponent();
  20. // s = this;
  21. }
  22. private void UICO20180_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. CoreClientParam ccp1 = new CoreClientParam();
  77. Hashtable ht = new Hashtable();
  78. //ht.Add("i1", this.ultraComboEditor1.Text);
  79. ht.Add("i1", this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") + "-" + this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd"));
  80. ht.Add("o2", "");
  81. ccp1.ServerName = "UIB.COM.ComDBProcedure";
  82. ccp1.MethodName = "doXmlProcedure";
  83. ccp1.ServerParams = new object[] { "UIC010001_03.CALL", ht };
  84. this.ExecuteNonQuery(ccp1, CoreInvokeType.Internal);
  85. this.dataSet1.Clear();
  86. ArrayList al = new ArrayList();
  87. if (this.checkBox1.Checked)
  88. {
  89. al.Add("UIC020180_01.SELECT");
  90. }
  91. else
  92. {
  93. al.Add("UIC020180_02.SELECT");
  94. }
  95. al.Add(beginTime);
  96. al.Add(endTime);
  97. CoreClientParam ccp = new CoreClientParam();
  98. ccp.ServerName = "UIB.COM.ComDBQuery";
  99. ccp.MethodName = "doSimpleQuery";
  100. ccp.ServerParams = new object[] { al };
  101. ccp.IfShowErrMsg = false;
  102. ccp.SourceDataTable = this.dataSet1.Tables[0];
  103. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  104. //统计钢卷数量,钢卷总重量
  105. int coilCount = (int)dataSet1.Tables[0].Compute("count(OLD_SAMPL_NO)", "");
  106. double coilWgtSum = 0, actWgt1 = 0, coilWgtSum1 = 0, coilWgtSum2 = 0;
  107. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid1.Rows)
  108. {
  109. double actWgt = 0, actWgt2 = 0;
  110. string status = ugr.Cells["EXTSHAPE_QUALITY"].Value.ToString().Trim();
  111. try
  112. {
  113. actWgt = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  114. actWgt2 = double.Parse(ugr.Cells["COIL_RT"].Value.ToString().Trim());
  115. if ("FA".Equals(status))
  116. {
  117. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  118. coilWgtSum1 += actWgt1;
  119. }
  120. }
  121. catch (Exception e)
  122. {
  123. }
  124. coilWgtSum += actWgt;
  125. coilWgtSum2 += actWgt2;
  126. }
  127. this.textBox1.Text = coilCount.ToString();
  128. this.textBox2.Text = (coilWgtSum / 1000).ToString();
  129. this.textBox3.Text = (coilWgtSum1 / 1000).ToString();
  130. this.textBox4.Text = (Math.Round(coilWgtSum2/1000,2)).ToString();
  131. }
  132. private void DoExport()
  133. {
  134. try
  135. {
  136. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  137. {
  138. string fileName = this.saveFileDialog1.FileName;
  139. ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  140. //System.Diagnostics.Process.Start(fileName);
  141. }
  142. }
  143. catch (Exception EX)
  144. {
  145. MessageBox.Show(EX.ToString());
  146. }
  147. }
  148. private void ultraGrid1_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e)
  149. {
  150. try
  151. {
  152. ultraGrid1.ActiveCell.SelectAll();
  153. }
  154. catch
  155. {
  156. }
  157. }
  158. }
  159. }