diff --git a/Tiobon.Core.Model/ViewModels/Extend/UshioPlanReport.cs b/Tiobon.Core.Model/ViewModels/Extend/UshioPlanReport.cs index 77c4384f..97ac6c14 100644 --- a/Tiobon.Core.Model/ViewModels/Extend/UshioPlanReport.cs +++ b/Tiobon.Core.Model/ViewModels/Extend/UshioPlanReport.cs @@ -33,7 +33,7 @@ public class UshioPlanReport : Ghre_PlanDto public class Ushio_ExternalTrainApply { - public int TrainDays { get; set; } = 0; + public int? TrainDays { get; set; } = 0; public DateTime BeginDate { get; set; } public DateTime EndDate { get; set; } } diff --git a/Tiobon.Core.Services/Ghre/Ghre_PlanServices.cs b/Tiobon.Core.Services/Ghre/Ghre_PlanServices.cs index fcc440b8..f76ad99e 100644 --- a/Tiobon.Core.Services/Ghre/Ghre_PlanServices.cs +++ b/Tiobon.Core.Services/Ghre/Ghre_PlanServices.cs @@ -237,7 +237,7 @@ public class Ghre_PlanServices : BaseServices x.InOrOut == "In").Select(x => x.Id).ToList(); var outPlanIds = result.result.DT_TableDataT1.Where(x => x.InOrOut == "Out").Select(x => x.Id).ToList(); - int? year = null; + int? year1 = null; if (filter.jsonParam != null) foreach (JProperty jProperty in filter.jsonParam.Properties()) { @@ -247,7 +247,7 @@ public class Ghre_PlanServices : BaseServices(value); - year = jsonParam.columnValue.ObjToInt(); + year1 = jsonParam.columnValue.ObjToInt(); } } @@ -264,12 +264,13 @@ public class Ghre_PlanServices : BaseServices new { q.Id, q.PlanId, q.ExamDate }) .Select(m => new { m.PlanId, ExamDate = m.ExamDate.Value, Count = SqlFunc.AggregateCount(m.Id) }) .ToListAsync(); - studyRecordGroup1 = studyRecordGroup1.Where(x => x.ExamDate.Year == year).ToList(); + studyRecordGroup1 = studyRecordGroup1.Where(x => x.ExamDate.Year == year1).ToList(); var data = Mapper.Map(result.result.DT_TableDataT1).ToANew>(); - - data.ForEach(async d => + for (int i = 0; i < data.Count; i++) { + var d = data[i]; + int year = d.Year.Value; if (d.InOrOut == "In") { @@ -291,9 +292,10 @@ public class Ghre_PlanServices : BaseServices(sql); + //var applys = await DbAccess.QueryListAsync(sql); + var applys = await Db.Ado.SqlQueryAsync(sql); d.M1_Count = applys.Where(x => x.BeginDate.Year == year && x.BeginDate.Month == 1).Sum(x => x.TrainDays); d.M2_Count = applys.Where(x => x.BeginDate.Year == year && x.BeginDate.Month == 2).Sum(x => x.TrainDays); @@ -349,7 +351,7 @@ public class Ghre_PlanServices : BaseServices x.field == "Year").SingleOrDefault(); - if (year != yearField?.searchColumnDefaultValue.ObjToInt()) + if (year1 != yearField?.searchColumnDefaultValue.ObjToInt()) { result1.result.JM_TableColumnT1.TableColumn?.ForEach(x => @@ -370,9 +372,9 @@ public class Ghre_PlanServices : BaseServices