|
|
|
@ -41,23 +41,27 @@ public class Ghre_UshioPlanServices : BaseServices<Ghre_UshioPlan, Ghre_UshioPla |
|
|
|
|
var DT_TableDataT1 = result.result.DT_TableDataT1; |
|
|
|
|
|
|
|
|
|
var deptIds = DT_TableDataT1.Select(x => x.DeptId).Distinct().ToList(); |
|
|
|
|
var courseIds = DT_TableDataT1.Select(x => x.CourseId).Distinct().ToList(); |
|
|
|
|
//var courseIds = DT_TableDataT1.Select(x => x.CourseId).Distinct().ToList(); |
|
|
|
|
var staffIds = new List<int>(); |
|
|
|
|
for (int i = 0; i < DT_TableDataT1.Count; i++) |
|
|
|
|
{ |
|
|
|
|
if (DT_TableDataT1[i].StaffIds.IsNotEmptyOrNull()) |
|
|
|
|
staffIds.AddRange(JsonHelper.JsonToObj<List<int>>(DT_TableDataT1[i].StaffIds)); |
|
|
|
|
|
|
|
|
|
if (DT_TableDataT1[i].Month.IsNotEmptyOrNull()) |
|
|
|
|
DT_TableDataT1[i].Months = JsonHelper.JsonToObj<List<string>>(DT_TableDataT1[i].Month); |
|
|
|
|
DT_TableDataT1[i].TrainCategory = await GetParaLabel("TrainingCategory", DT_TableDataT1[i].TrainCategory); |
|
|
|
|
DT_TableDataT1[i].Month = await GetParaLabel("MonthSelect", DT_TableDataT1[i].Month); |
|
|
|
|
} |
|
|
|
|
staffIds = staffIds.Distinct().ToList(); |
|
|
|
|
var staffs = await Db.Queryable<Ghra_Staff>().Where(x => staffIds.Contains(x.StaffID)).ToListAsync(); |
|
|
|
|
var depts = await Db.Queryable<Ghro_Dept>().Where(x => deptIds.Contains(x.DeptID)).ToListAsync(); |
|
|
|
|
var courses = await Db.Queryable<Ghre_Course>().Where(x => courseIds.Contains(x.Id)).ToListAsync(); |
|
|
|
|
//var courses = await Db.Queryable<Ghre_Course>().Where(x => courseIds.Contains(x.Id)).ToListAsync(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int i = 0; i < DT_TableDataT1.Count; i++) |
|
|
|
|
{ |
|
|
|
|
DT_TableDataT1[i].InOrOut = await GetParaLabel("CourseInOrOut", DT_TableDataT1[i].InOrOut); |
|
|
|
|
if (DT_TableDataT1[i].StaffIds.IsNotEmptyOrNull()) |
|
|
|
|
{ |
|
|
|
|
var staffIds1 = JsonHelper.JsonToObj<List<int>>(DT_TableDataT1[i].StaffIds); |
|
|
|
@ -65,8 +69,34 @@ public class Ghre_UshioPlanServices : BaseServices<Ghre_UshioPlan, Ghre_UshioPla |
|
|
|
|
DT_TableDataT1[i].StaffNames = string.Join("、", staffs.Where(x => staffIds1.Contains(x.StaffID)).Select(x => x.StaffName)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
DT_TableDataT1[i].CourseName = courses.Where(x => x.Id == DT_TableDataT1[i].CourseId).Select(x => x.CourseName).FirstOrDefault(); |
|
|
|
|
//DT_TableDataT1[i].CourseName = courses.Where(x => x.Id == DT_TableDataT1[i].CourseId).Select(x => x.CourseName).FirstOrDefault(); |
|
|
|
|
DT_TableDataT1[i].DeptName = depts.Where(x => x.DeptID == DT_TableDataT1[i].DeptId).Select(x => x.DeptName).FirstOrDefault(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (DT_TableDataT1[i].TrainNum != null && DT_TableDataT1[i].TrainDays != null) |
|
|
|
|
DT_TableDataT1[i].TotalDays = DT_TableDataT1[i].TrainNum * DT_TableDataT1[i].TrainDays; |
|
|
|
|
|
|
|
|
|
if (DT_TableDataT1[i].Months.Any()) |
|
|
|
|
{ |
|
|
|
|
DT_TableDataT1[i].Months.ForEach(x => |
|
|
|
|
{ |
|
|
|
|
//if (x.ObjToInt() == 1) DT_TableDataT1[i] = "✔√"; |
|
|
|
|
if (x.ObjToInt() == 1) DT_TableDataT1[i].M1 = "✔"; |
|
|
|
|
else if (x.ObjToInt() == 2) DT_TableDataT1[i].M2 = "✔"; |
|
|
|
|
else if (x.ObjToInt() == 3) DT_TableDataT1[i].M3 = "✔"; |
|
|
|
|
else if (x.ObjToInt() == 4) DT_TableDataT1[i].M4 = "✔"; |
|
|
|
|
else if (x.ObjToInt() == 5) DT_TableDataT1[i].M5 = "✔"; |
|
|
|
|
else if (x.ObjToInt() == 6) DT_TableDataT1[i].M6 = "✔"; |
|
|
|
|
else if (x.ObjToInt() == 7) DT_TableDataT1[i].M7 = "✔"; |
|
|
|
|
else if (x.ObjToInt() == 8) DT_TableDataT1[i].M8 = "✔"; |
|
|
|
|
else if (x.ObjToInt() == 9) DT_TableDataT1[i].M9 = "✔"; |
|
|
|
|
else if (x.ObjToInt() == 10) DT_TableDataT1[i].M10 = "✔"; |
|
|
|
|
else if (x.ObjToInt() == 11) DT_TableDataT1[i].M11 = "✔"; |
|
|
|
|
else if (x.ObjToInt() == 12) DT_TableDataT1[i].M12 = "✔"; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -102,6 +132,10 @@ public class Ghre_UshioPlanServices : BaseServices<Ghre_UshioPlan, Ghre_UshioPla |
|
|
|
|
{ |
|
|
|
|
if (entity.StaffId != null) |
|
|
|
|
entity.StaffIds = JsonHelper.ObjToJson(entity.StaffId); |
|
|
|
|
|
|
|
|
|
entity.TrainNum = entity.StaffId.Count; |
|
|
|
|
if (entity.Months != null) |
|
|
|
|
entity.Month = JsonHelper.ObjToJson(entity.Months); |
|
|
|
|
var result = await base.Add(entity); |
|
|
|
|
|
|
|
|
|
return result; |
|
|
|
@ -112,6 +146,9 @@ public class Ghre_UshioPlanServices : BaseServices<Ghre_UshioPlan, Ghre_UshioPla |
|
|
|
|
if (editModel.StaffId != null) |
|
|
|
|
editModel.StaffIds = JsonHelper.ObjToJson(editModel.StaffId); |
|
|
|
|
|
|
|
|
|
if (editModel.Months != null) |
|
|
|
|
editModel.Month = JsonHelper.ObjToJson(editModel.Months); |
|
|
|
|
editModel.TrainNum = editModel.StaffId.Count; |
|
|
|
|
var result = await base.Update(Id, editModel, null, ["Status"]); |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
@ -120,8 +157,14 @@ public class Ghre_UshioPlanServices : BaseServices<Ghre_UshioPlan, Ghre_UshioPla |
|
|
|
|
{ |
|
|
|
|
var result = await base.QueryForm(body); |
|
|
|
|
string StaffIds = result.result.DT_TableDataT1[0].StaffIds; |
|
|
|
|
string Month = result.result.DT_TableDataT1[0].Month; |
|
|
|
|
if (!string.IsNullOrWhiteSpace(StaffIds)) |
|
|
|
|
result.result.DT_TableDataT1[0].StaffId = JsonConvert.DeserializeObject<List<int>>(StaffIds); |
|
|
|
|
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(Month)) |
|
|
|
|
result.result.DT_TableDataT1[0].Months = JsonConvert.DeserializeObject<List<string>>(Month); |
|
|
|
|
if (result.result.DT_TableDataT1[0].TrainNum != null && result.result.DT_TableDataT1[0].TrainDays != null) |
|
|
|
|
result.result.DT_TableDataT1[0].TotalDays = result.result.DT_TableDataT1[0].TrainNum * result.result.DT_TableDataT1[0].TrainDays; |
|
|
|
|
return result; |
|
|
|
|
} |
|
|
|
|
public async Task<ServiceResult<long>> InsertByStatus(InsertGhre_UshioPlanInput insertModel, string status) |
|
|
|
|