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 f66d1a954..fb9ec9227 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 @@ -226,6 +226,24 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers { return View(); } + /// + /// 床位管理 + /// + /// + [HttpGet] + public ActionResult IndexBed() + { + return View(); + } + /// + /// 床位管理 + /// + /// + [HttpGet] + public ActionResult FormBed() + { + return View(); + } #endregion @@ -397,6 +415,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("删除成功!"); + } + /// /// 保存实体数据(新增、修改) /// 主键 /// @@ -410,7 +440,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("保存成功!"); + } + /// /// 寝室分配系 /// 主键 @@ -439,6 +483,7 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers accommodationIBLL.SaveRoom(RoomId, list); return Success("保存成功!"); } + /// /// 学生宿舍的单元、楼层、房间、床位添加 /// @@ -450,11 +495,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/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 006f55cbf..d4664f16f 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 3d4756ee6..97304ee77 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 @@ -247,7 +247,7 @@ var bootstrap = function ($, learun) { var keyValue = $('#gridtable').jfGridValue('ID'); if (learun.checkrow(keyValue)) { if (keyValue.indexOf(',') != -1) { - learun.alert.warning("只能选择一条记录!"); + learun.alert.warning("只能选择一条记录进行编辑!"); return false; } learun.layerForm({ @@ -261,24 +261,10 @@ var bootstrap = function ($, learun) { } }); } - + }); - //分类管理 - $("#lr_Classify").on("click", function () { - learun.layerForm({ - id: 'indexBed', - title: '分类管理', - url: top.$.rootUrl + '/LogisticsManagement/Accommodation/IndexClassify', - width: 1200, - height: 780, - btn: null, - callBack: function (id) { - return top[id].acceptClick(refreshGirdData); - } - }); - }); }, //初始化左侧树 initTree: function () { 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 30f9f4240..eb5218731 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 @@ -1300,6 +1300,7 @@ + @@ -1310,6 +1311,7 @@ + @@ -7584,6 +7586,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 ee125e205..d1569482a 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 @@ -583,6 +583,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); + } + } + } + /// /// 保存实体数据(新增、修改) /// 主键 @@ -607,6 +632,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 84cee539c..8fc202a97 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 @@ -71,6 +71,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// /// void DeleteEntity(string keyValue); + void DeleteBed(string keyValue, string ParentID); string GetBuildType(string parentID); string GetParentBuildType(string keyValue); @@ -80,6 +81,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 1573f0d4e..0fb58ff46 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 @@ -1021,6 +1021,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(); @@ -1579,6 +1600,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