diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/AccommodationController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/AccommodationController.cs index eadc78e89..c01fd46c8 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/AccommodationController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/AccommodationController.cs @@ -172,6 +172,24 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers { return View(); } + /// + /// 床位管理 + /// + /// + [HttpGet] + public ActionResult IndexBed() + { + return View(); + } + /// + /// 床位管理 + /// + /// + [HttpGet] + public ActionResult FormBed() + { + return View(); + } #endregion @@ -330,6 +348,18 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers return Success("删除成功!"); } /// + /// 删除 + /// 主键 + /// + /// + [HttpPost] + [AjaxOnly] + public ActionResult DeleteBed(string keyValue,string ParentID) + { + accommodationIBLL.DeleteBed(keyValue, ParentID); + return Success("删除成功!"); + } + /// /// 保存实体数据(新增、修改) /// 主键 /// @@ -343,7 +373,21 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers accommodationIBLL.SaveEntity(keyValue, entity); return Success("保存成功!"); } - + /// + /// 保存实体数据(新增、修改) + /// 主键 + /// + /// + [HttpPost] + [ValidateAntiForgeryToken] + [AjaxOnly] + public ActionResult SaveBedForm(string keyValue,string ParentID, string strEntity) + { + Acc_DormitoryBuildEntity entity = strEntity.ToObject(); + accommodationIBLL.SaveBedEntity(keyValue, ParentID, entity); + return Success("保存成功!"); + } + /// /// 寝室分配系 /// 主键 @@ -372,6 +416,7 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers accommodationIBLL.SaveRoom(RoomId, list); return Success("保存成功!"); } + /// /// 学生宿舍的单元、楼层、房间、床位添加 /// @@ -383,11 +428,6 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers [AjaxOnly] public ActionResult DormitoryAdd(string keyValue, string strEntity) { - //dynamic entity = JsonConvert.DeserializeObject(strEntity); - //var ElementNum = entity.ElementNum; - //var FloorNum = entity.FloorNum; - //var RoomNum = entity.RoomNUm; - //var BedNum = entity.BedNum; JObject jsonEntity = JObject.Parse(strEntity); var elementNum = int.Parse(jsonEntity["ElementNum"].ToString()); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormBed.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormBed.cshtml new file mode 100644 index 000000000..dfd044b5c --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormBed.cshtml @@ -0,0 +1,12 @@ +@{ + ViewBag.Title = "学生宿舍管理"; + Layout = "~/Views/Shared/_Form.cshtml"; +} +
+
+
名称
+ +
+ +
+@Html.AppendJsFile("/Areas/LogisticsManagement/Views/Accommodation/FormBed.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormBed.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormBed.js new file mode 100644 index 000000000..c9bf45f59 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormBed.js @@ -0,0 +1,52 @@ +/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) + * Copyright (c) 2013-2018 北京泉江科技有限公司 + * 创建人:超级管理员 + * 日 期:2019-04-26 15:02 + * 描 述:学生宿舍管理 + */ +var acceptClick; +var keyValue = request('keyValue'); +var ParentID = request('ParentID'); +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + $('.lr-form-wrap').lrscroll(); + page.bind(); + page.initData(); + }, + bind: function () { + + }, + initData: function () { + if (!!keyValue) { + $.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetFormData?keyValue=' + keyValue, function (data) { + for (var id in data) { + if (!!data[id].length && data[id].length > 0) { + $('#' + id).jfGridSet('refreshdata', data[id]); + } + else { + $('[data-table="' + id + '"]').lrSetFormData(data[id]); + } + } + }); + } + }, + }; + // 保存数据 + acceptClick = function (callBack) { + if (!$('body').lrValidform()) { + return false; + } + var postData = { + strEntity: JSON.stringify($('body').lrGetFormData()) + }; + $.lrSaveForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/SaveBedForm?keyValue=' + keyValue + '&ParentID=' + ParentID, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormRoom.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormRoom.js index ee92b9db6..a0bf149da 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormRoom.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormRoom.js @@ -17,23 +17,7 @@ var bootstrap = function ($, learun) { page.initData(); }, bind: function () { - //$('.Student').lrselect({ - // value: "stuid", - // text: "stuname", - // url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable', - // param: { code: "StuInfoBasic", strWhere: "ClassNo='" + Class + "'" }, - // select: function (item) { - // if (item) { - // console.log(item); - // $.each(arr, - // function(index, value) { - // console.log('arr_index',value); - // console.log('arr_index',value); - // }); - // } - - // } - //}); + }, initData: function () { if (!!keyValue) { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.cshtml index ff9a66fe1..49661d9c9 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.cshtml @@ -66,8 +66,9 @@
 录入 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.js index 8df0af2cb..10aa87770 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.js @@ -238,6 +238,30 @@ var bootstrap = function ($, learun) { } }); + + //床位管理 + $("#lr_bedManage").on("click", function () { + var keyValue = $('#gridtable').jfGridValue('ID'); + if (learun.checkrow(keyValue)) { + if (keyValue.indexOf(',') != -1) { + learun.alert.warning("只能选择一条记录进行编辑!"); + return false; + } + learun.layerForm({ + id: 'indexBed', + title: '床位管理', + url: top.$.rootUrl + '/LogisticsManagement/Accommodation/IndexBed?ParentID=' + keyValue, + width: 700, + height: 500, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } + + + }); + }, //初始化左侧树 initTree: function () { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexBed.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexBed.cshtml new file mode 100644 index 000000000..a04a0afeb --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexBed.cshtml @@ -0,0 +1,61 @@ +@{ + ViewBag.Title = "学生宿舍管理"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +
+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ + + +@*
+
+
+
+ 树形列表 + 刷新 +
+
+
+
+
+
+ +
+ +
+
+ +
+ +
+
+
+
+
+
*@ + +@Html.AppendJsFile("/Areas/LogisticsManagement/Views/Accommodation/IndexBed.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexBed.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexBed.js new file mode 100644 index 000000000..04b75f750 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexBed.js @@ -0,0 +1,110 @@ +/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) + * Copyright (c) 2013-2018 北京泉江科技有限公司 + * 创建人:超级管理员 + * 日 期:2019-04-26 15:02 + * 描 述:学生宿舍管理 + */ +var refreshGirdData; +var acceptClick; +var selectedParent = {}; +var ParentID = request('ParentID'); +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + page.initGird(); + page.bind(); + + }, + bind: function () { + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + // 新增 + $('#lr_add').on('click', function () { + learun.layerForm({ + id: 'form', + title: '新增', + url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormBed?ParentID=' + ParentID, + width: 400, + height: 300, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + }); + // 编辑 + $('#lr_edit').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('ID'); + if (learun.checkrow(keyValue)) { + if (keyValue.indexOf(',') != -1) { + learun.alert.warning("只能选择一条记录进行编辑!"); + return false; + } + learun.layerForm({ + id: 'form', + title: '编辑', + url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormBed?keyValue=' + keyValue + '&ParentID=' + ParentID, + width: 400, + height: 300, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } + }); + // 删除 + $('#lr_delete').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('ID'); + if (learun.checkrow(keyValue)) { + learun.layerConfirm('是否确认删除该项!', function (res) { + if (res) { + learun.deleteForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/DeleteBed', { keyValue: keyValue, ParentID: ParentID }, function () { + refreshGirdData(); + }); + } + }); + } + }); + + // 打印 + $('#lr_print').on('click', function () { + $('#gridtable').jqprintTable(); + }); + + + }, + // 初始化列表 + initGird: function () { + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetBedListByRoomId?RoomId=' + ParentID, + headData: [ + { label: "名称", name: "Name", width: 100, align: "left" }, + + ], + mainId: 'ID', + isPage: false, + //isMultiselect: true, + //sidx: 'ApartmentId asc,UnitId asc ,FloorId asc ', + //sord: 'ASC', + + }); + page.search(); + }, + search: function (param) { + param = param || {}; + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + } + }; + refreshGirdData = function () { + page.search(); + }; + // 保存数据 + acceptClick = function (callBack) { + if (!!callBack) { + callBack(); + } + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index baa54306f..99a8f794f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj @@ -1220,11 +1220,13 @@ + + @@ -7506,6 +7508,8 @@ + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs index 6157526a8..ea1fc0a50 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationBLL.cs @@ -523,6 +523,31 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } + + /// + /// 删除实体数据 + /// 主键 + /// + /// + public void DeleteBed(string keyValue, string ParentID) + { + try + { + accommodationService.DeleteBed(keyValue, ParentID); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// /// 保存实体数据(新增、修改) /// 主键 @@ -547,6 +572,32 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } + /// + /// 保存实体数据(新增、修改) + /// 主键 + /// + /// + public void SaveBedEntity(string keyValue,string ParentID, Acc_DormitoryBuildEntity entity) + { + try + { + accommodationService.SaveBedEntity(keyValue, ParentID, 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/LogisticsManagement/Accommodation/AccommodationIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationIBLL.cs index b09bf2076..47a64bac8 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationIBLL.cs @@ -69,6 +69,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// /// void DeleteEntity(string keyValue); + void DeleteBed(string keyValue, string ParentID); string GetBuildType(string parentID); string GetParentBuildType(string keyValue); @@ -78,6 +79,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// /// void SaveEntity(string keyValue, Acc_DormitoryBuildEntity entity); + void SaveBedEntity(string keyValue,string ParentID, Acc_DormitoryBuildEntity entity); void SaveDeptClass(string keyValue, Acc_DormitoryBuildEntity entity,int type); void SaveRoom(string RoomId, List list); diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs index 88e58316d..e0d72f00c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationService.cs @@ -915,6 +915,27 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName } } + + public void DeleteBed(string keyValue, string ParentID) + { + try + { + this.BaseRepository("CollegeMIS").Delete(t => t.ID == keyValue); + UpdateCheckInNum(ParentID); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + public void DeleteAll(string parentid) { var list = this.BaseRepository("CollegeMIS").FindList(a => a.ParentID == parentid).ToList(); @@ -1472,6 +1493,74 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName } } + + /// + /// 保存实体数据(新增、修改) + /// 主键 + /// + /// + public void SaveBedEntity(string keyValue, string ParentID, Acc_DormitoryBuildEntity entity) + { + var db = this.BaseRepository("CollegeMIS"); + try + { + db.BeginTrans(); + if (!string.IsNullOrEmpty(keyValue)) + { + entity.Modify(keyValue); + db.Update(entity); + } + else + { + var parentEntity = db.FindEntity(ParentID); + entity.Create(); + entity.ApartmentId = parentEntity.ApartmentId; + entity.UnitId = parentEntity.UnitId; + entity.FloorId = parentEntity.FloorId; + entity.ParentID = ParentID; + entity.BuildType = "5"; + db.Insert(entity); + } + db.Commit(); + UpdateCheckInNum(ParentID); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + private void UpdateCheckInNum(string ParentID) + { + try + { + string sql = $@"update [dbo].[Acc_DormitoryBuild] set RoomType=( +select count(1) from [dbo].[Acc_DormitoryBuild] where ParentId='{ParentID}' and BuildType='5' +) +where ID='{ParentID}' +"; + this.BaseRepository("CollegeMIS").ExecuteBySql(sql); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + public void SaveDeptClass(string keyValue, Acc_DormitoryBuildEntity entity, int type) { try