StockLocationPopup.cs 4.0 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 System.Diagnostics;
  10. using System.IO;
  11. using CoreFS.CA06;
  12. using Core.Mes.Client.Comm.Server;
  13. using Core.Mes.Client.Comm.Control;
  14. using Core.Mes.Client.Comm.Tool;
  15. using Infragistics.Win.UltraWinGrid;
  16. using Infragistics.Win;
  17. using System.Net;
  18. using System.Collections;
  19. using CoreFS.SA06;
  20. namespace Core.StlMes.Client.BuyBillet
  21. {
  22. public partial class StockLocationPopup : FrmBase
  23. {
  24. private new CoreFS.CA06.OpeBase ob = new OpeBase();
  25. public String StockName { get; set; }
  26. public event Action<string> onSelected;
  27. public StockLocationPopup(OpeBase ops)
  28. {
  29. this.ob = ops;
  30. InitializeComponent();
  31. }
  32. private void StockLocationPopup_Load(object sender, EventArgs e)
  33. {
  34. Bind_PiKind(this.StockName);
  35. }
  36. private void Bind_PiKind(string stockname)
  37. {
  38. DataTable dt = ServerHelper.GetData("com.steering.pss.buybillet.Buybillet.get_CGP_Stock_Location", new object[] { stockname }, this.ob);
  39. if (dt.Rows.Count > 0)
  40. {
  41. GridHelper.CopyDataToDatatable(dt,this.ds_location.Tables[0], true);
  42. RefreshAndAutoSize(this.ug_location);
  43. }
  44. }
  45. public static void RefreshAndAutoSize(Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid)
  46. {
  47. try
  48. {
  49. ultraGrid.DataBind();
  50. foreach (Infragistics.Win.UltraWinGrid.UltraGridBand band in ultraGrid.DisplayLayout.Bands)
  51. {
  52. foreach (Infragistics.Win.UltraWinGrid.UltraGridColumn column in band.Columns)
  53. {
  54. column.PerformAutoResize(Infragistics.Win.UltraWinGrid.PerformAutoSizeType.AllRowsInBand);
  55. }
  56. }
  57. ultraGrid.Refresh();
  58. }
  59. catch { }
  60. }
  61. private void ug_location_DoubleClick(object sender, EventArgs e)
  62. {
  63. selected_Row();
  64. }
  65. private void ug_location_DoubleClickCell(object sender, DoubleClickCellEventArgs e)
  66. {
  67. selected_Row();
  68. }
  69. private void selected_Row()
  70. {
  71. UltraGridRow row = ug_location.ActiveRow;
  72. if (row == null)
  73. return;
  74. string location_name = row.GetValue("LOCATION_NAME");
  75. if (onSelected != null && MessageUtil.ShowYesNoAndTips("确认库位:" + location_name + "?") == DialogResult.Yes)
  76. {
  77. onSelected(location_name);
  78. this.Close();
  79. }
  80. }
  81. private void btn_qry_Click(object sender, EventArgs e)
  82. {
  83. string location = txt_stocklocation.Text.Trim();
  84. if(!string.IsNullOrEmpty(location))
  85. {
  86. DataView dv = ds_location.Tables[0].DefaultView;
  87. dv.RowFilter = "LOCATION_NAME like '%"+location+"%'";
  88. ug_location.DataSource = dv;
  89. }
  90. else
  91. {
  92. ug_location.DataSource = ds_location.Tables[0];
  93. }
  94. }
  95. private void btn_choice_Click(object sender, EventArgs e)
  96. {
  97. selected_Row();
  98. }
  99. private void txt_stocklocation_ValueChanged(object sender, EventArgs e)
  100. {
  101. string location = txt_stocklocation.Text.Trim();
  102. if (!string.IsNullOrEmpty(location))
  103. {
  104. DataView dv = ds_location.Tables[0].DefaultView;
  105. dv.RowFilter = "LOCATION_NAME like '%" + location + "%'";
  106. ug_location.DataSource = dv;
  107. }
  108. else
  109. {
  110. DataView dv = ds_location.Tables[0].DefaultView;
  111. dv.RowFilter = " 1=1 ";
  112. ug_location.DataSource = ds_location.Tables[0];
  113. }
  114. }
  115. }
  116. }