From 5077da8277e1449960027fe7896362bc68269c7c Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Wed, 2 Nov 2022 16:12:08 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91=E5=AD=A6?= =?UTF-8?q?=E7=94=9F=E5=AE=BF=E8=88=8D=E7=AE=A1=E7=90=86=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=88=E5=AD=A6=E7=94=9F=E5=AE=BF=E8=88=8D=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E3=80=81=E6=9F=A5=E7=9C=8B=E3=80=81=E5=88=86=E9=85=8D=E5=AE=BF?= =?UTF-8?q?=E8=88=8D=E3=80=81=E5=AD=A6=E7=94=9F=E5=BD=92=E5=AE=BF=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E3=80=81=E5=BD=92=E5=AE=BF=E7=BB=9F=E8=AE=A1=E3=80=81?= =?UTF-8?q?=E5=AE=BF=E8=88=8D=E6=99=9A=E5=BD=92=E8=A7=84=E5=88=99=E3=80=81?= =?UTF-8?q?=EF=BC=89=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/AccommodationController.cs | 83 ++++ .../Views/Acc_DormitoryRule/Form.cshtml | 20 +- .../Views/Acc_DormitoryRule/Form.js | 9 + .../Views/Acc_DormitoryRule/Index.js | 28 +- .../Views/Acc_Punishment/Index.js | 6 +- .../Views/Accommodation/ClearForm.cshtml | 11 + .../Views/Accommodation/ClearForm.js | 37 ++ .../Views/Accommodation/Corridor.cshtml | 5 - .../Views/Accommodation/Dormitory.cshtml | 2 +- .../Views/Accommodation/Floor.cshtml | 7 +- .../Views/Accommodation/Form.js | 22 +- .../Views/Accommodation/FormClass.js | 7 +- .../Views/Accommodation/FormClassify.js | 11 +- .../Views/Accommodation/FormDept.js | 3 +- .../Views/Accommodation/Index.cshtml | 5 +- .../Views/Accommodation/Index.js | 16 + .../Accommodation/IndexDistribution.cshtml | 1 + .../Views/Accommodation/IndexDistribution.js | 20 +- .../Views/Accommodation/IndexImport.cshtml | 26 ++ .../Views/Accommodation/IndexImport.js | 180 +++++++++ .../Views/Accommodation/Room.cshtml | 5 - .../Views/Accommodation/Unit.cshtml | 5 - .../Views/DormitoryReturn/Index.cshtml | 2 +- .../Content/excel/AccommodationImport.xls | Bin 0 -> 31232 bytes .../Learun.Application.Web.csproj | 5 + .../Acc_DormitoryRuleEntity.cs | 18 +- .../Acc_DormitoryRuleService.cs | 11 + .../Accommodation/AccommodationBLL.cs | 109 +++++- .../Accommodation/AccommodationIBLL.cs | 4 + .../Accommodation/AccommodationService.cs | 353 ++++++++++++++++++ .../DormitoryReturn/DormitoryReturnService.cs | 2 +- 31 files changed, 946 insertions(+), 67 deletions(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/ClearForm.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/ClearForm.js create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexImport.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexImport.js create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/AccommodationImport.xls 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 24e3ad8cf..144b80a81 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 @@ -8,6 +8,8 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Linq; +using System.IO; +using Learun.Application.Base.SystemModule; namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers { @@ -21,6 +23,7 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers public class AccommodationController : MvcControllerBase { private AccommodationIBLL accommodationIBLL = new AccommodationBLL(); + private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL(); #region 视图功能 @@ -208,6 +211,25 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers return View(); } + /// + /// 分类管理 + /// + /// + [HttpGet] + public ActionResult ClearForm() + { + return View(); + } + + /// + /// 导入宿舍 + /// + /// + [HttpGet] + public ActionResult IndexImport() + { + return View(); + } #endregion @@ -521,6 +543,67 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers return Success("同步成功"); } + /// + /// 按条件清空 + /// + /// + public ActionResult StudentClear(string Grade) + { + accommodationIBLL.ClearEntity(Grade); + return Success("清空成功"); + } + + /// + /// 宿舍信息导入模板 + /// + /// + public ActionResult DownTemplate() + { + FileStreamResult result = null; + try + { + var path = Server.MapPath("~/Content/excel/"); + var pathoffull = path + "AccommodationImport.xls"; + FileStream fsread = fsread = new FileStream(pathoffull, FileMode.OpenOrCreate, FileAccess.ReadWrite); + result = File(fsread, "application/ms-excel", "宿舍信息导入.xls"); + + return result; + } + catch (Exception ex) + { + return null; + } + } + + + /// + /// 宿舍信息excel文件导入 + /// + /// + /// + /// + [HttpPost] + [ValidateAntiForgeryToken] + public ActionResult ExecuteImportExcel(string fileGuid, int chunks) + { + string path = annexesFileIBLL.SaveAnnexes(fileGuid, fileGuid, chunks, LoginUserInfo.Get()); + if (!string.IsNullOrEmpty(path)) + { + DataTable dt = ExcelHelper.ExcelImport(path); + var res = accommodationIBLL.ExecuteImportExcel(dt, fileGuid); + var data = new + { + Success = res.snum, + Fail = res.failDt.Rows.Count + }; + return Success(data); + } + else + { + return Fail("导入数据失败!"); + } + } + #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 index 100ee31f8..5e7a175f9 100644 --- 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 @@ -11,17 +11,25 @@
推送人*
-
+
推送班主任*
-
+
+
+
+
推送辅导员*
+
+
+
+
推送保卫处*
+
+
+
+
启用*
+
推送时间点*
-
-
启用*
-
-
@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 index 2dab9f792..4dcf7d09e 100644 --- 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 @@ -27,6 +27,15 @@ var bootstrap = function ($, learun) { type: 'radio', code: 'YesOrNoInt', }); + $('#CoachTeach').lrRadioCheckbox({ + type: 'radio', + code: 'YesOrNoInt', + }); + $('#Defend').lrRadioCheckbox({ + type: 'radio', + code: 'YesOrNoInt', + }); + }, initData: function () { if (!!keyValue) { 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 index 4b81ce7c9..0a1045d87 100644 --- 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 @@ -71,7 +71,7 @@ var bootstrap = function ($, learun) { headData: [ { label: "晚归时间", name: "LateReturnTime", width: 100, align: "left" }, { - label: "推送人", name: "PushUser", width: 200, align: "left", + label: "推送人", name: "PushUser", width: 400, align: "left", formatterAsync: function (callback, value, row, op, $cell) { if (value.indexOf(',') != -1) { var content = ''; @@ -83,7 +83,7 @@ var bootstrap = function ($, learun) { key: timearr[i], keyId: 'f_userid', callback: function (_data) { - content += _data['f_realname']; + content += _data['f_realname'] + ","; } }); } @@ -113,6 +113,30 @@ var bootstrap = function ($, learun) { }); } }, + { + label: "推送辅导员", name: "CoachTeach", 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: "Defend", 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", diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_Punishment/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_Punishment/Index.js index 0192b5074..22fe3aa2a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_Punishment/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Acc_Punishment/Index.js @@ -148,9 +148,9 @@ var bootstrap = function ($, learun) { }); } }, - { label: "奖励", name: "RewardContent", width: 100, align: "left" }, - { label: "奖励时间", name: "RTime", width: 100, align: "left" }, - { label: "奖励原因", name: "RReason", width: 100, align: "left" }, + { label: "惩罚", name: "RewardContent", width: 100, align: "left" }, + { label: "惩罚时间", name: "RTime", width: 100, align: "left" }, + { label: "惩罚原因", name: "RReason", width: 100, align: "left" }, ], mainId: 'ID', isPage: true diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/ClearForm.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/ClearForm.cshtml new file mode 100644 index 000000000..100f49f0c --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/ClearForm.cshtml @@ -0,0 +1,11 @@ +@{ + ViewBag.Title = "开课计划"; + Layout = "~/Views/Shared/_Form.cshtml"; +} +
+
+
年级*
+
+
+
+@Html.AppendJsFile("/Areas/LogisticsManagement/Views/Accommodation/ClearForm.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/ClearForm.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/ClearForm.js new file mode 100644 index 000000000..d8e83ff7d --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/ClearForm.js @@ -0,0 +1,37 @@ +/* * 版 本 Learun-ADMS V7.0.6 力软敏捷开发框架(http://www.learun.cn) + * Copyright (c) 2013-2020 力软信息技术(苏州)有限公司 + * 创建人:超级管理员 + * 日 期:2021-11-29 11:43 + * 描 述:开课计划 + */ +var acceptClick; +var keyValue = request('keyValue'); +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + $('.lr-form-wrap').lrscroll(); + page.bind(); + }, + bind: function () { + $('#Grade').lrselect({ + url: top.$.rootUrl + '/EducationalAdministration/ClassInfo/GenerateNearByYear', + value: 'value', + text: 'text', + allowSearch: true + }); + } + }; + // 保存数据 + acceptClick = function (callBack) { + if (!$('body').lrValidform()) { + return false; + } + var postData = $('#form').lrGetFormData(); + var Grade = postData.Grade; + learun.postForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/StudentClear', { Grade: Grade }, function () { + learun.frameTab.currentIframe().refreshGirdData() + }); + }; + 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 1b54c106e..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 @@ -45,11 +45,6 @@ left: 0px; width: 228px } - .indSec1T > a { - width: fit-content; - padding-left: 6px; - padding-right: 6px; - } 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 45a61029c..2af49c720 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 @@ -103,7 +103,7 @@
独卫
-
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Floor.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Floor.cshtml index 99ada60d1..06d008f5d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Floor.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Floor.cshtml @@ -168,12 +168,7 @@ key: value, keyId: 'f_companyid', callback: function (_data) { - if (!_data.f_fullname || _data.f_fullname == '' || _data.f_fullname == 'undefined') { - result = ''; - } - else { - result = _data.f_fullname; - } + result = _data.f_fullname; } }); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.js index fdda26390..38b25fdd2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Form.js @@ -97,19 +97,16 @@ var bootstrap = function ($, learun) { initData: function () { if (!!keyValue) { - $.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetFormData?keyValue=' + keyValue, - function(data) { - for (var id in data) { - if (!!data[id].length && data[id].length > 0) { - $('#' + id).jfGridSet('refreshdata', data[id]); - } else { - $('[data-table="' + id + '"]').lrSetFormData(data[id]); - } + $.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetFormData?keyValue=' + keyValue, function (data) { + for (var id in data) { + if (!!data[id].length && data[id].length > 0) { + $('#' + id).jfGridSet('refreshdata', data[id]); } - }); - } else { - $('#BuildType').lrselectSet('4'); - $('#BuildType').attr('readonly', 'readonly'); + else { + $('[data-table="' + id + '"]').lrSetFormData(data[id]); + } + } + }); } }, initSelect: function () { @@ -125,7 +122,6 @@ var bootstrap = function ($, learun) { param: { parentId: '0' }, } $('#Campus').lrselect(dfop); - $('#Campus').lrselectSet(learun.clientdata.get(['userinfo']).companyId); } }; diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClass.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClass.js index 4a3fd0578..ab7e16d53 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClass.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClass.js @@ -19,12 +19,14 @@ var bootstrap = function ($, learun) { $('#Class').lrselect({ value: "classno", - text: "classname" + text: "classname", + allowSearch: true }); $('#Major').lrselect({ value: "majorno", text: "majorname", + allowSearch: true, url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable', param: { code: "CdMajorInfo", strWhere: "DeptNo='" + Dept + "'" }, select: function (item) { @@ -50,7 +52,8 @@ var bootstrap = function ($, learun) { }, initData: function () { if (!!keyValue) { - $.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetFormData?keyValue=' + keyValue, function (data) { + var kv = keyValue.split(',')[0]; + $.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetFormData?keyValue=' + kv, function (data) { for (var id in data) { if (!!data[id].length && data[id].length > 0) { $('#' + id).jfGridSet('refreshdata', data[id]); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClassify.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClassify.js index c530fc983..878fe4fc5 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClassify.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormClassify.js @@ -25,7 +25,7 @@ var bootstrap = function ($, learun) { allowSearch: true, maxHeight: 225, select: function (item) { - if (item && item.id != '-1') { + if (item&&item.id!='-1') { $('#BuildType').lrselectSet(item.title); $('#BuildType').attr('readonly', 'readonly'); } else { @@ -43,7 +43,7 @@ var bootstrap = function ($, learun) { type: 'radio', code: 'HasToilet', }) - + //$('#StudentID').lrDataSourceSelect({ code: 'StuInfoBasic', value: 'stuid', text: 'stuname' }); //$('#StudentID').lrDataSourceSelect({ code: 'StuInfoTwo', value: 'stuid', text: 'stuname' }); $('#StudentID').lrselect({ @@ -51,7 +51,7 @@ var bootstrap = function ($, learun) { text: "stuname", url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=StuInfoBasic' }); - + $('#Class').lrselect({ value: "classno", text: "classname" @@ -115,7 +115,7 @@ var bootstrap = function ($, learun) { if (!!keyValue) { $.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetFormData?keyValue=' + keyValue, - function (data) { + function(data) { for (var id in data) { if (!!data[id].length && data[id].length > 0) { $('#' + id).jfGridSet('refreshdata', data[id]); @@ -126,7 +126,6 @@ var bootstrap = function ($, learun) { }); } else { $('#ParentID').lrselectSet(ParentID); - $('#ParentID').attr('readonly', 'readonly'); } }, initSelect: function () { @@ -142,7 +141,7 @@ var bootstrap = function ($, learun) { param: { parentId: '0' }, } $('#Campus').lrselect(dfop); - $('#Campus').lrselectSet(learun.clientdata.get(['userinfo']).companyId); + } }; // 保存数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormDept.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormDept.js index f945452d6..1daa1164a 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormDept.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/FormDept.js @@ -24,7 +24,8 @@ var bootstrap = function ($, learun) { }, initData: function () { if (!!keyValue) { - $.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetFormData?keyValue=' + keyValue, function (data) { + var kv = keyValue.split(',')[0]; + $.lrSetForm(top.$.rootUrl + '/LogisticsManagement/Accommodation/GetFormData?keyValue=' + kv, function (data) { for (var id in data) { if (!!data[id].length && data[id].length > 0) { $('#' + id).jfGridSet('refreshdata', data[id]); diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.cshtml index d4664f16f..49bced24d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.cshtml @@ -67,7 +67,7 @@  批量添加宿舍  床位管理 - @* 自动分配宿舍 + @* 自动分配宿舍  同步宿舍信息*@
@@ -79,6 +79,9 @@
 分类管理
+
+  导入 +
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.js index ff87bf30a..6df688c8f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Index.js @@ -280,6 +280,22 @@ var bootstrap = function ($, learun) { } }); }); + + //导入 + $("#lr_importBed").on("click", function () { + learun.layerForm({ + id: 'indexImport', + title: "导入宿舍信息", + url: top.$.rootUrl + '/LogisticsManagement/Accommodation/IndexImport', + width: 600, + height: 400, + maxmin: true, + btn: null, + end: function () { + refreshGirdData(); + } + }); + }); }, //初始化左侧树 initTree: function () { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.cshtml index 2b92a19cb..262f931ab 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.cshtml @@ -80,6 +80,7 @@  分配系  分配专业班级  分配宿舍 +  按年级清空  打印 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.js index 71a969a6d..94c88de0f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexDistribution.js @@ -271,7 +271,7 @@ var bootstrap = function ($, learun) { if (arrDept.some(function (value, index) { return value != arrDept[0]; })) { - return learun.alert.warning("选中记录包含多种专业的数据,不可批量分配班级!"); + return learun.alert.warning("选中记录包含多种系的数据,不可批量分配班级!"); } } learun.layerForm({ @@ -308,14 +308,26 @@ var bootstrap = function ($, learun) { id: 'formRoom', title: '分配宿舍--' + Name, url: top.$.rootUrl + '/LogisticsManagement/Accommodation/FormRoom?keyValue=' + keyValue + '&Class=' + Class + '&Sex=' + Sex, - width: 600, - height: 400, + width: 800, + height: 600, callBack: function (id) { return top[id].acceptClick(refreshGirdData); } }); }); - + //清空 + $("#lr_Clear").on("click", function () { + learun.layerForm({ + id: 'form', + title: '按年级清空', + url: top.$.rootUrl + '/LogisticsManagement/Accommodation/ClearForm', + width: 400, + height: 300, + callBack: function (id) { + return top[id].acceptClick(); + } + }); + }); }, //初始化左侧树 initTree: function () { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexImport.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexImport.cshtml new file mode 100644 index 000000000..ea6c5f2f7 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexImport.cshtml @@ -0,0 +1,26 @@ +@{ + ViewBag.Title = "Form"; + Layout = "~/Views/Shared/_Form.cshtml"; +} + + +@Html.AppendCssFile("/Areas/LR_SystemModule/Views/ExcelImport/ImportForm.css") + +
+
+
上传文件
+
下载模板
+
+
+
+
+ +
+
+

试试将电脑里的文件拖拽到此上传

+
+
+
+
+ +@Html.AppendJsFile("/Areas/LogisticsManagement/Views/Accommodation/IndexImport.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexImport.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexImport.js new file mode 100644 index 000000000..8795c6ee4 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/IndexImport.js @@ -0,0 +1,180 @@ +/* + * 描 述:附件上传管理 + */ +var CLId = request('CLId'); + +var bootstrap = function ($, learun) { + "use strict"; + var fileInfo = {}; + + // 触发合并文件碎片 + var mergeFileChunks = function (file) { + var param = {}; + param['__RequestVerificationToken'] = $.lrToken; + //param['CLId'] = CLId; + param['fileGuid'] = fileInfo[file.id].fileGuid; + param['fileName'] = fileInfo[file.id].name; + param['chunks'] = fileInfo[file.id].chunks; + learun.httpAsyncPost(top.$.rootUrl + "/LogisticsManagement/Accommodation/ExecuteImportExcel", param, function (res) { + var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); + $fileItem.find('.lr-uploader-progress').remove(); + + if (res.code == learun.httpCode.success) { + if (res.data.Success != '0') { + learun.alert.success('导入成功' + res.data.Success + '条'); + } + // 文件保存成功后 + $fileItem.append('
' + res.data.Success + '/' + res.data.Fail + '
'); + // 如果有失败 + if (res.data.Fail != '0') + { + learun.download({ url: top.$.rootUrl + '/LR_SystemModule/ExcelImport/DownImportErrorFile', param: { fileId: fileInfo[file.id].fileGuid, fileName: fileInfo[file.id].name, __RequestVerificationToken: $.lrToken }, method: 'POST' }); + } + + // 文件保存成功后 + //$fileItem.append('
'); + //$fileItem.append('
'); + + // $fileItem.find('.lr-tool-bar .fa-minus-circle').on('click', function () { + // var fileId = $(this).attr('data-value'); + // DeleteFile(fileId); + // }); + // learun.alert.success(res.data.info); + } + else { + learun.alert.error(res.info); + $fileItem.append('
'); + } + }); + } + // 触发清楚文件碎片 + var reomveFileChunks = function (file) { + var param = {}; + param['__RequestVerificationToken'] = $.lrToken; + param['fileGuid'] = fileInfo[file.id].fileGuid; + param['chunks'] = fileInfo[file.id].chunks; + learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/Annexes/MergeAnnexesFile", param, function (res) { }); + var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); + $fileItem.find('.lr-uploader-progress').remove(); + $fileItem.append('
'); + } + // 删除文件 + var DeleteFile = function (fileId) { + var param = {}; + param['__RequestVerificationToken'] = $.lrToken; + param['fileId'] = fileInfo[fileId].fileGuid; + learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/Annexes/DeleteAnnexesFile", param, function (res) { }); + var file = page.uploader.getFile(fileId); + if (!!file) { + page.uploader.removeFile(file); + } + delete fileInfo[fileId]; + var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + fileId); + $fileItem.remove(); + if ($('#lr_form_file_queue_list>div').length == 0) { + $('#lr_form_file_queue .lr-form-file-queue-bg').show(); + } + } + + var page = { + uploader: null, + init: function () { + if (!WebUploader.Uploader.support()) { + alert('Web Uploader 不支持您的浏览器!如果你使用的是IE浏览器,请尝试升级 flash 播放器'); + throw new Error('WebUploader does not support the browser you are using.'); + } + /*模板下载*/ + $('#lr_down_file_btn').on('click', function () { + location.href = top.$.rootUrl + "/LogisticsManagement/Accommodation/DownTemplate"; + }); + + page.uploader = WebUploader.create({ + auto: true, + swf: top.$.rootUrl + '/Content/webuploader/Uploader.swf', + // 文件接收服务端。 + server: top.$.rootUrl + "/LR_SystemModule/Annexes/UploadAnnexesFileChunk", + // 选择文件的按钮。可选。 + // 内部根据当前运行是创建,可能是input元素,也可能是flash. + pick: '#lr_add_file_btn', + dnd: '#lr_form_file_queue', + paste: 'document.body', + disableGlobalDnd: true, + accept: { + extensions: "xls,xlsx" + }, + multiple: false, + // 不压缩image, 默认如果是jpeg,文件上传前会压缩一把再上传! + resize: false, + // 文件分片上传 + chunked: true, + chunkRetry: 3, + prepareNextFile: true, + chunkSize: '1048576', + // 上传参数 + formData: { + __RequestVerificationToken: $.lrToken + } + }); + page.uploader.on('fileQueued', page.fileQueued); + page.uploader.on('uploadStart', page.uploadStart); + page.uploader.on('uploadBeforeSend', page.uploadBeforeSend); + page.uploader.on('uploadProgress', page.uploadProgress); + page.uploader.on('uploadSuccess', page.uploadSuccess); + page.uploader.on('uploadError', page.uploadError); + page.uploader.on('uploadComplete', page.uploadComplete); + page.uploader.on('error', page.error); + + + $('#lr_form_file_queue').mCustomScrollbar({ // 优化滚动条 + theme: "minimal-dark" + }); + + }, + fileQueued: function (file) {// 文件加载到队列 + fileInfo[file.id] = { name: file.name }; + $('#lr_form_file_queue .lr-form-file-queue-bg').hide(); + // 添加一条文件记录 + var $item = $('
'); + $item.append('
'); + $item.append('' + file.name + '(' + learun.countFileSize(file.size) + ')'); + + $('#lr_form_file_queue_list').append($item); + }, + uploadStart: function (file) { + var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); + $fileItem.append('
'); + }, + uploadBeforeSend: function (object, data, headers) { + data.chunk = data.chunk || 0; + data.chunks = data.chunks || 1; + fileInfo[data.id].fileGuid = fileInfo[data.id].fileGuid || WebUploader.Base.guid(); + data.fileGuid = fileInfo[data.id].fileGuid; + fileInfo[data.id].chunks = data.chunks; + }, + uploadProgress: function (file, percentage) { + var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); + $fileItem.find('.lr-uploader-progress-bar').css('width', (percentage * 100 + '%')); + }, + uploadSuccess: function (file, res) { + if (res.code == 200) {// 上传成功 + mergeFileChunks(file); + } + else {// 上传失败 + reomveFileChunks(file); + } + }, + uploadError: function (file, code) { + reomveFileChunks(file); + }, + uploadComplete: function (file) { + }, + error: function (type) { + switch (type) { + case 'Q_TYPE_DENIED': + learun.alert.error('当前文件类型不允许上传'); + break; + }; + } + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Room.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Room.cshtml index f120a829f..1683921af 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Room.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Room.cshtml @@ -45,11 +45,6 @@ left: -60px; width: 273px; } - .indSec1T > a { - width: fit-content; - padding-left: 6px; - padding-right: 6px; - } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Unit.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Unit.cshtml index 78802bccc..3e3925d18 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Unit.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/Accommodation/Unit.cshtml @@ -45,11 +45,6 @@ left: 0px; width: 225px } - .indSec1T > a { - width: fit-content; - padding-left: 6px; - padding-right: 6px; - } 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 index c71a2bed5..8f5361aab 100644 --- 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 @@ -36,7 +36,7 @@
 学生出宿  学生归宿 -  编辑 + @* 编辑*@  删除  打印
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/AccommodationImport.xls b/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/AccommodationImport.xls new file mode 100644 index 0000000000000000000000000000000000000000..27b3b570dc2d773ce27c4c13af5c1dbea3f1744d GIT binary patch literal 31232 zcmeHQ2Urxzwyqfl7%~VVL182aNE8%UQBg1pf`DmBra@E`1>*{W0;{O2h*>eqVvd+l zjB7wKqGDEb&Dk}tI`5qB>6xCH9xnHO_r3eQ_on!2rt4JIe@>k`UEy@~aN)e!y;a+7 zYKT&3L$t^bi5}5m(Rpwk#H39Lo}!U?Jnhr+6{4nQ_v2AhRl8 z#BZ*KuE$B|lLnmlgy^fGH&;V%#YyLpU{1b-wBamIh#m+14d_Q|QLMhRAuPI*rP&Fr zh&C}N#G%;1(ZkWvCkQU$JgG}NK_eKGtyp=nQQ|@I>;iT~7j6+*WiKCgeMs2}9H9g3 z6iX|y8Tw^d2a+~2d3Z2JakYyF zhRH=YVQ}V|nJqL}Xg~yXzk?;ydYG4#bjbdYJrV4o9cPtgSf9 zTXU4p5L%E787_i^kfLRe5;BGDNTvcEtw4(y!8`&}4>gzIssX21V^|FG1yqJONdTGj z{3;Tuf}qLN0R%On9t7>H4j||mP!EE}SO*Z@T0zhf>i~j!R4)mdZ5=>x)KL$DHvSJm zD#L2;9W=~3fYjbQXsvYssl9j5gzErOd+)#iQx}lhdj}THbpffpcVIF6k3oF>YVRFb zEY}63_TGVARb4=8?;V(7>H<=G?}+LKQhV<-t{aGA?|3SWY>oiJmyK*Vy0J$#p6V#( zq`+0V0$(T{BWv$Y=emGMf@=q9QWp?q!%}X)3xKF^KVP-|t}?E;6(}M)61KvqsQ@!1 zC(lXLk63OBAh2@b208JX4boGo>zV?HK-P6U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X)s2rmW+VB5p^sZ3K$dMg?My{iYb0LlA-%l6EqsoXh5R@jRrIt z&}cxT0gVPU8qjD!qXCTuG#b!oK%;@WXkZom8WRtE6tt(458hZ0soUfpKD2;vFBpCX zPuK(^o#y&PKQ0}5g7;ELGN}VGggEK7rO22@4#SPxQQl2V!_iEId@b;=>^5pE%NM`_ zEp~nMZFgbiw{n0$yA;;0RJt!yeYbH4CVRYG~zM&gpa?$LVIE9 zqhCTkp2EUwseX7S@^dN<$ZPDLgnyrwkxvB1;)U3cHZbGlCSp4oIhr zA%*RuQznqYX99G}6jFGkhEAD53J*I~16NbZQrf`rxZTv#hqgdx!VGxMFhjv&`0(ps zCPWKgQ$)pLcM1fr0fs(Aw}Xc#?3jSAZ$v-H^CmewG#BpV|7AuzZ?L@LUNmHI(M-Y6T@e)vYmTPN`daa#Y;scBR$dOBnjQ7>^?Iv$W? zWJkuR3&yv>qG=TeG z+`Hnw7x%^ZY#&dL;N}_kv3Rlr_rSQ9$9+2P+3~mw9%O;NHgzlpcf`22XI>e_{XO~s ztRPxL#D5fm|K|f=`f3Cb_r&%PMGzZ9bb#mx(Fvk6#3m43AmaYq4I=)3S$FvMfanR) z3!*nf+)p=yi1~i-jc;b+uX*`H#2VLW6z@yiA*bj6zA-$=W@`l0hkf9vI7;>Gz z;lIGj_@fMUt(YA}m(+&W`0$m%;qa0mw!I5zA&HU+DWl=lzEq&753ax;?;*T@>dK#b afe~*W2-+&IE&g-z1pW){_eI81{{IC@my9(4 literal 0 HcmV?d00001 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 8784c354d..9c8aee1fc 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 @@ -1322,6 +1322,7 @@ + @@ -1332,6 +1333,7 @@ + @@ -7900,6 +7902,9 @@ + + + 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 index 351f0e912..d7cd70906 100644 --- 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 @@ -11,7 +11,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// 日 期:2022-03-14 12:05 /// 描 述:宿舍晚归规则 /// - public class Acc_DormitoryRuleEntity + public class Acc_DormitoryRuleEntity { #region 实体成员 /// @@ -64,6 +64,22 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// [Column("UPDATEUSERID")] public string UpdateUserId { get; set; } + /// + /// + /// + [Column("COACHTEACH")] + public int? CoachTeach { get; set; } + /// + /// + /// + [Column("DEFEND")] + public int? Defend { get; set; } + /// + /// + /// + [Column("DEFENDID")] + public string DefendId { get; set; } + #endregion #region 扩展操作 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 index 751c2f837..e5148edfb 100644 --- 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 @@ -1,4 +1,5 @@ using Dapper; +using Learun.Application.Organization; using Learun.DataBase.Repository; using Learun.Util; using System; @@ -138,14 +139,24 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement { try { + var loInfo = LoginUserInfo.Get(); if (!string.IsNullOrEmpty(keyValue)) { + entity.UpdateTime = DateTime.Now; + entity.UpdateUserId = loInfo.account; entity.Modify(keyValue); this.BaseRepository("CollegeMIS").Update(entity); } else { entity.Create(); + entity.CreateTime = DateTime.Now; + entity.CreateUserId = loInfo.account; + var NewID = this.BaseRepository().FindEntity(x => x.F_FullName == "保卫处").F_DepartmentId; + if (NewID != null && entity.Defend == 1) + { + entity.DefendId = NewID; + } this.BaseRepository("CollegeMIS").Insert(entity); } } 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 41bda8acd..1b18261e9 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 @@ -311,11 +311,66 @@ 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); + // } + // } + //} + public List GetDept() { try { - return accommodationService.GetSelectData("").Select(x => new Acc_DormitoryBuildEntity { Dept = x.Dept, DeptName = x.DeptName }).Distinct().ToList(); + return accommodationService.GetDeptOrMajorOrClass("").Select(x => new Acc_DormitoryBuildEntity { Dept = x.Dept, DeptName = x.DeptName }).Distinct().ToList(); } catch (Exception ex) { @@ -333,7 +388,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement { try { - return accommodationService.GetSelectData(strWhere).Select(x => new Acc_DormitoryBuildEntity { Major = x.Major, MajorName = x.MajorName }).Distinct().ToList(); + return accommodationService.GetDeptOrMajorOrClass(strWhere).Select(x => new Acc_DormitoryBuildEntity { Major = x.Major, MajorName = x.MajorName }).Distinct().ToList(); } catch (Exception ex) { @@ -351,7 +406,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement { try { - return accommodationService.GetSelectData(strWhere).Select(x => new Acc_DormitoryBuildEntity { Class = x.Class, ClassName = x.ClassName }).Distinct().ToList(); + return accommodationService.GetDeptOrMajorOrClass(strWhere).Select(x => new Acc_DormitoryBuildEntity { Class = x.Class, ClassName = x.ClassName }).Distinct().ToList(); } catch (Exception ex) { @@ -365,7 +420,6 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } } - /// /// 获取左侧树形数据 /// @@ -830,6 +884,53 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } + + + /// + /// 清空实体数据 + /// 主键 + /// + /// + public void ClearEntity(string Grade) + { + try + { + accommodationService.ClearEntity(Grade); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + + + public (DataTable failDt, int snum, int fnum) ExecuteImportExcel(DataTable dt, string fileGuid) + { + try + { + return accommodationService.ExecuteImportExcel(dt, fileGuid); + + } + 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/Accommodation/AccommodationIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/Accommodation/AccommodationIBLL.cs index 2050f1292..9d68bf9cc 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 @@ -106,6 +106,10 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement object GetFloorList(string parentID); object GetRoomList(string parentID); object GetBedList(string parentID); + + void ClearEntity(string Grade); + (DataTable failDt, int snum, int fnum) ExecuteImportExcel(DataTable dt, string fileGuid); + #endregion } 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 ade272d6d..3bdefa34c 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 @@ -1,5 +1,7 @@ using Dapper; using Learun.Application.TwoDevelopment.EducationalAdministration; +using Learun.Cache.Base; +using Learun.Cache.Factory; using Learun.DataBase.Repository; using Learun.Util; using System; @@ -19,6 +21,10 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// public class AccommodationService : RepositoryFactory { + #region 缓存定义 + private ICache cache = CacheFactory.CaChe(); + private string cacheKey = "Learun_adms_excelError_"; // +公司主键 + #endregion #region 获取数据 /// @@ -1866,6 +1872,353 @@ where ID='{ParentID}' } } + /// + /// 按年级清空 + /// + public void ClearEntity(string Grade) + { + try + { + BaseRepository("CollegeMIS").ExecuteBySql($"delete from Acc_DormitoryBuild where StudentID in(select StuNo from StuInfoBasic where Grade ='{Grade}')"); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + + public List GetDeptOrMajorOrClass(string strWhere) + { + try + { + string sql1 = " select distinct dept,d.DeptName from Acc_DormitoryBuild t join CdDept d on t.dept=d.deptno"; + string sql2 = " select distinct major,m.MajorName from Acc_DormitoryBuild t join CdMajor m on t.major=m.majorno"; + string sql3 = " select distinct class,c.ClassName from Acc_DormitoryBuild t join ClassInfo c on t.class=c.classno"; + string sql = @" 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 = sql1 + sql; + } + else if (strWhere.Contains("deptno")) + { + sql = sql2 + sql + " and " + strWhere; + } + else if (strWhere.Contains("majorno")) + { + sql = sql3 + sql + " and " + strWhere; + } + return this.BaseRepository("CollegeMIS").FindList(sql).ToList(); + + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + /// + /// 导入宿舍信息 + /// + /// + /// + public (DataTable failDt, int snum, int fnum) ExecuteImportExcel(DataTable dt, string fileGuid) + { + int snum = 0; + int fnum = 0; + var db = this.BaseRepository("CollegeMIS"); + var msg = ""; + try + { + db.BeginTrans(); + var dormitoryBuildList = db.FindList().ToList(); + + //系 专业 班级 + var deptList = db.FindList(); + var majorList = db.FindList(x => x.CheckMark == true); + var classList = db.FindList(x => x.CheckMark == true); + //学生 + var stuinfobasic = db.FindList(); + // 创建一个datatable容器用于保存导入失败的数据 + DataTable failDt = new DataTable(); + foreach (DataColumn dc in dt.Columns) + { + failDt.Columns.Add(dc.ColumnName, dc.DataType); + } + failDt.Columns.Add("导入错误", typeof(string)); + dt.Columns.Add("导入错误", typeof(string)); + //寝室Id + var dormitoryIds = new List(); + + var user = LoginUserInfo.Get(); + foreach (DataRow dr in dt.Rows) + { + try + { + if (!string.IsNullOrEmpty(dr["宿舍楼"].ToString().Trim())) + { + + //系 专业 班级 + var DeptNo = deptList.Where(x => x.DeptName == dr["系部"].ToString().Trim()).FirstOrDefault()?.DeptNo; + var MajorNo = majorList.Where(x => x.MajorName == dr["专业"].ToString().Trim() && x.DeptNo == DeptNo) + .FirstOrDefault()?.MajorNo; + var ClassNo = classList.Where(x => x.ClassName == dr["班级"].ToString()).FirstOrDefault()?.ClassNo; + if (string.IsNullOrEmpty(DeptNo)) + { + fnum++; + dr["导入错误"] = "系部导入错误"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + if (string.IsNullOrEmpty(MajorNo)) + { + fnum++; + dr["导入错误"] = "专业导入错误"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + if (string.IsNullOrEmpty(ClassNo)) + { + fnum++; + dr["导入错误"] = "班级导入错误"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + + var leaderno = ""; + if (!string.IsNullOrEmpty(dr["舍长学号"].ToString())) + { + leaderno = stuinfobasic.Where(x => x.StuNo == dr["舍长学号"].ToString() && x.ClassNo == ClassNo).FirstOrDefault()?.StuNo; + if (string.IsNullOrEmpty(leaderno)) + { + fnum++; + dr["导入错误"] = dr["舍长学号"] + "导入错误"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + } + + var stuno = ""; + if (!string.IsNullOrEmpty(dr["学生学号"].ToString())) + { + stuno = stuinfobasic.Where(x => x.StuNo == dr["学生学号"].ToString() && x.ClassNo == ClassNo).FirstOrDefault()?.StuNo; + if (string.IsNullOrEmpty(stuno)) + { + fnum++; + dr["导入错误"] = dr["学生学号"] + "导入错误"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + } + + var parent = dormitoryBuildList.Where(x => x.Name == "数字化智慧校园").FirstOrDefault(); + if (parent == null) + { + parent = new Acc_DormitoryBuildEntity(); + parent.Create(); + parent.DNo = ""; + parent.Name = "数字化智慧校园"; + //parent.BuildType = "1"; + parent.CreateBy = user.realName; + parent.CreateTime = DateTime.Now; + parent.Campus = user.companyId; + db.Insert(parent); + + dormitoryBuildList.Add(parent); + } + + //宿舍楼 + var apartmentName = dr["宿舍楼"].ToString().Trim(); + var apartmentCode = dr["宿舍楼编号"].ToString(); + var apartment = dormitoryBuildList.Where(x => x.Name == apartmentName && x.BuildType == "1") + .FirstOrDefault(); + if (apartment == null) + { + //添加宿舍楼 + apartment = new Acc_DormitoryBuildEntity(); + apartment.Create(); + apartment.ParentID = parent.ID; + apartment.DNo = apartmentCode; + apartment.Name = apartmentName; + apartment.BuildType = "1"; + apartment.CreateBy = user.realName; + apartment.CreateTime = DateTime.Now; + apartment.Campus = user.companyId; + db.Insert(apartment); + + dormitoryBuildList.Add(apartment); + } + //单元 + var unitName = dr["单元"].ToString().Trim(); + var unitCode = dr["单元编号"].ToString(); + var unit = dormitoryBuildList.Where(x => x.Name == unitName && x.BuildType == "2" && x.ParentID == apartment.ID) + .FirstOrDefault(); + if (unit == null) + { + //添加单元 + unit = new Acc_DormitoryBuildEntity(); + unit.Create(); + unit.ParentID = apartment.ID; + unit.ApartmentId = apartment.ID; + unit.DNo = unitCode; + unit.Name = unitName; + unit.BuildType = "2"; + unit.CreateBy = user.realName; + unit.CreateTime = DateTime.Now; + unit.Campus = user.companyId; + db.Insert(unit); + + dormitoryBuildList.Add(unit); + } + //楼层 + var floorName = dr["楼层"].ToString().Trim(); + var floorCode = dr["楼层编号"].ToString(); + var floor = dormitoryBuildList.Where(x => x.Name == floorName && x.DNo == floorCode && x.BuildType == "3" && x.ParentID == unit.ID) + .FirstOrDefault(); + if (floor == null) + { + //添加楼层 + floor = new Acc_DormitoryBuildEntity(); + floor.Create(); + floor.ParentID = unit.ID; + floor.ApartmentId = apartment.ID; + floor.UnitId = unit.ID; + floor.DNo = floorCode; + floor.Name = floorName; + floor.BuildType = "3"; + floor.CreateBy = user.realName; + floor.CreateTime = DateTime.Now; + floor.Campus = user.companyId; + db.Insert(floor); + + dormitoryBuildList.Add(floor); + } + //寝室 + var dormitoryName = dr["寝室名称"].ToString().Trim(); + var dormitoryCode = dr["寝室编号"].ToString().Trim(); + var dormitory = dormitoryBuildList.Where(x => x.Name == dormitoryName && x.DNo == dormitoryCode && x.BuildType == "4" && x.ParentID == floor.ID) + .FirstOrDefault(); + if (dormitory == null) + { + //添加 + dormitory = new Acc_DormitoryBuildEntity(); + dormitory.Create(); + dormitory.Dept = DeptNo; + dormitory.Major = MajorNo; + dormitory.Class = ClassNo; + dormitory.ParentID = floor.ID; + dormitory.ApartmentId = apartment.ID; + dormitory.UnitId = unit.ID; + dormitory.FloorId = floor.ID; + dormitory.DNo = dormitoryCode; + dormitory.Name = dormitoryName; + dormitory.Sex = dr["性别"].ToString() == "女" ? "0" : "1"; + dormitory.BuildType = "4"; + dormitory.RoomType = Convert.ToInt32(dr["几人寝"].ToString()); + dormitory.Leader = leaderno; + dormitory.Starred = "3"; + dormitory.CreateBy = user.realName; + dormitory.CreateTime = DateTime.Now; + dormitory.Campus = user.companyId; + db.Insert(dormitory); + + dormitoryBuildList.Add(dormitory); + } + dormitoryIds.Add(dormitory.ID); + + //床位 + var bedName = dr["床位"].ToString().Trim(); + var bedCode = bedName.Replace("床", "").Replace("号", ""); + var bed = dormitoryBuildList.Where(x => x.Name == bedName && x.DNo == bedCode && x.BuildType == "5" && x.ParentID == dormitory.ID) + .FirstOrDefault(); + if (bed == null) + { + bed = new Acc_DormitoryBuildEntity(); + bed.Create(); + bed.ParentID = dormitory.ID; + bed.ApartmentId = apartment.ID; + bed.UnitId = unit.ID; + bed.FloorId = floor.ID; + bed.DNo = bedCode; + bed.Name = bedName; + bed.Dept = DeptNo; + bed.Major = MajorNo; + bed.Class = ClassNo; + bed.StudentID = stuno; + bed.Leader = leaderno; + bed.BuildType = "5"; + bed.CreateBy = user.realName; + bed.CreateTime = DateTime.Now; + bed.Campus = user.companyId; + db.Insert(bed); + + dormitoryBuildList.Add(bed); + snum++; + } + + } + else + { + break; + } + } + catch (Exception e) + { + fnum++; + dr["导入错误"] = "出现异常:" + e.Message; + failDt.Rows.Add(dr.ItemArray); + continue; + } + } + + + db.Commit(); + + //更新寝室入住人数字段 + var ids = string.Join("','", dormitoryIds); + var sql = $@" update a set a.CheckInStu=b.num +from Acc_DormitoryBuild a join (select parentid,count(1) as num from Acc_DormitoryBuild where buildtype='5' and studentid is not null and len(studentid)>0 and parentid in ('{ids}') group by parentid) b + on a.id=b.parentid + where a.id in ('{ids}') and a.buildtype='4'"; + this.BaseRepository("CollegeMIS").ExecuteBySql(sql); + // 写入缓存如果有未导入的数据 + if (failDt.Rows.Count > 0) + { + string errordt = failDt.ToJson(); + + cache.Write(cacheKey + fileGuid, errordt, CacheId.excel); + } + return (failDt, snum, fnum); + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } #endregion 提交数据 } } \ No newline at end of file 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 index 94249c21b..83b251047 100644 --- 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 @@ -83,7 +83,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement { string sql = @"select (case t.isreturn when 1 then 1 else 0 end) as 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) +select parentid,isreturn from [dbo].[Acc_DormitoryBuild] where BuildType='5' and (studentid is not null and len(studentid)>0) and (IsReturn is not null and len(IsReturn)>0) ) t join Acc_DormitoryBuild a on a.ID=t.parentid where 1=1 ";