/// <summary> /// 获取指定 供应商/客户 、 仓库 、商品的相关单据明细列表 /// </summary> /// <param name="shType"></param> /// <param name="typeId"></param> /// <param name="id"></param> /// <returns></returns> public List <SheetGoodsInfoModel> GetSheetGoodsInfoList(int shType, int typeId, int id) { DataTable dt = GetSheetGoodsInfoDt(shType, typeId, id); string cols = "Id,SheetId,SheetNo,ShType,IsChecked,CreateTime,UnitId,UnitName,Count,Price,Amount,DealPerson,Creator,CheckPerson,CheckTime,StoreId,StoreName,GoodsId,GoodsNo,GoodsName,GUnit"; return(DbConvert.DataTableToList <SheetGoodsInfoModel>(dt, cols)); }
/// <summary> /// 将DataSet 转换为PageModel<S> 针对分页查询得到的DataSet /// </summary> /// <typeparam name="S"></typeparam> /// <param name="ds"></param> /// <param name="cols"></param> /// <returns></returns> public PageModel <S> DsToPageModel <S>(DataSet ds, string cols) { int total = (int)ds.Tables[0].Rows[0][0]; List <S> list = DbConvert.DataTableToList <S>(ds.Tables[1], cols); return(new PageModel <S>() { TotalCount = total, ReList = list }); }
/// <summary> /// 获取指定商品的库存分布 /// </summary> /// <param name="goodsId"></param> /// <param name="storeId"></param> /// <param name="storeName"></param> /// <returns></returns> public List <GoodsStoreStockModel> GetGoodsStoreStock(int goodsId, int storeId, string storeName) { DataTable dt = sgsDAL.GetGoodsStoreStockData(goodsId, storeId, storeName); List <GoodsStoreStockModel> list = new List <GoodsStoreStockModel>(); if (dt.Rows.Count > 0) { list = DbConvert.DataTableToList <GoodsStoreStockModel>(dt, ""); } return(list); }
/// <summary> /// 获取商品库存统计数据 /// </summary> /// <param name="qModel"></param> /// <returns></returns> public List <StoreStockQueryModel> GetStoreStockData(StockQueryParaModel qModel) { DataTable dt = sgsDAL.GetStoreStockData(qModel); List <StoreStockQueryModel> list = new List <StoreStockQueryModel>(); if (dt.Rows.Count > 0) { list = DbConvert.DataTableToList <StoreStockQueryModel>(dt, ""); } return(list); }
/// <summary> /// 获取指定商品的变动记录List /// </summary> /// <param name="goodsId"></param> /// <param name="storeId"></param> /// <param name="storeName"></param> /// <returns></returns> public List <StockChangeInfoModel> GetGoodsStockChangeList(int goodsId, int storeId, string storeName) { List <StockChangeInfoModel> list = new List <StockChangeInfoModel>(); string cols = "Id,SheetId,SheetNo,ShType,IsChecked,CreateTime,Price,Amount,DealPerson,Creator,CheckPerson,CheckTime,StoreId,StoreName,GoodsId,GoodsNo,GoodsName,GUnit,InCount,OutCount,CurCount,StPrice,StAmount"; DataTable dt = GetGoodsStockChangeDt(goodsId, storeId, storeName); if (dt.Rows.Count > 0) { list = DbConvert.DataTableToList <StockChangeInfoModel>(dt, cols); } return(list); }
/// <summary> /// 分页查询 /// </summary> /// <typeparam name="T1"></typeparam> /// <param name="sql"></param> /// <param name="strCols"></param> /// <param name="startIndex"></param> /// <param name="pageSize"></param> /// <returns></returns> public PageModel <T> GetPageList <T>(string sql, string strCols, int startIndex, int pageSize) { SqlParameter[] paras = { new SqlParameter("@sql", sql), new SqlParameter("@startIndex", startIndex), new SqlParameter("@endIndex", startIndex + pageSize - 1) }; DataSet ds = GetDs("proc_Page", 2, paras); int total = (int)ds.Tables[0].Rows[0][0]; List <T> list = DbConvert.DataTableToList <T>(ds.Tables[1], strCols); return(new PageModel <T>() { TotalCount = total, ReList = list }); }