/// <summary> /// 焦点行转变,刷新库位的选项 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void gvProductSJ_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e) { WaitDialogForm waitForm = new WaitDialogForm(Constants.OPERATE_DB_DATA); waitForm.Show(); try { DataRow row = gvProductSJ.GetFocusedDataRow(); repositoryItemComboBoxStockLayout.Items.Clear(); if (row != null && row["StockHouseCode"] != null) { List <StockLayout> list = StockLayoutService.GetStockLayout(c => c.StockHouseCode == row["StockHouseCode"].ToString()); Hashtable layoutTable = new Hashtable(); int i = 0; foreach (StockLayout sl in list) { repositoryItemComboBoxStockLayout.Items.Add(sl.LayoutName); layoutTable.Add(i++, sl.StockHouseCode); } repositoryItemComboBoxStockLayout.Tag = layoutTable; } waitForm.Close(); } catch (Exception ex) { waitForm.Close(); XtraMessageBox.Show(ex.ToString(), Constants.SYSTEM_PROMPT, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// 选择仓库 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void repositoryItemComboBoxStockHouse_SelectedIndexChanged(object sender, EventArgs e) { ComboBoxEdit combo = sender as ComboBoxEdit; gvProductSJ.BeginUpdate(); DataRow row = gvProductSJ.GetFocusedDataRow(); row[gcStockHouse.FieldName] = combo.Properties.Items[combo.SelectedIndex]; Hashtable table = repositoryItemComboBoxStockHouse.Tag as Hashtable; row["StockHouseCode"] = table[combo.SelectedIndex]; gvProductSJ.EndUpdate(); repositoryItemComboBoxStockLayout.Items.Clear(); List <StockLayout> list = StockLayoutService.GetStockLayout(c => c.StockHouseCode == table[combo.SelectedIndex].ToString()); Hashtable layoutTable = new Hashtable(); int i = 0; foreach (StockLayout sl in list) { repositoryItemComboBoxStockLayout.Items.Add(sl.LayoutName); layoutTable.Add(i++, sl.StockLayoutCode); } repositoryItemComboBoxStockLayout.Tag = layoutTable; gvProductSJ.BestFitColumns(); }
/// <summary> /// 仓库变化加载库位 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void comboBoxStockHouse_SelectedIndexChanged(object sender, EventArgs e) { dTable.Rows.Clear(); skuOuterIDList.Clear(); if (string.Empty == comboBoxStockHouse.Text) { return; } if (comboBoxStockHouse.Tag == null) { return; } Hashtable table = comboBoxStockHouse.Tag as Hashtable; string houseCode = table[comboBoxStockHouse.SelectedIndex].ToString(); rICBLayout.Items.Clear(); List <StockLayout> layOutList = StockLayoutService.GetStockLayout(i => i.StockHouseCode == houseCode); if (layOutList != null && layOutList.Count > 0) { Hashtable tag = new Hashtable(); int index = 0; foreach (StockLayout stockLayout in layOutList) { rICBLayout.Items.Add(stockLayout.LayoutName); tag.Add(index++, stockLayout.StockLayoutCode); } rICBLayout.Tag = tag; } gvProductCheck.BestFitColumns(); gridViewDetail.BestFitColumns(); }
/// <summary> /// 根据HouseCode加载库位 /// </summary> /// <param name="repositoryItemComboBoxLayout"></param> /// <param name="houseCode"></param> public void LoadLayout(RepositoryItemComboBox repositoryItemComboBoxLayout, string houseCode) { repositoryItemComboBoxLayout.Items.Clear(); List <StockLayout> list = StockLayoutService.GetStockLayout(c => c.StockHouseCode == houseCode); Hashtable layoutTable = new Hashtable(); int i = 0; foreach (StockLayout sl in list) { repositoryItemComboBoxLayout.Items.Add(sl.LayoutName); layoutTable.Add(i++, sl.StockHouseCode); } repositoryItemComboBoxLayout.Tag = layoutTable; }
/// <summary> /// 调入仓库 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void comboStockIn_SelectedIndexChanged(object sender, EventArgs e) { if (comboStockIn.Text == comboStockOut.Text) { XtraMessageBox.Show("调出仓库和调入仓库不能相同", Constants.SYSTEM_PROMPT); return; } SetCellLayoutEmpty(false); repositoryItemComboBoxLayoutIn.Items.Clear(); if (comboStockIn.Tag != null) { int index = ((DevExpress.XtraEditors.ComboBoxEdit)(sender)).SelectedIndex; string[] codeList = comboStockIn.Tag.ToString().Split(','); if (index != -1 && codeList.Length > index) { string houseCode = codeList[index]; //加载入库库位 string tag = string.Empty; List <StockLayout> stockLayoutList = StockLayoutService.GetStockLayout(i => i.StockHouseCode == houseCode); foreach (StockLayout layout in stockLayoutList) { if (string.IsNullOrEmpty(layout.LayoutName)) { continue; } repositoryItemComboBoxLayoutIn.Items.Add(layout.LayoutName); tag += layout.StockLayoutCode + ","; } repositoryItemComboBoxLayoutIn.Tag = tag.Trim(','); } else { SetCellLayoutEmpty(false); //gVStockProduct.SetFocusedRowCellValue("LayoutCodeIn", string.Empty); //gVStockProduct.SetFocusedRowCellValue("LayoutNameIn", string.Empty); } } }
/// <summary> /// 根据stockHouseCode加载库位 /// </summary> /// <param name="houseCode"></param> private void LoadLayout(string stockHouseCode) { List <Alading.Entity.StockLayout> layOutList = StockLayoutService.GetStockLayout(i => i.StockHouseCode == stockHouseCode); gridStockLayout.DataSource = layOutList; }
public AllocationAdd(Alading.Entity.StockInOut stockInOut, DataTable dTable) { InitializeComponent(); IsAddFlag = false; this.Text = "库存调拨-修改"; AddColumns();//给table增加row textOperatorName.Text = stockInOut.OperatorName; dateInOutTime.DateTime = stockInOut.InOutTime; textInOutCode.Text = stockInOut.InOutCode; comboStockOut.Text = stockInOut.HouseNameOut; comboStockIn.Text = stockInOut.HouseNameIn; simpleBtnSaveAdd.Visible = false; foreach (DataRow dRow in dTable.Rows) { DataRow newRow = this.dTable.NewRow(); newRow["IsSelected"] = false; newRow["Name"] = dRow["Name"]; newRow["OuterID"] = dRow["OuterID"]; newRow["Specification"] = dRow["Specification"]; newRow["Model"] = dRow["Model"]; newRow["SaleProps"] = dRow["SaleProps"]; newRow["Num"] = StockHouseService.GetQuantity(dRow["SkuOuterID"].ToString(), stockInOut.HouseCodeOut, dRow["LayoutCodeOut"].ToString());//调出仓库库位库存量 newRow["SkuOuterID"] = dRow["SkuOuterID"]; newRow["SkuQuantity"] = dRow["SkuQuantity"]; newRow["LayoutCodeIn"] = dRow["LayoutCodeIn"]; newRow["LayoutCodeOut"] = dRow["LayoutCodeOut"]; newRow["LayoutNameIn"] = dRow["LayoutNameIn"]; newRow["LayoutNameOut"] = dRow["LayoutNameOut"]; this.dTable.Rows.Add(newRow); } int rowHandle = gVStockProduct.FocusedRowHandle; //gVStockProduct.FocusedRowChanged -= gVStockProduct_FocusedRowChanged; gridStockProduct.DataSource = this.dTable; if (rowHandle == 0 && gVStockProduct.FocusedRowHandle > -1) { FocusedRowChange(); } //加载出库库位 string tag = string.Empty; DataRow dataRow = gVStockProduct.GetFocusedDataRow(); if (dataRow != null) { string skuOuterID = dataRow["SkuOuterID"].ToString(); List <StockHouseProduct> stockLayoutList = StockHouseService.GetStockHouseProduct(i => i.SkuOuterID == skuOuterID && i.HouseCode == stockInOut.HouseCodeOut); foreach (StockHouseProduct vStockHouse in stockLayoutList) { if (string.IsNullOrEmpty(vStockHouse.LayoutName)) { continue; } repositoryItemComboBoxLayoutOut.Items.Add(vStockHouse.LayoutName); tag += vStockHouse.LayoutCode + ","; } repositoryItemComboBoxLayoutOut.Tag = tag.Trim(','); } //加载入库库位 string tagIn = string.Empty; List <StockLayout> LayoutList = StockLayoutService.GetStockLayout(i => i.StockHouseCode == stockInOut.HouseCodeIn); foreach (StockLayout layout in LayoutList) { if (string.IsNullOrEmpty(layout.LayoutName)) { continue; } repositoryItemComboBoxLayoutIn.Items.Add(layout.LayoutName); tagIn += layout.StockLayoutCode + ","; } repositoryItemComboBoxLayoutIn.Tag = tagIn.Trim(','); }