From 154ecf3d94edef23247796ea313d00b35314563a Mon Sep 17 00:00:00 2001 From: 南骏 池 <chiffly@163.com> Date: 星期四, 17 七月 2025 13:34:34 +0800 Subject: [PATCH] 1.来料检验优化 --- service/QC/LljService.cs | 90 +++++++++++++++++--------------------------- 1 files changed, 35 insertions(+), 55 deletions(-) diff --git a/service/QC/LljService.cs b/service/QC/LljService.cs index a6573b0..5d687f7 100644 --- a/service/QC/LljService.cs +++ b/service/QC/LljService.cs @@ -3,6 +3,7 @@ using NewPdaSqlServer.DB; using NewPdaSqlServer.Dto.service; using NewPdaSqlServer.entity; +using NewPdaSqlServer.entity.Base; using NewPdaSqlServer.util; using SqlSugar; using static Azure.Core.HttpHeader; @@ -202,62 +203,41 @@ { var parsedGuid = Guid.Empty; - if (id != null) - { - var isValid = Guid.TryParse(id, out parsedGuid); - if (!isValid) - throw new ApplicationException("GUID杞崲閿欒"); - } + var sql = string.Format(@"SELECT [a].[guid] AS [Guid], + [a].[parent_guid] AS [ParentGuid], + [a].[release_no] AS [ReleaseNo], + [a].[check_qyt] AS [CheckQyt], + [a].[fac_level] AS [FacLevel], + [a].[fcheck_item] AS [FcheckItem], + [a].[fcheck_tool] AS [FcheckTool], + [a].[fdown_allow] AS [FdownAllow], + [a].[fcheck_level] AS [FcheckLevel], + [a].[fstand] AS [Fstand], + [a].[fup_allow] AS [FupAllow], + [a].[sample_size_no] AS [SampleSizeNo], + [a].[fspec_requ] AS [FspecRequ], + [a].[fre_qty] AS [FreQty], + N'1000' AS [Factory], + N'1000' AS [Company], + COUNT([b].[guid]) AS [FenterQty], + [a].[fcheck_resu] AS [FcheckResu], + [a].[forder] AS [Order], + [a].[ybsl] AS [Ybsl], + ISNULL((SELECT COUNT(1) +FROM MES_QA_ITEMS_DETECT_DETAIL13 C +WHERE C.parent_guid = A.guid),0) AS [YbslIn] +FROM [MES_QA_ITEMS_DETECT_DETAIL5] [a] + Left JOIN [MES_QA_ITEMS_DETECT_DETAIL12] [b] ON ([a].[guid] = [b].[parent_guid]) +WHERE ([a].[release_no] = N'{0}') +GROUP BY [a].[guid], [a].[parent_guid], [a].[release_no], [a].[fac_level], [a].[fcheck_item], [a].[fcheck_tool], + [a].[fdown_allow], [a].[fcheck_level], [a].[fstand], [a].[fup_allow], [a].[sample_size_no], [a].[fspec_requ], + [a].[fre_qty], [a].[check_qyt], [a].[fcheck_resu], [a].[forder], [a].[ybsl] +ORDER BY [a].[forder] ASC", releaseNo); - return Db.Queryable<MesQaItemsDetectDetail5, MesQaItemsDetectDetail12>( - (a, b) => - new JoinQueryInfos(JoinType.Left, a.Guid == b.ParentGuid)) - .Where((a, b) => a.ReleaseNo == releaseNo) - .WhereIF(UtilityHelper.CheckGuid(parsedGuid), - (a, b) => a.Guid == parsedGuid) - .GroupBy((a, b) => new - { - a.Guid, - a.ParentGuid, - a.ReleaseNo, - a.FacLevel, - a.FcheckItem, - a.FcheckTool, - a.FdownAllow, - a.FcheckLevel, - a.Fstand, - a.FupAllow, - a.SampleSizeNo, - a.FspecRequ, - a.FreQty, - a.CheckQyt, - a.FcheckResu, - a.Order, - a.Ybsl - }).Select((a, b) => new MesQaItemsDetectDetail5 - { - Guid = a.Guid, - ParentGuid = a.ParentGuid, - ReleaseNo = a.ReleaseNo, - CheckQyt = a.CheckQyt, - FacLevel = a.FacLevel, - FcheckItem = a.FcheckItem, - FcheckTool = a.FcheckTool, - FdownAllow = a.FdownAllow, - FcheckLevel = a.FcheckLevel, - Fstand = a.Fstand, - FupAllow = a.FupAllow, - SampleSizeNo = a.SampleSizeNo, - FspecRequ = a.FspecRequ, - FreQty = a.FreQty, - Factory = "1000", - Company = "1000", - FenterQty = SqlFunc.AggregateCount(b.Guid), - FcheckResu = a.FcheckResu, - Order = a.Order, - Ybsl = a.Ybsl, - }).OrderBy(a => a.Order) - .ToList(); + var Ybsl_In = Db.Ado.SqlQuery<MesQaItemsDetectDetail5>(sql).ToList(); + + return Ybsl_In; + } public int SetQSItemDetail(MesQaItemsDetectDetail12 detail) -- Gitblit v1.9.3