返回值修改

This commit is contained in:
gcw_MV9p2JJN 2025-09-16 11:08:48 +08:00
parent 8a1a757dae
commit 725f1a05bc

View File

@ -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<ProWorkorder>()
.LeftJoin<ProReportwork>((wo, rw) => wo.Workorder == rw.FkWorkorder) // ⚠️ 请根据实际外键关系修改!!!
.LeftJoin<ProReportwork>((wo, rw) => wo.Workorder == rw.FkWorkorder)
.Where((wo, rw) =>
wo.WorkorderDate >= weekStartDate &&
wo.WorkorderDate <= weekEndDate &&