diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/Acc_DormitoryRuleController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/Acc_DormitoryRuleController.cs new file mode 100644 index 000000000..043d4af3e --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/Acc_DormitoryRuleController.cs @@ -0,0 +1,141 @@ +using Learun.Util; +using System.Data; +using Learun.Application.TwoDevelopment.LogisticsManagement; +using System.Web.Mvc; +using System.Collections.Generic; +using System; + +namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-03-14 12:05 + /// 描 述:宿舍晚归规则 + /// + public class Acc_DormitoryRuleController : MvcControllerBase + { + private Acc_DormitoryRuleIBLL acc_DormitoryRuleIBLL = new Acc_DormitoryRuleBLL(); + + #region 视图功能 + + /// + /// 主页面 + /// + /// + [HttpGet] + public ActionResult Index() + { + return View(); + } + /// + /// 表单页 + /// + /// + [HttpGet] + public ActionResult Form() + { + return View(); + } + #endregion + + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetPageList(string pagination, string queryJson) + { + Pagination paginationobj = pagination.ToObject(); + var data = acc_DormitoryRuleIBLL.GetPageList(paginationobj, queryJson); + var jsonData = new + { + rows = data, + total = paginationobj.total, + page = paginationobj.page, + records = paginationobj.records + }; + return Success(jsonData); + } + /// + /// 获取表单数据 + /// + /// 主键 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetFormData(string keyValue) + { + var Acc_DormitoryRuleData = acc_DormitoryRuleIBLL.GetAcc_DormitoryRuleEntity(keyValue); + var jsonData = new + { + Acc_DormitoryRule = Acc_DormitoryRuleData, + }; + return Success(jsonData); + } + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult DeleteForm(string keyValue) + { + acc_DormitoryRuleIBLL.DeleteEntity(keyValue); + return Success("删除成功!"); + } + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// + [HttpPost] + [ValidateAntiForgeryToken] + [AjaxOnly] + public ActionResult SaveForm(string keyValue, string strEntity) + { + Acc_DormitoryRuleEntity entity = strEntity.ToObject(); + DateTime time; + bool flag = DateTime.TryParse(entity.LateReturnTime, out time); + if (!flag) + { + return Fail("晚归时间格式不正确!"); + } + + if (!(entity.PushHour >= 0 && entity.PushHour <= 23)) + { + return Fail("推送时间点填写不正确!"); + } + + var model = acc_DormitoryRuleIBLL.GetEnableEntity(); + if (entity.IsEnable == 1) + { + if (string.IsNullOrEmpty(keyValue) && model != null) + { + return Fail("只能有一个启用的规则!"); + } + else if (!string.IsNullOrEmpty(keyValue) && model != null && model.Id != keyValue) + { + return Fail("只能有一个启用的规则!"); + } + } + acc_DormitoryRuleIBLL.SaveEntity(keyValue, entity); + + return Success("保存成功!"); + } + #endregion + + } +} 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 94c336d32..24e3ad8cf 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 { @@ -32,26 +33,31 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers { return View(); } - ///// - ///// 表单页 - ///// - ///// - //[HttpGet] - //public ActionResult Form() - //{ - // return View(); - //} + /// + /// 分配宿舍 + /// + /// + [HttpGet] + public ActionResult IndexDistribution() + { + return View(); + } /// /// 带参数的表单页 /// /// [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(); } @@ -137,9 +143,70 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers return View(); } + /// + /// 分配系 + /// + /// + [HttpGet] + public ActionResult FormDept() + { + return View(); + } - - + /// + /// 分配专业和班级 + /// + /// + [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(); + } #endregion @@ -167,6 +234,38 @@ 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).OrderBy(x => x.DNo); + //var jsonData = new + //{ + // rows = data, + // total = paginationobj.total, + // page = paginationobj.page, + // records = paginationobj.records + //}; + return Success(data); + } /// /// 获取宿舍楼数据 @@ -269,6 +368,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 提交数据 @@ -286,6 +398,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("删除成功!"); + } + /// /// 保存实体数据(新增、修改) /// 主键 /// @@ -299,7 +423,54 @@ 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("保存成功!"); + } + /// + /// 寝室分配系 + /// 主键 + /// + /// + [HttpPost] + [ValidateAntiForgeryToken] + [AjaxOnly] + public ActionResult SaveDeptClass(string keyValue, string strEntity, int type) + { + Acc_DormitoryBuildEntity entity = strEntity.ToObject(); + accommodationIBLL.SaveDeptClass(keyValue, entity, type); + return Success("保存成功!"); + } + + /// + /// 寝室分配床位 + /// + /// + [HttpPost] + [ValidateAntiForgeryToken] + [AjaxOnly] + public ActionResult SaveRoom(string RoomId, List list) + { + //List list = strEntity.ToObject>(); + string res = accommodationIBLL.SaveRoom(RoomId, list); + if (!string.IsNullOrEmpty(res)) + { + return Fail(res); + } + + return Success("保存成功!"); + } /// /// 学生宿舍的单元、楼层、房间、床位添加 @@ -312,11 +483,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()); @@ -344,7 +510,7 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers } - + /// /// 同步宿舍信息数据 /// @@ -353,10 +519,7 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers { accommodationIBLL.SyncData(); return Success("同步成功"); - - } - //public ActionResult DormitoryAdd(string a,string ) #endregion diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/DormitoryReturnController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/DormitoryReturnController.cs new file mode 100644 index 000000000..10d1f7135 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/DormitoryReturnController.cs @@ -0,0 +1,245 @@ +using Learun.Util; +using System.Data; +using Learun.Application.TwoDevelopment.LogisticsManagement; +using System.Web.Mvc; +using System.Collections.Generic; +using System.Linq; +using System; + +namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-03-10 10:06 + /// 描 述:学生归宿管理 + /// + public class DormitoryReturnController : MvcControllerBase + { + private DormitoryReturnIBLL dormitoryReturnIBLL = new DormitoryReturnBLL(); + private AccommodationIBLL accommodationIBLL = new AccommodationBLL(); + + #region 视图功能 + + /// + /// 主页面 + /// + /// + [HttpGet] + public ActionResult Index() + { + return View(); + } + /// + /// 表单页 + /// + /// + [HttpGet] + public ActionResult Form() + { + return View(); + } + /// + /// 表单页 + /// + /// + [HttpGet] + public ActionResult FormOut() + { + return View(); + } + + /// + /// 表单页 + /// + /// + [HttpGet] + public ActionResult FormReturn() + { + return View(); + } + /// + /// 表单页 + /// + /// + [HttpGet] + public ActionResult IndexReport() + { + return View(); + } + + #endregion + + #region 获取数据 + /// + /// 获取左侧树形数据 + /// + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetTree() + { + var data = dormitoryReturnIBLL.GetTree(); + return Success(data); + } + /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetPageList(string pagination, string queryJson) + { + Pagination paginationobj = pagination.ToObject(); + var data = dormitoryReturnIBLL.GetPageList(paginationobj, queryJson); + var jsonData = new + { + rows = data, + total = paginationobj.total, + page = paginationobj.page, + records = paginationobj.records + }; + return Success(jsonData); + } + /// + /// 获取表单数据 + /// + /// 主键 + /// + [HttpGet] + [AjaxOnly] + public ActionResult GetFormData(string keyValue) + { + var Acc_DormitoryReturnData = dormitoryReturnIBLL.GetAcc_DormitoryReturnEntity(keyValue); + var jsonData = new + { + Acc_DormitoryReturn = Acc_DormitoryReturnData, + }; + return Success(jsonData); + } + /// + /// 获取下拉框数据 + /// + /// + [HttpGet] + public ActionResult GetDept() + { + var data = accommodationIBLL.GetDept(); + + return Success(data); + } + /// + /// 获取下拉框数据 + /// + /// + [HttpGet] + public ActionResult GetMajor(string strWhere) + { + var data = accommodationIBLL.GetMajor(strWhere); + + return Success(data); + } + /// + /// 获取下拉框数据 + /// + /// + [HttpGet] + public ActionResult GetClass(string strWhere) + { + var data = accommodationIBLL.GetClass(strWhere); + + return Success(data); + } + + [HttpGet] + public ActionResult GetReportList(string queryJson) + { + List data = dormitoryReturnIBLL.GetReportList(queryJson).ToList(); + var list = data.GroupBy(a => a.IsReturn).Select(a => new { a.Key, num = a.Count() }).ToList(); + List list2 = new List(); + foreach (var item in list) + { + var name = item.Key == 1 ? "已归宿" : "未归宿"; + list2.Add(new { name = name, value = item.num }); + + } + return JsonResult(list2); + } + + /// + /// + /// + /// + public ActionResult GetReportData(string queryJson) + { + List data = dormitoryReturnIBLL.GetReportList(queryJson).ToList(); + var list = data.GroupBy(a => a.IsReturn).Select(a => new { a.Key, num = a.Count() }).ToList(); + List list2 = new List(); + List list1 = new List(); + foreach (var item in list) + { + var name = item.Key == 1 ? "已归宿" : "未归宿"; + list2.Add(new { name = name, value = item.num }); + list1.Add(name); + + } + return Success(new { list1, list2 }); + } + + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult DeleteForm(string keyValue) + { + dormitoryReturnIBLL.DeleteEntity(keyValue); + return Success("删除成功!"); + } + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// + [HttpPost] + [ValidateAntiForgeryToken] + [AjaxOnly] + public ActionResult SaveData(string keyValue, string strEntity) + { + Acc_DormitoryReturnEntity entity = strEntity.ToObject(); + dormitoryReturnIBLL.SaveData(keyValue, entity); + + return Success("保存成功!"); + } + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// + [HttpPost] + [ValidateAntiForgeryToken] + [AjaxOnly] + public ActionResult SaveForm(string type, string strEntity) + { + Acc_DormitoryReturnEntity entity = strEntity.ToObject(); + dormitoryReturnIBLL.SaveEntity(type, entity); + + return Success("保存成功!"); + } + + + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Form.cshtml new file mode 100644 index 000000000..100ee31f8 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Form.cshtml @@ -0,0 +1,27 @@ +@{ + ViewBag.Title = "宿舍晚归规则"; + Layout = "~/Views/Shared/_Form.cshtml"; +} +
+
+
晚归时间*
+ +
+
+
推送人*
+
+
+
+
推送班主任*
+
+
+
+
推送时间点*
+ +
+
+
启用*
+
+
+
+@Html.AppendJsFile("/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Form.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Form.js new file mode 100644 index 000000000..2dab9f792 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Form.js @@ -0,0 +1,62 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2022-03-14 12:05 + * 描 述:宿舍晚归规则 + */ +var acceptClick; +var keyValue = request('keyValue'); +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + $('.lr-form-wrap').lrscroll(); + page.bind(); + page.initData(); + }, + bind: function () { + $('#PushUser').lrDataSourceSelect({ + code: 'teacheruserdata', value: 'f_userid', text: 'f_realname', type: 'multiple' + }); + + $('#ClassDiredctor').lrRadioCheckbox({ + type: 'radio', + code: 'YesOrNoInt', + }); + $('#IsEnable').lrRadioCheckbox({ + type: 'radio', + code: 'YesOrNoInt', + }); + }, + initData: function () { + if (!!keyValue) { + $.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Acc_DormitoryRule/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/Acc_DormitoryRule/SaveForm?keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Index.cshtml new file mode 100644 index 000000000..ebbd5409c --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Index.cshtml @@ -0,0 +1,27 @@ +@{ + ViewBag.Title = "宿舍晚归规则"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +
+
+
+
+
+
+
+
+ +
+ +
+
+
+
+
+
+@Html.AppendJsFile("/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Index.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Index.js new file mode 100644 index 000000000..4b81ce7c9 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_DormitoryRule/Index.js @@ -0,0 +1,139 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2022-03-14 12:05 + * 描 述:宿舍晚归规则 + */ +var refreshGirdData; +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/Acc_DormitoryRule/Form', + width: 600, + height: 400, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + }); + // 编辑 + $('#lr_edit').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('Id'); + if (learun.checkrow(keyValue)) { + learun.layerForm({ + id: 'form', + title: '编辑', + url: top.$.rootUrl + '/LogisticsManagement/Acc_DormitoryRule/Form?keyValue=' + keyValue, + width: 600, + 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/Acc_DormitoryRule/DeleteForm', { keyValue: keyValue }, function () { + refreshGirdData(); + }); + } + }); + } + }); + // 打印 + $('#lr_print').on('click', function () { + $('#gridtable').jqprintTable(); + }); + }, + // 初始化列表 + initGird: function () { + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/LogisticsManagement/Acc_DormitoryRule/GetPageList', + headData: [ + { label: "晚归时间", name: "LateReturnTime", width: 100, align: "left" }, + { + label: "推送人", name: "PushUser", width: 200, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + if (value.indexOf(',') != -1) { + var content = ''; + var timearr = value.split(','); + for (var i = 0; i < timearr.length; i++) { + learun.clientdata.getAsync('custmerData', + { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'teacheruserdata', + key: timearr[i], + keyId: 'f_userid', + callback: function (_data) { + content += _data['f_realname']; + } + }); + } + content = content.substring(0, content.length - 1); + callback(content); + } else { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'teacheruserdata', + key: value, + keyId: 'f_userid', + callback: function (_data) { + callback(_data['f_realname']); + } + }); + } + } + }, + { + label: "推送班主任", name: "ClassDiredctor", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('dataItem', { + key: value, + code: 'YesOrNoInt', + callback: function (_data) { + callback(_data.text); + } + }); + } + }, + { label: "推送时间点", name: "PushHour", width: 100, align: "left" }, + { + label: "启用", name: "IsEnable", width: 100, align: "left", + formatter: function (cellvalue, rowObject) { + return cellvalue == 1 ? "" : ""; + } + + }, + ], + mainId: 'Id', + isPage: true + }); + page.search(); + }, + search: function (param) { + param = param || {}; + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + } + }; + refreshGirdData = function () { + $('#gridtable').jfGridSet('reload'); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Corridor.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Corridor.cshtml index 76b48d7ef..a6de56ca7 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Corridor.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Corridor.cshtml @@ -58,11 +58,7 @@
@@ -76,7 +72,9 @@
-
{{floor.dormitory.Name}}
{{floor.dormitory.Sex | filter_sex}}
+
{{floor.dormitory.Name}} + @*
{{floor.dormitory.Sex | filter_sex}}
*@ +
{{floor.RoomNum}}{{floor.BedNum}}
@@ -344,7 +342,7 @@ }, addFloor: function () { var url = ""; - url = top.$.rootUrl + '/LogisticsManagement/Accommodation/Form?ParentID=' + this.unitID + '&ParentName=' + this.unitName; + url = top.$.rootUrl + '/LogisticsManagement/Accommodation/FormClassify?ParentID=' + this.unitID + '&ParentName=' + this.unitName; top.learun.layerForm({ id: 'form', title: '新增', @@ -361,7 +359,7 @@ top.learun.layerForm({ id: 'form', title: '编辑', - url: top.$.rootUrl + '/LogisticsManagement/Accommodation/Form?keyValue=' + id, + url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormClassify?keyValue=' + id, width: 600, height: 400, callBack: function (id) { @@ -393,7 +391,7 @@ '
' + '
' + this.dormitoryName + '  ' + this.unitName + '
' + '
' + floor.dormitory.Name + - this.filter_sex(floor.dormitory.Sex) + + '' + this.filter_sex(floor.dormitory.Sex) + '' + '
' + '
' + '
负 责 人' + floor.dormitory.Functionary + '
负责人电话' + floor.dormitory.Phone + '
' + @@ -403,14 +401,14 @@ '
' + '
' + '
    ' + - '
  • 编     号' + floor.dormitory.Name + '
  • ' + - '
  • 价     格' + floor.dormitory.Price + '
  • ' + + '
  • 编     号' + floor.dormitory.DNo + '
  • ' + + '
  • 价     格' + (floor.dormitory.Price == null ? '' : floor.dormitory.Price) + '
  • ' + '
  • 房     间' + floor.RoomNum + '
  • ' + '
  • 入     住' + floor.HasStudentNum + '
  • ' + '
  • 空     床' + floor.NoStudentNum + '
  • ' + '
  • 床     位' + floor.BedNum + '
  • ' + - '
  • 涉及院系' + this.filter_Dept(floor.dormitory.Dept) + '
  • ' + - '
  • 涉及专业' + this.filter_Major(floor.dormitory.Major) + '
  • ' + + //'
  • 涉及院系' + this.filter_Dept(floor.dormitory.Dept) + '
  • ' + + //'
  • 涉及专业' + this.filter_Major(floor.dormitory.Major) + '
  • ' + '
' + '
' + //'' + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Dormitory.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Dormitory.cshtml index b9a5635ac..b85a292ec 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Dormitory.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Dormitory.cshtml @@ -62,11 +62,7 @@
@@ -118,155 +114,6 @@ +@Html.AppendJsFile("/Areas/LogisticsManagement/Views/DormitoryReturn/IndexReport.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/IndexReport.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/IndexReport.js new file mode 100644 index 000000000..7f8aec873 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/IndexReport.js @@ -0,0 +1,131 @@ +var bootstrap = function ($, learun) { + "use strict"; + var year = ""; + var page = { + init: function () { + page.bind(); + page.initGrid(); + page.initChart(); + }, + bind: function () { + $('#Dept').lrselect({ + width: '150px', + placeholder: "请选择系部", + allowSearch: true, + url: top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/GetDept', + value: 'Dept', + text: 'DeptName', + select: function (item) { + if (item) { + $('#Major').lrselectRefresh({ + url: top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/GetMajor', + param: { strWhere: "m.deptno='" + item.Dept + "'" } + }); + $('#Class').lrselectRefresh({ + //url: top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/GetClass', + //param: { strWhere: "c.majorno=''" } + }); + } + } + }); + $('#Major').lrselect({ + width: '150px', + placeholder: "请选择专业", + allowSearch: true, + //url: top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/GetMajor', + value: 'Major', + text: 'MajorName', + select: function (item) { + if (item) { + $('#Class').lrselectRefresh({ + url: top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/GetClass', + param: { strWhere: "c.majorno='" + item.Major + "'" } + }); + } + } + }); + $('#Class').lrselect({ + width: '150px', + placeholder: "请选择班级", + allowSearch: true, + value: 'Class', + text: 'ClassName' + }); + + //查询 + $('#btn_Search').on('click', function () { + page.search({ Dept: $('#Dept').lrselectGet(), Major: $('#Major').lrselectGet(), Class: $('#Class').lrselectGet() }); + }); + + }, + initGrid: function () { + $(".lr-layout-grid").height($(window).height() - 110); + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/GetReportList', + headData: [ + { name: "name", label: "状态", width: 100, align: "center" }, + { name: "value", label: "人数", width: 150, align: "center" } + + ] + }); + page.search(); + }, + initChart: function (queryJson) { + var myChart1 = echarts.init(document.getElementById('main')); + //var myChart2 = echarts.init(document.getElementById('main1')); + queryJson = { + Dept: $('#Dept').lrselectGet(), + Major: $('#Major').lrselectGet(), + Class: $('#Class').lrselectGet() + }; + //console.log('queryJson', queryJson); + learun.httpAsyncPost(top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/GetReportData', { queryJson: JSON.stringify(queryJson) }, function (res) { + if (res.code == 200) { + var option = { + title: { + text: '学生归宿统计', + x: 'center' + }, + tooltip: { + trigger: 'item', + formatter: "{a}
{b} : {c} ({d}%)" + }, + legend: { + orient: 'vertical', + left: 'left', + data: res.data.list1 + }, + series: [ + { + name: '学生归宿', + type: 'pie', + radius: '55%', + center: ['50%', '60%'], + data: res.data.list2, + itemStyle: { + emphasis: { + shadowBlur: 10, + shadowOffsetX: 0, + shadowColor: 'rgba(0, 0, 0, 0.5)' + } + } + } + ] + }; + + myChart1.setOption(option); + + } + }); + + }, + search: function (param) { + param = param || {}; + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + page.initChart(param); + } + }; + 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 6a8a214c6..36d47b979 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 @@ -361,8 +361,10 @@ + + @@ -1220,6 +1222,16 @@ + + + + + + + + + + @@ -1227,6 +1239,11 @@ + + + + + @@ -7645,6 +7662,21 @@ + + + + + + + + + + + + + + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj index e366181a5..229569a99 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/Learun.Application.Mapping.csproj @@ -102,6 +102,8 @@ + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LogisticsManagement/Acc_DormitoryReturnMap.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LogisticsManagement/Acc_DormitoryReturnMap.cs new file mode 100644 index 000000000..912286693 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LogisticsManagement/Acc_DormitoryReturnMap.cs @@ -0,0 +1,29 @@ +using Learun.Application.TwoDevelopment.LogisticsManagement; +using System.Data.Entity.ModelConfiguration; + +namespace Learun.Application.Mapping +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-03-10 10:06 + /// 描 述:学生归宿管理 + /// + public class Acc_DormitoryReturnMap : EntityTypeConfiguration + { + public Acc_DormitoryReturnMap() + { + #region 表、主键 + //表 + this.ToTable("ACC_DORMITORYRETURN"); + //主键 + this.HasKey(t => t.Id); + #endregion + + #region 配置关系 + #endregion + } + } +} + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LogisticsManagement/Acc_DormitoryRuleMap.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LogisticsManagement/Acc_DormitoryRuleMap.cs new file mode 100644 index 000000000..f56e03bcd --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.Mapping/LogisticsManagement/Acc_DormitoryRuleMap.cs @@ -0,0 +1,29 @@ +using Learun.Application.TwoDevelopment.LogisticsManagement; +using System.Data.Entity.ModelConfiguration; + +namespace Learun.Application.Mapping +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-03-14 12:05 + /// 描 述:宿舍晚归规则 + /// + public class Acc_DormitoryRuleMap : EntityTypeConfiguration + { + public Acc_DormitoryRuleMap() + { + #region 表、主键 + //表 + this.ToTable("ACC_DORMITORYRULE"); + //主键 + this.HasKey(t => t.Id); + #endregion + + #region 配置关系 + #endregion + } + } +} + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj index 18945acac..5cf67fb65 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj @@ -275,8 +275,16 @@ + + + + + + + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Acc_DormitoryRule/Acc_DormitoryRuleBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Acc_DormitoryRule/Acc_DormitoryRuleBLL.cs new file mode 100644 index 000000000..491d215b1 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Acc_DormitoryRule/Acc_DormitoryRuleBLL.cs @@ -0,0 +1,148 @@ +using Learun.Util; +using System; +using System.Data; +using System.Collections.Generic; + +namespace Learun.Application.TwoDevelopment.LogisticsManagement +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-03-14 12:05 + /// 描 述:宿舍晚归规则 + /// + public class Acc_DormitoryRuleBLL : Acc_DormitoryRuleIBLL + { + private Acc_DormitoryRuleService acc_DormitoryRuleService = new Acc_DormitoryRuleService(); + + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + return acc_DormitoryRuleService.GetPageList(pagination, queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取Acc_DormitoryRule表实体数据 + /// + /// 主键 + /// + public Acc_DormitoryRuleEntity GetAcc_DormitoryRuleEntity(string keyValue) + { + try + { + return acc_DormitoryRuleService.GetAcc_DormitoryRuleEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + + /// + /// 获取Acc_DormitoryRule表实体数据 + /// + /// + public Acc_DormitoryRuleEntity GetEnableEntity() + { + try + { + return acc_DormitoryRuleService.GetEnableEntity(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + public void DeleteEntity(string keyValue) + { + try + { + acc_DormitoryRuleService.DeleteEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// + public void SaveEntity(string keyValue, Acc_DormitoryRuleEntity entity) + { + try + { + acc_DormitoryRuleService.SaveEntity(keyValue, entity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Acc_DormitoryRule/Acc_DormitoryRuleEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Acc_DormitoryRule/Acc_DormitoryRuleEntity.cs new file mode 100644 index 000000000..351f0e912 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Acc_DormitoryRule/Acc_DormitoryRuleEntity.cs @@ -0,0 +1,90 @@ +using Learun.Util; +using System; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Learun.Application.TwoDevelopment.LogisticsManagement +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-03-14 12:05 + /// 描 述:宿舍晚归规则 + /// + public class Acc_DormitoryRuleEntity + { + #region 实体成员 + /// + /// Id + /// + [Column("ID")] + public string Id { get; set; } + /// + /// 晚归时间 + /// + [Column("LATERETURNTIME")] + public string LateReturnTime { get; set; } + /// + /// 推送人员 + /// + [Column("PUSHUSER")] + public string PushUser { get; set; } + /// + /// 是否推送班主任 + /// + [Column("CLASSDIREDCTOR")] + public int? ClassDiredctor { get; set; } + /// + /// 推送时间点 + /// + [Column("PUSHHOUR")] + public int? PushHour { get; set; } + /// + /// 是否启用 + /// + [Column("ISENABLE")] + public int? IsEnable { get; set; } + /// + /// CreateTime + /// + [Column("CREATETIME")] + public DateTime? CreateTime { get; set; } + /// + /// CreateUserId + /// + [Column("CREATEUSERID")] + public string CreateUserId { get; set; } + /// + /// UpdateTime + /// + [Column("UPDATETIME")] + public DateTime? UpdateTime { get; set; } + /// + /// UpdateUserId + /// + [Column("UPDATEUSERID")] + public string UpdateUserId { get; set; } + #endregion + + #region 扩展操作 + /// + /// 新增调用 + /// + public void Create() + { + this.Id = Guid.NewGuid().ToString(); + } + /// + /// 编辑调用 + /// + /// + public void Modify(string keyValue) + { + this.Id = keyValue; + } + #endregion + #region 扩展字段 + #endregion + } +} + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Acc_DormitoryRule/Acc_DormitoryRuleIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Acc_DormitoryRule/Acc_DormitoryRuleIBLL.cs new file mode 100644 index 000000000..22b52a86d --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Acc_DormitoryRule/Acc_DormitoryRuleIBLL.cs @@ -0,0 +1,49 @@ +using Learun.Util; +using System.Data; +using System.Collections.Generic; + +namespace Learun.Application.TwoDevelopment.LogisticsManagement +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-03-14 12:05 + /// 描 述:宿舍晚归规则 + /// + public interface Acc_DormitoryRuleIBLL + { + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 查询参数 + /// + IEnumerable GetPageList(Pagination pagination, string queryJson); + /// + /// 获取Acc_DormitoryRule表实体数据 + /// + /// 主键 + /// + Acc_DormitoryRuleEntity GetAcc_DormitoryRuleEntity(string keyValue); + Acc_DormitoryRuleEntity GetEnableEntity(); + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + void DeleteEntity(string keyValue); + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + void SaveEntity(string keyValue, Acc_DormitoryRuleEntity entity); + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Acc_DormitoryRule/Acc_DormitoryRuleService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Acc_DormitoryRule/Acc_DormitoryRuleService.cs new file mode 100644 index 000000000..751c2f837 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Acc_DormitoryRule/Acc_DormitoryRuleService.cs @@ -0,0 +1,168 @@ +using Dapper; +using Learun.DataBase.Repository; +using Learun.Util; +using System; +using System.Collections.Generic; +using System.Data; +using System.Text; + +namespace Learun.Application.TwoDevelopment.LogisticsManagement +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-03-14 12:05 + /// 描 述:宿舍晚归规则 + /// + public class Acc_DormitoryRuleService : RepositoryFactory + { + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 查询参数 + /// 查询参数 + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(@" + t.* + "); + strSql.Append(" FROM Acc_DormitoryRule t "); + strSql.Append(" WHERE 1=1 "); + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取Acc_DormitoryRule表实体数据 + /// + /// 主键 + /// + public Acc_DormitoryRuleEntity GetAcc_DormitoryRuleEntity(string keyValue) + { + try + { + return this.BaseRepository("CollegeMIS").FindEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + + /// + /// 获取Acc_DormitoryRule表实体数据 + /// + /// 主键 + /// + public Acc_DormitoryRuleEntity GetEnableEntity() + { + try + { + return this.BaseRepository("CollegeMIS").FindEntity(x => x.IsEnable == 1); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + public void DeleteEntity(string keyValue) + { + try + { + this.BaseRepository("CollegeMIS").Delete(t => t.Id == keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + public void SaveEntity(string keyValue, Acc_DormitoryRuleEntity entity) + { + try + { + if (!string.IsNullOrEmpty(keyValue)) + { + entity.Modify(keyValue); + this.BaseRepository("CollegeMIS").Update(entity); + } + else + { + entity.Create(); + this.BaseRepository("CollegeMIS").Insert(entity); + } + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion + + } +} 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 8dfc1bb3a..0c0866c1e 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 @@ -19,12 +19,33 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// [Column("ID")] public string ID { get; set; } + /// + /// 编号 + /// + [Column("DNO")] + public string DNo { get; set; } + /// /// 名称 /// [Column("NAME")] public string Name { get; set; } /// + /// 宿舍楼 + /// + [Column("APARTMENTID")] + public string ApartmentId { get; set; } + /// + /// 单元 + /// + [Column("UNITID")] + public string UnitId { get; set; } + /// + /// 楼层 + /// + [Column("FLOORID")] + public string FloorId { get; set; } + /// /// 负责人 /// [Column("FUNCTIONARY")] @@ -145,9 +166,32 @@ 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; } + /// + /// 是否归宿 + /// + [Column("ISRETURN")] + public int? IsReturn { get; set; } #endregion #region 扩展字段 + + [NotMapped] + public string ApartmentName { get; set; } + [NotMapped] + public string UnitName { get; set; } + [NotMapped] + public string FloorName { get; set; } /// /// 学生名字 /// @@ -176,6 +220,13 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement [NotMapped] public string bedId { get; set; } + + [NotMapped] + public string DeptName { get; set; } + [NotMapped] + public string MajorName { get; set; } + [NotMapped] + public string ClassName { get; set; } #endregion #region 扩展操作 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 efb5fe22b..41bda8acd 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 @@ -61,6 +81,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 @@ -179,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表实体数据 /// 主键 @@ -251,6 +311,61 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } + public List GetDept() + { + try + { + return accommodationService.GetSelectData("").Select(x => new Acc_DormitoryBuildEntity { Dept = x.Dept, DeptName = x.DeptName }).Distinct().ToList(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + public List GetMajor(string strWhere) + { + try + { + return accommodationService.GetSelectData(strWhere).Select(x => new Acc_DormitoryBuildEntity { Major = x.Major, MajorName = x.MajorName }).Distinct().ToList(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + public List GetClass(string strWhere) + { + try + { + return accommodationService.GetSelectData(strWhere).Select(x => new Acc_DormitoryBuildEntity { Class = x.Class, ClassName = x.ClassName }).Distinct().ToList(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// /// 获取左侧树形数据 /// @@ -270,8 +385,9 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement value = item.ID.ToString(), showcheck = false, checkstate = 0, - isexpand = false, - parentId = item.ParentID == null ? "" : item.ParentID + isexpand = true, + parentId = item.ParentID == null ? "" : item.ParentID, + title = item.BuildType }; @@ -339,9 +455,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); + } + } + } + /// /// 根据父id 获取树形数据 @@ -386,7 +542,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } - /// + /// /// 根据父id 获取树形数据 /// /// @@ -431,11 +587,11 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } - public bool MatchDormitoryInfo(string stuNo,string dormitory,string unit,string floor,string room,string bed ,List data) + public bool MatchDormitoryInfo(string stuNo, string dormitory, string unit, string floor, string room, string bed, List data) { try { - return accommodationService.MatchDormitoryInfo(stuNo,dormitory,unit,floor,room,bed,data); + return accommodationService.MatchDormitoryInfo(stuNo, dormitory, unit, floor, room, bed, data); } catch (Exception ex) @@ -481,6 +637,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); + } + } + } + /// /// 保存实体数据(新增、修改) /// 主键 @@ -505,6 +686,74 @@ 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); + } + } + } + + + + /// + /// 分配系 + /// + /// + /// + public void SaveDeptClass(string keyValue, Acc_DormitoryBuildEntity entity, int type) + { + try + { + accommodationService.SaveDeptClass(keyValue, entity, type); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public string SaveRoom(string RoomId, List list) + { + try + { + return accommodationService.SaveRoom(RoomId, list); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } /// /// 批量添加单元、楼层、宿舍、床位 @@ -581,7 +830,6 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } - #endregion } 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 41cd164b0..2050f1292 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,7 +21,9 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// 查询参数 /// IEnumerable GetPageList(Pagination pagination, string queryJson); + IEnumerable GetBedListByRoomId(string RoomId); IEnumerable GetAllList(); + IEnumerable GetClassifyList(Pagination paginationobj,string queryJson); /// /// 获取Acc_DormitoryBuild表实体数据 /// 主键 @@ -42,6 +44,9 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// /// List GetList(); + List GetDept(); + List GetMajor(string strWhere); + List GetClass(string strWhere); /// /// 获取左侧树形数据 /// @@ -50,6 +55,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); @@ -68,7 +74,9 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// /// void DeleteEntity(string keyValue); + void DeleteBed(string keyValue, string ParentID); string GetBuildType(string parentID); + string GetParentBuildType(string keyValue); /// /// 保存实体数据(新增、修改) @@ -76,7 +84,9 @@ 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); + string 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 21b627eb3..ade272d6d 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,10 +51,14 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement t.ParentID, t.Remark, t.Starred, - t.HasToilet, - stb.StuName + 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 LEFT JOIN dbo.StuInfoBasic stb ON t.StudentID=stb.StuId"); + 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 "); var queryParam = queryJson.ToJObject(); // 虚拟参数 @@ -64,6 +68,27 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement 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()) + { + 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); @@ -76,18 +101,18 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } if (!queryParam["Dept"].IsEmpty()) { - dp.Add("Dept", "%" + queryParam["Dept"].ToString() + "%", DbType.String); - strSql.Append(" AND t.Dept Like @Dept "); + dp.Add("Dept", queryParam["Dept"].ToString(), DbType.String); + 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 "); + dp.Add("Class", queryParam["Class"].ToString(), DbType.String); + 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 "); + dp.Add("Major", queryParam["Major"].ToString(), DbType.String); + strSql.Append(" AND t.Major=@Major "); } if (!queryParam["Sex"].IsEmpty()) { @@ -104,6 +129,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) @@ -118,6 +190,27 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } } + + 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 @@ -137,11 +230,95 @@ 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).ToList(); + //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 { - var entity = this.BaseRepository("CollegeMIS").FindEntity(a => a.ParentID == parentID); + var entity = this.BaseRepository("CollegeMIS").FindEntity(a => a.ID == parentID); if (null != entity) { return entity.BuildType; @@ -164,6 +341,35 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } + 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 @@ -418,7 +624,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement floorInfo.dormitory = bed; if (!string.IsNullOrEmpty(bed.StudentID)) { - floorInfo.stuInfo = this.BaseRepository("CollegeMIS").FindEntity(a => a.StuId == bed.StudentID); + floorInfo.stuInfo = this.BaseRepository("CollegeMIS").FindEntity(a => a.StuNo == bed.StudentID); } list.Add(floorInfo); } @@ -510,6 +716,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表实体数据 /// 主键 @@ -582,7 +807,44 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement { try { - return this.BaseRepository("CollegeMIS").FindList(a => a.BuildType != "5").OrderBy(a => a.sort).ThenBy(a => a.Name).ToList(); + return this.BaseRepository("CollegeMIS").FindList(a => a.BuildType != "5" && a.BuildType != "4").OrderBy(a => a.sort).ThenBy(a => a.Name).ToList(); + + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取非空床的系部专业 班级 + /// + /// + public List GetSelectData(string strWhere) + { + try + { + string sql = + @"select distinct dept,d.DeptName,major,m.MajorName,class,c.ClassName from [dbo].[Acc_DormitoryBuild] t +join CdDept d on t.dept=d.deptno +join CdMajor m on t.major=m.majorno +join ClassInfo c on t.class=c.classno +where t.ID in ( +select parentid from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (studentid is not null and len(studentid)>0) +)"; + if (!string.IsNullOrEmpty(strWhere)) + { + sql += " and " + strWhere; + } + + return this.BaseRepository("CollegeMIS").FindList(sql).ToList(); } catch (Exception ex) @@ -598,6 +860,41 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } + /// + /// 获取树形数据(学生归宿) + /// + /// + public List GetSqlTreeForReturn() + { + try + { + List list = new List(); + var roomSql = @"select * from [dbo].[Acc_DormitoryBuild] where ID in ( +select parentid from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (studentid is not null and len(studentid)>0) +)"; + List roomList = this.BaseRepository("CollegeMIS") + .FindList(roomSql).ToList(); + list = roomList.Union(list).ToList(); + var apartIds = roomList.Select(x => x.ApartmentId).Distinct().ToList(); + var unitIds = roomList.Select(x => x.UnitId).Distinct().ToList(); + var floorIds = roomList.Select(x => x.FloorId).Distinct().ToList(); + var otherList = this.BaseRepository("CollegeMIS").FindList(x => + apartIds.Contains(x.ID) || unitIds.Contains(x.ID) || floorIds.Contains(x.ID)).ToList(); + list = list.Union(otherList).ToList(); + return list.OrderBy(x => x.DNo).OrderBy(x => x.Name).ToList(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } /// /// 根据父id获取数据 /// @@ -734,6 +1031,10 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } 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; } @@ -799,6 +1100,27 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } + + 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(); @@ -842,7 +1164,9 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement var elementEntity = new Acc_DormitoryBuildEntity { ParentID = keyValue, + ApartmentId = keyValue, Name = i.ToString() + "单元", + DNo = i.ToString(), BuildType = "2",//单元类型 Sex = dormitory.Sex, Address = dormitory.Address, @@ -859,6 +1183,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement UpdateTime = DateTime.Now }; elementEntity.Create(); + elementEntity.UnitId = elementEntity.ID; list.Add(elementEntity); //添加楼层 @@ -869,7 +1194,10 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement 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, @@ -886,6 +1214,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement UpdateTime = DateTime.Now }; floorEntity.Create(); + floorEntity.FloorId = floorEntity.ID; list.Add(floorEntity); //添加房间 @@ -896,7 +1225,11 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement 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, @@ -909,6 +1242,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement Major = dormitory.Major, Phone = dormitory.Phone, Price = dormitory.Price, + RoomType = bedNum, UpdateBy = currentUser.realName, UpdateTime = DateTime.Now, Starred = "3", @@ -925,7 +1259,11 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement var bedEntity = new Acc_DormitoryBuildEntity { ParentID = roomEntity.ID, + ApartmentId = keyValue, + UnitId = elementEntity.ID, + FloorId = floorEntity.ID, Name = m.ToString() + "床", + DNo = m.ToString(), BuildType = "5", Sex = dormitory.Sex, Address = dormitory.Address, @@ -1275,9 +1613,11 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } else { + entity.Create(); if (entity.BuildType == "1") { - if (string.IsNullOrEmpty(entity.ParentID)) + entity.ApartmentId = entity.ID; + if (string.IsNullOrEmpty(entity.ParentID) || entity.ParentID == "-1") { var rootNode = this.BaseRepository("CollegeMIS").FindList().FirstOrDefault(a => a.ParentID == null); if (rootNode == null) @@ -1291,6 +1631,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); } @@ -1300,7 +1641,33 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } } - entity.Create(); + else + { + //上一级 + var parentity = this.BaseRepository("CollegeMIS").FindList().FirstOrDefault(a => a.ID == entity.ParentID); + switch (parentity.BuildType) + { + case "1": + entity.ApartmentId = parentity.ID; + entity.UnitId = entity.ID; + break; + case "2": + { + entity.FloorId = entity.ID; + entity.UnitId = parentity.ID; + entity.ApartmentId = parentity.ApartmentId; + } + break; + case "3": + { + entity.FloorId = parentity.ID; + entity.UnitId = parentity.UnitId; + entity.ApartmentId = parentity.ApartmentId; + } + break; + } + } + entity.CreateBy = currentUser.realName; entity.CreateTime = DateTime.Now; entity.UpdateBy = currentUser.realName; @@ -1321,6 +1688,157 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } + + /// + /// 保存实体数据(新增、修改) + /// 主键 + /// + /// + 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 string SaveRoom(string RoomId, List list) + { + var db = this.BaseRepository("CollegeMIS").BeginTrans(); + try + { + foreach (var entity in list) + { + //判断该学生是否已分配 + if (!string.IsNullOrEmpty(entity.StudentID)) + { + var count = db.FindList().Count(x => x.StudentID == entity.StudentID && x.ID != entity.ID); + if (count > 0) + { + var stuname = db.FindEntity(x => x.StuNo == entity.StudentID)?.StuName; + return "学生" + stuname + "已分配床位,不可重复分配!"; + } + } + + //分配床位 + 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(); + return ""; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + /// /// 同步宿舍信息 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/Acc_DormitoryReturnEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/Acc_DormitoryReturnEntity.cs new file mode 100644 index 000000000..3e91d02ac --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/Acc_DormitoryReturnEntity.cs @@ -0,0 +1,104 @@ +using Learun.Util; +using System; +using System.ComponentModel.DataAnnotations.Schema; + +namespace Learun.Application.TwoDevelopment.LogisticsManagement +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-03-10 10:06 + /// 描 述:学生归宿管理 + /// + public class Acc_DormitoryReturnEntity + { + #region 实体成员 + /// + /// Id + /// + [Column("ID")] + public string Id { get; set; } + /// + /// 宿舍id,关联Acc_DormitoryBuild表 + /// + [Column("DORMITORYBUILDID")] + public string DormitoryBuildId { get; set; } + /// + /// 床位父级 + /// + [Column("PARENTID")] + public string ParentId { get; set; } + + /// + /// 检查日期 + /// + [Column("CHECKDATE")] + public DateTime? CheckDate { get; set; } + /// + /// 出宿时间 + /// + [Column("OUTTIME")] + public DateTime? OutTime { get; set; } + /// + /// 归宿时间 + /// + [Column("RETURNTIME")] + public DateTime? ReturnTime { get; set; } + + /// + /// 备注 + /// + [Column("REMARK")] + public string Remark { get; set; } + /// + /// 创建人 + /// + [Column("CREATEUSERID")] + public string CreateUserId { get; set; } + /// + /// 创建时间 + /// + [Column("CREATETIME")] + public DateTime? CreateTime { get; set; } + /// + /// 修改时间 + /// + [Column("UPDATETIME")] + public DateTime? UpdateTime { get; set; } + /// + /// 修改人 + /// + [Column("UPDATEUSERID")] + public string UpdateUserId { get; set; } + #endregion + + #region 扩展操作 + /// + /// 新增调用 + /// + public void Create() + { + this.Id = Guid.NewGuid().ToString(); + this.CreateTime = DateTime.Now; + this.CreateUserId = LoginUserInfo.Get().userId; + } + /// + /// 编辑调用 + /// + /// + public void Modify(string keyValue) + { + this.Id = keyValue; + this.UpdateTime = DateTime.Now; + this.UpdateUserId = LoginUserInfo.Get().userId; + } + #endregion + #region 扩展字段 + [NotMapped] + public string Name { get; set; } + + #endregion + } +} + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnBLL.cs new file mode 100644 index 000000000..066f0b3e8 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnBLL.cs @@ -0,0 +1,210 @@ +using Learun.Util; +using System; +using System.Data; +using System.Collections.Generic; +using System.Linq; + +namespace Learun.Application.TwoDevelopment.LogisticsManagement +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-03-10 10:06 + /// 描 述:学生归宿管理 + /// + public class DormitoryReturnBLL : DormitoryReturnIBLL + { + private DormitoryReturnService dormitoryReturnService = new DormitoryReturnService(); + private AccommodationService accommodationService = new AccommodationService(); + + #region 获取数据 + + /// + /// 获取左侧树形数据 + /// + /// + public List GetTree() + { + try + { + List list = accommodationService.GetSqlTreeForReturn(); + 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 = true, + parentId = item.ParentID == null ? "" : item.ParentID, + title = item.BuildType + + }; + + + treeList.Add(node); + + + } + + + return treeList.ToTree(); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + /// + /// 获取页面显示列表数据 + /// + /// 分页参数 + /// 查询参数 + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + return dormitoryReturnService.GetPageList(pagination, queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public IEnumerable GetReportList(string queryJson) + { + try + { + return dormitoryReturnService.GetReportList(queryJson); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 获取Acc_DormitoryReturn表实体数据 + /// + /// 主键 + /// + public Acc_DormitoryReturnEntity GetAcc_DormitoryReturnEntity(string keyValue) + { + try + { + return dormitoryReturnService.GetAcc_DormitoryReturnEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + public void DeleteEntity(string keyValue) + { + try + { + dormitoryReturnService.DeleteEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + /// + public void SaveEntity(string type, Acc_DormitoryReturnEntity entity) + { + try + { + dormitoryReturnService.SaveEntity(type, entity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + public void SaveData(string keyValue, Acc_DormitoryReturnEntity entity) + { + try + { + dormitoryReturnService.SaveData(keyValue, entity); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnIBLL.cs new file mode 100644 index 000000000..39401c7d1 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnIBLL.cs @@ -0,0 +1,50 @@ +using Learun.Util; +using System.Data; +using System.Collections.Generic; + +namespace Learun.Application.TwoDevelopment.LogisticsManagement +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-03-10 10:06 + /// 描 述:学生归宿管理 + /// + public interface DormitoryReturnIBLL + { + #region 获取数据 + List GetTree(); + /// + /// 获取页面显示列表数据 + /// + /// 查询参数 + /// + IEnumerable GetPageList(Pagination pagination, string queryJson); + IEnumerable GetReportList(string queryJson); + /// + /// 获取Acc_DormitoryReturn表实体数据 + /// + /// 主键 + /// + Acc_DormitoryReturnEntity GetAcc_DormitoryReturnEntity(string keyValue); + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + void DeleteEntity(string keyValue); + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + void SaveEntity(string type, Acc_DormitoryReturnEntity entity); + void SaveData(string keyValue, Acc_DormitoryReturnEntity entity); + #endregion + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnService.cs new file mode 100644 index 000000000..66b235250 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnService.cs @@ -0,0 +1,273 @@ +using Dapper; +using Learun.DataBase.Repository; +using Learun.Util; +using System; +using System.Collections.Generic; +using System.Data; +using System.Linq; +using System.Text; + +namespace Learun.Application.TwoDevelopment.LogisticsManagement +{ + /// + /// 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架 + /// Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + /// 创 建:超级管理员 + /// 日 期:2022-03-10 10:06 + /// 描 述:学生归宿管理 + /// + public class DormitoryReturnService : RepositoryFactory + { + #region 获取数据 + + /// + /// 获取页面显示列表数据 + /// + /// 查询参数 + /// 查询参数 + /// + public IEnumerable GetPageList(Pagination pagination, string queryJson) + { + try + { + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(@" + t.*,a.Name + "); + strSql.Append(" FROM Acc_DormitoryReturn t "); + strSql.Append(" join Acc_DormitoryBuild a on t.DormitoryBuildId=a.ID "); + strSql.Append(" WHERE 1=1 "); + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + if (!queryParam["StartTime"].IsEmpty() && !queryParam["EndTime"].IsEmpty()) + { + dp.Add("startTime", queryParam["StartTime"].ToDate(), DbType.DateTime); + dp.Add("endTime", queryParam["EndTime"].ToDate(), DbType.DateTime); + strSql.Append(" AND ( t.CheckDate >= @startTime AND t.CheckDate <= @endTime ) "); + } + if (!queryParam["OutTime"].IsEmpty()) + { + dp.Add("OutTime", queryParam["OutTime"].ToString(), DbType.String); + strSql.Append(" AND t.OutTime = @OutTime "); + } + if (!queryParam["ParentId"].IsEmpty()) + { + dp.Add("ParentId", queryParam["ParentId"].ToString(), DbType.String); + strSql.Append(" AND t.ParentId = @ParentId "); + } + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取统计数据 + /// + /// + /// + public IEnumerable GetReportList(string queryJson) + { + try + { + string sql = @"select t.isreturn,a.Dept,a.Major,a.class from +( +select parentid,isreturn from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (studentid is not null and len(studentid)>0) +) t +join Acc_DormitoryBuild a on a.ID=t.parentid where 1=1 +"; + var queryParam = queryJson.ToJObject(); + // 虚拟参数 + var dp = new DynamicParameters(new { }); + if (!queryParam["Dept"].IsEmpty()) + { + sql += $" AND a.Dept = '{queryParam["Dept"].ToString()}'"; + } + if (!queryParam["Major"].IsEmpty()) + { + sql += $" AND a.Major = '{queryParam["Major"].ToString()}'"; + } + if (!queryParam["Class"].IsEmpty()) + { + sql += $" AND a.Class = '{queryParam["Class"].ToString()}'"; + } + return this.BaseRepository("CollegeMIS").FindList(sql); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 获取Acc_DormitoryReturn表实体数据 + /// + /// 主键 + /// + public Acc_DormitoryReturnEntity GetAcc_DormitoryReturnEntity(string keyValue) + { + try + { + return this.BaseRepository("CollegeMIS").FindEntity(keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + public void DeleteEntity(string keyValue) + { + try + { + this.BaseRepository("CollegeMIS").Delete(t => t.Id == keyValue); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + public void SaveEntity(string type, Acc_DormitoryReturnEntity entity) + { + var db = this.BaseRepository("CollegeMIS"); + try + { + db.BeginTrans(); + if (type == "1") + { + //学生出宿 + entity.Create(); + entity.CheckDate = Convert.ToDateTime(entity.OutTime.Value.Date); + db.Insert(entity); + + //修改该床位为未归宿 + var sql = $"update Acc_DormitoryBuild set IsReturn=0 where ID='{entity.DormitoryBuildId}'"; + db.ExecuteBySql(sql); + } + else + { + //学生归宿 + //获取今天最后一次出宿的记录 + var outsql = + $"select top 1 * from Acc_DormitoryReturn where DormitoryBuildId='{entity.DormitoryBuildId}' and CheckDate='{DateTime.Now.Date}' order by OutTime desc"; + var model = db.FindList(outsql).FirstOrDefault(); + if (model == null) + { + //新增 + entity.Create(); + entity.ReturnTime = entity.ReturnTime; + entity.CheckDate = Convert.ToDateTime(entity.ReturnTime.Value.Date); + db.Insert(entity); + } + else + { + //修改 + model.ReturnTime = entity.ReturnTime; + model.Remark += " " + entity.Remark; + model.Modify(model.Id); + db.Update(model); + } + + //修改该床位为未归宿 + var sql = $"update Acc_DormitoryBuild set IsReturn=1 where ID='{entity.DormitoryBuildId}'"; + db.ExecuteBySql(sql); + } + + db.Commit(); + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 保存 + /// + /// + /// + public void SaveData(string keyValue, Acc_DormitoryReturnEntity entity) + { + try + { + if (!string.IsNullOrEmpty(keyValue)) + { + entity.Modify(keyValue); + this.BaseRepository("CollegeMIS").Update(entity); + } + else + { + entity.Create(); + this.BaseRepository("CollegeMIS").Insert(entity); + } + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + #endregion + + } +}