86bf5f6d39e062c72c7f79295b3727be1f9d8d76.svn-base 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  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.Collections;
  11. using System.Diagnostics;
  12. using Infragistics.Win.UltraWinGrid;
  13. namespace Core.LZMes.Client.UIC
  14. {
  15. public partial class UIC020120 : FrmBase
  16. {
  17. public UIC020120()
  18. {
  19. InitializeComponent();
  20. }
  21. public override void ToolBar_Click(object sender, string ToolbarKey)
  22. {
  23. switch (ToolbarKey)
  24. {
  25. case "Query":
  26. this.DoQuery();
  27. break;
  28. case "Export":
  29. this.DoExport();
  30. break;
  31. case "Exit":
  32. this.Close();
  33. break;
  34. }
  35. }
  36. private void DoExport()
  37. {
  38. try
  39. {
  40. if (this.ultraGrid1.Rows.Count == 0)
  41. {
  42. MessageBox.Show("没有可以导出的数据", "提示");
  43. return;
  44. }
  45. saveFileDialog1.FileName = "入库品种说明表"+DateTime.Today.ToShortDateString()+"_01";
  46. saveFileDialog1.Filter = "表格(*.xls)|*.xls";
  47. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  48. {
  49. string fName = this.saveFileDialog1.FileName;
  50. this.ultraGridExcelExporter1.Export(ultraGrid1, fName);
  51. Process.Start(fName);
  52. }
  53. }
  54. catch (Exception ex)
  55. {
  56. System.Diagnostics.Debug.WriteLine(ex.ToString());
  57. }
  58. }
  59. private void DoQuery()
  60. {
  61. try
  62. {
  63. this.dataSet1.Tables[0].Clear();
  64. ultraTextEditor4.Text = "";
  65. ultraTextEditor3.Text = "";
  66. ArrayList al = new ArrayList();
  67. if (ultraComboEditor2.Value.Equals("连退"))
  68. al.Add("UIC0201120_01.SELECT");//SQL语句的ID
  69. else
  70. al.Add("UIC0201120_02.SELECT");//SQL语句的ID
  71. al.Add(this.ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd").Trim());
  72. al.Add(this.ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd").Trim());
  73. al.Add(this.ultraDateTimeEditor3.DateTime.ToString("yyyyMMddHHmmss").Trim());
  74. al.Add(this.ultraDateTimeEditor4.DateTime.ToString("yyyyMMddHHmmss").Trim());
  75. al.Add(this.txtOLD_SAMPL_NO1.Text.Trim());
  76. al.Add(this.txtOLD_SAMPL_NO2.Text.Trim());
  77. al.Add("");
  78. CoreClientParam ccp = new CoreClientParam();
  79. ccp.ServerName = "UIB.COM.ComDBQuery";
  80. ccp.MethodName = "doSimpleQuery";
  81. ccp.ServerParams = new object[] { al };
  82. ccp.SourceDataTable = this.dataSet1.Tables[0];
  83. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  84. if (this.ultraGrid1.Rows.Count > 0)
  85. {
  86. int sumNum=0;
  87. double sumWeight=0;
  88. foreach(UltraGridRow ugr in this.ultraGrid1.Rows)
  89. {
  90. sumNum += int.Parse(ugr.Cells["COIL_CNT"].Text);
  91. sumWeight += double.Parse(ugr.Cells["COIL_WGT"].Text);
  92. }
  93. ultraTextEditor3.Text = sumNum.ToString();
  94. ultraTextEditor4.Text = sumWeight.ToString();
  95. }
  96. }
  97. catch (Exception ex)
  98. {
  99. System.Diagnostics.Debug.WriteLine(ex.ToString());
  100. }
  101. }
  102. private void ultraCheckEditor1_CheckedChanged(object sender, EventArgs e)
  103. {
  104. if (ultraCheckEditor1.Checked)
  105. {
  106. ultraGrid1.Rows.Band.Columns["INSTR_COIL_THK"].AllowRowFiltering = Infragistics.Win.DefaultableBoolean.True;
  107. ultraGrid1.Rows.Band.Columns["INSTR_COIL_WTH"].AllowRowFiltering = Infragistics.Win.DefaultableBoolean.True;
  108. }
  109. else
  110. {
  111. ultraGrid1.Rows.Band.ColumnFilters["INSTR_COIL_WTH"].FilterConditions.Clear();
  112. ultraGrid1.Rows.Band.ColumnFilters["INSTR_COIL_THK"].FilterConditions.Clear();
  113. ultraGrid1.Rows.Band.Columns["INSTR_COIL_THK"].AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  114. ultraGrid1.Rows.Band.Columns["INSTR_COIL_WTH"].AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  115. }
  116. }
  117. private void ultraCheckEditor2_CheckedChanged(object sender, EventArgs e)
  118. {
  119. if (ultraCheckEditor2.Checked)
  120. {
  121. ultraGrid1.Rows.Band.Columns["SPEC_STL_GRD"].AllowRowFiltering = Infragistics.Win.DefaultableBoolean.True;
  122. }
  123. else
  124. {
  125. ultraGrid1.Rows.Band.ColumnFilters["SPEC_STL_GRD"].FilterConditions.Clear();
  126. ultraGrid1.Rows.Band.Columns["SPEC_STL_GRD"].AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  127. }
  128. }
  129. private void ultraCheckEditor3_CheckedChanged(object sender, EventArgs e)
  130. {
  131. if (ultraCheckEditor3.Checked)
  132. ultraGrid1.Rows.Band.Columns["EXTSHAPE_DEC_GRD"].AllowRowFiltering = Infragistics.Win.DefaultableBoolean.True;
  133. else
  134. {
  135. ultraGrid1.Rows.Band.ColumnFilters["EXTSHAPE_DEC_GRD"].FilterConditions.Clear();
  136. ultraGrid1.Rows.Band.Columns["EXTSHAPE_DEC_GRD"].AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  137. }
  138. }
  139. private void ultraCheckEditor4_CheckedChanged(object sender, EventArgs e)
  140. {
  141. if (ultraCheckEditor4.Checked)
  142. ultraGrid1.Rows.Band.Columns["ORD_FL"].AllowRowFiltering = Infragistics.Win.DefaultableBoolean.True;
  143. else
  144. {
  145. ultraGrid1.Rows.Band.ColumnFilters["ORD_FL"].FilterConditions.Clear();
  146. ultraGrid1.Rows.Band.Columns["ORD_FL"].AllowRowFiltering = Infragistics.Win.DefaultableBoolean.False;
  147. }
  148. }
  149. }
  150. }