public ActionResult BadReportList() { int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0); int pageIndex = WebUtil.GetFormValue<int>("pageIndex", 0); int pageSize = WebUtil.GetFormValue<int>("pageSize", 0); string storageNum = this.DefaultStore; BadProvider provider = new BadProvider(); BadReportEntity entity = new BadReportEntity(); PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize }; if (queryTime > 0) { entity.Where("CreateTime", ECondition.Between, DateTime.Now.AddDays(-queryTime), DateTime.Now); } if (storageNum.IsNotNull()) { entity.Where("StorageNum", ECondition.Eth, storageNum); } entity.And(a => a.StorageNum == this.DefaultStore); List<BadReportEntity> listResult = provider.GetList(entity, ref pageInfo, storageNum); listResult = listResult == null ? new List<BadReportEntity>() : listResult; string json = ConvertJson.ListToJson<BadReportEntity>(listResult, "List"); this.ReturnJson.AddProperty("Data", new JsonObject(json)); this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount); return Content(this.ReturnJson.ToString()); }
public ActionResult BadTOP10Num() { int queryTime = WebUtil.GetFormValue<int>("QueryTime", 0); int pageIndex = 1; int pageSize = 10; string storageNum = this.DefaultStore; BadProvider provider = new BadProvider(); PageInfo pageInfo = new PageInfo() { PageIndex = pageIndex, PageSize = pageSize }; List<Proc_BadTOP10NumEntity> listResult = provider.GetListTOP10(queryTime, storageNum); listResult = listResult.IsNull() ? new List<Proc_BadTOP10NumEntity>() : listResult; StringBuilder sb = new StringBuilder(); sb.Append("<pie>"); listResult.ForEach(a => { if (a.TotalNum > 0) { sb.AppendFormat("<slice title=\"{0}\">{1}</slice>", a.ProductName, a.TotalNum.ToString()); } }); sb.Append("</pie>"); this.ReturnJson.AddProperty("InStorageData", sb.ToString()); string json = ConvertJson.ListToJson<Proc_BadTOP10NumEntity>(listResult, "List"); this.ReturnJson.AddProperty("Data", new JsonObject(json)); this.ReturnJson.AddProperty("RowCount", pageInfo.RowCount); return Content(this.ReturnJson.ToString()); }
public ActionResult GetLocalDetail() { string barCode = WebUtil.GetFormValue<string>("SnNum", string.Empty); BadProvider provider = new BadProvider(); List<LocalProductEntity> list = provider.GetList(barCode); if (!list.IsNullOrEmpty()) { Parallel.ForEach(list, item => { item.Num = ConvertHelper.ToType<double>(item.Num.ToString(), 0); }); } this.ReturnJson.AddProperty("List", ConvertJson.ListToJson<LocalProductEntity>(list, "Data")); return Content(this.ReturnJson.ToString()); }