UIM070050.cs 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  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. namespace Core.LZMes.Client.UIM
  12. {
  13. public partial class UIM070050 : FrmBase
  14. {
  15. public UIM070050()
  16. {
  17. InitializeComponent();
  18. }
  19. public override void ToolBar_Click(object sender, string ToolbarKey)
  20. {
  21. switch (ToolbarKey)
  22. {
  23. case "Query":
  24. this.DoQuery();
  25. break;
  26. case "Export":
  27. this.Export();
  28. break;
  29. case "Save":
  30. this.DoSave();
  31. break;
  32. }
  33. }
  34. /// <summary>
  35. /// 查询原料库库存数据
  36. /// </summary>
  37. private void DoQuery()
  38. {
  39. try
  40. {
  41. this.dataSet1.Tables[0].Clear();
  42. string startTime = this.ultraDateTimeEditor1.Value != null ? ultraDateTimeEditor1.DateTime.ToString("yyyyMMdd") : "";//入库开始时间
  43. string endTime = this.ultraDateTimeEditor2.Value != null ? ultraDateTimeEditor2.DateTime.ToString("yyyyMMdd") : "";//入库结束时间
  44. string[] queryParams = new string[] { startTime, endTime };
  45. List<string[]> list = new List<String[]>();
  46. list.Add(queryParams);
  47. CoreClientParam ccp = new CoreClientParam();
  48. ccp.ServerName = "UIM.UIM07.UIM070010";
  49. ccp.MethodName = "queryHYardSpm";
  50. ccp.ServerParams = new object[] { list };
  51. ccp.SourceDataTable = this.dataSet1.Tables[0];
  52. this.ExecuteQueryToDataTable(ccp, CoreInvokeType.Internal);
  53. }
  54. catch (Exception EX)
  55. {
  56. MessageBox.Show(EX.ToString());
  57. }
  58. }
  59. /// <summary>
  60. /// 导出EXCEL
  61. /// </summary>
  62. private void Export()
  63. {
  64. try
  65. {
  66. if (this.saveFileDialog1.ShowDialog(this) == DialogResult.OK)
  67. {
  68. string fileName = this.saveFileDialog1.FileName;
  69. this.ultraGridExcelExporter1.Export(ultraGrid3, fileName);
  70. System.Diagnostics.Process.Start(fileName);
  71. }
  72. }
  73. catch (Exception ex)
  74. {
  75. MessageBox.Show(ex.ToString());
  76. }
  77. }
  78. private void UIM070050_Load(object sender, EventArgs e)
  79. {
  80. this.ultraDateTimeEditor1.Value = "" ;
  81. this.ultraDateTimeEditor2.Value = "";
  82. }
  83. private void DoSave()
  84. {
  85. Infragistics.Win.UltraWinGrid.RowsCollection rs = null;
  86. ArrayList list = new ArrayList();
  87. string[] param = null;
  88. CoreClientParam ccp = new CoreClientParam();
  89. rs = this.ultraGrid1.Rows;
  90. for (int i = 0; i < rs.Count; i++)
  91. {
  92. if ("TRUE".Equals(rs[i].Cells["CHK"].Text.ToUpperInvariant()))
  93. {
  94. param = new string[2];
  95. param[0] = rs[i].Cells["LZBZ"].Text.ToString().Trim();
  96. param[1] = rs[i].Cells["OLD_SAMPL_NO"].Value.ToString().Trim();
  97. list.Add(param);
  98. }
  99. }
  100. ccp.ServerName = "UIM.UIM070050";
  101. ccp.MethodName = "addLzbz";
  102. ccp.ServerParams = new Object[] { list };
  103. this.ExecuteNonQuery(ccp, CoreInvokeType.Internal);
  104. }
  105. }
  106. }