using System.Data; using System.Windows; using SSWMS.Common; namespace SSWMS.Client { public partial class WAREHOUSE_CELL_SELECT : Window { private WH_CELL wcSelectedCell; public readonly bool? isNohave; public readonly string sWarehouseCode; public WAREHOUSE_CELL_SELECT(bool? b, string s) { InitializeComponent(); isNohave = b; sWarehouseCode = s; Window_Loaded(null, null); } private void Window_Loaded(object sender, RoutedEventArgs e) { this.Title = "货位选择"; this.Height = SystemParameters.PrimaryScreenHeight * 2 / 3; this.Width = SystemParameters.PrimaryScreenWidth * 2 / 3; this.ucCell.U_CellDoubleClick += (wc) => { if (wc == null) { return; } if (!string.IsNullOrWhiteSpace(sWarehouseCode) && wc.WAREHOUSE_CODE != sWarehouseCode) { string sWarehouse = sWarehouseCode == SystemCode.WAREHOUSE_CODE.Warehouse ? "立库" : "平库"; MessageDialog.ShowException($"货位编码 {wc.CELL_CODE} 请选择{sWarehouse}货位"); return; } this.wcSelectedCell = wc; this.DialogResult = true; this.Close(); }; if (!string.IsNullOrWhiteSpace(sWarehouseCode)) { this.ucCell.ucWare.sWarehouseCode = sWarehouseCode; } this.ucCell.U_InitControl(); } public static bool GetSelectedCell(bool? isNohave, string sWarehouseCode, out string sCellCode, out DataView dv) { sCellCode = string.Empty; dv = null; WAREHOUSE_CELL_SELECT wcs = new WAREHOUSE_CELL_SELECT(isNohave, sWarehouseCode); if (wcs.ShowDialog() == true && wcs.wcSelectedCell != null) { DataTable dt = new DataTable(); dt.Columns.Add("NAME", SystemCode.ConstCode.TypeString); dt.Columns.Add("VALUE", SystemCode.ConstCode.TypeString); dt.Rows.Add(wcs.wcSelectedCell.CELL_NAME, wcs.wcSelectedCell.CELL_CODE); dv = dt.DefaultView; sCellCode = wcs.wcSelectedCell.CELL_CODE; return true; } return false; } } }