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 984afa1b0..26194b945 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 @@ -7,6 +7,7 @@ using System.Web.Helpers; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; +using System.Linq; namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers { @@ -47,11 +48,16 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers /// /// [HttpGet] - public ActionResult Form(string ParentID = null, string ParentName = null) + public ActionResult Form(string ParentID = null, string ParentName = null, string keyValue = null) { ViewBag.ParentID = ParentID; ViewBag.ParentName = ParentName; ViewBag.BuildType = accommodationIBLL.GetBuildType(ParentID); + if (!string.IsNullOrEmpty(keyValue)) + { + ViewBag.BuildType = accommodationIBLL.GetParentBuildType(keyValue); + } + return View(); } @@ -233,27 +239,7 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers var data = accommodationIBLL.GetBedListByRoomId(RoomId).OrderBy(x => x.DNo); return Success(data); } - /// - /// 获取分类数据 - /// - /// - /// - [HttpGet] - [AjaxOnly] - public ActionResult GetClassifyList(string pagination, string queryJson) - { - Pagination paginationobj = pagination.ToObject(); - var data = accommodationIBLL.GetClassifyList(paginationobj,queryJson); - var jsonData = new - { - rows = data, - total = paginationobj.total, - page = paginationobj.page, - records = paginationobj.records - }; - return Success(jsonData); - } - + /// /// 获取宿舍楼数据 /// @@ -444,6 +430,15 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers } + /// + /// 同步宿舍信息数据 + /// + /// + public ActionResult SyncData() + { + accommodationIBLL.SyncData(); + return Success("同步成功"); + //public ActionResult DormitoryAdd(string a,string ) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.cshtml index 630cbbefa..bf8ed99d3 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.cshtml @@ -8,23 +8,23 @@ {
上级
- - + +
}
名称
- +
编号*
- +
位置
- +
类别*
@@ -49,23 +49,23 @@
*@
负责人
- +
负责人电话
- +
价格
- +
@*
-
顺序
- -
*@ +
顺序
+ + *@ @if (ViewBag.BuildType == "3") - { + { //寝室信息
性别
@@ -73,11 +73,7 @@
舍长
- -
-
-
学生名字
- +
类型
@@ -85,14 +81,20 @@
星级
- +
是否独卫
} - + @if (ViewBag.BuildType == "4") + { +
+
学生名字
+ +
+ }
备注
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 9c1a99e69..006f55cbf 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 @@ -28,41 +28,37 @@
宿舍楼
-
+
单元
-
+
楼层
-
+
- @*
+ @*
类别
*@ -
-
学校
- -
-
-
- -
-
-
班级
- -
-
-
专业
- -
-
-
性别
-
-
+
+
+
+
+
+
专业
+
+
+
+
班级
+
+
+
+
性别
+
+
@@ -71,6 +67,7 @@  批量添加宿舍  自动分配宿舍 + @* 同步宿舍信息*@
 新增宿舍 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 ceaa57b09..749e04695 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 @@ -20,11 +20,107 @@ var bootstrap = function ($, learun) { $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { page.search(queryJson); - }, 220, 400); - $('#Sex').lrRadioCheckbox({ - type: 'radio', - code: 'usersex', + }, 420, 400); + //宿舍楼 + $('#ApartmentId').lrselect({ + allowSearch: true, + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=DormitoryInfo', + param: { strWhere: " BuildType='1' " }, + value: "id", + text: "name", + select: function (item) { + if (!!item) { + //单元 + $('#UnitId').lrselectRefresh({ + allowSearch: true, + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=DormitoryInfo', + param: { strWhere: " BuildType='2' and ApartmentId='" + item.id + "'" }, + value: "id", + text: "name", + select: function (item) { + if (!!item) { + //楼层 + $('#FloorId').lrselectRefresh({ + allowSearch: true, + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=DormitoryInfo', + param: { strWhere: " BuildType='3' and UnitId='" + item.id + "'" }, + value: "id", + text: "name" + }); + } + } + }); + } + } + }); + $('#UnitId').lrselect({ allowSearch: true }); + $('#FloorId').lrselect({ allowSearch: true }); + + $('#Sex').lrDataItemSelect({code: 'usersex'}); + //.lrRadioCheckbox({ + // type: 'radio', + // code: 'usersex', + //}); + + $('#Class').lrselect({ + value: "classno", + text: "classname" + }); + + $('#Dept').lrselect({ + value: "deptno", + text: "deptname", + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=CdDeptInfo', + select: function (item) { + if (item) { + $('#Major').lrselectRefresh({ + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable', + param: { code: "CdMajorInfo", strWhere: "DeptNo='" + item.deptno + "'" } + }); + } + else { + $('#Major').lrselectRefresh({ + url: "", + data: [] + }); + } + $('#Class').lrselectRefresh({ + url: "", + data: [] + }); + } + }); + $('#Major').lrselect({ + value: "majorno", + text: "majorname", + select: function (item) { + if (item) { + $('#Class').lrselectRefresh({ + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable', + param: { code: "bjsj", strWhere: "DeptNo='" + item.deptno + "' and majorno='" + item.majorno + "'" } + }); + } + + } }); + + + $('#Major').on("click", + function () { + var data = $('#Dept').lrselectGet(); + if (!data) { + learun.alert.error('请先选择系'); + } + }); + $('#Class').on("click", + function () { + var data1 = $('#Dept').lrselectGet(); + var data2 = $('#Major').lrselectGet(); + if (!data1 || !data2) { + learun.alert.error('请先选择系和专业'); + } + }); + // 刷新 $('#lr_refresh').on('click', function () { location.reload(); @@ -215,9 +311,8 @@ var bootstrap = function ($, learun) { initGird: function () { $("#gridtable").empty(); $("#gridtable")[0].dfop = undefined; - // console.log('selectedParent.BuildType', selectedParent.BuildType); if (selectedParent.BuildType == undefined || selectedParent.BuildType === "3") { - // console.log('查询寝室列表'); + //宿舍数据 $('#gridtable').jfGrid({ url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetPageList', headData: [ @@ -301,14 +396,13 @@ var bootstrap = function ($, learun) { }, { label: "性别", name: "Sex", width: 100, align: "left", - formatterAsync: function (callback, value, row, op, $cell) { - learun.clientdata.getAsync('dataItem', { - key: value, - code: 'usersex', - callback: function (_data) { - callback(_data.text); - } - }); + formatter: function (callback, value, row, op, $cell) { + if (value == '0') + return '女'; + else if (value == '1') + return '男'; + else + return ''; } }, { label: "负责人", name: "Functionary", width: 100, align: "left" }, @@ -320,6 +414,37 @@ var bootstrap = function ($, learun) { isMultiselect: true, sidx: 'ApartmentId asc,UnitId asc ,FloorId asc ', //sord: 'ASC', + isSubGrid: true, // 是否有子表 + subGridExpanded: function (subContentId, rowItem) { + $('#' + subContentId).jfGrid({ + url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetBedListByRoomId?RoomId=' + rowItem.ID, + headData: [ + { label: "名称", name: "Name", width: 100, align: "left" }, + { + label: "学生", name: "StudentID", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'StuInfoBasic', + key: value, + keyId: 'stuid', + callback: function (_data) { + callback(_data['stuname']); + } + }); + } + }, + ], + mainId: 'ID', + isPage: false, + //sidx: 'DNo', + //sord: 'ASC', + }); + //var param; + //param = param || {}; + //param.ParentID = rowItem.Id; + $('#' + subContentId).jfGridSet('reload'); + }, + subGridHeight: 250, }); } else { //lrAuthorizeJfGridLei @@ -410,7 +535,7 @@ var bootstrap = function ($, learun) { ], mainId: 'ID', isPage: true, - isMultiselect: true + //isMultiselect: true //sidx: 'ApartmentId asc,UnitId asc ,FloorId asc ', //sord: 'ASC', }); 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 8773ca846..0b81e8815 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 @@ -42,6 +42,26 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } } + + public IEnumerable GetBedListByRoomId(string RoomId) + { + try + { + return accommodationService.GetBedListByRoomId(RoomId); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + public IEnumerable GetAllList() { try @@ -198,6 +218,27 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } + public string GetParentBuildType(string keyValue) + { + try + { + return accommodationService.GetParentBuildType(keyValue); + + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + + } + /// /// 获取Acc_DormitoryBuild表实体数据 /// 主键 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 31b843de2..83afc60d6 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 @@ -21,6 +21,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// 查询参数 /// IEnumerable GetPageList(Pagination pagination, string queryJson); + IEnumerable GetBedListByRoomId(string RoomId); IEnumerable GetAllList(); IEnumerable GetClassifyList(Pagination paginationobj,string queryJson); /// @@ -71,6 +72,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// void DeleteEntity(string keyValue); string GetBuildType(string parentID); + string GetParentBuildType(string keyValue); /// /// 保存实体数据(新增、修改) 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 277bc8b83..f41cf4b10 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 @@ -73,6 +73,22 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName strSql.Append(" AND t.BuildType ='4' "); } + if (!queryParam["ApartmentId"].IsEmpty()) + { + dp.Add("ApartmentId", queryParam["ApartmentId"].ToString(), DbType.String); + strSql.Append(" AND t.ApartmentId =@ApartmentId "); + } + if (!queryParam["UnitId"].IsEmpty()) + { + dp.Add("UnitId", queryParam["UnitId"].ToString(), DbType.String); + strSql.Append(" AND t.UnitId =@UnitId "); + } + if (!queryParam["FloorId"].IsEmpty()) + { + dp.Add("FloorId", queryParam["FloorId"].ToString(), DbType.String); + strSql.Append(" AND t.FloorId =@FloorId "); + } + if (!queryParam["Name"].IsEmpty()) { dp.Add("Name", "%" + queryParam["Name"].ToString() + "%", DbType.String); @@ -86,17 +102,17 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName if (!queryParam["Dept"].IsEmpty()) { dp.Add("Dept", "%" + queryParam["Dept"].ToString() + "%", DbType.String); - strSql.Append(" AND t.Dept Like @Dept "); + strSql.Append(" AND t.Dept=@Dept "); } if (!queryParam["Class"].IsEmpty()) { dp.Add("Class", "%" + queryParam["Class"].ToString() + "%", DbType.String); - strSql.Append(" AND t.Class Like @Class "); + strSql.Append(" AND t.Class=@Class "); } if (!queryParam["Major"].IsEmpty()) { dp.Add("Major", "%" + queryParam["Major"].ToString() + "%", DbType.String); - strSql.Append(" AND t.Major Like @Major "); + strSql.Append(" AND t.Major=@Major "); } if (!queryParam["Sex"].IsEmpty()) { @@ -174,6 +190,27 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName } } } + + public IEnumerable GetBedListByRoomId(string RoomId) + { + try + { + string sql = $"select ID,Name,DNo,StudentID from Acc_DormitoryBuild where BuildType='5' and ParentID='{RoomId}'"; + return this.BaseRepository("CollegeMIS").FindList(sql); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + public IEnumerable GetAllList() { try @@ -303,6 +340,35 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName } } + public string GetParentBuildType(string keyValue) + { + try + { + string sql = $@" select BuildType from [dbo].[Acc_DormitoryBuild] where Id=( + select parentid from [dbo].[Acc_DormitoryBuild] where id='{keyValue}')"; + var data = this.BaseRepository("CollegeMIS").FindObject(sql); + if (data == null) + { + return ""; + } + else + { + return data.ToString(); + } + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + internal object GetRoomList(string parentID) { try @@ -1004,7 +1070,9 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName var elementEntity = new Acc_DormitoryBuildEntity { ParentID = keyValue, + ApartmentId = keyValue, Name = i.ToString() + "单元", + DNo = i.ToString(), BuildType = "2",//单元类型 Sex = dormitory.Sex, Address = dormitory.Address, @@ -1031,7 +1099,10 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName var floorEntity = new Acc_DormitoryBuildEntity { ParentID = elementEntity.ID, + ApartmentId = keyValue, + UnitId = elementEntity.ID, Name = j.ToString() + "层", + DNo = j.ToString(), BuildType = "3",//楼层类型, Sex = dormitory.Sex, Address = dormitory.Address, @@ -1058,7 +1129,11 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName var roomEntity = new Acc_DormitoryBuildEntity { ParentID = floorEntity.ID, + ApartmentId = keyValue, + UnitId = elementEntity.ID, + FloorId = floorEntity.ID, Name = j.ToString() + (n < 10 ? "0" + n.ToString() : n.ToString()) + "室", + DNo = j.ToString() + (n < 10 ? "0" + n.ToString() : n.ToString()), BuildType = "4",//房间类型 Sex = dormitory.Sex, Address = dormitory.Address, @@ -1088,6 +1163,7 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName { ParentID = roomEntity.ID, Name = m.ToString() + "床", + DNo = m.ToString(), BuildType = "5", Sex = dormitory.Sex, Address = dormitory.Address,