UIC020200.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  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 UIC020200 : FrmBase
  15. {
  16. public UIC020200()
  17. {
  18. InitializeComponent();
  19. }
  20. public override void ToolBar_Click(object sender, string ToolbarKey)
  21. {
  22. switch (ToolbarKey)
  23. {
  24. case "Query":
  25. this.DoQuery();
  26. break;
  27. case "Export":
  28. this.DoExport();
  29. break;
  30. case "Exit":
  31. this.Close();
  32. break;
  33. }
  34. }
  35. /// <summary>
  36. ///
  37. /// </summary>
  38. ///
  39. public void DoQuery()
  40. {
  41. string startTime = ultraStartTime.Value != null ? ultraStartTime.DateTime.ToString("yyyyMMdd") : "";
  42. string endTime = ultraEndTime.Value != null ? ultraEndTime.DateTime.ToString("yyyyMMdd") : "";
  43. string coilNo = txtCoilNo.Text.Trim();
  44. string line = this.ultraComboEditor7.Value.ToString();//产线区分 P酸轧 S酸洗
  45. if (("".Equals(startTime) || "".Equals(endTime)) && "".Equals(coilNo))
  46. {
  47. MessageBox.Show("请选择查询条件!", "提示");
  48. return;
  49. }
  50. this.dataSet1.Clear();
  51. ArrayList al = new ArrayList();
  52. if (line == "S")
  53. { al.Add("UIC020200_02.SELECT"); }
  54. else
  55. { al.Add("UIC020200_01.SELECT"); }
  56. al.Add(coilNo);
  57. al.Add(startTime);
  58. al.Add(endTime);
  59. CoreClientParam ccp = new CoreClientParam();
  60. ccp.ServerName = "UIB.COM.ComDBQuery";
  61. ccp.MethodName = "doSimpleQuery";
  62. ccp.ServerParams = new object[] { al };
  63. ccp.IfShowErrMsg = false;
  64. ccp.SourceDataTable = this.dataSet1.Tables[0];
  65. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  66. ArrayList arraylist = (ArrayList)ccp.ReturnObject;//得到返回结果
  67. if (arraylist.Count == 0)
  68. {
  69. MessageBox.Show("未找到符合条件的记录,请修改查询条件!");
  70. }
  71. //统计钢卷数量,钢卷总重量
  72. int coilCount = (int)dataSet1.Tables[0].Compute("count(OLD_SAMPL_NO)", "");
  73. double coilWgtSum = 0, actWgt1 = 0, coilWgtSum1 = 0, coilWgtSum2 = 0;
  74. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid1.Rows)
  75. {
  76. double actWgt = 0, actWgt2 = 0;
  77. string status = ugr.Cells["EXTSHAPE_QUALITY"].Value.ToString().Trim();
  78. try
  79. {
  80. actWgt = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  81. actWgt2 = double.Parse(ugr.Cells["M_WGT"].Value.ToString().Trim());
  82. if ("FA".Equals(status))
  83. {
  84. actWgt1 = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  85. coilWgtSum1 += actWgt1;
  86. }
  87. }
  88. catch (Exception e)
  89. {
  90. }
  91. coilWgtSum += actWgt;
  92. coilWgtSum2 += actWgt2;
  93. }
  94. this.textBox1.Text = coilCount.ToString();
  95. this.textBox2.Text = (coilWgtSum / 1000).ToString();
  96. this.textBox3.Text = (coilWgtSum1 / 1000).ToString();
  97. this.textBox4.Text = (Math.Round(coilWgtSum2 / 1000, 2)).ToString();
  98. }
  99. private void DoExport()
  100. {
  101. try
  102. {
  103. if (this.ultraGrid1.Rows.Count == 0)
  104. {
  105. MessageBox.Show("没有可以导出的数据", "提示");
  106. return;
  107. }
  108. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  109. {
  110. string fileName = this.saveFileDialog1.FileName;
  111. ultraGridExcelExporter1.Export(ultraGrid1, fileName);
  112. System.Diagnostics.Process.Start(fileName);
  113. }
  114. }
  115. catch (Exception EX)
  116. {
  117. MessageBox.Show(EX.ToString());
  118. }
  119. }
  120. private void ultraGrid1_ClickCell(object sender, Infragistics.Win.UltraWinGrid.ClickCellEventArgs e)
  121. {
  122. try
  123. {
  124. ultraGrid1.ActiveCell.SelectAll();
  125. }
  126. catch
  127. {
  128. }
  129. }
  130. private void UIC020200_Load(object sender, EventArgs e)
  131. {
  132. this.ultraComboEditor7.Value = "P";
  133. }
  134. }
  135. }