From 35b5de1cca843dcd81b51a5fe475ff83c1ae3540 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Tue, 22 Feb 2022 16:57:29 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=9D=E5=AE=A4=E5=88=86=E7=B1=BB=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/AccommodationController.cs | 101 +++++++++- .../Views/Accommodation/FormClassify.cshtml | 97 +++++++++ .../Views/Accommodation/FormClassify.js | 164 ++++++++++++++++ .../Views/Accommodation/Index.cshtml | 5 +- .../Views/Accommodation/Index.js | 54 +++++ .../Views/Accommodation/IndexClassify.cshtml | 69 +++++++ .../Views/Accommodation/IndexClassify.js | 184 ++++++++++++++++++ .../Learun.Application.Web.csproj | 8 + .../Accommodation/AccommodationBLL.cs | 61 ++++++ .../Accommodation/AccommodationIBLL.cs | 2 + .../Accommodation/AccommodationService.cs | 150 ++++++++++++++ 11 files changed, 893 insertions(+), 2 deletions(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClassify.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClassify.js create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexClassify.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexClassify.js 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 44ceaa1eb..984afa1b0 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 @@ -139,6 +139,60 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers + /// + /// 分配专业和班级 + /// + /// + [HttpGet] + public ActionResult FormClass() + { + return View(); + } + /// + /// 分配宿舍 + /// + /// + [HttpGet] + public ActionResult FormRoom() + { + return View(); + } + /// + /// 床位管理 + /// + /// + [HttpGet] + public ActionResult IndexBed() + { + return View(); + } + /// + /// 床位管理 + /// + /// + [HttpGet] + public ActionResult FormBed() + { + return View(); + } + /// + /// 分类管理 + /// + /// + [HttpGet] + public ActionResult FormClassify() + { + return View(); + } + /// + /// 分类管理 + /// + /// + [HttpGet] + public ActionResult IndexClassify() + { + return View(); + } @@ -167,7 +221,39 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers return Success(jsonData); } - + /// + /// 获取床位数据 + /// + /// 查询参数 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetBedListByRoomId(string RoomId) + { + 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); + } + /// /// 获取宿舍楼数据 /// @@ -269,6 +355,19 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers var data = accommodationIBLL.GetTreeNew(); return Success(data); } + /// + /// 获取上级树形数据 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetClassifyTree() + { + var data = accommodationIBLL.GetClassifyTree(); + return Success(data); + } + + #endregion #region 提交数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClassify.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClassify.cshtml new file mode 100644 index 000000000..2a7c07966 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClassify.cshtml @@ -0,0 +1,97 @@ +@{ + ViewBag.Title = "学生宿舍管理"; + Layout = "~/Views/Shared/_Form.cshtml"; +} +
+
+
上级
+
+
+
+
名称*
+ +
+
+
编号*
+ +
+ +
+
位置
+ +
+
+
类别*
+
+
+ +
+
校区
+
+
+ @*
+
+
+
+
+
专业
+
+
+
+
班级
+
+
*@ +
+
负责人
+ +
+
+
负责人电话
+ +
+
+
价格
+ +
+ @*
+
顺序
+ +
*@ + + @if (ViewBag.BuildType == "3") + { + //寝室信息 +
+
性别
+
+
+
+
舍长
+ +
+
+
几人寝*
+ +
+
+
星级
+ +
+
+
是否独卫
+
+
+ } + @if (ViewBag.BuildType == "4") + { +
+
学生名字
+ +
+ } +
+
备注
+ +
+
+@Html.AppendJsFile("/Areas/LogisticsManagement/Views/Accommodation/FormClassify.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClassify.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClassify.js new file mode 100644 index 000000000..dd54bbc88 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClassify.js @@ -0,0 +1,164 @@ +/* * 版 本 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 bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + $('.lr-form-wrap').lrscroll(); + page.bind(); + page.initData(); + page.initSelect(); + }, + bind: function () { + $('#BuildType').lrDataItemSelect({ code: 'BuildType' }); + // 上级 + $('#ParentID').lrselect({ + url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetClassifyTree', + type: 'tree', + allowSearch: true, + maxHeight: 225, + select: function (item) { + if (item&&item.id!='-1') { + $('#BuildType').lrselectSet(item.title); + $('#BuildType').attr('readonly', 'readonly'); + } else { + $('#BuildType').lrselectSet('1'); + $('#BuildType').removeAttr('readonly'); + } + } + }); + + $('#Sex').lrRadioCheckbox({ + type: 'radio', + code: 'usersex', + }); + $("#HasToilet").lrRadioCheckbox({ + type: 'radio', + code: 'HasToilet', + }) + + //$('#StudentID').lrDataSourceSelect({ code: 'StuInfoBasic', value: 'stuid', text: 'stuname' }); + //$('#StudentID').lrDataSourceSelect({ code: 'StuInfoTwo', value: 'stuid', text: 'stuname' }); + $('#StudentID').lrselect({ + value: "stuid", + text: "stuname", + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=StuInfoBasic' + }); + + $('#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('请先选择系和专业'); + } + }); + }, + 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]); + } + } + }); + } + }, + initSelect: function () { + var dfop = { + type: 'tree', + // 展开最大高度 + maxHeight: 200, + // 是否允许搜索 + allowSearch: true, + // 访问数据接口地址 + url: top.$.rootUrl + '/LR_OrganizationModule/Company/GetTree', + // 访问数据接口参数 + param: { parentId: '0' }, + } + $('#Campus').lrselect(dfop); + + } + }; + // 保存数据 + acceptClick = function (callBack) { + if (!$('body').lrValidform()) { + return false; + } + var strEntity = $('body').lrGetFormData(); + if (!strEntity.ParentID && strEntity.BuildType != '1') { + return learun.alert.warning("请选择上级!"); + } + var postData = { + strEntity: JSON.stringify(strEntity) + }; + $.lrSaveForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/SaveForm?keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); + }; + page.init(); +} 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 3a88caf9d..5352776df 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 @@ -69,11 +69,14 @@  自动分配宿舍 +
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 cd72f86d6..ee18771ce 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 @@ -29,6 +29,9 @@ var bootstrap = function ($, learun) { }); // 新增 $('#lr_add').on('click', function () { + if (selectedParent.BuildType != '3') { + return learun.alert.warning("请选择楼层!"); + } var url = ""; if (selectedParent.ID != null) { url = top.$.rootUrl + '/LogisticsManagement/Accommodation/Form?ParentID=' + selectedParent.ID + '&ParentName=' + selectedParent.Name; @@ -126,6 +129,57 @@ var bootstrap = function ($, learun) { }); }); + // 同步宿舍信息 + $('#lr_syncdata').on('click', function () { + if (learun.checkrow(keyValue)) { + learun.layerConfirm('是否确认同步!', function (res) { + if (res) { + learun.postForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/SyncData', { keyValue: keyValue }, function () { + refreshGirdData(); + }); + } + }); + } + }); + + + //床位管理 + $("#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); + } + }); + } + + + }); + + //分类管理 + $("#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/Areas/LogisticsManagement/Views/Accommodation/IndexClassify.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexClassify.cshtml new file mode 100644 index 000000000..10c6e047d --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexClassify.cshtml @@ -0,0 +1,69 @@ +@{ + ViewBag.Title = "学生宿舍管理"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +
+
+
+
+
+
+
+
+
+
名称
+ +
+
+
宿舍楼
+
+
+
+
单元
+
+
+
+
楼层
+
+
+ @*
+
类别
+ +
+
+
+
+
+
+
专业
+
+
+
+
班级
+
+
+
+
性别
+
+
*@ +
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+ +@Html.AppendJsFile("/Areas/LogisticsManagement/Views/Accommodation/IndexClassify.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexClassify.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexClassify.js new file mode 100644 index 000000000..69dbfe816 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexClassify.js @@ -0,0 +1,184 @@ +/* * 版 本 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 () { + + $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { + page.search(queryJson); + }, 220, 400); + + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + //宿舍楼 + $('#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 }); + + // 新增 + $('#lr_add').on('click', function () { + learun.layerForm({ + id: 'form', + title: '新增', + url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormClassify', + width: 700, + height: 400, + 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/FormClassify?keyValue=' + keyValue, + width: 700, + height: 400, + 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/DeleteForm', { keyValue: keyValue }, function () { + refreshGirdData(); + }); + } + }); + } + }); + + // 打印 + $('#lr_print').on('click', function () { + $('#gridtable').jqprintTable(); + }); + + + }, + // 初始化列表 + initGird: function () { + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetClassifyList', + headData: [ + { label: "名称", name: "Name", width: 150, 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: "BuildType", width: 100, align: "left", + formatter: function (value, row) { + if (value == '1') return '宿舍楼'; + else if (value == '2') return '单元'; + else if (value == '3') return '楼层'; + else if (value == '4') return '房间'; + } + }, + { label: "位置", name: "Address", width: 100, align: "left" }, + { + label: "校区", name: "Campus", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'company', + key: value, + keyId: 'f_companyid', + callback: function (_data) { + callback(_data['f_fullname']); + } + }); + } + }, + { label: "负责人", name: "Functionary", width: 100, align: "left" }, + { label: "负责人电话", name: "Phone", width: 100, align: "left" }, + { label: "备注", name: "Remark", width: 100, align: "left" }, + ], + mainId: 'ID', + isPage: true, + isMultiselect: true, + sidx: 'ApartmentId asc,UnitId asc ,FloorId asc ', + }); + page.search(); + }, + search: function (param) { + param = param || {}; + + //param.SqlParameter = " AND t.BuildType <>'5' "; + $('#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 f166d720c..27413dd16 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,8 +1300,16 @@ + + + + + + + + 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 ce5fef8f2..0fd4e3ddd 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 @@ -61,6 +61,25 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } + public IEnumerable GetClassifyList(Pagination paginationobj, string queryJson) + { + try + { + return accommodationService.GetClassifyList(paginationobj,queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + public object GetDormitoryList() { try @@ -340,7 +359,49 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } + + public List GetClassifyTree() + { + try + { + List list = accommodationService.GetClassifyTree(); + List treeList = new List(); + foreach (Acc_DormitoryBuildEntity item in list) + { + TreeModel node = new TreeModel + { + id = item.ID.ToString(), + text = item.Name.ToString(), + value = item.ID.ToString(), + showcheck = false, + checkstate = 0, + isexpand = false, + parentId = item.ParentID == null ? "" : item.ParentID, + title =string.IsNullOrEmpty(item.BuildType)?"":(Convert.ToInt32(item.BuildType)+1).ToString() , + + }; + + treeList.Add(node); + + + } + + + return treeList.ToTree(); + } + 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 db8337358..31b843de2 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 @@ -22,6 +22,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// IEnumerable GetPageList(Pagination pagination, string queryJson); IEnumerable GetAllList(); + IEnumerable GetClassifyList(Pagination paginationobj,string queryJson); /// /// 获取Acc_DormitoryBuild表实体数据 /// 主键 @@ -50,6 +51,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement string GetDormitoryInfoByStuNo(string val); List GetTree(); List GetTreeNew(); + List GetClassifyTree(); bool MatchDormitoryInfo(string stuNo, string dormitory, string unit, string floor, string room, string bed,List data); 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 aa608c1ad..89ca0eea5 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 @@ -104,6 +104,53 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement dp.Add("Leader", "%" + queryParam["Leader"].ToString() + "%", DbType.String); strSql.Append(" AND t.Leader Like @Leader "); } + + if (!queryParam["NoDistribution"].IsEmpty()) + { + var noDistribution = queryParam["NoDistribution"].ToString(); + if (noDistribution.Contains("dept")) + { + strSql.Append(" AND (t.Dept is null or len(t.Dept)=0) "); + } + if (noDistribution.Contains("major")) + { + strSql.Append(" AND (t.Major is null or len(t.Major)=0) "); + } + if (noDistribution.Contains("class")) + { + strSql.Append(" AND (t.Class is null or len(t.Class)=0) "); + } + if (noDistribution.Contains("room")) + { + strSql.Append(" AND (t.CheckInStu is null or len(t.CheckInStu)=0 or t.CheckInStu=0) "); + } + } + if (!queryParam["Distribution"].IsEmpty()) + { + var distribution = queryParam["Distribution"].ToString(); + if (distribution.Contains("dept")) + { + strSql.Append(" AND len(t.Dept)>0 "); + } + if (distribution.Contains("major")) + { + strSql.Append(" AND len(t.Major)>0 "); + } + if (distribution.Contains("class")) + { + strSql.Append(" AND len(t.Class)>0 "); + } + if (distribution.Contains("room")) + { + strSql.Append(" AND t.CheckInStu>0 "); + } + } + + if (!queryParam["SqlParameter"].IsEmpty()) + { + strSql.Append(queryParam["SqlParameter"].ToString()); + } + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination).OrderBy(a => a.Name).ThenBy(a => a.Name).ToList(); } catch (Exception ex) @@ -137,6 +184,89 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } + + public IEnumerable GetClassifyList(Pagination pagination, string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(@" + t.ID, + t.Name, + t.Address, + t.Campus, + t.Dept, + t.BuildType, + t.Major, + t.Class, + t.Sex, + t.Functionary, + t.Phone, + t.Price, + t.Leader, + t.StudentID, + t.PlanStudentID, + t.ParentID, + t.Remark, + t.Starred, + t.HasToilet,t.RoomType, +t.ApartmentId,t.UnitId,t.FloorId,t.CheckInStu, +a.name as ApartmentName,b.name as UnitName,c.Name as FloorName + "); + strSql.Append(" FROM Acc_DormitoryBuild t "); + strSql.Append(@" left join (select * FROM Acc_DormitoryBuild where BuildType='1') a on t.ApartmentId=a.ID + left join(select * FROM Acc_DormitoryBuild where BuildType = '2') b on t.UnitId = b.ID + left join(select * FROM Acc_DormitoryBuild where BuildType = '3') c on t.FloorId = c.ID "); + strSql.Append(" WHERE 1=1 and (t.BuildType<>'5' and t.BuildType<>'4') "); + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + if (!queryParam["ParentID"].IsEmpty()) + { + dp.Add("ParentID", queryParam["ParentID"].ToString(), DbType.String); + strSql.Append(" AND t.ParentID =@ParentID "); + } + if (!queryParam["keyword"].IsEmpty()) + { + strSql.Append($" AND t.Name like '%{queryParam["keyword"].ToString()}%' "); + } + 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); + strSql.Append(" AND t.Name Like @Name "); + } + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination).ToList(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + internal string GetBuildType(string parentID) { try @@ -510,6 +640,25 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } + public List GetClassifyTree() + { + try + { + return this.BaseRepository("CollegeMIS").FindList(x => ( x.BuildType == "2" || x.BuildType == "1")).ToList(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// /// 获取Acc_DormitoryBuild表实体数据 /// 主键 @@ -1295,6 +1444,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement rootEntity.CreateTime = DateTime.Now; rootEntity.UpdateBy = currentUser.realName; rootEntity.UpdateTime = DateTime.Now; + rootEntity.ApartmentId = rootEntity.ID; entity.ParentID = rootEntity.ID; this.BaseRepository("CollegeMIS").Insert(rootEntity); }