|
|
@ -100,7 +100,14 @@ FROM Ghre_Request A |
|
|
|
if (entity.TrainStaffIds.IsNotEmptyOrNull()) |
|
|
|
if (entity.TrainStaffIds.IsNotEmptyOrNull()) |
|
|
|
entity.TrainStaffId = JsonHelper.ObjToJson(entity.TrainStaffIds); |
|
|
|
entity.TrainStaffId = JsonHelper.ObjToJson(entity.TrainStaffIds); |
|
|
|
entity.RequestNo = await GenerateContinuousSequence("Ghre_Request", "RequestNo", "R"); |
|
|
|
entity.RequestNo = await GenerateContinuousSequence("Ghre_Request", "RequestNo", "R"); |
|
|
|
|
|
|
|
if (entity.CourseSource != "Dept") |
|
|
|
|
|
|
|
entity.RequestNum = null; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (entity.CourseSource == "Dept" && await QueryCompanyCode() == "Ushio") |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
if (entity.TrainStaffIds.Any() && entity.TrainStaffIds.Count != entity.RequestNum) |
|
|
|
|
|
|
|
throw new Exception("需求人数与培训对象人数不一致,请确认数据重新提交!"); |
|
|
|
|
|
|
|
} |
|
|
|
var id = await base.Add(entity); |
|
|
|
var id = await base.Add(entity); |
|
|
|
|
|
|
|
|
|
|
|
var sql = $"SELECT ISNULL(MAX(id)+1,1) FROM Ghre_Request WHERE Id !='{id}'"; |
|
|
|
var sql = $"SELECT ISNULL(MAX(id)+1,1) FROM Ghre_Request WHERE Id !='{id}'"; |
|
|
@ -325,8 +332,9 @@ FROM Ghre_Request A |
|
|
|
|
|
|
|
|
|
|
|
#region Excel导入 |
|
|
|
#region Excel导入 |
|
|
|
|
|
|
|
|
|
|
|
public static async Task<(List<Dictionary<string, object>>, int)> ValidImportExcel(ISqlSugarClient Db, List<QueryExportColumn> columns, DataTable dt) |
|
|
|
public async Task<(List<Dictionary<string, object>>, int)> ValidImportExcel(ISqlSugarClient Db, List<QueryExportColumn> columns, DataTable dt) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
var CompanyCode = await QueryCompanyCode(); |
|
|
|
Type entityType = typeof(Ghre_Request); |
|
|
|
Type entityType = typeof(Ghre_Request); |
|
|
|
var properties = entityType.GetGenericProperties(); |
|
|
|
var properties = entityType.GetGenericProperties(); |
|
|
|
int ErrorCount = 0; |
|
|
|
int ErrorCount = 0; |
|
|
@ -344,8 +352,22 @@ FROM Ghre_Request A |
|
|
|
{ |
|
|
|
{ |
|
|
|
var value = dt.Rows[i][x.label].ToString(); |
|
|
|
var value = dt.Rows[i][x.label].ToString(); |
|
|
|
var courseSource = dt.Rows[i]["课程来源"].ToString(); |
|
|
|
var courseSource = dt.Rows[i]["课程来源"].ToString(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (x.label == "需求来源" && value == "部门需求" && CompanyCode == "Ushio") |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
var RequestNum = dt.Rows[i]["需求人数"].ObjToInt(); |
|
|
|
|
|
|
|
var TrainStaffIds1 = dt.Rows[i]["培训对象"].ToString(); |
|
|
|
|
|
|
|
TrainStaffIds1 = TrainStaffIds1.Replace(",", ","); |
|
|
|
|
|
|
|
TrainStaffIds1 = TrainStaffIds1.Replace(";", ","); |
|
|
|
|
|
|
|
TrainStaffIds1 = TrainStaffIds1.Replace(";", ","); |
|
|
|
|
|
|
|
var value1 = value.Split(',').ToList(); |
|
|
|
|
|
|
|
if (value1.Any() && value1.Count != RequestNum) |
|
|
|
|
|
|
|
throw new Exception("需求人数与培训对象人数不一致,请确认数据重新提交!"); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (x.label == "需求课程" || x.label == "新增课程") |
|
|
|
if (x.label == "需求课程" || x.label == "新增课程") |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
|
|
|
|
if (x.label == "需求课程" && courseSource == "已有课程" && value.IsNullOrEmpty()) |
|
|
|
if (x.label == "需求课程" && courseSource == "已有课程" && value.IsNullOrEmpty()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
comments.Add(x.label + "不能为空!"); |
|
|
|
comments.Add(x.label + "不能为空!"); |
|
|
|