From 65ff7d387894592103cf514e00f58ffd7270704b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8D=A2=E6=B1=9F=E6=B5=B7?= <18360817963@163.com> Date: Thu, 27 Mar 2025 19:41:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B4=A8=E9=87=8F=E5=A4=A7=E5=B1=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Quality/Dto/QualityScreenHeadDto.cs | 4 ++++ .../SmartScreen/Quality/QualitySmartService.cs | 17 +++++++++++++++++ 2 files changed, 21 insertions(+) diff --git a/DOAN.Model/MES/SmartScreen/Quality/Dto/QualityScreenHeadDto.cs b/DOAN.Model/MES/SmartScreen/Quality/Dto/QualityScreenHeadDto.cs index 309b01f..f2e9f5e 100644 --- a/DOAN.Model/MES/SmartScreen/Quality/Dto/QualityScreenHeadDto.cs +++ b/DOAN.Model/MES/SmartScreen/Quality/Dto/QualityScreenHeadDto.cs @@ -11,5 +11,9 @@ namespace DOAN.Model.MES.SmartScreen.Quality.Dto public int? MonthFQC { get; set; } public int? WeekFQC { get; set; } + + public string MonthPassRate { get; set; } + public string WeekPassRate { get; set; } + } } diff --git a/DOAN.Service/MES/SmartScreen/Quality/QualitySmartService.cs b/DOAN.Service/MES/SmartScreen/Quality/QualitySmartService.cs index 77dcdd8..a15741a 100644 --- a/DOAN.Service/MES/SmartScreen/Quality/QualitySmartService.cs +++ b/DOAN.Service/MES/SmartScreen/Quality/QualitySmartService.cs @@ -41,9 +41,26 @@ namespace DOAN.Service.MES.SmartScreen.Quality .AddMinutes(59) .AddSeconds(59); var response = Queryable().ToList(); + List proWorkorders = Context.Queryable().ToList(); + List proWorkordersMonth = proWorkorders.Where(o=>o.WorkorderDate>= firstDayOfMonth&& o.WorkorderDate<= lastDayOfMonth).ToList(); + List proWorkordersWeek = proWorkorders.Where(o => o.WorkorderDate >= startOfWeek && o.WorkorderDate <= endOfWeek).ToList(); + qualityScreenHeadDto.MonthFQC = response.Where(o => o.CheckDatetime >= firstDayOfMonth && o.CheckDatetime <= lastDayOfMonth).Sum(o => o.Number); qualityScreenHeadDto.WeekFQC = response.Where(o => o.CheckDatetime >= startOfWeek && o.CheckDatetime <= endOfWeek).Sum(o => o.Number); + + double planSumMonth =Convert.ToDouble(proWorkordersMonth.Sum(o => o.PlanNum)); + double numeratorMonth = planSumMonth - (double)qualityScreenHeadDto.MonthFQC; + double ratioMonth = numeratorMonth / (double)planSumMonth; + string percentageMonth = ratioMonth.ToString("P2"); + qualityScreenHeadDto.MonthPassRate = percentageMonth; + + double planSumWeek = Convert.ToDouble(proWorkordersWeek.Sum(o => o.PlanNum)); + double numeratorWeek = planSumWeek - (double)qualityScreenHeadDto.WeekFQC; + double ratioWeek = numeratorWeek / (double)planSumWeek; + string percentageWeek = ratioWeek.ToString("P2"); + qualityScreenHeadDto.WeekPassRate= percentageWeek; + return qualityScreenHeadDto; }