StandardInterface/MES.Service/Dto/service/SJPageResult.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
StandardInterface/MES.Service/service/QC/SJService.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
StandardInterface/MES.Service/service/QC/XJService.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
StandardInterface/MESApplication/Controllers/QC/SJController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 | |
StandardInterface/MESApplication/Controllers/QC/XJController.cs | ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史 |
StandardInterface/MES.Service/Dto/service/SJPageResult.cs
@@ -91,4 +91,12 @@ [SugarColumn(ColumnName = "SJ_MJ")] public string? SJ_MJ { get; set; } [SugarColumn(IsIgnore = true)] // 新增参数用于动态搜索 public int? selectedIndex { get; set; } // 搜索条件索引 [SugarColumn(IsIgnore = true)] public string? searchField { get; set; } // 搜索字段名 [SugarColumn(IsIgnore = true)] public string? SearchValue { get; set; } // 搜索值 } StandardInterface/MES.Service/service/QC/SJService.cs
@@ -34,7 +34,7 @@ } //获取所有数据分页 public List<SJPageResult> getPage(SJPageResult queryObj) public (List<SJPageResult> item, int TotalCount) getPage(SJPageResult queryObj) { var db = SqlSugarHelper.GetInstance(); @@ -43,7 +43,7 @@ if (StringUtil.IsNotNullOrEmpty(queryObj.StatusUser)) lineNo = _baseService.getUserLineNo(queryObj.StatusUser); var data = db.Queryable<SJPageResult>() var query = db.Queryable<SJPageResult>() .WhereIF(lineNo != null && lineNo.Length > 0, a => lineNo.Contains(a.line)) .WhereIF(queryObj.Id != null, a => a.Id == queryObj.Id) @@ -56,11 +56,56 @@ .WhereIF( StringUtil.IsNotNullOrEmpty(queryObj.Result) && !"未完成".Equals(queryObj.Result), a => a.Result != "未完成") .OrderBy(a => a.BillNo, OrderByType.Desc) .ToPageList(queryObj.PageIndex, queryObj.Limit); a => a.Result != "未完成"); return data; // 新增的动态搜索逻辑 if (!string.IsNullOrEmpty(queryObj.SearchValue) && !string.IsNullOrEmpty(queryObj.searchField)) { switch (queryObj.searchField) { case "daa001": // 工单 query = query.Where(x => x.daa001.Contains(queryObj.SearchValue)); break; case "billNo": // 检验单号 query = query.Where(x => x.BillNo.Contains(queryObj.SearchValue)); break; case "line": // 产线 query = query.Where(x => x.line.Contains(queryObj.SearchValue)); break; case "itemNo": // 物料编码 query = query.Where(x => x.ItemNo.Contains(queryObj.SearchValue)); break; case "daa003": // 物料名称 query = query.Where(x => x.Daa003.Contains(queryObj.SearchValue)); break; default: // 如果没有指定字段或字段不匹配,使用原有的模糊查询逻辑作为兜底方案 query = query.Where(x => x.ItemNo.Contains(queryObj.SearchValue) || x.Daa003.Contains(queryObj.SearchValue) || x.daa001.Contains(queryObj.SearchValue) || x.BillNo.Contains(queryObj.SearchValue) || x.line.Contains(queryObj.SearchValue)); break; } } // 为了兼容旧版本,如果没有传递 searchField,使用原来的查询逻辑 else if (string.IsNullOrEmpty(queryObj.searchField) && !string.IsNullOrEmpty(queryObj.SearchValue)) { // 保持原有的多字段模糊查询逻辑 query = query.Where(x => x.ItemNo.Contains(queryObj.SearchValue) || x.Daa003.Contains(queryObj.SearchValue) || x.daa001.Contains(queryObj.SearchValue) || x.BillNo.Contains(queryObj.SearchValue) || x.line.Contains(queryObj.SearchValue)); } var totalCount = 0; var data = query.OrderBy(a => a.BillNo, OrderByType.Desc) .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount); return (data, totalCount); } @@ -224,7 +269,7 @@ item.Items = getQSItems(qsItemIpiReq.Id, null); var sjPageResult = new SJPageResult { Id = item.From.Id, Limit = 1, PageIndex = 1 }; item.Result = getPage(sjPageResult)[0]; item.Result = getPage(sjPageResult).item[0]; return item; } StandardInterface/MES.Service/service/QC/XJService.cs
@@ -106,7 +106,7 @@ }).ToList(); } public List<QsQaItemXj> getPage(XJPageResult queryObj) public (List<QsQaItemXj> item, int TotalCount) getPage(XJPageResult queryObj) { var db = SqlSugarHelper.GetInstance(); @@ -117,7 +117,8 @@ if (StringUtil.IsNotNullOrEmpty(queryObj.createUser)) lineNo = _baseService.getUserLineNo(queryObj.createUser); return db var totalCount = 0; var data = db .Queryable<QsQaItemXj, Womdaa, MesLine, MesItems>((s, a, c, b) => new JoinQueryInfos( @@ -153,7 +154,9 @@ FcheckResu = s.FcheckResu, Remarks = s.Remarks }).OrderBy(s => s.CreateDate, OrderByType.Desc) .ToPageList(queryObj.PageIndex, queryObj.Limit); .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount); return (data, totalCount); } StandardInterface/MESApplication/Controllers/QC/SJController.cs
@@ -41,14 +41,14 @@ try { dynamic resultInfos = new ExpandoObject(); var tbBillList = new SJService().getPage(queryObj); resultInfos.tbBillList = tbBillList; var (items, totalCount) = new SJService().getPage(queryObj); resultInfos.tbBillList = items; return new ResponseResult { status = 0, message = "OK", data = resultInfos data = resultInfos, TotalCount = totalCount }; } catch (Exception ex) StandardInterface/MESApplication/Controllers/QC/XJController.cs
@@ -236,14 +236,14 @@ try { dynamic resultInfos = new ExpandoObject(); var tbBillList = new XJService().getPage(queryObj); resultInfos.tbBillList = tbBillList; var (item, totalCount) = new XJService().getPage(queryObj); resultInfos.tbBillList = item; return new ResponseResult { status = 0, message = "OK", data = resultInfos data = resultInfos, TotalCount = totalCount }; } catch (Exception ex)