public static List <GoodsStockExtend> GetGoodsStockInfo(StockQueryAgrs stockQueryEntity) { return(utity.ExecuteListSp <GoodsStockExtend>("usp_GetGoodsStockInfo", new object[] { stockQueryEntity.StoreID?.ToString(), stockQueryEntity.Category, stockQueryEntity.ProductName })); }
private void btnQueryStock_Click(object sender, EventArgs e) { StockQueryAgrs queryAgrs = new StockQueryAgrs(); queryAgrs.Barcode = txtProductCode.Text; queryAgrs.ProductName = txtProductName.Text; queryAgrs.StoreID = UserInfo.Instance.StoreID; gridStock.DataSource = biz.StockQuery(queryAgrs); }
private void txtProductCode_EditValueChanged(object sender, EventArgs e) { StockQueryAgrs queryAgrs = new StockQueryAgrs(); queryAgrs.Barcode = txtProductCode.Text; queryAgrs.ProductName = txtProductName.Text; queryAgrs.StoreID = UserInfo.Instance.StoreID; queryAgrs.Category = lookUpCategories.EditValue.ToString() == "0" ? "" : lookUpCategories.EditValue.ToString(); gridStock.DataSource = biz.StockQuery(queryAgrs); }
public FileResult ExportExcel() { Model.StockQueryAgrs entity = new StockQueryAgrs(); entity.StoreID = (Request["StoreID"] == null) ? null : Request["StoreID"].ToString().ToNullableInt32(); entity.Category = Request["Catetory"]; entity.ProductName = Request["ProductName"]; List <string> exportFields = new List <string> { "StoreName", "BarID", "Name", "Category", "RetailPrice", "SaleQuantity", "StockQuantity", "AlarmAmount" }; System.IO.MemoryStream memory = ExcelExport.ExportMemory(QueryGoods(entity), exportFields); return(File(memory, "application/vnd.ms-excel", $"库存列表{DateTime.Now.ToString("yyyyMMddHH")}.xls")); }
/// <summary> /// 库存查询 /// </summary> /// <param name="queryAgrs">查询参数</param> /// <returns></returns> public DataTable StockQuery(StockQueryAgrs queryAgrs) { string select_content = "SELECT * FROM Goods "; string select_where = " WHERE "; IList <DbParameter> parms = new List <DbParameter>(); if (queryAgrs != null) { if (queryAgrs.StoreID.HasValue) { select_where += " StoreID=@StoreID AND "; parms.Add(new SqlParameter("@StoreID", queryAgrs.StoreID.Value)); } if (!string.IsNullOrEmpty(queryAgrs.Barcode)) { select_where += " BarID LIKE '%'+ @BarID +'%' AND "; parms.Add(new SqlParameter("@BarID", queryAgrs.Barcode)); } if (!string.IsNullOrEmpty(queryAgrs.ProductName)) { select_where += " Name LIKE '%'+ @Name +'%' AND "; parms.Add(new SqlParameter("@Name", queryAgrs.ProductName)); } if (!string.IsNullOrEmpty(queryAgrs.ProductNameAbbr)) { select_where += " NameAbbr LIKE '%'+ @NameAbbr +'%' AND "; parms.Add(new SqlParameter("@NameAbbr", queryAgrs.ProductNameAbbr)); } } DataSet result; try { if (parms.Count > 0) { select_where = select_where.Remove(select_where.LastIndexOf("AND")); select_content += select_where; result = db.ExecuteDataSet(CommandType.Text, select_content, parms.ToArray()); } else { result = db.ExecuteDataSet(CommandType.Text, select_content); } if (result != null) { return(result.Tables[0]); } else { return(null); } } catch (Exception exc) { throw exc; } }
/// <summary> /// 获取库存商品信息 /// </summary> /// <param name="stockQueryEntity"></param> /// <returns></returns> public List <GoodsStockExtend> GetGoodsStockInfo(StockQueryAgrs stockQueryEntity) { return(DataAccess.GoodsDAL.GetGoodsStockInfo(stockQueryEntity)); }