From 725f1a05bcd25d4f841cee801615eaa67b1309bd Mon Sep 17 00:00:00 2001 From: gcw_MV9p2JJN Date: Tue, 16 Sep 2025 11:08:48 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=80=BC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DOAN.Service/MES/product/ProweekplanManageService.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/DOAN.Service/MES/product/ProweekplanManageService.cs b/DOAN.Service/MES/product/ProweekplanManageService.cs index a86b8e7..3e7c019 100644 --- a/DOAN.Service/MES/product/ProweekplanManageService.cs +++ b/DOAN.Service/MES/product/ProweekplanManageService.cs @@ -32,6 +32,7 @@ namespace DOAN.Service.MES.product { public int ImportExcel(IFormFile formFile, string username) { + int insertCount = 0; using (var stream = formFile.OpenReadStream()) { try @@ -147,6 +148,7 @@ namespace DOAN.Service.MES.product // 清空缓存列表 insertProWeekPlanList.Clear(); insertProWeeklyDateList.Clear(); + insertCount = insertCount + insertProWeekPlanList.Count; } } @@ -154,9 +156,10 @@ namespace DOAN.Service.MES.product if (insertProWeekPlanList.Count > 0) { InsertBatchData(insertProWeekPlanList, insertProWeeklyDateList, year, week, username); + insertCount = insertCount + insertProWeekPlanList.Count; } - return insertProWeekPlanList.Count + (insertProWeeklyDateList.Count > 0 ? 0 : 0); // 实际可根据需求返回总插入条数 + return insertCount; } catch (Exception ex) { @@ -446,7 +449,7 @@ namespace DOAN.Service.MES.product // 4. 【关键优化点】一次性查询所有相关的工单数据,并按 ProductCode + Specification 分组统计总合格数 var workOrderStats = Context.Queryable() - .LeftJoin((wo, rw) => wo.Workorder == rw.FkWorkorder) // ⚠️ 请根据实际外键关系修改!!! + .LeftJoin((wo, rw) => wo.Workorder == rw.FkWorkorder) .Where((wo, rw) => wo.WorkorderDate >= weekStartDate && wo.WorkorderDate <= weekEndDate &&