/// <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 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> /// 选择仓库 /// </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 barDeleteLayout_ItemClick(object sender, DevExpress.XtraBars.ItemClickEventArgs e) { /*库位中如果有商品则不能删除*/ Alading.Entity.StockLayout layout = gViewStockLayout.GetFocusedRow() as Alading.Entity.StockLayout; if (layout != null) { if (layout.StockLayoutCode == Constants.DEFAULT_STOCKLAYOUT_CODE || layout.LayoutName == "默认库位") { XtraMessageBox.Show("系统默认库位,不能删除", Constants.SYSTEM_PROMPT); return; } if (XtraMessageBox.Show(string.Format("是否删除库位\n{0}", layout.LayoutName), Constants.SYSTEM_PROMPT, MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.OK) { List <StockHouseProduct> productList = StockHouseService.GetStockHouseProduct(i => i.LayoutCode == layout.StockLayoutCode); if (productList == null || productList.Count == 0) { if (StockLayoutService.RemoveStockLayout(layout.StockLayoutCode) == ReturnType.Success) { XtraMessageBox.Show("库位删除成功", Constants.SYSTEM_PROMPT); //重新加载库位 LoadLayout(stockHouseCode); } else { XtraMessageBox.Show("库位删除失败", Constants.SYSTEM_PROMPT); } } else { XtraMessageBox.Show("该库位有商品,不能删除", Constants.SYSTEM_PROMPT); } } } }
/// <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 simpleConfirm_Click(object sender, EventArgs e) { StockLayout stockLayout = new StockLayout(); stockLayout.LayoutName = textLayoutName.Text; stockLayout.LayoutRemark = memoLayoutRemark.Text; if (modifyFlag == true) { stockLayout.StockLayoutCode = stockLayoutCode; if (StockLayoutService.UpdateStockLayout(stockLayout) == ReturnType.Success) { XtraMessageBox.Show("修改库位信息成功", Constants.SYSTEM_PROMPT); this.Close(); } else { XtraMessageBox.Show("修改库位信息失败", Constants.SYSTEM_PROMPT); } } else { stockLayout.StockHouseCode = stockHouseCode; if (textEditLayoutCode.Text == string.Empty) { stockLayout.StockLayoutCode = Guid.NewGuid().ToString(); } else { stockLayout.StockLayoutCode = textEditLayoutCode.Text; } ReturnType result = StockLayoutService.AddStockLayout(stockLayout); if (result == ReturnType.Success) { XtraMessageBox.Show("新增库位成功", Constants.SYSTEM_PROMPT); this.Close(); } else if (result == ReturnType.PropertyExisted) { XtraMessageBox.Show("库位编码重复,请重输", Constants.SYSTEM_PROMPT); textEditLayoutCode.Focus(); } else { XtraMessageBox.Show("新增库位失败", Constants.SYSTEM_PROMPT); } } }
/// <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(','); }