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 &&