UIM050020.cs 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  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 System.Diagnostics;
  11. using System.Collections;
  12. namespace Core.LZMes.Client.UIM
  13. {
  14. public partial class UIM050020 : FrmBase
  15. {
  16. public UIM050020()
  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. private void DoQuery()
  39. {
  40. try
  41. {
  42. string queryDate = this.ultraDateTimeEditor2.Value == null ? "000000" : this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd");
  43. string queryDate1 = this.ultraDateTimeEditor1.Value == null ? "000000" : this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd");
  44. ArrayList al = new ArrayList();
  45. if (this.ultraComboEditor1.Text == "成品库")
  46. al.Add("UIM050020_01.SELECT");
  47. else if (this.ultraComboEditor1.Text == "中间库")
  48. al.Add("UIM050020_02.SELECT");
  49. else if (this.ultraComboEditor1.Text == "热轧库")
  50. al.Add("UIM050020_04.SELECT");
  51. else
  52. al.Add("UIM050020_03.SELECT");
  53. al.Add(queryDate);
  54. al.Add(queryDate1);
  55. this.dataSet1.Tables[0].Clear();
  56. CoreClientParam ccp = new CoreClientParam();
  57. ccp.ServerName = "UIB.COM.ComDBQuery";
  58. ccp.MethodName = "doSimpleQuery";
  59. ccp.ServerParams = new object[] { al };
  60. ccp.SourceDataTable = this.dataSet1.Tables[0];
  61. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  62. int coilCount = (int)dataSet1.Tables[0].Compute("count(OLD_SAMPL_NO)", "");
  63. double coilWgtSum = 0, actWgt1 = 0, coilWgtSum1 = 0, coilWgtSum2 = 0;
  64. foreach (Infragistics.Win.UltraWinGrid.UltraGridRow ugr in ultraGrid1.Rows)
  65. {
  66. double actWgt = 0, actWgt2 = 0;
  67. try
  68. {
  69. actWgt = double.Parse(ugr.Cells["ACT_WGT"].Value.ToString().Trim());
  70. }
  71. catch (Exception e)
  72. {
  73. }
  74. coilWgtSum += actWgt;
  75. }
  76. this.textBox3.Text = coilCount.ToString();
  77. this.textBox2.Text = (coilWgtSum / 1000).ToString();
  78. }
  79. catch (Exception EX)
  80. {
  81. MessageBox.Show(EX.ToString());
  82. }
  83. }
  84. private void DoExport()
  85. {
  86. try
  87. {
  88. if (this.ultraGrid1.Rows.Count == 0)
  89. {
  90. MessageBox.Show("没有可以导出的数据", "提示");
  91. return;
  92. }
  93. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  94. {
  95. string fName = this.saveFileDialog1.FileName;
  96. this.ultraGridExcelExporter1.Export(this.ultraGrid1, fName);
  97. Process.Start(fName);
  98. }
  99. }
  100. catch (Exception ex)
  101. {
  102. System.Diagnostics.Debug.WriteLine(ex.ToString());
  103. }
  104. }
  105. private void UIM050020_Load(object sender, EventArgs e)
  106. {
  107. this.ultraComboEditor1.SelectedIndex = 0;
  108. }
  109. }
  110. }