| | |
| | | } |
| | | |
| | | //获取所有数据分页 |
| | | public (List<SJPageResult> item, int TotalCount) getPage(SJPageResult queryObj) |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | //public (List<SJPageResult> item, int TotalCount) getPage(SJPageResult queryObj) |
| | | //{ |
| | | // var db = SqlSugarHelper.GetInstance(); |
| | | |
| | | string[]? lineNo = null; |
| | | // string[]? lineNo = null; |
| | | |
| | | // if (StringUtil.IsNotNullOrEmpty(queryObj.StatusUser)) |
| | | // lineNo = _baseService.getUserLineNo(queryObj.StatusUser); |
| | | // // if (StringUtil.IsNotNullOrEmpty(queryObj.StatusUser)) |
| | | // // lineNo = _baseService.getUserLineNo(queryObj.StatusUser); |
| | | |
| | | var totalCount = 0; |
| | | // var totalCount = 0; |
| | | |
| | | var data = db.Queryable<SJPageResult>() |
| | | .WhereIF(lineNo != null && lineNo.Length > 0, |
| | | a => lineNo.Contains(a.line)) |
| | | .WhereIF(queryObj.Id != null, a => a.Id == queryObj.Id) |
| | | .WhereIF(StringUtil.IsNotNullOrEmpty(queryObj.BillNo), |
| | | a => a.BillNo == queryObj.BillNo) |
| | | // var data = db.Queryable<SJPageResult>() |
| | | // .WhereIF(lineNo != null && lineNo.Length > 0, |
| | | // a => lineNo.Contains(a.line)) |
| | | // .WhereIF(queryObj.Id != null, a => a.Id == queryObj.Id) |
| | | // .WhereIF(StringUtil.IsNotNullOrEmpty(queryObj.BillNo), |
| | | // a => a.BillNo == queryObj.BillNo) |
| | | // // .WhereIF( |
| | | // // StringUtil.IsNotNullOrEmpty(queryObj.Result) && |
| | | // // "未完成".Equals(queryObj.Result), |
| | | // // a => a.Result == queryObj.Result && (a.FSubmit == 0 || a.FSubmit == null)) |
| | | // .WhereIF( |
| | | // StringUtil.IsNotNullOrEmpty(queryObj.Result) && |
| | | // "未完成".Equals(queryObj.Result), |
| | | // a => a.Result == queryObj.Result && (a.FSubmit == 0 || a.FSubmit == null)) |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.Result) && |
| | | "未完成".Equals(queryObj.Result), |
| | | a => a.FSubmit == 0 || a.FSubmit == null) |
| | | // a => a.FSubmit == 0 || a.FSubmit == null) |
| | | // // .WhereIF( |
| | | // // StringUtil.IsNotNullOrEmpty(queryObj.Result) && |
| | | // // !"未完成".Equals(queryObj.Result), |
| | | // // a => a.Result != "未完成" && a.FSubmit == 1) |
| | | // .WhereIF( |
| | | // StringUtil.IsNotNullOrEmpty(queryObj.Result) && |
| | | // !"未完成".Equals(queryObj.Result), |
| | | // a => a.Result != "未完成" && a.FSubmit == 1) |
| | | .WhereIF( |
| | | StringUtil.IsNotNullOrEmpty(queryObj.Result) && |
| | | !"未完成".Equals(queryObj.Result), |
| | | a => a.FSubmit == 1) |
| | | // a => a.FSubmit == 1) |
| | | // .OrderBy(a => a.BillNo, OrderByType.Desc) |
| | | // .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount); |
| | | |
| | | // return (data, totalCount); |
| | | //} |
| | | |
| | | public (List<SJPageResult> item, int TotalCount) getPage(SJPageResult queryObj) |
| | | { |
| | | var db = SqlSugarHelper.GetInstance(); |
| | | int totalCount = 0; |
| | | |
| | | string searchValue = queryObj.searchValue?.Trim(); |
| | | |
| | | var query = db.Queryable<SJPageResult>(); |
| | | |
| | | // 1️⃣ 如果 SearchValue 为空 → 查询全部 |
| | | if (string.IsNullOrWhiteSpace(searchValue)) |
| | | { |
| | | var allData = query |
| | | .OrderBy(a => a.BillNo, OrderByType.Desc) |
| | | .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount); |
| | | .ToPageList( |
| | | Math.Max(queryObj.PageIndex, 1), |
| | | Math.Max(queryObj.Limit, 1), |
| | | ref totalCount); |
| | | |
| | | return (allData, totalCount); |
| | | } |
| | | |
| | | // 2️⃣ SearchValue 非空 → 模糊匹配 BILL_NO 或 ITEM_NO |
| | | query = query.Where(a => |
| | | SqlFunc.Like(SqlFunc.Trim(a.BillNo).ToLower(), $"%{searchValue.ToLower()}%") || |
| | | SqlFunc.Like(SqlFunc.Trim(a.ItemNo).ToLower(), $"%{searchValue.ToLower()}%") |
| | | ); |
| | | |
| | | var data = query |
| | | .OrderBy(a => a.BillNo, OrderByType.Desc) |
| | | .ToPageList( |
| | | Math.Max(queryObj.PageIndex, 1), |
| | | Math.Max(queryObj.Limit, 1), |
| | | ref totalCount); |
| | | |
| | | // 3️⃣ 如果没有匹配数据 → 返回空列表 |
| | | if (totalCount == 0) |
| | | return (new List<SJPageResult>(), 0); |
| | | |
| | | return (data, totalCount); |
| | | } |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | //SetQSItem |
| | | // public List<QsItemIpiItem> SetQSItems(string itemNo) |
| | | // { |