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..e91324329 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/DormitoryReturnController.cs @@ -0,0 +1,147 @@ +using Learun.Util; +using System.Data; +using Learun.Application.TwoDevelopment.LogisticsManagement; +using System.Web.Mvc; +using System.Collections.Generic; + +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(); + + #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(); + } + #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); + } + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + /// + [HttpPost] + [AjaxOnly] + public ActionResult DeleteForm(string keyValue) + { + dormitoryReturnIBLL.DeleteEntity(keyValue); + 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/DormitoryReturn/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/Form.cshtml new file mode 100644 index 000000000..4df7d49cd --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/Form.cshtml @@ -0,0 +1,23 @@ +@{ + ViewBag.Title = "学生归宿管理"; + Layout = "~/Views/Shared/_Form.cshtml"; +} +
+
+
床位
+
+
+
+
出宿时间
+ +
+
+
归宿时间
+ +
+ @*
+
检查日期
+ +
*@ +
+@Html.AppendJsFile("/Areas/LogisticsManagement/Views/DormitoryReturn/Form.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/Form.js new file mode 100644 index 000000000..32fa55cf7 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/Form.js @@ -0,0 +1,59 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2022-03-10 10:06 + * 描 述:学生归宿管理 + */ +var acceptClick; +var keyValue = request('keyValue'); +var ParentId = request('ParentId'); +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + $('.lr-form-wrap').lrscroll(); + page.bind(); + page.initData(); + }, + bind: function () { + $('#DormitoryBuildId').lrselect({ + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable', + param: { code: 'DormitoryInfo', strWhere: "ParentID='" + ParentId + "' and BuildType='5' order by name" }, + text: 'name', + value: 'id', + allowSearch: true + }); + }, + initData: function () { + if (!!keyValue) { + $.lrSetForm(top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/GetFormData?keyValue=' + keyValue, function (data) { + console.log('data', 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/DormitoryReturn/SaveForm?keyValue=' + keyValue, postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/FormOut.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/FormOut.cshtml new file mode 100644 index 000000000..8ffe95108 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/FormOut.cshtml @@ -0,0 +1,19 @@ +@{ + ViewBag.Title = "学生出宿"; + Layout = "~/Views/Shared/_Form.cshtml"; +} +
+
+
床位*
+
+
+
+
出宿时间*
+ +
+
+
备注
+ +
+
+@Html.AppendJsFile("/Areas/LogisticsManagement/Views/DormitoryReturn/FormOut.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/FormOut.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/FormOut.js new file mode 100644 index 000000000..12f942c58 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/FormOut.js @@ -0,0 +1,61 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2022-03-10 10:06 + * 描 述:学生归宿管理 + */ +var acceptClick; +var keyValue = request('keyValue'); +var ParentId = request('ParentId'); +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + $('.lr-form-wrap').lrscroll(); + page.bind(); + page.initData(); + }, + bind: function () { + $('#DormitoryBuildId').lrselect({ + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable', + param: { code: 'DormitoryInfo', strWhere: "ParentID='" + ParentId + "' and BuildType='5' order by name" }, + text: 'name', + value: 'id', + allowSearch: true + }); + + }, + initData: function () { + if (!!keyValue) { + $.lrSetForm(top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/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 strEntity = $('body').lrGetFormData(); + strEntity.ParentId = ParentId; + var postData = { + strEntity: JSON.stringify(strEntity) + }; + $.lrSaveForm(top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/SaveForm?type=1', postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/FormReturn.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/FormReturn.cshtml new file mode 100644 index 000000000..073ba9dce --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/FormReturn.cshtml @@ -0,0 +1,19 @@ +@{ + ViewBag.Title = "学生出宿"; + Layout = "~/Views/Shared/_Form.cshtml"; +} +
+
+
床位*
+
+
+
+
归宿时间*
+ +
+
+
备注
+ +
+
+@Html.AppendJsFile("/Areas/LogisticsManagement/Views/DormitoryReturn/FormReturn.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/FormReturn.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/FormReturn.js new file mode 100644 index 000000000..5dcb77fe9 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/FormReturn.js @@ -0,0 +1,61 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2022-03-10 10:06 + * 描 述:学生归宿管理 + */ +var acceptClick; +var keyValue = request('keyValue'); +var ParentId = request('ParentId'); +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + $('.lr-form-wrap').lrscroll(); + page.bind(); + page.initData(); + }, + bind: function () { + $('#DormitoryBuildId').lrselect({ + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable', + param: { code: 'DormitoryInfo', strWhere: "ParentID='" + ParentId + "' and BuildType='5' order by name" }, + text: 'name', + value: 'id', + allowSearch: true + }); + + }, + initData: function () { + if (!!keyValue) { + $.lrSetForm(top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/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 strEntity = $('body').lrGetFormData(); + strEntity.ParentId = ParentId; + var postData = { + strEntity: JSON.stringify(strEntity) + }; + $.lrSaveForm(top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/SaveForm?type=2', postData, function (res) { + // 保存成功后才回调 + if (!!callBack) { + callBack(); + } + }); + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/Index.cshtml new file mode 100644 index 000000000..c71a2bed5 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/Index.cshtml @@ -0,0 +1,49 @@ +@{ + ViewBag.Title = "学生归宿管理"; + Layout = "~/Views/Shared/_Index.cshtml"; +} +
+
+
+
树形列表
+
+
+
+
+
+
+ 列表信息 +
+
+
+
+
+
+ @*
+
+
+
+
出宿时间
+
+
+
+
*@ +
+ +
+
+
+
+
+@Html.AppendJsFile("/Areas/LogisticsManagement/Views/DormitoryReturn/Index.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/Index.js new file mode 100644 index 000000000..b57fc8796 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/DormitoryReturn/Index.js @@ -0,0 +1,159 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2022-03-10 10:06 + * 描 述:学生归宿管理 + */ +var refreshGirdData; +var ParentId = ''; +var bootstrap = function ($, learun) { + "use strict"; + var startTime; + var endTime; + var page = { + init: function () { + page.initGird(); + page.bind(); + }, + bind: function () { + // 初始化左侧树形数据 + $('#dataTree').lrtree({ + url: top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/GetTree', + nodeClick: function (item) { + if (item.title == '4') { + ParentId = item.value; + page.search({ DormitoryBuildId: item.value }); + } + } + }); + // 时间搜索框 + $('#datesearch').lrdate({ + dfdata: [ + { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近7天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'd', -6) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近1个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -1) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, + { name: '近3个月', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00', 'm', -3) }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } } + ], + // 月 + mShow: false, + premShow: false, + // 季度 + jShow: false, + prejShow: false, + // 年 + ysShow: false, + yxShow: false, + preyShow: false, + yShow: false, + // 默认 + dfvalue: '1', + selectfn: function (begin, end) { + startTime = begin; + endTime = end; + page.search(); + } + }); + $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { + page.search(queryJson); + }, 220, 400); + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + // 学生出宿 + $('#lr_out').on('click', function () { + if (!!ParentId) { + learun.layerForm({ + id: 'formout', + title: '学生出宿', + url: top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/FormOut?ParentId=' + ParentId, + width: 600, + height: 400, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } else { + return learun.alert.warning('请选择宿舍!'); + } + }); + + // 学生出宿 + $('#lr_return').on('click', function () { + if (!!ParentId) { + learun.layerForm({ + id: 'formreturn', + title: '学生归宿', + url: top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/FormReturn?ParentId=' + ParentId, + width: 600, + height: 400, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData); + } + }); + } else { + return learun.alert.warning('请选择宿舍!'); + } + }); + // 编辑 + $('#lr_edit').on('click', function () { + var keyValue = $('#gridtable').jfGridValue('Id'); + if (learun.checkrow(keyValue)) { + learun.layerForm({ + id: 'form', + title: '编辑', + url: top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/Form?keyValue=' + keyValue + '&ParentId=' + ParentId, + 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/DormitoryReturn/DeleteForm', { keyValue: keyValue }, function () { + refreshGirdData(); + }); + } + }); + } + }); + // 打印 + $('#lr_print').on('click', function () { + $('#gridtable').jqprintTable(); + }); + }, + // 初始化列表 + initGird: function () { + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/LogisticsManagement/DormitoryReturn/GetPageList', + headData: [ + { label: "床位", name: "Name", width: 100, align: "left" }, + { label: "出宿时间", name: "OutTime", width: 200, align: "left" }, + { label: "归宿时间", name: "ReturnTime", width: 200, align: "left" }, + ], + mainId: 'Id', + isPage: true, + sidx: 'OutTime desc', + }); + }, + search: function (param) { + param = param || {}; + if (!!ParentId) { + param.StartTime = startTime; + param.EndTime = endTime; + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + } + } + }; + refreshGirdData = function () { + $('#gridtable').jfGridSet('reload'); + }; + 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 09e77255e..02aaffd0c 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 @@ -845,6 +845,7 @@ + @@ -1338,6 +1339,8 @@ + + @@ -6692,6 +6695,10 @@ + + + + @@ -7639,6 +7646,8 @@ + + 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 a654f0021..0291b6d2d 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 @@ -599,6 +599,7 @@ + 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.TwoDevelopment/Learun.Application.TwoDevelopment.csproj b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/Learun.Application.TwoDevelopment.csproj index d2d3ac69e..85be91922 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 @@ -1826,6 +1826,10 @@ + + + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/Acc_DormitoryBuildEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/Acc_DormitoryBuildEntity.cs index 3ea342fb6..e5bd4c356 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 @@ -177,6 +177,11 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement ///
[Column("CHECKINSTU")] public int? CheckInStu { get; set; } + /// + /// 是否归宿 + /// + [Column("ISRETURN")] + public int? IsReturn { get; set; } #endregion #region 扩展字段 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 224268f75..d03e72a74 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 @@ -823,6 +823,41 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName } } + /// + /// 获取树形数据(学生归宿) + /// + /// + 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获取数据 /// @@ -1187,6 +1222,9 @@ a.name as ApartmentName,b.name as UnitName,c.Name as FloorName var bedEntity = new Acc_DormitoryBuildEntity { ParentID = roomEntity.ID, + ApartmentId = keyValue, + UnitId = elementEntity.ID, + FloorId = floorEntity.ID, Name = m.ToString() + "床", DNo = m.ToString(), BuildType = "5", 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..3dba95c19 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnBLL.cs @@ -0,0 +1,173 @@ +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); + } + } + } + + /// + /// 获取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); + } + } + } + + #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..bbcd2be79 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnIBLL.cs @@ -0,0 +1,48 @@ +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); + /// + /// 获取Acc_DormitoryReturn表实体数据 + /// + /// 主键 + /// + Acc_DormitoryReturnEntity GetAcc_DormitoryReturnEntity(string keyValue); + #endregion + + #region 提交数据 + + /// + /// 删除实体数据 + /// + /// 主键 + void DeleteEntity(string keyValue); + /// + /// 保存实体数据(新增、修改) + /// + /// 主键 + /// 实体 + void SaveEntity(string type, 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..9491f5f02 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/DormitoryReturn/DormitoryReturnService.cs @@ -0,0 +1,196 @@ +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); + } + } + } + + /// + /// 获取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); + } + } + } + + #endregion + + } +}