using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Diagnostics; using System.IO; using CoreFS.CA06; using Core.Mes.Client.Comm.Server; using Core.Mes.Client.Comm.Control; using Core.Mes.Client.Comm.Tool; using Infragistics.Win.UltraWinGrid; using Infragistics.Win; using System.Net; using System.Collections; using CoreFS.SA06; namespace Core.StlMes.Client.BuyBillet { public partial class StockLocationPopup : FrmBase { private new CoreFS.CA06.OpeBase ob = new OpeBase(); public String StockName { get; set; } public event Action onSelected; public StockLocationPopup(OpeBase ops) { this.ob = ops; InitializeComponent(); } private void StockLocationPopup_Load(object sender, EventArgs e) { Bind_PiKind(this.StockName); } private void Bind_PiKind(string stockname) { DataTable dt = ServerHelper.GetData("com.steering.pss.buybillet.Buybillet.get_CGP_Stock_Location", new object[] { stockname }, this.ob); if (dt.Rows.Count > 0) { GridHelper.CopyDataToDatatable(dt,this.ds_location.Tables[0], true); RefreshAndAutoSize(this.ug_location); } } public static void RefreshAndAutoSize(Infragistics.Win.UltraWinGrid.UltraGrid ultraGrid) { try { ultraGrid.DataBind(); foreach (Infragistics.Win.UltraWinGrid.UltraGridBand band in ultraGrid.DisplayLayout.Bands) { foreach (Infragistics.Win.UltraWinGrid.UltraGridColumn column in band.Columns) { column.PerformAutoResize(Infragistics.Win.UltraWinGrid.PerformAutoSizeType.AllRowsInBand); } } ultraGrid.Refresh(); } catch { } } private void ug_location_DoubleClick(object sender, EventArgs e) { selected_Row(); } private void ug_location_DoubleClickCell(object sender, DoubleClickCellEventArgs e) { selected_Row(); } private void selected_Row() { UltraGridRow row = ug_location.ActiveRow; if (row == null) return; string location_name = row.GetValue("LOCATION_NAME"); if (onSelected != null && MessageUtil.ShowYesNoAndTips("确认库位:" + location_name + "?") == DialogResult.Yes) { onSelected(location_name); this.Close(); } } private void btn_qry_Click(object sender, EventArgs e) { string location = txt_stocklocation.Text.Trim(); if(!string.IsNullOrEmpty(location)) { DataView dv = ds_location.Tables[0].DefaultView; dv.RowFilter = "LOCATION_NAME like '%"+location+"%'"; ug_location.DataSource = dv; } else { ug_location.DataSource = ds_location.Tables[0]; } } private void btn_choice_Click(object sender, EventArgs e) { selected_Row(); } private void txt_stocklocation_ValueChanged(object sender, EventArgs e) { string location = txt_stocklocation.Text.Trim(); if (!string.IsNullOrEmpty(location)) { DataView dv = ds_location.Tables[0].DefaultView; dv.RowFilter = "LOCATION_NAME like '%" + location + "%'"; ug_location.DataSource = dv; } else { DataView dv = ds_location.Tables[0].DefaultView; dv.RowFilter = " 1=1 "; ug_location.DataSource = ds_location.Tables[0]; } } } }