From f4e84a98facb28bbfc63343c81095a9787812e27 Mon Sep 17 00:00:00 2001 From: 南骏 池 <chiffly@163.com> Date: 星期六, 30 八月 2025 16:25:51 +0800 Subject: [PATCH] 1.PDA分组织 --- service/QC/IpqcService.cs | 94 +++++++++++++++++++++++++++++++++++++++-------- 1 files changed, 78 insertions(+), 16 deletions(-) diff --git a/service/QC/IpqcService.cs b/service/QC/IpqcService.cs index 8186562..d477004 100644 --- a/service/QC/IpqcService.cs +++ b/service/QC/IpqcService.cs @@ -93,6 +93,10 @@ public (List<VIpqcXj> item, int TotalCount) getPageXj(XJPageResult queryObj) { + + + + var totalCount = 0; var parsedGuid = Guid.Empty; if (!queryObj.id.IsNullOrEmpty()) { @@ -100,25 +104,83 @@ if (!isValid) throw new ApplicationException("GUID杞崲閿欒"); } + //var pageList = Db.Queryable<VIpqcXj>() + // .WhereIF(!string.IsNullOrWhiteSpace(queryObj.keyword), a => + // a.ItemNo.Contains(queryObj.keyword) || + // a.ItemName.Contains(queryObj.keyword) || + // a.Daa001.Contains(queryObj.keyword) || + // a.ReleaseNo.Contains(queryObj.keyword) || + // a.DepartmentName.Contains(queryObj.keyword) || + // a.xtName.Contains(queryObj.keyword) + // ) + // .WhereIF(UtilityHelper.CheckGuid(parsedGuid), + // a => a.Guid == parsedGuid.ToString()) + // .Where(a => (a.FSubmit ?? 0) == 0) + // .OrderByDescending(a => a.CreateDate) + // .OrderBy(a => a.checkTimeSlot) + // .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount); + + var sql = string.Format(@"SELECT [guid], + [fsubmit], + [MODIFY1_FLAG], + [LOT_NO], + [FNG_HANDLE], + [FVERSION], + [LOT_NO1], + [FCOVERT_QTY], + [FCHECK_RESU], + [RELEASE_NO], + [DAA001], + [FBATCH_QTY], + [ITEM_NO], + [FCHECK_BY], + [FNG_DESC], + [CREATE_BY], + [DAA013], + [sj_xt], + [departmentname], + [name], + [ITEM_NAME], + [remarks], + [DATE_01], + [ITEM_MODEL], + [CREATE_DATE], + [line_id], + [check_time_slot], + ROW_NUMBER() OVER (ORDER BY [CREATE_DATE] DESC, [check_time_slot] ASC) AS RowIndex +FROM [V_IPQC_XJ] +WHERE + ISNULL([fsubmit], 0) = 0 + AND ( + -- 澶勭悊22瀛楃鐨勬爣鍑嗘椂闂存 (e.g. '2025-07-29 08:00-10:00') + ( + LEN([check_time_slot]) = 22 + AND TRY_CONVERT(date, SUBSTRING([check_time_slot], 1, 10)) = CAST(GETDATE() AS date) + AND CAST(GETDATE() AS time) BETWEEN + TRY_CAST(SUBSTRING([check_time_slot], 12, 5) + ':00' AS time) + AND TRY_CAST(SUBSTRING([check_time_slot], 18, 5) + ':00' AS time) + ) + OR + -- 澶勭悊13瀛楃鐨勫姞鐝牸寮� (e.g. '2025-07-29 鍔犵彮') + ( + LEN([check_time_slot]) = 13 + AND [check_time_slot] LIKE '%鍔犵彮' + AND TRY_CONVERT(date, SUBSTRING([check_time_slot], 1, 10)) = CAST(GETDATE() AS date) + AND CAST(GETDATE() AS time) >= '17:00:00' + ) + ) + {0}", + parsedGuid != Guid.Empty ? "AND guid = @parsedGuid" : ""); // 鏂板GUID杩囨护鏉′欢 + + - var totalCount = 0; - var pageList = Db.Queryable<VIpqcXj>() - .WhereIF(!string.IsNullOrWhiteSpace(queryObj.keyword), a => - a.ItemNo.Contains(queryObj.keyword) || - a.ItemName.Contains(queryObj.keyword) || - a.Daa001.Contains(queryObj.keyword) || - a.ReleaseNo.Contains(queryObj.keyword) || - a.DepartmentName.Contains(queryObj.keyword) || - a.xtName.Contains(queryObj.keyword) - ) - .WhereIF(UtilityHelper.CheckGuid(parsedGuid), - a => a.Guid == parsedGuid.ToString()) - .Where(a => (a.FSubmit ?? 0) == 0) - .OrderByDescending(a => a.CreateDate) - .OrderBy(a => a.checkTimeSlot) - .ToPageList(queryObj.PageIndex, queryObj.Limit, ref totalCount); + var sqlParams = new List<SugarParameter> { + new("@parsedGuid", parsedGuid) // 鏂板鍙傛暟 + }; + + var pageList = Db.Ado.SqlQuery<VIpqcXj>(sql,sqlParams).ToList(); return (pageList, totalCount); } -- Gitblit v1.9.3