From c6edfa2328f21fe6258fe83f6c4ac3af2ed3b1e8 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Fri, 11 Feb 2022 18:27:19 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=AE=BF=E8=88=8D=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E8=B0=83=E6=95=B4=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/Accommodation/Form.cshtml | 48 ++- .../Views/Accommodation/Index.js | 293 +++--------------- .../Accommodation/Acc_DormitoryBuildEntity.cs | 14 +- .../Accommodation/AccommodationBLL.cs | 2 +- .../Accommodation/AccommodationService.cs | 282 +---------------- 5 files changed, 79 insertions(+), 560 deletions(-) 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 970177fa4..d6bdc03d2 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 @@ -3,7 +3,6 @@ Layout = "~/Views/Shared/_Form.cshtml"; }
- @**@ @if (ViewBag.ParentID != null) {
@@ -36,17 +35,17 @@
@*
-
-
-
-
-
专业
-
-
-
-
班级
-
-
*@ +
+
+
+
+
专业
+
+
+
+
班级
+
+
*@
负责人
@@ -59,14 +58,13 @@
价格
- @*
-
顺序
- -
*@ +
+
顺序
+ +
- @if (ViewBag.BuildType == "3") + @if (ViewBag.BuildType == "4") { - //寝室信息
性别
@@ -76,8 +74,8 @@
-
几人寝*
- +
学生名字
+
星级
@@ -88,16 +86,10 @@
} - @if (ViewBag.BuildType == "4") - { -
-
学生名字
- -
- } +
备注
- +
@Html.AppendJsFile("/Areas/LogisticsManagement/Views/Accommodation/Form.js") 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 402a3152c..e2aa18e97 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 @@ -14,113 +14,17 @@ var bootstrap = function ($, learun) { page.initGird(); page.search({ ParentID: '' }); page.bind(); - + }, bind: function () { $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { page.search(queryJson); - }, 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: [] - }); - } + }, 220, 400); + $('#Sex').lrRadioCheckbox({ + type: 'radio', + code: 'usersex', }); - $('#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(); @@ -288,7 +192,7 @@ var bootstrap = function ($, learun) { nodeClick: function (item) { selectedParent.ID = item.value; selectedParent.Name = item.text; - selectedParent.BuildType = item.title; + if (item.parent) { if (!item.parent.parentId) { selectedParent.ChildType = "2"; @@ -302,24 +206,13 @@ var bootstrap = function ($, learun) { if (item.text.indexOf("室") > -1) { selectedParent.ChildType = "5"; } - var param = {}; - - if (item.title == '1') - param.ApartmentId = item.value; - else if (item.title == '2') - param.UnitId = item.value; - else if (item.title == '3') - param.FloorId = item.value; - - //page.initGird(); - //page.search({ ParentID: item.value }); - page.search(param); + page.initGird(); + page.search({ ParentID: item.value }); } }); }, // 初始化列表 initGird: function () { - //宿舍数据 $('#gridtable').jfGrid({ url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetPageList', headData: [ @@ -328,11 +221,9 @@ var bootstrap = function ($, learun) { label: "宿舍楼", name: "ApartmentName", width: 100, align: "left" }, { - label: "单元", name: "UnitName", width: 100, align: "left" - }, + label: "单元", name: "UnitName", width: 100, align: "left" }, { - label: "楼层", name: "FloorName", width: 100, align: "left" - }, + label: "楼层", name: "FloorName", width: 100, align: "left" }, //{ // label: "学生", name: "StudentID", width: 100, align: "left", // formatterAsync: function (callback, value, row, op, $cell) { @@ -389,26 +280,16 @@ var bootstrap = function ($, learun) { } }, { label: "班级", name: "Class", width: 100, align: "left" }, - { - label: "寝室类型", name: "RoomType", width: 100, align: "left", - formatter: function (value, row) { - if (value) { - return value + '人寝'; - } else { - return ''; - } - } - }, - { label: "入住人数", name: "CheckInStu", width: 100, align: "left" }, { label: "性别", name: "Sex", width: 100, align: "left", - formatter: function (value, row) { - if (value == '0') - return '女'; - else if (value == '1') - return '男'; - else - return ''; + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('dataItem', { + key: value, + code: 'usersex', + callback: function (_data) { + callback(_data.text); + } + }); } }, { label: "负责人", name: "Functionary", width: 100, align: "left" }, @@ -420,142 +301,58 @@ 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, }); - //$("#gridtable").empty(); - //$("#gridtable")[0].dfop = undefined; - //if (selectedParent.BuildType == undefined || selectedParent.BuildType === "3") { - - //} else { - // //lrAuthorizeJfGridLei - // $('#gridtable').jfGrid({ + //if (selectedParent.ChildType == "5") { + // $('#gridtable').lrAuthorizeJfGridLei({ // url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetPageList', // headData: [ // { label: "名称", name: "Name", width: 100, align: "left" }, - // { - // label: "宿舍楼", name: "ApartmentName", width: 100, align: "left" - // }, - // { - // label: "单元", name: "UnitName", width: 100, align: "left" - // }, - // { - // label: "楼层", name: "FloorName", width: 100, align: "left" - // }, - // //{ - // // label: "学生", name: "StudentID", width: 100, align: "left", - // // formatterAsync: function (callback, value, row, op, $cell) { + // { label: "学生名字", name: "StuName", width: 100, align: "left" }, - // // learun.clientdata.getAsync('custmerData', { - // // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'StuInfoBasic', - // // key: value, - // // keyId: 'stuid', - // // callback: function (_data) { - // // callback(_data['stuname']); - // // } - // // }); - // // } - // //}, - // { label: "位置", name: "Address", width: 100, align: "left" }, + // { label: "班级", name: "Class", width: 100, align: "left" }, // { - // label: "校区", name: "Campus", width: 100, align: "left", + // label: "性别", name: "Sex", width: 100, align: "left", // formatterAsync: function (callback, value, row, op, $cell) { - - // learun.clientdata.getAsync('custmerData', { - // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'company', + // learun.clientdata.getAsync('dataItem', { // key: value, - // keyId: 'f_companyid', + // code: 'usersex', // callback: function (_data) { - // callback(_data['f_fullname']); + // callback(_data.text); // } // }); // } // }, - // //{ - // // label: "系", name: "Dept", width: 100, align: "left", - // // formatterAsync: function (callback, value, row, op, $cell) { - // // learun.clientdata.getAsync('custmerData', { - // // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo', - // // key: value, - // // keyId: 'deptno', - // // callback: function (_data) { - // // callback(_data['deptname']); - // // } - // // }); - // // } - // //}, - // //{ - // // label: "专业", name: "Major", width: 100, align: "left", - // // formatterAsync: function (callback, value, row, op, $cell) { - // // learun.clientdata.getAsync('custmerData', { - // // url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo', - // // key: value, - // // keyId: 'id', - // // callback: function (_data) { - // // callback(_data['majorname']); - // // } - // // }); - // // } - // //}, - // //{ label: "班级", name: "Class", width: 100, align: "left" }, - // //{ - // // 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); - // // } - // // }); - // // } - // //}, // { label: "负责人", name: "Functionary", width: 100, align: "left" }, // { label: "负责人电话", name: "Phone", width: 100, align: "left" }, + // { label: "价格", name: "Price", width: 100, align: "left" }, + // { label: "星级", name: "Starred", width: 100, align: "left" }, + // { + // label: "是否独卫", name: "HasToilet", width: 100, align: "left", + // formatterAsync: function (callback, value, row, op, $cell) { + // learun.clientdata.getAsync('dataItem', { + // key: value, + // code: 'HasToilet', + // callback: function (_data) { + // callback(_data.text); + // } + // }); + // } + // }, + // { label: "舍长", name: "Leader", width: 100, align: "left" }, // { label: "备注", name: "Remark", width: 100, align: "left" }, // ], // mainId: 'ID', // isPage: true, - // //isMultiselect: true - // //sidx: 'ApartmentId asc,UnitId asc ,FloorId asc ', - // //sord: 'ASC', + // isMultiselect:true // }); - //} + //} else { + //} + //page.search(); }, search: function (param) { param = param || {}; - param.SqlParameter = " AND t.BuildType ='4' "; $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); } }; diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/Acc_DormitoryBuildEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/Acc_DormitoryBuildEntity.cs index 3ea342fb6..928e0866e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/Acc_DormitoryBuildEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/Acc_DormitoryBuildEntity.cs @@ -24,7 +24,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// [Column("DNO")] public string DNo { get; set; } - + /// /// 名称 /// @@ -166,21 +166,9 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// [Column("PLANBEDNUM")] public int? PlanBedNum { get; set; } - - /// - /// 寝室类型(几人寝) - /// - [Column("ROOMTYPE")] - public int? RoomType { get; set; } - /// - /// 入住人数 - /// - [Column("CHECKINSTU")] - public int? CheckInStu { get; set; } #endregion #region 扩展字段 - [NotMapped] public string ApartmentName { get; set; } [NotMapped] 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 0fd4e3ddd..f257777a2 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 @@ -289,7 +289,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement value = item.ID.ToString(), showcheck = false, checkstate = 0, - isexpand = false, + isexpand = true, parentId = item.ParentID == null ? "" : item.ParentID }; 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 b4d278a9a..49237f24e 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 @@ -51,8 +51,8 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement t.ParentID, t.Remark, t.Starred, - t.HasToilet,t.RoomType, -t.ApartmentId,t.UnitId,t.FloorId,t.CheckInStu, + t.HasToilet, +t.ApartmentId,t.UnitId,t.FloorId, a.name as ApartmentName,b.name as UnitName,c.Name as FloorName "); strSql.Append(" FROM Acc_DormitoryBuild t "); @@ -68,25 +68,9 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName dp.Add("ParentID", queryParam["ParentID"].ToString(), DbType.String); strSql.Append(" AND t.ParentID =@ParentID "); } - //else - //{ - // 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()) + else { - dp.Add("FloorId", queryParam["FloorId"].ToString(), DbType.String); - strSql.Append(" AND t.FloorId =@FloorId "); + strSql.Append(" AND t.BuildType ='4' "); } if (!queryParam["Name"].IsEmpty()) @@ -102,17 +86,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=@Dept "); + strSql.Append(" AND t.Dept Like @Dept "); } if (!queryParam["Class"].IsEmpty()) { dp.Add("Class", "%" + queryParam["Class"].ToString() + "%", DbType.String); - strSql.Append(" AND t.Class=@Class "); + strSql.Append(" AND t.Class Like @Class "); } if (!queryParam["Major"].IsEmpty()) { dp.Add("Major", "%" + queryParam["Major"].ToString() + "%", DbType.String); - strSql.Append(" AND t.Major=@Major "); + strSql.Append(" AND t.Major Like @Major "); } if (!queryParam["Sex"].IsEmpty()) { @@ -190,27 +174,6 @@ 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 @@ -317,7 +280,7 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName { try { - var entity = this.BaseRepository("CollegeMIS").FindEntity(a => a.ID == parentID); + var entity = this.BaseRepository("CollegeMIS").FindEntity(a => a.ParentID == parentID); if (null != entity) { return entity.BuildType; @@ -340,35 +303,6 @@ 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 @@ -958,6 +892,10 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName } bedInfo.StudentID = stuInfo.StuId; bedInfo.StuName = stuInfo.StuName; + bedInfo.Dept = stuInfo.DeptNo; + bedInfo.Major = stuInfo.MajorNo; + bedInfo.Class = stuInfo.ClassNo; + bedInfo.Sex = Convert.ToString(stuInfo.GenderNo); this.BaseRepository("CollegeMIS").Update(bedInfo); return true; } @@ -1023,27 +961,6 @@ 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(); @@ -1087,9 +1004,7 @@ 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, @@ -1116,10 +1031,7 @@ 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, @@ -1146,11 +1058,7 @@ 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, @@ -1163,7 +1071,6 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName Major = dormitory.Major, Phone = dormitory.Phone, Price = dormitory.Price, - RoomType = bedNum, UpdateBy = currentUser.realName, UpdateTime = DateTime.Now, Starred = "3", @@ -1181,7 +1088,6 @@ 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, @@ -1603,170 +1509,6 @@ 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 - { - if (keyValue.Contains(",")) - { - keyValue = string.Join("','", keyValue.Split(',')); - } - string sql = $"update Acc_DormitoryBuild set "; - if (type == 1) - { - sql += $" Dept='{entity.Dept}' "; - } - else - { - sql += $"Major='{entity.Major}',Class='{entity.Class}'"; - } - - sql += $" where ID in ('{keyValue}')"; - - this.BaseRepository("CollegeMIS").ExecuteBySql(sql); - } - catch (Exception ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowServiceException(ex); - } - } - } - - /// - /// 分配宿舍 - /// - /// - /// - public void SaveRoom(string RoomId, List list) - { - var db = this.BaseRepository("CollegeMIS").BeginTrans(); - try - { - foreach (var entity in list) - { - string sql = $"update Acc_DormitoryBuild set StudentID='{entity.StudentID}' where ID='{entity.ID}'"; - db.ExecuteBySql(sql); - } - - int checkInStu = list.Where(x => x.StudentID != null).Count(); - string checkInSql = $"update Acc_DormitoryBuild set CheckInStu='{checkInStu}' where ID='{RoomId}'"; - db.ExecuteBySql(checkInSql); - - db.Commit(); - } - catch (Exception ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowServiceException(ex); - } - } - } - - /// - /// 同步宿舍信息 - /// - public void SyncData() - { - var db = this.BaseRepository("CollegeMIS").BeginTrans(); - try - { - string sql = "select 学号,姓名,性别,公寓,单元,楼层,宿舍号,床位号 from t1 where 学号 is not null order by 公寓,单元,楼层,宿舍号,床位号"; - DataTable dt = db.FindTable(sql); - //var list = db.FindList(); - //select * from Acc_DormitoryBuild where parentid= (select ID from Acc_DormitoryBuild where parentid=( select ID from Acc_DormitoryBuild where name='一号学生公寓')); - - } - catch (Exception ex) - { - if (ex is ExceptionEx) - { - throw; - } - else - { - throw ExceptionEx.ThrowServiceException(ex); - } - } - } - #endregion 提交数据 } } \ No newline at end of file