/// <summary> /// 窗体载入 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UserControlStore_Load(object sender, EventArgs e) { InitTreeView(); m_selectDepotCode = treeView.Nodes[0].Nodes[0].Name; if (BasicInfo.ListRoles.Contains(CE_RoleEnum.营销仓库管理员.ToString())) { if (!m_storeServer.GetAllStore(m_selectDepotCode, m_sequence, out m_findStore, out m_err)) { MessageDialog.ShowErrorMessage(m_err); return; } } else if (BasicInfo.ListRoles.Contains(CE_RoleEnum.制造仓库管理员.ToString())) { if (!m_storeServer.GetAllStore(m_selectDepotCode, m_sequence, out m_findStore, out m_err)) { MessageDialog.ShowErrorMessage(m_err); return; } } RefreshDataGridView(m_findStore); if (dataGridView1.Columns.Count > 0) { dataGridView1.Columns[0].Visible = false; } RefreshShelf(); }
/// <summary> /// 查询库存 /// </summary> private void QueryStock() { if (checkBox1.Checked) { if (!m_storeServer.GetAllStore(null, true, out m_stockInfo, out m_error)) { MessageDialog.ShowErrorMessage(m_error); return; } } else { if (!m_storeServer.GetNoZeroStore(out m_stockInfo, out m_error)) { MessageDialog.ShowErrorMessage(m_error); return; } } // 用来显示的库存信息 List <View_S_Stock> showStockInfo = null; showStockInfo = m_stockInfo.ToList(); RefreshDataGridView(showStockInfo); }
/// <summary> /// 窗体载入 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FormGoods_Load(object sender, EventArgs e) { if (!m_storeServer.GetAllStore(null, true, out m_findStore, out m_err)) { MessageDialog.ShowErrorMessage(m_err); return; } RefreshDataGridView(m_findStore); for (int i = 0; i < dataGridView1.Columns.Count; i++) { dataGridView1.Columns[i].Visible = false; } dataGridView1.Columns[1].Visible = true; dataGridView1.Columns[2].Visible = true; dataGridView1.Columns[3].Visible = true; dataGridView1.Columns[3].AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; ColumnWidthControl.SetDataGridView(this.Text, dataGridView1); // 添加数据定位控件 if (m_dataLocalizer == null) { m_dataLocalizer = new UserControlDataLocalizer( dataGridView1, this.Name, UniversalFunction.SelectHideFields( this.Name, dataGridView1.Name, BasicInfo.LoginID)); panelTop.Controls.Add(m_dataLocalizer); m_dataLocalizer.Dock = DockStyle.Bottom; m_dataLocalizer.Visible = true; } }
/// <summary> /// 窗体载入 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FormStore_Load(object sender, EventArgs e) { InitTreeView(); m_selectDepotCode = null; if (m_conditionGoodsCode != null) { DataTable table; if (!m_storeServer.GetSomeGoodsCodeStore(m_conditionGoodsCode, m_conditionSpec, out table, out m_err)) { MessageDialog.ShowErrorMessage(m_err); return; } dataGridView1.DataSource = table; dataGridView1.Refresh(); treeView.Enabled = false; } else { if (!m_storeServer.GetAllStore(m_selectDepotCode, m_sequence, out m_findStore, out m_err)) { MessageDialog.ShowErrorMessage(m_err); return; } RefreshDataGridView(m_findStore); treeView.Enabled = true; } for (int i = 0; i < dataGridView1.Columns.Count; i++) { //dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable; } dataGridView1.Columns[0].Visible = false; }
private void treeView_AfterSelect(object sender, TreeViewEventArgs e) { if (e.Node == null) { MessageDialog.ShowPromptMessage("您当前所选仓库为空!"); } m_selectDepotCode = e.Node.Name; if (e.Node.Name == "仓库") { m_selectDepotCode = treeView.Nodes[0].Nodes[0].Name; } if (m_storeServer.GetAllStore(m_selectDepotCode, m_sequence, out m_findStore, out m_err)) { RefreshDataGridView(m_findStore); } RefreshDataGridView(m_findStore); RefreshShelf(); }
/// <summary> /// 窗体载入 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> public void FormFindGoods_Load(object sender, EventArgs e) { if (m_StoreServer.GetAllStore(null, false, out m_findAllSock, out m_err)) { dateStore = GlobalObject.GeneralFunction.ConvertToDataTable <View_S_Stock>(m_findAllSock); dataGridView1.DataSource = dateStore; } m_dataLocalizer = new UserControlDataLocalizer(dataGridView1, this.Name, UniversalFunction.SelectHideFields(this.Name, dataGridView1.Name, BasicInfo.LoginID)); panel3.Controls.Add(m_dataLocalizer); m_dataLocalizer.Dock = DockStyle.Bottom; m_findDepotType = m_DepotTypeForPersonnel.GetDepotTypeBill(); GlobalObject.GeneralFunction.LoadTreeViewDt(treeView1, m_DepotTypeForPersonnel.ChangeDataTable(GlobalObject.GeneralFunction.ConvertToDataTable <S_Depot>(m_findDepotType)), "DepotName", "DepotCode", "RootSign", "RootSign = 'Root'"); }
/// <summary> /// 获取库存中的物品信息对话框 /// </summary> /// <param name="billType">单据类型</param> /// <param name="showZeroStoreGoods">是否显示零库存物品</param> /// <returns>成功则返回获取到的对话框,失败返回null</returns> static public FormQueryInfo GetStoreGoodsInfoDialog(CE_BillTypeEnum billType, bool showZeroStoreGoods, string strStorageID) { IStoreServer server = ServerModuleFactory.GetServerModule <IStoreServer>(); IQueryable <View_S_Stock> queryResult; System.Data.DataTable dataTable = null; if (!server.GetAllStore(null, true, out queryResult, out m_err)) { MessageDialog.ShowErrorMessage(m_err); return(null); } // 仅显示状态为正常且不在隔离库中的物品 if (billType == CE_BillTypeEnum.领料单) { List <string> listTempStockStatus = new List <string>(); listTempStockStatus.Add("正常"); foreach (int statusID in _lstStockStatus) { switch (statusID) { case 1: listTempStockStatus.Add("仅限于返修箱用"); break; case 2: listTempStockStatus.Add("样品"); break; case 3: listTempStockStatus.Add("仅限于返修箱用"); listTempStockStatus.Add("仅限于售后备件"); break; case 4: listTempStockStatus.Add("隔离"); break; default: break; } } queryResult = from r in queryResult where listTempStockStatus.Contains(r.物品状态) && r.库房代码 == strStorageID select r; } else if (billType == CE_BillTypeEnum.领料退库单) { queryResult = from r in queryResult where r.物品状态 != "隔离" select r; } ////TCU 采购部领用委外装配 Modify by cjb on 2014.5.28 //if (!GlobalObject.GeneralFunction.IsNullOrEmpty(prefixDepotType) && strStorageID != "03") //{ // int len = prefixDepotType.Length; // queryResult = from r in queryResult where r.材料类别编码.Substring(0, len) == prefixDepotType select r; //} if (!showZeroStoreGoods) { queryResult = from r in queryResult where r.库存数量 > 0 select r; } FormQueryInfo form = null; if (!BasicInfo.ListRoles.Exists(r => r.Contains("库管理员"))) { if (billType == CE_BillTypeEnum.领料单 && !_lstStockStatus.Contains(2) && !_lstStockStatus.Contains(4)) { var result = (from r in queryResult select r).ToList().Distinct(new StockGoodsComparer()); dataTable = GlobalObject.GeneralFunction.ConvertToDataTable <View_S_Stock>(result); } else { dataTable = GlobalObject.GeneralFunction.ConvertToDataTable <View_S_Stock>(queryResult); } } else { dataTable = GlobalObject.GeneralFunction.ConvertToDataTable <View_S_Stock>(queryResult); } form = new FormQueryInfo(dataTable); if (!showZeroStoreGoods) { form.Text = form.Text + ",库存数量为0的物品不会显示在列表中。"; } if (!BasicInfo.ListRoles.Exists(r => r.Contains("库管理员"))) { if (billType == CE_BillTypeEnum.报废单 || billType == CE_BillTypeEnum.领料退库单) { form.HideColumns = new string[] { "序号", "物品ID", "单位", "单位ID", "库存数量", "仓库", "货架", "层", "列", "实际单价", "实际金额" } } ; else if (billType == CE_BillTypeEnum.领料单) { form.HideColumns = new string[] { "序号", "物品ID", "单位", "实际单价", "实际金额" } } ; } else { form.HideColumns = new string[] { "序号", "物品ID", "单位ID", "单位", "实际单价", "实际金额" }; } return(form); }