From 3a95572688e7221c5f1459bc293d452df0477368 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Tue, 28 Jun 2022 16:20:11 +0800 Subject: [PATCH 1/9] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=AE=BF=E8=88=8D?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/AccommodationController.cs | 67 ++++- .../Views/Accommodation/Index.cshtml | 5 +- .../Views/Accommodation/Index.js | 18 ++ .../Views/Accommodation/IndexImport.cshtml | 26 ++ .../Views/Accommodation/IndexImport.js | 180 +++++++++++++ .../Content/excel/AccommodationImport.xls | Bin 0 -> 31232 bytes .../Learun.Application.Web.csproj | 2 + .../Accommodation/AccommodationBLL.cs | 21 ++ .../Accommodation/AccommodationIBLL.cs | 2 + .../Accommodation/AccommodationService.cs | 253 ++++++++++++++++++ 10 files changed, 572 insertions(+), 2 deletions(-) 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 cecc6a18d..8ba4e596e 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,11 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Linq; +using System.IO; +using NPOI.HSSF.UserModel; +using NPOI.SS.UserModel; +using Learun.Application.Base.SystemModule; +using System.Drawing; namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers { @@ -21,6 +26,7 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers public class AccommodationController : MvcControllerBase { private AccommodationIBLL accommodationIBLL = new AccommodationBLL(); + private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL(); #region 视图功能 @@ -207,7 +213,15 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers { return View(); } - + /// + /// 导入宿舍 + /// + /// + [HttpGet] + public ActionResult IndexImport() + { + return View(); + } #endregion @@ -526,6 +540,57 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers 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/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 162af9682..d88593baa 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,24 @@ 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/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/Content/excel/AccommodationImport.xls b/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/AccommodationImport.xls new file mode 100644 index 0000000000000000000000000000000000000000..ab60347cf767e9cf3d807a457187d395bd0e5345 GIT binary patch literal 31232 zcmeHQ2Urxzwyqfl7%~VVL182aNE8%UQBg1pf`DmBra?s%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#H39L?;{&Tq&q*N{y`IXP-&4`VTXhtl^EuaetB`rnoGV#!)W<&(-C&XVy z7xIuUB4N;y!DI*-4Q;U?9y}hDIe-dg)wLi3HS}AcEw1t?gN2M2pW?;HX2wb9fy}CW z5x=<_x*jK;Pa1II6QZw%-dqj66(^lXf;ssT(uT7MX~zMhOp>LmS!ig zBHF~95Qkz1M-N9wpCGu1^Q12A1dU)!wqoVQMu`W-vkTY}UARSLmA!n}^&w>^aD)!9 zQ!Jr`LKO=jO^Gidi6TI6Dx%mYih`s`sXTImgQo+PXqzaq6L=9f_=BqKdQC;_N=-!y zHG+u;feD1o41|!wORFl-03bM6&eWf{gJsK^GG%3a#nmnz z7$z6pgu$6-X135^p#c%l{SKB)>tS9}(jogp_C&CUlE;jpE6HC^4ILH?G|pwx4=!QG zV#c36obvEsc;=GRg29pLhqf!2Af>=%?stFjS!Fu(skX zZ_QCYLuf%VWVi?tLW-6>O2`zpBbf?xv;r++1oH??J=9!+s|K86jbSm!7f>1EBmrd7 z^Q%at3W6q62N2YRdJwd)I)I>OKs^W=V;w+rYXw0|tOE$@QN1K+wsio(QAa%p+W0>N zsSK;VchE5F08)GJptaTkr1suH6RrbD?Y#p7OkF@~?;Th)*9D~Z-hsvNKL+vjtG#z% zv0N9B+It6fRdoTWy?0=SsS8N$y(6j{NbSATxNabdz2m7gvN-|>UpBJg=*Aw|c&ekA zlLA-e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N-$^=sQOn^?ALJE)6&?z%W;bEt0;A%=)N*g#Hx0`zU&=%-Sm;uijW++$;AATLo zglOSwil|uZPJ!Sxz|e>2cJT0o9TU*?jpzq?-Xw>I#zS`o^Npf6(BcJ*AtW6R#?zS+ zi6O`~Sl9p}(&zvldqmS}Pe15j$eQo}j0S#4upjWIPz>0!_wrV}`w}t4bmJT$ad+8y z-3MqxAmWXI`IyF@#rKHOTA)j*8zTn3@swOYh={xn?khX^MoWVq5v8uNUiZj|F7QP; zaY?iO2`1C8@$eSZ1dRqX8qjD!qXCTuG#b!oK%)VT1~eMbXh5R@jRrIt`1fi+-Toi< z?fffeuM~ONn$BGa`+tuwTX27`twehRv`r9kKaW0v&Jgi;P9q_ro2m~)Q;7W_qEBE5 zM11pZBt&$gjfaR1tQim)Ujgj{Fs14PS?#wS03%OyvC(gx5BpV|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#2#wG8$g(O9hJh;0pZl9>V*luKcMN81d$Tpsn)S R;y))(;J?s*Ut}!h|6fPji2(or 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 78b3fd178..c3d8d2f62 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 @@ -1352,6 +1352,7 @@ + @@ -7691,6 +7692,7 @@ + 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 e3fb35e6c..12c98a70c 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 @@ -830,6 +830,27 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement } } + + 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..9c3541bc6 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,8 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement object GetFloorList(string parentID); object GetRoomList(string parentID); object GetBedList(string parentID); + (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 0f830c378..a022735b9 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 获取数据 /// @@ -1908,6 +1914,253 @@ where ID='{ParentID}' } } + /// + /// 导入宿舍信息 + /// + /// + /// + 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)); + var dic = new Dictionary(); + 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() && x.DeptNo == DeptNo && x.MajorNo == MajorNo).FirstOrDefault()?.ClassNo; + if (string.IsNullOrEmpty(DeptNo)) + { + fnum++; + dr["导入错误"] = dr["系部"] + "导入错误"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + if (string.IsNullOrEmpty(MajorNo)) + { + fnum++; + dr["导入错误"] = dr["专业"] + "导入错误"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + if (string.IsNullOrEmpty(ClassNo)) + { + fnum++; + dr["导入错误"] = dr["班级"] + "导入错误"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + var leaderno = stuinfobasic.Where(x => x.StuNo == dr["舍长学号"].ToString() && x.ClassNo == ClassNo).FirstOrDefault()?.StuNo; + var 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; + } + if (string.IsNullOrEmpty(leaderno)) + { + fnum++; + dr["导入错误"] = dr["舍长学号"] + "导入错误"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + + //宿舍楼 + 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.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); + } + //床位 + 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(); + // 写入缓存如果有未导入的数据 + 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 From fb2428dc2dde8137d0dbef997deb0be3ffa54c95 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Tue, 28 Jun 2022 17:44:30 +0800 Subject: [PATCH 2/9] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=AE=BF=E8=88=8D?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=20=20=E5=AF=BC=E5=85=A5=E6=88=90=E5=8A=9F?= =?UTF-8?q?=E5=90=8E=E6=9B=B4=E6=96=B0=E5=AE=BF=E8=88=8D=E7=9A=84=E5=85=A5?= =?UTF-8?q?=E4=BD=8F=E4=BA=BA=E6=95=B0=E5=AD=97=E6=AE=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Accommodation/AccommodationService.cs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) 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 a022735b9..38b09417d 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 @@ -1919,7 +1919,7 @@ where ID='{ParentID}' /// /// /// - public (DataTable failDt, int snum, int fnum) ExecuteImportExcel(DataTable dt,string fileGuid) + public (DataTable failDt, int snum, int fnum) ExecuteImportExcel(DataTable dt, string fileGuid) { int snum = 0; int fnum = 0; @@ -1944,7 +1944,9 @@ where ID='{ParentID}' } failDt.Columns.Add("导入错误", typeof(string)); dt.Columns.Add("导入错误", typeof(string)); - var dic = new Dictionary(); + //寝室Id + var dormitoryIds = new List(); + var user = LoginUserInfo.Get(); foreach (DataRow dr in dt.Rows) { @@ -2093,6 +2095,8 @@ where ID='{ParentID}' dormitoryBuildList.Add(dormitory); } + dormitoryIds.Add(dormitory.ID); + //床位 var bedName = dr["床位"].ToString().Trim(); var bedCode = bedName.Replace("床", "").Replace("号", ""); @@ -2138,7 +2142,16 @@ where ID='{ParentID}' } } + 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) { From bf3aec8dec43f87e814abc1bbd85501d1e64a6ed Mon Sep 17 00:00:00 2001 From: liangkun Date: Wed, 29 Jun 2022 15:00:02 +0800 Subject: [PATCH 3/9] =?UTF-8?q?=E5=8E=BB=E6=8E=89=E7=8F=AD=E7=BA=A7?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E7=B3=BB=E9=83=A8=E5=BF=85=E5=A1=AB=E9=AA=8C?= =?UTF-8?q?=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EducationalAdministration/Views/ClassInfo/Form.cshtml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ClassInfo/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ClassInfo/Form.cshtml index 4381b907b..abf2c24ad 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ClassInfo/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ClassInfo/Form.cshtml @@ -12,8 +12,8 @@
-
系部*
-
+
系部
+
专业*
From 47dc34a68b72c7c8eded7146dc398ec96b1412a7 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Wed, 29 Jun 2022 15:00:46 +0800 Subject: [PATCH 4/9] =?UTF-8?q?=E5=AE=BF=E8=88=8D=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=AF=BC=E5=85=A5=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Accommodation/AccommodationService.cs | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) 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 38b09417d..69fd1768c 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 @@ -1998,6 +1998,22 @@ where ID='{ParentID}' 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(); @@ -2009,6 +2025,7 @@ where ID='{ParentID}' //添加宿舍楼 apartment = new Acc_DormitoryBuildEntity(); apartment.Create(); + apartment.ParentID = parent.ID; apartment.DNo = apartmentCode; apartment.Name = apartmentName; apartment.BuildType = "1"; From f4bdfa164bd3b61be58f0dd13b07ad92f5654632 Mon Sep 17 00:00:00 2001 From: liangkun Date: Wed, 29 Jun 2022 15:08:24 +0800 Subject: [PATCH 5/9] =?UTF-8?q?=E7=8F=AD=E7=BA=A7=E7=AE=A1=E7=90=86?= =?UTF-8?q?=E7=B3=BB=E4=B8=93=E4=B8=9A=E8=81=94=E5=8A=A8=E6=95=88=E6=9E=9C?= =?UTF-8?q?=E5=8E=BB=E6=8E=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/ClassInfo/Form.js | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ClassInfo/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ClassInfo/Form.js index dbb4686dd..5b35fe8d4 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ClassInfo/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ClassInfo/Form.js @@ -16,19 +16,19 @@ var bootstrap = function ($, learun) { }, bind: function () { $('#DeptNo').lrDataSourceSelect({ - code: 'CdDeptInfo', value: 'deptno', text: 'deptname', - select: function (item) { - if (!!item) { - $('#MajorNo').lrselectRefresh({ - url: "/CdMajor/GetListByDeptNo", - param: { DeptNo: item.deptno }, - value: 'MajorNo', - text: 'MajorName' - }); - } - } + code: 'CdDeptInfo', value: 'deptno', text: 'deptname' + //select: function (item) { + // if (!!item) { + // $('#MajorNo').lrselectRefresh({ + // url: "/CdMajor/GetListByDeptNo", + // param: { DeptNo: item.deptno }, + // value: 'MajorNo', + // text: 'MajorName' + // }); + // } + //} }); - $('#MajorNo').lrselect(); + $('#MajorNo').lrDataSourceSelect({ code: 'CdMajor', value: 'majorno', text: 'majorname'}); $('#Grade').lrselect({ url: top.$.rootUrl + '/EducationalAdministration/ClassInfo/GenerateNearByYear', value: 'value', From 74340a4fe089cd837ed4bca74fd0fc14879ba10b Mon Sep 17 00:00:00 2001 From: liangkun Date: Wed, 29 Jun 2022 15:36:20 +0800 Subject: [PATCH 6/9] =?UTF-8?q?major=E6=95=B0=E6=8D=AE=E6=BA=90=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Areas/EducationalAdministration/Views/ClassInfo/Form.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ClassInfo/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ClassInfo/Form.js index 5b35fe8d4..8f3ac5b5f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ClassInfo/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ClassInfo/Form.js @@ -28,7 +28,7 @@ var bootstrap = function ($, learun) { // } //} }); - $('#MajorNo').lrDataSourceSelect({ code: 'CdMajor', value: 'majorno', text: 'majorname'}); + $('#MajorNo').lrDataSourceSelect({ code: 'CdMajorInfo', value: 'majorno', text: 'majorname'}); $('#Grade').lrselect({ url: top.$.rootUrl + '/EducationalAdministration/ClassInfo/GenerateNearByYear', value: 'value', From 560b2e1dd596db88ee9393d773473f7c02793e55 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Wed, 29 Jun 2022 16:27:01 +0800 Subject: [PATCH 7/9] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=AE=BF=E8=88=8D?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Accommodation/AccommodationService.cs | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) 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 69fd1768c..3749ff438 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 @@ -1959,8 +1959,7 @@ where ID='{ParentID}' 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() && x.DeptNo == DeptNo && x.MajorNo == MajorNo).FirstOrDefault()?.ClassNo; + var ClassNo = classList.Where(x => x.ClassName == dr["班级"].ToString()).FirstOrDefault()?.ClassNo; if (string.IsNullOrEmpty(DeptNo)) { fnum++; @@ -1984,21 +1983,21 @@ where ID='{ParentID}' } var leaderno = stuinfobasic.Where(x => x.StuNo == dr["舍长学号"].ToString() && x.ClassNo == ClassNo).FirstOrDefault()?.StuNo; var 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; - } - if (string.IsNullOrEmpty(leaderno)) - { - fnum++; - dr["导入错误"] = dr["舍长学号"] + "导入错误"; - failDt.Rows.Add(dr.ItemArray); - continue; - } - + //if (string.IsNullOrEmpty(stuno)) + //{ + // fnum++; + // dr["导入错误"] = dr["学生学号"] + "导入错误"; + // failDt.Rows.Add(dr.ItemArray); + // continue; + //} + //if (string.IsNullOrEmpty(leaderno)) + //{ + // fnum++; + // dr["导入错误"] = dr["舍长学号"] + "导入错误"; + // failDt.Rows.Add(dr.ItemArray); + // continue; + //} + var parent = dormitoryBuildList.Where(x => x.Name == "数字化智慧校园").FirstOrDefault(); if (parent == null) { From cca104754463f9c9588d4d90ebac65ed1abc554c Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Thu, 30 Jun 2022 09:13:44 +0800 Subject: [PATCH 8/9] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E5=AE=BF=E8=88=8D?= =?UTF-8?q?=E7=AE=A1=E7=90=86=E5=AF=BC=E5=85=A5=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Accommodation/AccommodationService.cs | 48 +++++++++++-------- 1 file changed, 29 insertions(+), 19 deletions(-) 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 3749ff438..f18f16354 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 @@ -1963,40 +1963,50 @@ where ID='{ParentID}' if (string.IsNullOrEmpty(DeptNo)) { fnum++; - dr["导入错误"] = dr["系部"] + "导入错误"; + dr["导入错误"] = "系部导入错误"; failDt.Rows.Add(dr.ItemArray); continue; } if (string.IsNullOrEmpty(MajorNo)) { fnum++; - dr["导入错误"] = dr["专业"] + "导入错误"; + dr["导入错误"] = "专业导入错误"; failDt.Rows.Add(dr.ItemArray); continue; } if (string.IsNullOrEmpty(ClassNo)) { fnum++; - dr["导入错误"] = dr["班级"] + "导入错误"; + dr["导入错误"] = "班级导入错误"; failDt.Rows.Add(dr.ItemArray); continue; } - var leaderno = stuinfobasic.Where(x => x.StuNo == dr["舍长学号"].ToString() && x.ClassNo == ClassNo).FirstOrDefault()?.StuNo; - var 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; - //} - //if (string.IsNullOrEmpty(leaderno)) - //{ - // fnum++; - // dr["导入错误"] = 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) From 185cb68e7fee4b38c026094e652eb74b340ee5f9 Mon Sep 17 00:00:00 2001 From: zhangli <1109134334@qq.com> Date: Thu, 30 Jun 2022 15:52:59 +0800 Subject: [PATCH 9/9] =?UTF-8?q?=E5=AE=BF=E8=88=8D=E7=AE=A1=E7=90=86--?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E7=AE=A1=E7=90=86=EF=BC=8C=E5=AE=BF=E8=88=8D?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B=E4=B8=8B=E6=8B=89=E6=A1=86=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Views/Accommodation/FormClassify.js | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) 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 878fe4fc5..a4535c11e 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 @@ -17,7 +17,13 @@ var bootstrap = function ($, learun) { page.initSelect(); }, bind: function () { - $('#BuildType').lrDataItemSelect({ code: 'BuildType' }); + $('#BuildType').lrselect({ + allowSearch: true, + url: top.$.rootUrl + '/LR_SystemModule/DataItem/GetDetailList', + param: { itemCode: 'BuildType' }, + value: 'F_ItemValue', + text: 'F_ItemName', + }); // 上级 $('#ParentID').lrselect({ url: top.$.rootUrl + '/LogisticsManagement/Accommodation/GetClassifyTree', @@ -25,7 +31,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 +49,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 +57,7 @@ var bootstrap = function ($, learun) { text: "stuname", url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=StuInfoBasic' }); - + $('#Class').lrselect({ value: "classno", text: "classname" @@ -115,7 +121,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]);