From 8f25fecab6e6a79096b9940ab3432401b9045b39 Mon Sep 17 00:00:00 2001 From: cnf <3200815559@qq.com> Date: 星期四, 10 七月 2025 18:00:14 +0800 Subject: [PATCH] 首检\巡检\入库检适配 --- MES.Service/service/QC/RKJService.cs | 75 ++++++++++++++++++++++--------------- 1 files changed, 44 insertions(+), 31 deletions(-) diff --git a/MES.Service/service/QC/RKJService.cs b/MES.Service/service/QC/RKJService.cs index 8656f8a..bdcaa01 100644 --- a/MES.Service/service/QC/RKJService.cs +++ b/MES.Service/service/QC/RKJService.cs @@ -454,48 +454,61 @@ } - public List<QsItemOqcReq> getPage(XJPageResult queryObj) + public (List<QsItemOqcReq> items, int TotalCount) GetPage(XJPageResult queryObj) { var db = SqlSugarHelper.GetInstance(); + var totalCount = 0; - return db - .Queryable<QsItemOqcReq, Womdaa, MesItems, MesInvItemIns, Womdab, - MesInvTransaction, RKJDaa001>( - (a, da, b, c, d, ca, m) => new JoinQueryInfos( - JoinType.Left, da.Daa001 == a.BillNo, - JoinType.Left, a.ItemId == b.Id, - JoinType.Left, a.BillNo == c.BillNo, - JoinType.Left, c.CbillNo == d.Dab001, - JoinType.Left, - c.TransctionNo == ca.TransactionNo.ToString() && - c.Company == ca.Company && c.Factory == ca.Factory, - JoinType.Left, c.Id == m.ItemInId && a.ItemNo == m.ItemNo - )) - .Select((a, da, b, c, d, ca, m) => new QsItemOqcReq + // 鑾峰彇鐢ㄦ埛鍏宠仈鐨勭嚎浣撶紪鍙� + string[] lineNo = null; + if (!string.IsNullOrEmpty(queryObj.createUser)) + { + lineNo = _baseService.getUserLineNo(queryObj.createUser); + } + + var query = db.Queryable<QsItemOqcReq, MesItems, Womdaa>((a, b, da) => + new JoinQueryInfos( + JoinType.Left, a.ItemNo == b.ItemNo, // 鍏宠仈鐗╂枡淇℃伅 + JoinType.Left, a.BillNo == da.Daa001 // 鍏宠仈宸ュ崟淇℃伅 + )) + // 鐢ㄦ埛绾夸綋杩囨护鏉′欢 + //.WhereIF(lineNo != null && lineNo.Length > 0 && !"PL017".Equals(queryObj.createUser), + // (a, b, da) => lineNo.Contains(da.Daa015)) + // ID绮剧‘鏌ヨ + .WhereIF(!string.IsNullOrEmpty(queryObj.id), + (a, b, da) => a.Id.ToString() == queryObj.id) + // 瀹屾垚鐘舵�佽繃婊� + .WhereIF("鏈畬鎴�".Equals(queryObj.result), (a, b, da) => a.FcheckResu == null) + .WhereIF(!"鏈畬鎴�".Equals(queryObj.result), (a, b, da) => a.FcheckResu != null) + // 鎼滅储鏉′欢锛堢墿鏂欏悕绉�/缂栧彿锛� + .WhereIF(!string.IsNullOrEmpty(queryObj.SearchValue), + (a, b, da) => b.ItemName.ToLower().Contains(queryObj.SearchValue.ToLower()) || + a.ItemNo.ToLower().Contains(queryObj.SearchValue.ToLower())) + // 鏌ヨ瀛楁 + .Select((a, b, da) => new QsItemOqcReq { - BillNo = a.BillNo, - Remarks = a.Remarks, Id = a.Id, + BillNo = a.BillNo, + ItemNo = a.ItemNo, + ItemName = b.ItemName, + ItemModel = b.ItemModel, CreateDate = a.CreateDate, CreateBy = a.CreateBy, FcheckResu = a.FcheckResu, - ItemNo = a.ItemNo, FcheckBy = a.FcheckBy, FcheckDate = a.FcheckDate, ReleaseNo = a.ReleaseNo, - // 娣诲姞鍏朵粬瀛楁 - // 濡傛灉鍦� QsItemOqcReq 涓畾涔変簡棰濆瀛楁锛屽垯闇�瑕佸皢瀹冧滑璧嬪�� - // 渚嬪: - ItemName = b.ItemName, - ItemModel = b.ItemModel, - TaskNo = c.TaskNo, - CbillNo = c.CbillNo, - Dab001 = d.Dab001, - Daa015 = da.Daa015, - LineNo = c.LineNo, - Quantity = m.Quantity - }).OrderBy(a => a.CreateDate, OrderByType.Desc) - .ToPageList(queryObj.PageIndex, queryObj.Limit); + Remarks = a.Remarks, + Daa015 = da.Daa015, // 宸ュ崟绾夸綋 + Fsubmit = a.Fsubmit + }) + // 鎺掑簭 + .OrderBy(a => a.CreateDate, OrderByType.Desc); + + // 鍒嗛〉鏌ヨ + var result = query.ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount); + + return (result, totalCount); } //鍒犻櫎涓昏〃骞朵笖杩炵骇鍒犻櫎瀛愯〃鍜屽瓩琛� -- Gitblit v1.9.3