[牛尾] 培训需求新增需求人数与培训对象数量校验

[牛尾] 我的学习,公开课设置默认排序
master
xiaochanghai 4 months ago
parent 5dcbb2bd81
commit bb2581eecf
  1. 28
      Model/Tiobon.Web.pdm
  2. 8
      Tiobon.Core.Services/Ghre/Ghre_CourseServices.cs
  3. 44
      Tiobon.Core.Services/Ghre/Ghre_RequestServices.cs
  4. 7
      Tiobon.Core.Services/Ghre/Ghre_StudyRecordServices.cs

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<?PowerDesigner AppLocale="UTF16" ID="{C294868A-C3F3-41AD-98CC-78B6D4E0CC40}" Label="" LastModificationDate="1739932932" Name="Tiobon" Objects="3189" Symbols="123" Target="Microsoft SQL Server 2008" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="15.0.0.2613"?>
<?PowerDesigner AppLocale="UTF16" ID="{C294868A-C3F3-41AD-98CC-78B6D4E0CC40}" Label="" LastModificationDate="1740024007" Name="Tiobon" Objects="3189" Symbols="123" Target="Microsoft SQL Server 2008" Type="{CDE44E21-9669-11D1-9914-006097355D9B}" signature="PDM_DATA_MODEL_XML" version="15.0.0.2613"?>
<!-- do not edit this file -->
<Model xmlns:a="attribute" xmlns:c="collection" xmlns:o="object">
@ -13900,7 +13900,7 @@ LABL 0 Arial Unicode MS,8,N</a:FontList>
<a:Code>Ghre_Course</a:Code>
<a:CreationDate>1713839845</a:CreationDate>
<a:Creator>Administrator</a:Creator>
<a:ModificationDate>1738822136</a:ModificationDate>
<a:ModificationDate>1740024007</a:ModificationDate>
<a:Modifier>Administrator</a:Modifier>
<a:Comment>课程</a:Comment>
<c:Columns>
@ -14063,6 +14063,17 @@ LABL 0 Arial Unicode MS,8,N</a:FontList>
<a:Length>64</a:Length>
</o:Column>
<o:Column Id="o332">
<a:ObjectID>C7365459-E3F3-49CA-8372-60D1FCEDF4A0</a:ObjectID>
<a:Name>课程分类ID2</a:Name>
<a:Code>CourseClassId2</a:Code>
<a:CreationDate>1717723947</a:CreationDate>
<a:Creator>Administrator</a:Creator>
<a:ModificationDate>1717723991</a:ModificationDate>
<a:Modifier>Administrator</a:Modifier>
<a:Comment>课程分类ID</a:Comment>
<a:DataType>bigint</a:DataType>
</o:Column>
<o:Column Id="o333">
<a:ObjectID>1335D331-DAA5-4CD0-9A46-A58317A9F23F</a:ObjectID>
<a:Name>课程分类ID</a:Name>
<a:Code>CourseClassId</a:Code>
@ -14074,17 +14085,6 @@ LABL 0 Arial Unicode MS,8,N</a:FontList>
<a:DataType>nvarchar(2000)</a:DataType>
<a:Length>2000</a:Length>
</o:Column>
<o:Column Id="o333">
<a:ObjectID>C7365459-E3F3-49CA-8372-60D1FCEDF4A0</a:ObjectID>
<a:Name>课程分类ID2</a:Name>
<a:Code>CourseClassId2</a:Code>
<a:CreationDate>1717723947</a:CreationDate>
<a:Creator>Administrator</a:Creator>
<a:ModificationDate>1717723991</a:ModificationDate>
<a:Modifier>Administrator</a:Modifier>
<a:Comment>课程分类ID</a:Comment>
<a:DataType>bigint</a:DataType>
</o:Column>
<o:Column Id="o334">
<a:ObjectID>7A5BBC82-D331-4B1E-9332-138AA3B4BC05</a:ObjectID>
<a:Name>课程场景ID</a:Name>
@ -51745,7 +51745,7 @@ Ghra_staff_InsureBase
<o:Column Ref="o291"/>
</c:Object1>
<c:Object2>
<o:Column Ref="o332"/>
<o:Column Ref="o333"/>
</c:Object2>
</o:ReferenceJoin>
</c:Joins>

@ -1111,8 +1111,12 @@ public class Ghre_CourseServices : BaseServices<Ghre_Course, Ghre_CourseDto, Ins
WHERE A.IsOpen = 1
AND A.IsEnable = 1
AND A.Status = '{DIC_COURSE_STATUS.RELEASED}') A";
if (string.IsNullOrWhiteSpace(filter.orderBy))
if (await QueryCompanyCode() == "Ushio" && string.IsNullOrWhiteSpace(filter.orderBy))
{
filter.orderBy = "PublishTime DESC";
}
else
if (string.IsNullOrWhiteSpace(filter.orderBy))
filter.orderBy = "CourseName ASC";
string conditions = " WHERE 1=1";

@ -103,10 +103,18 @@ FROM Ghre_Request A
if (entity.CourseSource != "Dept")
entity.RequestNum = null;
if (entity.CourseSource == "Dept" && await QueryCompanyCode() == "Ushio")
if (entity.RequestSource == "Dept")
{
if (entity.TrainStaffIds.Any() && entity.TrainStaffIds.Count != entity.RequestNum)
throw new Exception("需求人数与培训对象人数不一致,请确认数据重新提交!");
if (await QueryCompanyCode() == "Ushio")
{
if (entity.TrainStaffIds.Any() && entity.TrainStaffIds.Count != entity.RequestNum)
throw new Exception("培训对象数量须和需求人数保持一致!");
}
else
{
if (entity.TrainStaffIds.Count != entity.RequestNum)
throw new Exception("培训对象数量须和需求人数保持一致!");
}
}
var id = await base.Add(entity);
@ -119,6 +127,20 @@ FROM Ghre_Request A
public override async Task<bool> Update(long Id, EditGhre_RequestInput entity)
{
if (entity.RequestSource == "Dept")
{
if (await QueryCompanyCode() == "Ushio")
{
if (entity.TrainStaffIds.Any() && entity.TrainStaffIds.Count != entity.RequestNum)
throw new Exception("培训对象数量须和需求人数保持一致!");
}
else
{
if (entity.TrainStaffIds.Count != entity.RequestNum)
throw new Exception("培训对象数量须和需求人数保持一致!");
}
}
if (entity.TrainStaffIds.IsNotEmptyOrNull())
entity.TrainStaffId = JsonHelper.ObjToJson(entity.TrainStaffIds);
else entity.TrainStaffId = null;
@ -353,16 +375,26 @@ FROM Ghre_Request A
var value = dt.Rows[i][x.label].ToString();
var courseSource = dt.Rows[i]["课程来源"].ToString();
if (x.label == "需求来源" && value == "部门需求" && CompanyCode == "Ushio")
if (x.label == "需求来源" && value == "部门需求")
{
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 (CompanyCode == "Ushio")
{
if (value1.Any() && value1.Count != RequestNum)
throw new Exception("培训对象数量须和需求人数保持一致!!");
}
else
{
if (value1.Count != RequestNum)
throw new Exception("培训对象数量须和需求人数保持一致!!");
}
}
if (x.label == "需求课程" || x.label == "新增课程")

@ -855,6 +855,11 @@ public class Ghre_StudyRecordServices : BaseServices<Ghre_StudyRecord, Ghre_Stud
/// <returns></returns>
public async Task<ServicePageResult<Ghre_StudyRecordESS>> QueryESS(QueryBody filter, string condition, bool? IsEnable = true)
{
if (await QueryCompanyCode() == "Ushio" && string.IsNullOrWhiteSpace(filter.orderBy))
{
filter.orderBy = "CoursePublishTime DESC";
}
else
if (string.IsNullOrWhiteSpace(filter.orderBy))
filter.orderBy = "JoinTime DESC";
@ -884,7 +889,7 @@ public class Ghre_StudyRecordServices : BaseServices<Ghre_StudyRecord, Ghre_Stud
A.ExamDateType,
A.AfterHowLong,
A.StudyProgress,
A.ExamId,A.ExamStatus
A.ExamId,A.ExamStatus,A.CoursePublishTime
FROM Ghre_StudyRecord_V A";
string conditions = $" WHERE UserId={App.User.ID} ";

Loading…
Cancel
Save