/// <summary> /// 在线库存报表 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public List <LocalProductEntity> GetList(LocalProductEntity entity, ref PageInfo pageInfo) { entity.IncludeAll(); ProductEntity ProEntity = new ProductEntity(); // ProEntity.Include(a => new { Size = a.Size, AvgPrice = a.AvgPrice, CateNum = a.CateNum, CateName = a.CateName, MinNum = a.MinNum, MaxNum = a.MaxNum }); ProEntity.Include(a => new { AvgPrice = a.AvgPrice, CateNum = a.CateNum, CateName = a.CateName, MinNum = a.MinNum, MaxNum = a.MaxNum }); entity.Left <ProductEntity>(ProEntity, new Params <string, string>() { Item1 = "ProductNum", Item2 = "SnNum" }); entity.OrderBy(a => a.ID, EOrderBy.DESC); int rowCount = 0; List <LocalProductEntity> listResult = this.LocalProduct.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); pageInfo.RowCount = rowCount; List <ProductCategoryEntity> listCates = new ProductCategoryProvider().GetList(); listCates = listCates.IsNull() ? new List <ProductCategoryEntity>() : listCates; if (!listResult.IsNullOrEmpty()) { foreach (LocalProductEntity item in listResult) { if (item.CateName.IsEmpty()) { ProductCategoryEntity cate = listCates.FirstOrDefault(a => a.CateNum == item.CateNum); item.CateName = cate == null ? "" : cate.CateName; } } } return(listResult); }
public ActionResult Add() { string cateNum = WebUtil.GetQueryStringValue<string>("cateNum", string.Empty); ProductCategoryEntity entity = null; if (!cateNum.IsEmpty()) { ProductCategoryProvider provider = new ProductCategoryProvider(); entity = provider.GetSingle(cateNum); } entity = entity.IsNull() ? new ProductCategoryEntity() : entity; ViewBag.Category = entity; return View(); }
/// <summary> /// 查询类别信息 /// </summary> /// <param name="cateNum"></param> /// <returns></returns> public ProductCategory_CE GetSingle(string cateNum) { if (cateNum.IsEmpty()) { return null; } ProductCategoryProvider provider = new ProductCategoryProvider(); ProductCategoryEntity entity = provider.GetSingle(cateNum); if (entity.IsNotNull()) { ProductCategory_CE ce = ProductCategory_To.ToCE(entity); return ce; } return null; }
/// <summary> /// 查询所有的货品种类 /// </summary> /// <returns></returns> public List<ProductCategory_CE> GetList() { ProductCategoryProvider provider = new ProductCategoryProvider(); List<ProductCategoryEntity> listResult=provider.GetList(); if (!listResult.IsNullOrEmpty()) { List<ProductCategory_CE> list = new List<ProductCategory_CE>(); foreach (ProductCategoryEntity item in listResult) { ProductCategory_CE ce = ProductCategory_To.ToCE(item); list.Add(ce); } return list; } return null; }
/// <summary> /// 查询产品列表 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public List <ProductEntity> GetList(ProductEntity entity, ref PageInfo pageInfo) { entity.IncludeAll(); entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete); entity.OrderBy(a => a.ID, EOrderBy.DESC); int rowCount = 0; List <ProductEntity> list = this.Product.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); if (!list.IsNullOrEmpty()) { List <ProductCategoryEntity> listCate = new ProductCategoryProvider().GetList(); listCate = listCate.IsNull() ? new List <ProductCategoryEntity>() : listCate; foreach (ProductEntity item in list) { if (listCate.Exists(a => a.CateNum == item.CateNum)) { item.CateName = listCate.First(a => a.CateNum == item.CateNum).CateName; } } } pageInfo.RowCount = rowCount; return(list); }
/// <summary> /// 存储过程查询在线产品库存 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <param name="ProductName"></param> /// <param name="begin"></param> /// <param name="end"></param> /// <returns></returns> public List<ProductEntity> GetList(ProductEntity entity, ref PageInfo pageInfo, string searchKey, string begin, string end) { entity.IncludeAll(); entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete); entity.OrderBy(a => a.ID, EOrderBy.DESC); int rowCount = 0; List<ProductEntity> list = this.Product.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); List<ProductEntity> listResult = new List<ProductEntity>(); pageInfo.RowCount = rowCount; DateTime beginTime = ConvertHelper.ToType<DateTime>(begin, DateTime.Now.AddDays(-1)); DateTime endTime = ConvertHelper.ToType<DateTime>(end, DateTime.Now); Proc_ProductReportEntity prEntity = new Proc_ProductReportEntity(); prEntity.SearchKey = searchKey; prEntity.BeginTime = beginTime; prEntity.EndTime = endTime; if (!begin.IsEmpty() && !end.IsEmpty()) { prEntity.IsTime = 1;//加上时间条件 } else { prEntity.IsTime = 0; } if (!list.IsNullOrEmpty()) { List<ProductCategoryEntity> listCates = new ProductCategoryProvider().GetList(); listCates = listCates.IsNull() ? new List<ProductCategoryEntity>() : listCates; foreach (ProductEntity item in list) { if (item.CateName.IsEmpty()) { ProductCategoryEntity cate= listCates.FirstOrDefault(a => a.CateNum == item.CateNum); item.CateName = cate == null ? "" : cate.CateName; } prEntity.ProductNum = item.SnNum; prEntity.IsDelete = (int)EIsDelete.NotDelete; prEntity.Status = (int)EAudite.Pass; int line = this.Proc_ProductReport.ExecuteNonQuery(prEntity); item.LocalProductNum = prEntity.LocalProductNum; item.InStorageNum = prEntity.InStorageNum; item.OutStorageNum = prEntity.OutStorageNum; item.BadReportNum = prEntity.BadReportNum; item.TotalLocalProductNum = prEntity.TotalLocalProductNum; item.TotalInStorageNum = prEntity.TotalInStorageNum; item.TotalOutStorageNum = prEntity.TotalOutStorageNum; item.TotalBadReportNum = prEntity.TotalBadReportNum; if (item.InStorageNum > 0 && item.TotalInStorageNum > 0) { item.InStorageNumPCT = (item.InStorageNum * 100.00f) / item.TotalInStorageNum; } if (item.OutStorageNum > 0 && item.TotalOutStorageNum > 0) { item.OutStorageNumPCT = (item.OutStorageNum * 100.00f) / item.TotalOutStorageNum; } listResult.Add(item); } } return listResult; }
/// <summary> /// 查询产品列表 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public List<ProductEntity> GetList(ProductEntity entity, ref PageInfo pageInfo) { entity.IncludeAll(); entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete); entity.OrderBy(a => a.ID, EOrderBy.DESC); int rowCount = 0; List<ProductEntity> list = this.Product.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); if (!list.IsNullOrEmpty()) { List<ProductCategoryEntity> listCate = new ProductCategoryProvider().GetList(); listCate = listCate.IsNull() ? new List<ProductCategoryEntity>() : listCate; foreach (ProductEntity item in list) { if (listCate.Exists(a => a.CateNum == item.CateNum)) { item.CateName = listCate.First(a => a.CateNum == item.CateNum).CateName; } } } pageInfo.RowCount = rowCount; return list; }
/// <summary> /// 在线库存报表 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <returns></returns> public List<LocalProductEntity> GetList(LocalProductEntity entity, ref PageInfo pageInfo) { entity.IncludeAll(); ProductEntity ProEntity = new ProductEntity(); ProEntity.Include(a => new { Size = a.Size, AvgPrice = a.AvgPrice,CateNum=a.CateNum, CateName = a.CateName, MinNum = a.MinNum, MaxNum = a.MaxNum }); entity.Left<ProductEntity>(ProEntity, new Params<string, string>() { Item1 = "ProductNum", Item2 = "SnNum" }); entity.OrderBy(a => a.ID, EOrderBy.DESC); int rowCount = 0; List<LocalProductEntity> listResult = this.LocalProduct.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); pageInfo.RowCount = rowCount; List<ProductCategoryEntity> listCates = new ProductCategoryProvider().GetList(); listCates = listCates.IsNull() ? new List<ProductCategoryEntity>() : listCates; if (!listResult.IsNullOrEmpty()) { foreach (LocalProductEntity item in listResult) { if (item.CateName.IsEmpty()) { ProductCategoryEntity cate = listCates.FirstOrDefault(a => a.CateNum == item.CateNum); item.CateName = cate == null ? "" : cate.CateName; } } } return listResult; }
private static void GetProCatInfo(System.Data.DataSet dataset, List<ProductEntity> list) { var rows = dataset.Tables[0].Rows; if (rows.Count > 2) { ProductCategoryProvider ProductCategory = new ProductCategoryProvider(); for (var i = 2; i < rows.Count; i++) { ProductEntity entity = new ProductEntity(); ProductCategoryEntity PCEntity = new ProductCategoryEntity(); var row = rows[i]; entity.SnNum = row[1].ToString(); if (string.IsNullOrEmpty(entity.SnNum)) continue; entity.BarCode = row[2].ToString(); entity.ProductName = row[3].ToString(); entity.CateName = row[4].ToString(); PCEntity = ProductCategory.GetSingleCateName(entity.CateName); if (PCEntity.IsNotNull()) { entity.CateNum = PCEntity.CateNum; } else { entity.CateNum = ""; } entity.Num = ConvertHelper.ToType<int>(row[5].ToString()); entity.MinNum = ConvertHelper.ToType<int>(row[6].ToString()); entity.MaxNum = ConvertHelper.ToType<int>(row[7].ToString()); entity.UnitName = row[8].ToString(); entity.UnitNum = entity.UnitNum; entity.AvgPrice = ConvertHelper.ToType<double>(row[9].ToString()); entity.InPrice = ConvertHelper.ToType<double>(row[10].ToString()); entity.OutPrice = ConvertHelper.ToType<double>(row[11].ToString()); entity.NetWeight = ConvertHelper.ToType<double>(row[12].ToString()); entity.GrossWeight = ConvertHelper.ToType<double>(row[13].ToString()); entity.Remark = row[14].ToString(); entity.IsDelete = (int)EIsDelete.NotDelete; entity.CreateTime = DateTime.Now; list.Add(entity); } } }
public ActionResult Edit() { string cateNum = WebUtil.GetFormValue<string>("num", string.Empty); string cateName = WebUtil.GetFormValue<string>("name", string.Empty); string remark = WebUtil.GetFormValue<string>("remark", string.Empty); if (cateNum.IsEmpty()) { ProductCategoryEntity entity = new ProductCategoryEntity(); entity.CateNum = SequenceProvider.GetSequence(typeof(ProductCategoryEntity)); entity.CateName = cateName; entity.IsDelete = (int)EIsDelete.NotDelete; entity.CreateTime = DateTime.Now; entity.Remark = remark; entity.CreateUser = this.LoginUserCode; ProductCategoryProvider provider = new ProductCategoryProvider(); int line = provider.Add(entity); if (line > 0) { this.ReturnJson.AddProperty("d", "success"); } } else { ProductCategoryEntity entity = new ProductCategoryEntity(); entity.CateNum = cateNum; entity.CateName = cateName; entity.Remark = remark; ProductCategoryProvider provider = new ProductCategoryProvider(); int line = provider.Update(entity); if (line > 0) { this.ReturnJson.AddProperty("d", "success"); } } return Content(this.ReturnJson.ToString()); }
public ActionResult DelCate(string cateNum) { if (!cateNum.IsEmpty()) { ProductCategoryProvider provider = new ProductCategoryProvider(); int line = provider.Delete(cateNum); if (line > 0) { this.ReturnJson.AddProperty("d", "success"); } } return Content(this.ReturnJson.ToString()); }
public ActionResult DelBat([ModelBinder(typeof(JsonBinder<List<string>>))] List<string> List) { if (!List.IsNullOrEmpty()) { ProductCategoryProvider provider = new ProductCategoryProvider(); int line = provider.DelBat(List); if (line > 0) { this.ReturnJson.AddProperty("d", "success"); } } return Content(this.ReturnJson.ToString()); }
public ActionResult CateList() { string cateName = WebUtil.GetFormValue<string>("cateName", string.Empty); int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 0); int pageSize = WebUtil.GetFormValue<int>("pageSize", 0); ProductCategoryProvider provider = new ProductCategoryProvider(); ProductCategoryEntity entity = new ProductCategoryEntity(); if (!cateName.IsEmpty()) { entity.Begin<ProductCategoryEntity>() .Where<ProductCategoryEntity>("CateNum", ECondition.Like, "%" + cateName + "%") .Or<ProductCategoryEntity>("CateName", ECondition.Like, "%" + cateName + "%") .End<ProductCategoryEntity>() ; } PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize }; List<ProductCategoryEntity> list = provider.GetList(entity, ref pageInfo); list = list.IsNull() ? new List<ProductCategoryEntity>() : list; string json = ConvertJson.ListToJson<ProductCategoryEntity>(list, "data"); JsonObject jsonObject = new JsonObject(json); this.ReturnJson.AddProperty("list", jsonObject); this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount); return Content(this.ReturnJson.ToString()); }
/// <summary> /// 获得产品的类别 /// </summary> /// <param name="cateNum"></param> /// <returns></returns> public static string GetProductCategory(string cateNum) { ProductCategoryProvider provider = new ProductCategoryProvider(); List<ProductCategoryEntity> list = provider.GetList(); StringBuilder sb = new StringBuilder(); string departTemplate = "<option value='{0}' {1}>{2}</option>"; sb.AppendFormat(departTemplate, "", "", "请选择类别"); if (!list.IsNullOrEmpty()) { foreach (ProductCategoryEntity depart in list) { sb.AppendFormat(departTemplate, depart.CateNum, depart.CateNum == cateNum ? "selected='selected'" : string.Empty, depart.CateName); } } return sb.ToString(); }
/// <summary> /// 存储过程查询在线产品库存 /// </summary> /// <param name="entity"></param> /// <param name="pageInfo"></param> /// <param name="ProductName"></param> /// <param name="begin"></param> /// <param name="end"></param> /// <returns></returns> public List <ProductEntity> GetList(ProductEntity entity, ref PageInfo pageInfo, string searchKey, string begin, string end) { entity.IncludeAll(); entity.Where(a => a.IsDelete == (int)EIsDelete.NotDelete); entity.OrderBy(a => a.ID, EOrderBy.DESC); int rowCount = 0; List <ProductEntity> list = this.Product.GetList(entity, pageInfo.PageSize, pageInfo.PageIndex, out rowCount); List <ProductEntity> listResult = new List <ProductEntity>(); pageInfo.RowCount = rowCount; DateTime beginTime = ConvertHelper.ToType <DateTime>(begin, DateTime.Now.AddDays(-1)); DateTime endTime = ConvertHelper.ToType <DateTime>(end, DateTime.Now); Proc_ProductReportEntity prEntity = new Proc_ProductReportEntity(); prEntity.SearchKey = searchKey; prEntity.BeginTime = beginTime; prEntity.EndTime = endTime; if (!begin.IsEmpty() && !end.IsEmpty()) { prEntity.IsTime = 1;//加上时间条件 } else { prEntity.IsTime = 0; } if (!list.IsNullOrEmpty()) { List <ProductCategoryEntity> listCates = new ProductCategoryProvider().GetList(); listCates = listCates.IsNull() ? new List <ProductCategoryEntity>() : listCates; foreach (ProductEntity item in list) { if (item.CateName.IsEmpty()) { ProductCategoryEntity cate = listCates.FirstOrDefault(a => a.CateNum == item.CateNum); item.CateName = cate == null ? "" : cate.CateName; } prEntity.ProductNum = item.SnNum; prEntity.IsDelete = (int)EIsDelete.NotDelete; prEntity.Status = (int)EAudite.Pass; int line = this.Proc_ProductReport.ExecuteNonQuery(prEntity); item.LocalProductNum = prEntity.LocalProductNum; item.InStorageNum = prEntity.InStorageNum; item.OutStorageNum = prEntity.OutStorageNum; item.BadReportNum = prEntity.BadReportNum; item.TotalLocalProductNum = prEntity.TotalLocalProductNum; item.TotalInStorageNum = prEntity.TotalInStorageNum; item.TotalOutStorageNum = prEntity.TotalOutStorageNum; item.TotalBadReportNum = prEntity.TotalBadReportNum; if (item.InStorageNum > 0 && item.TotalInStorageNum > 0) { item.InStorageNumPCT = (item.InStorageNum * 100.00f) / item.TotalInStorageNum; } if (item.OutStorageNum > 0 && item.TotalOutStorageNum > 0) { item.OutStorageNumPCT = (item.OutStorageNum * 100.00f) / item.TotalOutStorageNum; } listResult.Add(item); } } return(listResult); }