public Tuple <int, List <SysLog> > PageBootstrap(PubPage pg, Bootstrap.BootstrapParams bbp) { var queryable = BaseContext.Set <SysLog>().AsQueryable(); if (!string.IsNullOrEmpty(pg.keyword)) { queryable = queryable.Where(c => c.LogMessage == pg.keyword); } if (!string.IsNullOrEmpty(pg.startDate.ToString())) { queryable = queryable.Where(c => c.CreateTime >= pg.startDate); } if (!string.IsNullOrEmpty(pg.endDate.ToString())) { var dt = DateTimeHelper.EndDateTime(pg.endDate); queryable = queryable.Where(c => c.CreateTime <= dt); } var count = queryable.Count(); if (string.Equals(bbp.order, "ASC", StringComparison.CurrentCultureIgnoreCase)) { var list = queryable.OrderByz(bbp.sort).Skip(bbp.offset).Take(bbp.limit).ToList(); return(new Tuple <int, List <SysLog> >(count, list)); } else { var list = queryable.OrderByDescendingz(bbp.sort).Skip(bbp.offset).Take(bbp.limit).ToList(); return(new Tuple <int, List <SysLog> >(count, list)); } }
public async Task <string> Search(string text) { //var bootstrap = new Bootstrap.BootstrapParams //{ // limit = 100, // offset = 0, // sort = "CreateDate", // search = text, // order = "desc" //}; //var json = _storagerackServices.PageList(bootstrap); //return Content(json); var bootstrap = new Bootstrap.BootstrapParams { limit = 100, offset = 1, sort = "CreateDate", search = text, order = "desc" }; IWMSBaseApiAccessor wmsAccessor = WMSApiManager.GetBaseApiAccessor(bootstrap.storeId.ToString(), _client); RouteData <Wms_storagerack[]> result = await wmsAccessor.GetStorageRackList( null, null, bootstrap.offset, bootstrap.limit, bootstrap.search, new string[] { bootstrap.sort + " " + bootstrap.order }, bootstrap.datemin, bootstrap.datemax); if (!result.IsSccuess) { return(new PageGridData().JilToJson()); } return(result.ToGridJson()); }
public string PageList(Bootstrap.BootstrapParams bootstrap) { int totalNumber = 0; if (bootstrap.offset != 0) { bootstrap.offset = bootstrap.offset / bootstrap.limit + 1; } var query = _client.Queryable <Wms_storagerack, Wms_reservoirarea, Wms_warehouse, Sys_user, Sys_user> ((s, r, w, c, u) => new object[] { JoinType.Left, s.ReservoirAreaId == r.ReservoirAreaId, JoinType.Left, r.WarehouseId == w.WarehouseId, JoinType.Left, s.CreateBy == c.UserId, JoinType.Left, s.ModifiedBy == u.UserId, }) .Where((s, r, w, c, u) => s.WarehouseId == bootstrap.storeId && s.IsDel == 1 && r.IsDel == 1 && w.IsDel == 1) .Select((s, r, w, c, u) => new { StorageRackId = s.StorageRackId.ToString(), s.StorageRackNo, s.StorageRackName, r.ReservoirAreaNo, r.ReservoirAreaName, s.Row, s.Column, s.Floor, w.WarehouseNo, w.WarehouseName, s.IsDel, s.Remark, CName = c.UserNickname, s.CreateDate, UName = u.UserNickname, s.ModifiedDate }).MergeTable(); if (!bootstrap.search.IsEmpty()) { query.Where((s) => s.WarehouseName.Contains(bootstrap.search) || s.WarehouseNo.Contains(bootstrap.search)); } if (!bootstrap.datemin.IsEmpty() && !bootstrap.datemax.IsEmpty()) { query.Where(s => s.CreateDate > bootstrap.datemin.ToDateTimeB() && s.CreateDate <= bootstrap.datemax.ToDateTimeE()); } if (bootstrap.order.Equals("desc", StringComparison.OrdinalIgnoreCase)) { query.OrderBy($"MergeTable.{bootstrap.sort} desc"); } else { query.OrderBy($"MergeTable.{bootstrap.sort} asc"); } var list = query.ToPageList(bootstrap.offset, bootstrap.limit, ref totalNumber); return(Bootstrap.GridData(list, totalNumber).JilToJson()); }
public string EChart(Bootstrap.BootstrapParams bootstrap) { //sql й╣ож╥╫й╫ // string sql = ""; // if (_configuration["SqlSugar:DbType"] == "SqlServer") // { // sql = $@"SELECT CONVERT // ( VARCHAR ( 10 ), CreateDate, 121 ) AS CreateDate, // COUNT( * ) AS COUNT //FROM // Sys_log //WHERE // LogType = 'login' // AND CreateDate BETWEEN '{bootstrap.datemin}' // AND '{bootstrap.datemax}' //GROUP BY // CONVERT ( VARCHAR ( 10 ), CreateDate, 121 ) //HAVING // COUNT( * ) >= 0"; // } // else // { // sql = $@"SELECT // DATE_FORMAT( CreateDate, '%Y-%d-%m' ) AS CreateDate, // COUNT( * ) AS COUNT //FROM // Sys_log //WHERE // LogType = 'login' // AND CreateDate BETWEEN '{bootstrap.datemin}' // AND '{bootstrap.datemax}' //GROUP BY // DATE_FORMAT( CreateDate, '%Y-%d-%m' ) //HAVING // COUNT( * ) >= 0"; // } //var list = _client.Ado.SqlQuery<Log>(sql); var list = _client.Queryable ( _client.Queryable <Sys_log>() .Where(s => s.LogType == LogType.login.EnumToString()) .Where(s => s.CreateDate > bootstrap.datemin.ToDateTimeB() && s.CreateDate <= bootstrap.datemax.ToDateTimeE()) .GroupBy(s => SqlFuncL.ToDateFormat(s.CreateDate) ) .Having(s => SqlFunc.AggregateCount(s.LogId) >= 0) .Select(s => new Log() { CreateDate = SqlFuncL.ToDateFormat(s.CreateDate), COUNT = SqlFunc.AggregateCount(s.LogId) }) ) .ToList(); return(list.JilToJson()); }
public IActionResult Export([FromQuery] Bootstrap.BootstrapParams bootstrap) { var buffer = _materialServices.ExportList(bootstrap); if (buffer.IsNull()) { return(File(JsonL((false, PubConst.File8)).ToBytes(), ContentType.ContentTypeJson)); } return(File(buffer, ContentType.ContentTypeFile, DateTimeExt.GetDateTimeS(DateTimeExt.DateTimeFormatString) + "-" + EncoderUtil.UrlHttpUtilityEncoder("物料") + ".xlsx")); }
public string PageList(Bootstrap.BootstrapParams bootstrap) { int totalNumber = 0; if (bootstrap.offset != 0) { bootstrap.offset = bootstrap.offset / bootstrap.limit + 1; } var query = _client.Queryable <Wms_material, Sys_dict, Sys_dict, Wms_warehouse, Sys_user, Sys_user> ((s, t, ut, w, c, u) => new object[] { JoinType.Left, s.MaterialType == t.DictId, JoinType.Left, s.Unit == ut.DictId, JoinType.Left, s.WarehouseId == w.WarehouseId, JoinType.Left, s.CreateBy == c.UserId, JoinType.Left, s.ModifiedBy == u.UserId, }) .Where((s, t, ut, w, c, u) => s.WarehouseId == bootstrap.storeId && s.IsDel == 1 && t.IsDel == 1 && ut.IsDel == 1 && w.IsDel == 1) .Select((s, t, ut, w, c, u) => new { MaterialId = s.MaterialId.ToString(), s.MaterialOnlyId, s.MaterialNo, s.MaterialName, w.WarehouseNo, w.WarehouseName, MaterialType = t.DictName, Unit = ut.DictName, s.IsDel, s.Remark, CName = c.UserNickname, s.CreateDate, UName = u.UserNickname, s.ModifiedDate }).MergeTable(); if (!bootstrap.search.IsEmpty()) { query.Where((s) => s.MaterialNo.Contains(bootstrap.search) || s.MaterialName.Contains(bootstrap.search) || s.MaterialOnlyId.Contains(bootstrap.search)); } if (!bootstrap.datemin.IsEmpty() && !bootstrap.datemax.IsEmpty()) { query.Where(s => s.CreateDate > bootstrap.datemin.ToDateTimeB() && s.CreateDate <= bootstrap.datemax.ToDateTimeE()); } if (bootstrap.order.Equals("desc", StringComparison.OrdinalIgnoreCase)) { query.OrderBy($"MergeTable.{bootstrap.sort} desc"); } else { query.OrderBy($"MergeTable.{bootstrap.sort} asc"); } var list = query.ToPageList(bootstrap.offset, bootstrap.limit, ref totalNumber); return(Bootstrap.GridData(list, totalNumber).JilToJson()); }
public string PageList(Bootstrap.BootstrapParams bootstrap) { int totalNumber = 0; if (bootstrap.offset != 0) { bootstrap.offset = bootstrap.offset / bootstrap.limit + 1; } var query = _client.Queryable <Wms_inventorymove, Wms_storagerack, Wms_storagerack, Sys_user, Sys_user> ((w, s, a, c, u) => new object[] { JoinType.Left, w.SourceStoragerackId == s.StorageRackId, JoinType.Left, w.AimStoragerackId == a.StorageRackId, JoinType.Left, w.CreateBy == c.UserId, JoinType.Left, w.ModifiedBy == u.UserId, }) .Where((w, s, a, c, u) => w.IsDel == 1 && (s.WarehouseId == bootstrap.storeId || a.WarehouseId == bootstrap.storeId)) .Select((w, s, a, c, u) => new { InventorymoveId = w.InventorymoveId.ToString(), w.InventorymoveNo, w.Status, SourceStorageRackNo = s.StorageRackNo, SourceStorageRackName = s.StorageRackName, AimStorageRackNo = a.StorageRackNo, AimStorageRackName = a.StorageRackName, w.IsDel, w.Remark, CName = c.UserNickname, w.CreateDate, UName = u.UserNickname, w.ModifiedDate }).MergeTable(); if (!bootstrap.search.IsEmpty()) { query.Where((s) => s.InventorymoveNo.Contains(bootstrap.search)); } if (!bootstrap.datemin.IsEmpty() && !bootstrap.datemax.IsEmpty()) { query.Where(s => s.CreateDate > bootstrap.datemin.ToDateTimeB() && s.CreateDate <= bootstrap.datemax.ToDateTimeE()); } if (bootstrap.order.Equals("desc", StringComparison.OrdinalIgnoreCase)) { query.OrderBy($"MergeTable.{bootstrap.sort} desc"); } else { query.OrderBy($"MergeTable.{bootstrap.sort} asc"); } var list = query.ToPageList(bootstrap.offset, bootstrap.limit, ref totalNumber); return(Bootstrap.GridData(list, totalNumber).ToJsonL()); //return Bootstrap.GridData(list, totalNumber).JilToJson(); }
public string PageList(Bootstrap.BootstrapParams bootstrap) { int totalNumber = 0; if (bootstrap.offset != 0) { bootstrap.offset = bootstrap.offset / bootstrap.limit + 1; } var query = _client.Queryable <Wms_delivery, Wms_stockout, Wms_Carrier, Sys_user, Sys_user> ((s, p, d, c, u) => new object[] { JoinType.Left, s.StockOutId == p.StockOutId, JoinType.Left, s.CarrierId == d.CarrierId, JoinType.Left, s.CreateBy == c.UserId, JoinType.Left, s.ModifiedBy == u.UserId, }) .Where((s, p, d, c, u) => s.IsDel == 1) .Select((s, p, d, c, u) => new { DeliveryId = s.DeliveryId.ToString(), s.DeliveryDate, s.TrackingNo, p.StockOutNo, d.CarrierNo, d.CarrierName, d.CarrierPerson, d.Tel, s.IsDel, s.Remark, CName = c.UserNickname, s.CreateDate, UName = u.UserNickname, s.ModifiedDate }).MergeTable(); if (!bootstrap.search.IsEmpty()) { query.Where((s) => s.TrackingNo.Contains(bootstrap.search) || s.StockOutNo.Contains(bootstrap.search)); } if (!bootstrap.datemin.IsEmpty() && !bootstrap.datemax.IsEmpty()) { query.Where(s => s.CreateDate > bootstrap.datemin.ToDateTimeB() && s.CreateDate <= bootstrap.datemax.ToDateTimeE()); } if (bootstrap.order.Equals("desc", StringComparison.OrdinalIgnoreCase)) { query.OrderBy($"MergeTable.{bootstrap.sort} desc"); } else { query.OrderBy($"MergeTable.{bootstrap.sort} asc"); } var list = query.ToPageList(bootstrap.offset, bootstrap.limit, ref totalNumber); return(Bootstrap.GridData(list, totalNumber).JilToJson()); }
public byte[] ExportList(Bootstrap.BootstrapParams bootstrap) { bootstrap.sort = "创建时间"; bootstrap.order = "desc"; var query = _client.Queryable <Wms_material, Sys_dict, Sys_dict, Wms_storagerack, Wms_reservoirarea, Wms_warehouse, Sys_user, Sys_user> ((s, t, ut, r, k, w, c, u) => new object[] { JoinType.Left, s.MaterialType == t.DictId, JoinType.Left, s.Unit == ut.DictId, JoinType.Left, s.StoragerackId == r.StorageRackId, JoinType.Left, s.ReservoirAreaId == k.ReservoirAreaId, JoinType.Left, s.WarehouseId == w.WarehouseId, JoinType.Left, s.CreateBy == c.UserId, JoinType.Left, s.ModifiedBy == u.UserId, }) .Where((s, t, ut, r, k, w, c, u) => s.IsDel == 1 && t.IsDel == 1 && ut.IsDel == 1 && r.IsDel == 1 && k.IsDel == 1 && w.IsDel == 1) .Select((s, t, ut, r, k, w, c, u) => new { 物料编号 = s.MaterialNo, 物料名称 = s.MaterialName, 单位类别 = ut.DictName, 物料分类 = t.DictName, 安全库存 = s.Qty, 效期 = s.ExpiryDate, 货架编号 = r.StorageRackNo, 货架名称 = r.StorageRackName, 库区编号 = k.ReservoirAreaNo, 库区名称 = k.ReservoirAreaName, 仓库编号 = w.WarehouseNo, 仓库名称 = w.WarehouseName, 备注 = s.Remark, 创建人 = c.UserNickname, 创建时间 = s.CreateDate, 修改人 = u.UserNickname, 修改时间 = s.ModifiedDate }).MergeTable(); if (!bootstrap.datemin.IsEmpty() && !bootstrap.datemax.IsEmpty()) { query.Where(s => s.创建时间 > bootstrap.datemin.ToDateTimeB() && s.创建时间 <= bootstrap.datemax.ToDateTimeE()); } if (bootstrap.order.Equals("desc", StringComparison.OrdinalIgnoreCase)) { query.OrderBy($"MergeTable.{bootstrap.sort} desc"); } else { query.OrderBy($"MergeTable.{bootstrap.sort} asc"); } var list = query.ToList(); var buffer = NpoiUtil.Export(list, ExcelVersion.V2007); return(buffer); }
public IActionResult Search(string text) { var bootstrap = new Bootstrap.BootstrapParams { limit = 100, offset = 0, sort = "CreateDate", search = text, order = "desc" }; var json = _storagerackServices.PageList(bootstrap); return Content(json); }
public async Task <Wms_MaterialDto[]> MaterialList(Bootstrap.BootstrapParams bootstrap) { IWMSBaseApiAccessor wmsAccessor = WMSApiManager.GetBaseApiAccessor(bootstrap.storeId.ToString(), _client); RouteData <Wms_MaterialDto[]> result = (await wmsAccessor.GetMateralList( bootstrap.pageIndex, bootstrap.limit, bootstrap.search, new string[] { bootstrap.sort + " " + bootstrap.order }, bootstrap.datemin, bootstrap.datemax)); if (!result.IsSccuess) { return(new Wms_MaterialDto[0]); } return(result.Data); }
public ActionResult GetLogList2(Bootstrap.BootstrapParams bbp, PubPage pg, string strParentID) { //var db = ContextFactory.GetCurrentContext(); //var queryable = db.Set<SysLog>().Where(c => c.CreateTime < DateTime.Now); //int total = queryable.Count(); //var list = queryable.OrderByz(bbp.sort) // .Skip(bbp.offset).Take(bbp.limit).ToList(); //bbp.order = "DESC"; //bbp.sort = "CreateTime"; //bbp.offset = 10; //bbp.limit = 10; var list = _iSysLogServices.PageBootstrap(pg, bbp); return(Json(Bootstrap.GridData(list.Item1, list.Item2), JsonRequestBehavior.AllowGet)); }
public ContentResult List([FromForm] Bootstrap.BootstrapParams bootstrap) { //单表 //var express = ExpressionExt.Init<Sys_user>(); //express.And(c => c.IsDel == 1); //var order = ExpressionExt.InitO<Sys_user>(bootstrap.sort); //if (!bootstrap.search.IsEmpty()) //{ // express.And(c => c.UserName == bootstrap.search && c.UserNickname == bootstrap.search); //} //var list = _userServices.QueryableToPage(express, order, bootstrap.order, bootstrap.offset, bootstrap.limit); var sd = _userServices.PageList(bootstrap); return(Content(sd)); }
public string PageList(Bootstrap.BootstrapParams bootstrap) { int totalNumber = 0; if (bootstrap.offset != 0) { bootstrap.offset = bootstrap.offset / bootstrap.limit + 1; } var query = _client.Queryable <Sys_log, Sys_user, Sys_user> ((s, c, u) => new object[] { JoinType.Left, s.CreateBy == c.UserId, JoinType.Left, s.ModifiedBy == u.UserId }) .Select((s, c, u) => new { LogId = s.LogId.ToString(), s.LogIp, s.LogType, s.Url, s.Browser, s.Description, CName = c.UserNickname, s.CreateDate, UName = u.UserNickname, s.ModifiedDate }).MergeTable(); if (!bootstrap.search.IsEmpty()) { query.Where((s) => s.LogType.Contains(bootstrap.search)); } if (!bootstrap.datemin.IsEmpty() && !bootstrap.datemax.IsEmpty()) { query.Where(s => s.CreateDate > bootstrap.datemin.ToDateTimeB() && s.CreateDate <= bootstrap.datemax.ToDateTimeE()); } if (bootstrap.order.Equals("desc", StringComparison.OrdinalIgnoreCase)) { query.OrderBy($"MergeTable.{bootstrap.sort} desc"); } else { query.OrderBy($"MergeTable.{bootstrap.sort} asc"); } var list = query.ToPageList(bootstrap.offset, bootstrap.limit, ref totalNumber); return(Bootstrap.GridData(list, totalNumber).JilToJson()); }
public async Task <string> List([FromForm] Bootstrap.BootstrapParams bootstrap) { //var sd = _materialServices.PageList(bootstrap); //return Content(sd); IWMSBaseApiAccessor wmsAccessor = WMSApiManager.GetBaseApiAccessor(bootstrap.storeId.ToString(), _client); RouteData <Wms_MaterialDto[]> result = (await wmsAccessor.GetMateralList( bootstrap.pageIndex, bootstrap.limit, bootstrap.search, new string[] { bootstrap.sort + " " + bootstrap.order }, bootstrap.datemin, bootstrap.datemax)); if (!result.IsSccuess) { return(new PageGridData().JilToJson()); } return(result.ToGridJson()); }
public string PageList(Bootstrap.BootstrapParams bootstrap) { var totalNumber = 0; if (bootstrap.offset != 0) { bootstrap.offset = bootstrap.offset / bootstrap.limit + 1; } //var order = ExpressionExt.InitO<Sys_user>(bootstrap.sort); var query = _client.Queryable <Sys_user, Sys_user, Sys_user, Sys_dept, Sys_role> ((s, c, u, d, r) => new object[] { JoinType.Left, s.CreateBy == c.UserId, JoinType.Left, s.ModifiedBy == u.UserId, JoinType.Left, s.DeptId == d.DeptId, JoinType.Left, s.RoleId == r.RoleId }).Where((s, c, u, d, r) => s.IsDel == 1 && d.IsDel == 1 && r.IsDel == 1) .Select((s, c, u, d, r) => new { UserId = s.UserId.ToString(), s.UserName, s.UserNickname, d.DeptName, r.RoleName, s.Tel, s.Email, s.Sex, s.IsEabled, s.Remark, CName = c.UserNickname, s.CreateDate, UName = u.UserNickname, s.ModifiedDate }).MergeTable(); if (!bootstrap.search.IsEmpty()) { query.Where((s) => s.UserName == bootstrap.search || s.UserNickname == bootstrap.search); } if (!bootstrap.datemin.IsEmpty() && !bootstrap.datemax.IsEmpty()) { query.Where(s => s.CreateDate > bootstrap.datemin.ToDateTimeB() && s.CreateDate <= bootstrap.datemax.ToDateTimeE()); } if (bootstrap.order.Equals("desc", StringComparison.OrdinalIgnoreCase)) { query.OrderBy($"MergeTable.{bootstrap.sort} desc"); } else { query.OrderBy($"MergeTable.{bootstrap.sort} asc"); } var list = query.ToPageList(bootstrap.offset, bootstrap.limit, ref totalNumber); //var list = _client.Queryable("Sys_User", "s") // .AddJoinInfo("Sys_User", "c", "s.CreateBy=c.UserId") // .AddJoinInfo("Sys_User", "u", "s.ModifiedBy=u.UserId"); //if (!bootstrap.search.IsEmpty()) //{ // list.Where("s.IsDel=@id and s.UserName=@UserName or s.UserNickname=@UserName") // .AddParameters(new { id = 1, UserName = bootstrap.search }); //} //else //{ // list.Where("s.IsDel=@id ") // .AddParameters(new { id = 1 }); //} //if (bootstrap.offset != 0) //{ // bootstrap.offset = bootstrap.offset / bootstrap.limit + 1; //} //list.OrderBy($"s.{bootstrap.sort}") //.Select("s.*,c.UserNickname AS CNAME,u.UserNickname AS UNAME") //.ToPageList(bootstrap.offset, bootstrap.limit, ref totalNumber); return(Bootstrap.GridData(list, totalNumber).JilToJson()); }
public ContentResult List([FromForm] Bootstrap.BootstrapParams bootstrap) { var sd = _warehouseServices.PageList(bootstrap); return(Content(sd)); }
public (List <T>, int) QueryableToPage(Expression <Func <T, bool> > expression, Bootstrap.BootstrapParams bootstrap) { return(_baseRepository.QueryableToPage(expression, bootstrap)); }
public (List <T>, int) QueryableToPage(Expression <Func <T, bool> > expression, Bootstrap.BootstrapParams bootstrap) { int totalNumber = 0; if (bootstrap.offset != 0) { bootstrap.offset = bootstrap.offset / bootstrap.limit + 1; } if (bootstrap.order.Equals("DESC", StringComparison.OrdinalIgnoreCase)) { var list = _db.Queryable <T>().Where(expression).OrderBy(bootstrap.sort).ToPageList(bootstrap.offset, bootstrap.limit, ref totalNumber); return(list, totalNumber); } else { var list = _db.Queryable <T>().Where(expression).OrderBy(bootstrap.sort).ToPageList(bootstrap.offset, bootstrap.limit, ref totalNumber); return(list, totalNumber); } }
/// <summary> /// 基于bootstrap实现的分页 /// </summary> /// <param name="pg">查询参数</param> /// <param name="bbp">bootstrap table 的分页相关信息</param> /// <returns></returns> public Tuple <int, List <SysLog> > PageBootstrap(PubPage pg, Bootstrap.BootstrapParams bbp) { return(_sysUserRepository.PageBootstrap(pg, bbp)); }
public string PageList(Bootstrap.BootstrapParams bootstrap) { return(""); }
public ContentResult List([FromForm]Bootstrap.BootstrapParams bootstrap) { var sd = _storagerackServices.PageList(bootstrap); return Content(sd); }
public ContentResult Bar([FromForm] Bootstrap.BootstrapParams bootstrap) { var str = _logServices.EChart(bootstrap); return(Content(str)); }