diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/MeetingManagementController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/MeetingManagementController.cs index b003db4ae..afd25fe52 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/MeetingManagementController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/MeetingManagementController.cs @@ -170,6 +170,12 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers { UserInfo userInfo = LoginUserInfo.Get(); MeetingManagementEntity entity = strEntity.ToObject(); + //判断会议场地是否被占用 + var isOccupy = meetingManagementIBLL.JudgeIsOccupy(entity); + if (isOccupy) + { + return Fail("会议场地当前时间段已被占用!"); + } entity.CreateUser = userInfo.userId; entity.CreateTime = DateTime.Now; entity.CheckStatus = "0"; @@ -200,6 +206,13 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers [AjaxOnly] public ActionResult DoSubmit(string keyValue, string status, string processId) { + //判断会议场地是否被占用 + var entity = meetingManagementIBLL.GetMeetingManagementEntity(keyValue); + var isOccupy = meetingManagementIBLL.JudgeIsOccupy(entity); + if (isOccupy) + { + return Fail("会议场地当前时间段已被占用!"); + } meetingManagementIBLL.DoSubmit(keyValue, status, processId); return Success("操作成功!"); } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/MeetingManagement/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/MeetingManagement/Form.js index 469b7203c..86247033c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/MeetingManagement/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/MeetingManagement/Form.js @@ -93,6 +93,14 @@ var bootstrap = function ($, learun) { if (!$('body').lrValidform()) { return false; } + //验证结束时间必须大于开始时间 + var BeginTime = $("#BeginTime").val(); + var EndTime = $("#EndTime").val(); + if (new Date(EndTime) <= new Date(BeginTime)) { + learun.alert.warning("会议结束时间必须大于会议开始时间!"); + return false; + } + return true; }; // 保存数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/MeetingManagement/MeetingManagementBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/MeetingManagement/MeetingManagementBLL.cs index 6db1c2702..ee0a04f39 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/MeetingManagement/MeetingManagementBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/MeetingManagement/MeetingManagementBLL.cs @@ -215,6 +215,30 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } + /// + /// 判断会议场地是否被占用 + /// 主键 + /// + /// + public bool JudgeIsOccupy(MeetingManagementEntity entity) + { + try + { + return meetingManagementService.JudgeIsOccupy(entity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// /// 审核实体数据 /// 主键 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/MeetingManagement/MeetingManagementIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/MeetingManagement/MeetingManagementIBLL.cs index 236b539c4..17bfe3c1f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/MeetingManagement/MeetingManagementIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/MeetingManagement/MeetingManagementIBLL.cs @@ -70,6 +70,13 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// /// void DoSubmit(string keyValue, string status, string processId); + + /// + /// 判断会议场地是否被占用 + /// 主键 + /// + /// + bool JudgeIsOccupy(MeetingManagementEntity entity); /// /// 审核实体数据 /// 主键 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/MeetingManagement/MeetingManagementService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/MeetingManagement/MeetingManagementService.cs index c159ae22c..94b23a4e5 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/MeetingManagement/MeetingManagementService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/MeetingManagement/MeetingManagementService.cs @@ -378,6 +378,57 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } + /// + /// 判断会议场地是否被占用 + /// 主键 + /// + /// + public bool JudgeIsOccupy(MeetingManagementEntity entity) + { + try + { + var result = false;//默认false,代表未占用 + + //查找已提交/已审核通过的会议场地 + var list = this.BaseRepository("CollegeMIS").FindList(x => x.MeetingPlace == entity.MeetingPlace && (x.CheckStatus == "1" || x.CheckStatus == "3")).OrderBy(x => x.BeginTime); + if (list.Any()) + { + //有则判断时间是否冲突 + foreach (var item in list) + { + //开始时间:小于区间左,则判断结束时间;区间中间,则占用;大于区间右,则不占用; + if (entity.BeginTime < item.BeginTime) + { + //结束时间:小于区间左,则不占用; + if (entity.EndTime > item.BeginTime) + { + result = true; + return result; + } + } + else if(entity.BeginTime < item.EndTime) + { + result = true; + return result; + } + } + } + + return result; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// /// 审核实体数据 /// 主键