From 932a4f728a6c776f6176c91686eb3a631982b7d2 Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Wed, 14 Jun 2023 17:41:46 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90=E5=A2=9E=E5=8A=A0=E3=80=91=E7=BA=BF?= =?UTF-8?q?=E4=B8=8A=E6=88=90=E7=BB=A9=E7=AE=A1=E7=90=86=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/StuScoreOnlineController.cs | 20 +- .../Views/StuScoreOnline/InputScoreIndex.js | 85 ++- .../InputScoreIndexImport.cshtml | 27 + .../StuScoreOnline/InputScoreIndexImport.js | 195 ++++++ .../InputScoreIndexInTeacher.cshtml | 122 ++++ .../InputScoreIndexInTeacher.js | 624 ++++++++++++++++++ .../Learun.Application.Web.csproj | 4 + .../StuScoreOnline/StuScoreOnlineBLL.cs | 4 +- .../StuScoreOnline/StuScoreOnlineIBLL.cs | 2 +- .../StuScoreOnline/StuScoreOnlineService.cs | 174 ++--- 10 files changed, 1153 insertions(+), 104 deletions(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndexImport.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndexImport.js create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndexInTeacher.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndexInTeacher.js diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuScoreOnlineController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuScoreOnlineController.cs index 9ad9d7fd8..d113d09b8 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuScoreOnlineController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Controllers/StuScoreOnlineController.cs @@ -222,7 +222,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers /// /// [HttpGet] - public ActionResult InputScoreIndexInTeacherImport() + public ActionResult InputScoreIndexImport() { return View(); } @@ -363,7 +363,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers if (userEntity != null) { var name = userEntity.F_Account + "_" + userEntity.F_RealName + "_线上成绩录入"; - + //删除任务 RecurringJob.RemoveIfExists(name); } @@ -522,9 +522,9 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers /// [HttpGet] [AjaxOnly] - public ActionResult GetEmpNoDataOfAll(string lessonNo) + public ActionResult GetEmpNoDataOfAll(string lessonNo, string AcademicYearShort, string Semester) { - var data = stuScoreOnlineIBLL.GetEmpNoData("", "", lessonNo); + var data = stuScoreOnlineIBLL.GetEmpNoData("", "", lessonNo, AcademicYearShort, Semester); return Success(data); } @@ -534,10 +534,10 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers /// [HttpGet] [AjaxOnly] - public ActionResult GetEmpNoData(string lessonNo) + public ActionResult GetEmpNoData(string lessonNo, string AcademicYearShort, string Semester) { var loginInfo = LoginUserInfo.Get(); - var data = stuScoreOnlineIBLL.GetEmpNoData(loginInfo.account, loginInfo.Description, lessonNo); + var data = stuScoreOnlineIBLL.GetEmpNoData(loginInfo.account, loginInfo.Description, lessonNo, AcademicYearShort, Semester); return Success(data); } @@ -560,9 +560,9 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers /// [HttpGet] [AjaxOnly] - public ActionResult GetLessonNoDataOfAllWithNo() + public ActionResult GetLessonNoDataOfAllWithNo(string AcademicYearShort, string Semester) { - var data = stuScoreOnlineIBLL.GetLessonNoDataOfAll("", ""); + var data = stuScoreOnlineIBLL.GetLessonNoDataOfAll("", "", AcademicYearShort, Semester); foreach (var item in data) { item.text = string.Format("{0}({1})", item.text, item.value); @@ -1099,7 +1099,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers { var loginInfo = LoginUserInfo.Get(); var name = loginInfo.account + "_" + loginInfo.realName + "_线上成绩录入"; - + stuScoreOnlineIBLL.SaveInputScoreStatus(queryJson); //删除任务 RecurringJob.RemoveIfExists(name); @@ -1227,7 +1227,7 @@ namespace Learun.Application.Web.Areas.EducationalAdministration.Controllers var data = new { Success = res.snum, - Fail = res.failDt.Rows.Count + Fail = res.fnum }; return Success(data); } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndex.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndex.js index 7ae6b5bea..9185ccdd5 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndex.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndex.js @@ -15,6 +15,9 @@ var headData; //常规列头 var headDataEdit; //可编辑列头 var headDataNoEdit; //不可编辑列头 var headDataFinally; //最终列头 +var rowJson; +var columnJson; +var queryJson; var bootstrap = function ($, learun) { "use strict"; var page = { @@ -81,7 +84,7 @@ var bootstrap = function ($, learun) { }); } }, - { label: '学生姓名', name: 'StuName', width: 100, align: "left" }, + { label: '学生姓名', name: 'StuName', width: 150, align: "left" }, { label: '学生学号', name: 'StuNo', width: 100, align: "left" }, ]; headDataEdit = [ @@ -383,7 +386,63 @@ var bootstrap = function ($, learun) { }); //导入更新 $('#lr_importScore').on('click', function () { - //todo: + var query = judgeSelect(); + if (query) { + //判断成绩比例是否合理 + //var OrdinaryScoreScale = $('#OrdinaryScoreScale').html(); + //var TermInScoreScale = $('#TermInScoreScale').html(); + //var TermEndScoreScale = $('#TermEndScoreScale').html(); + //var OtherScoreScale = $('#OtherScoreScale').html(); + //var totalScale = Number(OrdinaryScoreScale) + Number(TermInScoreScale) + Number(TermEndScoreScale) + Number(OtherScoreScale); + //if (totalScale !== 100) { + // learun.alert.warning("成绩比例设置不合理!"); + // return false; + //} else { + //判断是否已审核;判断是否被其他教师占用 + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetEntityByJson?queryJson=' + JSON.stringify(query), function (data) { + if (data != null) { + if (data.CheckMark == 1) { + learun.alert.warning("学生成绩已审核!"); + return false; + } + if (data.IsEditable == 0) { + if (data.EditUserId == learun.clientdata.get(['userinfo']).account) { + modifyDate = data.ModifyDate; + } else { + learun.alert.warning("当前班级成绩由账号为" + data.EditUserId + "的教师在使用!"); + return false; + } + } + + rowJson = $('#gridtable').jfGridGet('showData'); + if (rowJson.length <= 0) { + learun.alert.warning("查询结果不存在!"); + return false; + } + columnJson = $('#gridtable').jfGridGet('settingInfo').headData; + //条件 + queryJson = query; + + learun.layerForm({ + id: 'IndexImport', + title: "导入学生成绩", + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/InputScoreIndexImport?type=0', + width: 600, + height: 400, + maxmin: true, + btn: null, + end: function () { + refreshGirdData2(); + } + }); + + } else { + learun.alert.warning("学生成绩不存在!"); + return false; + } + }); + //} + } }); }, @@ -399,7 +458,14 @@ var bootstrap = function ($, learun) { allowSearch: false, url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetAcademicYearNoData', value: 'value', - text: 'text' + text: 'text', + select: function (item) { + if (!!item) { + $("#LessonNo").lrselectRefresh({ + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetLessonNoDataOfAllWithNo?AcademicYearShort=' + item.value + '&Semester=' + $('#Semester').lrselectGet(), + }); + } + } }); //学期 $('#Semester').lrselect({ @@ -407,7 +473,14 @@ var bootstrap = function ($, learun) { allowSearch: false, url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetSemesterData', value: 'value', - text: 'text' + text: 'text', + select: function (item) { + if (!!item) { + $("#LessonNo").lrselectRefresh({ + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetLessonNoDataOfAllWithNo?AcademicYearShort=' + $('#AcademicYearNo').lrselectGet() + '&Semester=' + item.value, + }); + } + } }); //课程 $('#LessonNo').lrselect({ @@ -419,9 +492,7 @@ var bootstrap = function ($, learun) { select: function (item) { if (!!item) { $("#EmpNo").lrselectRefresh({ - url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetEmpNoDataOfAll?lessonNo=' + item.value, - value: 'value', - text: 'text', + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetEmpNoDataOfAll?lessonNo=' + item.value + '&AcademicYearShort=' + $('#AcademicYearNo').lrselectGet() + '&Semester=' + $('#Semester').lrselectGet(), }); } } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndexImport.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndexImport.cshtml new file mode 100644 index 000000000..108ec5d4d --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndexImport.cshtml @@ -0,0 +1,27 @@ +@{ + ViewBag.Title = "Form"; + Layout = "~/Views/Shared/_Form.cshtml"; +} + + +@Html.AppendCssFile("/Areas/LR_SystemModule/Views/ExcelImport/ImportForm.css") + +@*线上成绩录入导入*@ + + + 上传文件 + 下载模板 + + + + + + + + 试试将电脑里的文件拖拽到此上传 + + + + + +@Html.AppendJsFile("/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndexImport.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndexImport.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndexImport.js new file mode 100644 index 000000000..e98bd48e9 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndexImport.js @@ -0,0 +1,195 @@ +/* + * 描 述:附件上传管理 + */ +var gridId = request('gridtable'); +var type = request('type');//1:成绩录入;2:选修成绩录入 +var bootstrap = function ($, learun) { + "use strict"; + + var fileInfo = {}; + + // 触发合并文件碎片 + var mergeFileChunks = function (file) { + var param = {}; + param['type'] = type; + param['__RequestVerificationToken'] = $.lrToken; + param['fileGuid'] = fileInfo[file.id].fileGuid; + param['fileName'] = fileInfo[file.id].name; + param['chunks'] = fileInfo[file.id].chunks; + var queryJson = JSON.stringify(learun.frameTab.currentIframe().queryJson); + + param['queryJson'] = queryJson; + learun.httpAsyncPost(top.$.rootUrl + "/EducationalAdministration/StuScoreOnline/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' }); + } + } + 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 () { + var columnJson = learun.frameTab.currentIframe().columnJson; + columnJson = JSON.stringify(columnJson.filter(item => item.name !== 'TermEndScore')); + var rowJson = JSON.stringify(learun.frameTab.currentIframe().rowJson); + var fileName = "线上成绩录入数据"; + //if (type == '2') { + // fileName = "选修成绩录入数据"; + //} + //else if (type == '3') { + // fileName = "补考成绩录入"; + //} + //else if (type == '4') { + // fileName = "二次补考成绩录入"; + //} + learun.download({ + method: "POST", + url: '/EducationalAdministration/StuScoreOnline/ExportExcel', + param: { + fileName: fileName, + columnJson: columnJson, + dataJson: rowJson, + //exportField: String(exportField) + } + }); + }); + + 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/EducationalAdministration/Views/StuScoreOnline/InputScoreIndexInTeacher.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndexInTeacher.cshtml new file mode 100644 index 000000000..5a80b30cf --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndexInTeacher.cshtml @@ -0,0 +1,122 @@ +@{ ViewBag.Title = "全院学生线上成绩录入"; Layout = "~/Views/Shared/_Index.cshtml"; } + + + + + + + + + + + + + + + + + + + + + + + + + 查询 + + + + + + + + 开始录入 + 提交成绩 + 审核 + 取消审核 + @* 设置成绩比例*@ + 导入更新 + + + + + + @*比例设置: + 平时成绩占比 0 %, + 期中成绩占比 0 %, + 期末成绩占比 0 %, + 其他成绩占比 0 %*@ + 提示:录入完成后,请务必点击“提交成绩”按钮,避免成绩丢失! + + 倒计时: + 分钟(秒) + 续时 + + + + + + + +@Html.AppendJsFile("/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndexInTeacher.js") + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndexInTeacher.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndexInTeacher.js new file mode 100644 index 000000000..f438a7fdd --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/StuScoreOnline/InputScoreIndexInTeacher.js @@ -0,0 +1,624 @@ +/* * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) + * Copyright (c) 2013-2018 北京泉江科技有限公司 + * 创建人:超级管理员 + * 日 期:2023-06-12 11:02 + * 描 述:全院学生线上成绩录入 + */ +var selectedRow; +var refreshGirdData; +var refreshGirdData2; +var judgeSelect; //判断下拉框是否选择 +var modifyDate; //成绩被占用,且是登录用户时,成绩表中的编辑时间; +var timer; //计时器 +var submitScoreTimer; //五分钟提交成绩计时器 +var headData; //常规列头 +var headDataEdit; //可编辑列头 +var headDataNoEdit; //不可编辑列头 +var headDataFinally; //最终列头 +var rowJson; +var columnJson; +var queryJson; +var bootstrap = function ($, learun) { + "use strict"; + var page = { + init: function () { + headData = [ + { + label: "审核状态", name: "CheckMark", width: 80, align: "center", + formatter: function (cellvalue) { + return cellvalue == "1" ? "已审核" : "未审核"; + } + }, + { label: '学年', name: 'AcademicYearNo', width: 50, align: "left" }, + { label: '学期', name: 'Semester', width: 40, align: "left" }, + { label: '课程名称', name: 'LessonName', width: 150, align: "left" }, + { + label: "学校名称", name: "F_SchoolId", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'company', + key: value, + keyId: 'f_companyid', + callback: function (_data) { + callback(_data['f_fullname']); + } + }); + } + }, + { + label: "学院", name: "DeptNo", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdDeptInfo', + key: value, + keyId: 'deptno', + callback: function (_data) { + callback(_data['deptname']); + } + }); + } + }, + { + label: "专业", name: "MajorNo", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'CdMajorInfo', + key: value, + keyId: 'majorno', + callback: function (_data) { + callback(_data['majorname']); + } + }); + } + }, + { + label: "班级", name: "ClassNo", width: 100, align: "left", + formatterAsync: function (callback, value, row, op, $cell) { + learun.clientdata.getAsync('custmerData', { + url: '/LR_SystemModule/DataSource/GetDataTable?code=' + 'bjsj', + key: value, + keyId: 'classno', + callback: function (_data) { + callback(_data['classname']); + } + }); + } + }, + { label: '学生姓名', name: 'StuName', width: 150, align: "left" }, + { label: '学生学号', name: 'StuNo', width: 100, align: "left" }, + ]; + headDataEdit = [ + { + label: '成绩', name: 'TermEndScore', width: 80, align: "left", + edit: { + type: 'input', + inputType: 'number', + change: function (row, rownum) { + row.Score = (parseFloat(row.TermEndScore || '0') * 1).toFixed(2); + $('#gridtable').jfGridSet('updateRow', rownum); + }, + } + }, + { label: '最终核定成绩', name: 'Score', width: 80, align: "left" }, + { + label: '备注', name: 'Remark', width: 100, align: "left", + edit: { + type: 'input', + } + }, + ]; + headDataNoEdit = [ + { + label: '成绩', name: 'TermEndScore', width: 80, align: "left" + }, + { label: '最终核定成绩', name: 'Score', width: 80, align: "left" }, + { + label: '备注', name: 'Remark', width: 100, align: "left" + }, + ]; + headDataFinally = headData.concat(headDataNoEdit); + + page.initGird(); + page.bind(); + page.bindSelect(); + }, + bind: function () { + //多条件选择 + $('#multiple_condition_query').lrMultipleQuery(function (queryJson) { + page.search(queryJson); + }, 220, 500); + // 刷新 + $('#lr_refresh').on('click', function () { + location.reload(); + }); + //查询 + $('#btn_Search').on('click', function () { + refreshGirdData2(); + }); + //设置成绩比例(暂时未使用未修改) + $('#lr_setScale').on('click', function () { + var query = judgeSelect(); + if (query) { + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlan/GetOpenLessonPlanEntityByJson?queryJson=' + JSON.stringify(query), function (data) { + if (data["OpenLessonPlan"] != null) { + if (data["OpenLessonPlan"].IsAllowEdit) { //教务允许成绩录入时编辑比例 + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlan/GetStuSelectLessonListEntityByJson?queryJson=' + JSON.stringify(query), function (data) { + if (data["StuSelectLessonList"] != null) { + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetEntityByJson?queryJson=' + JSON.stringify(query), function (data) { + if (data != null) { + if (data.CheckMark == 1) { //学生成绩已审核 + learun.alert.warning("学生成绩已审核!"); + return false; + } else { + learun.layerForm({ + id: 'FormOfClass', + title: '班级成绩比例设置', + url: top.$.rootUrl + '/EducationalAdministration/OpenLessonPlan/FormOfClass?F_SchoolId=' + query.F_SchoolId + '&AcademicYearNo=' + query.AcademicYearNo + '&Semester=' + query.Semester + '&LessonNo=' + query.LessonNo + '&ClassNo=' + query.ClassNo, + width: 600, + height: 400, + callBack: function (id) { + return top[id].acceptClick(refreshGirdData2); + } + }); + } + } else { + learun.alert.warning("学生成绩不存在!"); + return false; + } + }); + } else { + learun.alert.warning("学生选课数据不存在!"); + return false; + } + }); + } else { + learun.alert.warning("教务不允许设置成绩比例!"); + return false; + } + } else { + learun.alert.warning("开课计划不存在!"); + return false; + } + }); + } + }); + // 开始录入 + $('#lr_input').on('click', function () { + //提示弹框 + learun.layerConfirm('录入完成后,请务必点击“提交成绩”按钮,避免成绩丢失!', function (res) { + if (res) { + + var query = judgeSelect(); + if (query) { + //判断成绩比例是否合理 + //var OrdinaryScoreScale = $('#OrdinaryScoreScale').html(); + //var TermInScoreScale = $('#TermInScoreScale').html(); + //var TermEndScoreScale = $('#TermEndScoreScale').html(); + //var OtherScoreScale = $('#OtherScoreScale').html(); + //var totalScale = Number(OrdinaryScoreScale) + Number(TermInScoreScale) + Number(TermEndScoreScale) + Number(OtherScoreScale); + //if (totalScale !== 100) { + // learun.alert.warning("成绩比例设置不合理!"); + // return false; + //} else { + //判断是否已审核;判断是否被其他教师占用 + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetEntityByJson?queryJson=' + JSON.stringify(query), function (data) { + if (data != null) { + if (data.CheckMark == 1) { + learun.alert.warning("学生成绩已审核!"); + return false; + } + if (data.IsEditable == 0) { + if (data.EditUserId == learun.clientdata.get(['userinfo']).account) { + modifyDate = data.ModifyDate; + } else { + learun.alert.warning("当前班级成绩由账号为" + data.EditUserId + "的教师在使用!"); + return false; + } + } else { + //占用成绩 + learun.postFormSilence(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/StartInputScore', { queryJson: JSON.stringify(query) }, function (res) { }); + } + //显示可编辑列头 + headDataFinally = headData.concat(headDataEdit); + $("#gridtable")[0].dfop = undefined; + page.initGird(); + page.search(query); + //显示“提交成绩”按钮 + $('#lr_save').show(); + //隐藏“开始录入”按钮 + $('#lr_input').hide(); + //显示“倒计时” + $('.timeBox').show(); + $('#minutes').html($('#minutes').attr('data-minutes')); + //开始倒计时 + page.countDown(); + //五分钟提交成绩 + page.submitScore(); + } else { + learun.alert.warning("学生成绩不存在!"); + return false; + } + }); + //} + } + + } + }); + }); + //提交成绩 + $('#lr_save').on('click', function () { + var query = judgeSelect(); + if (query) { + //成绩被占用,且是登录用户时,根据编辑时间判断是否是本人; + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetEntityByJson?queryJson=' + JSON.stringify(query), function (data) { + if (data != null) { + if (data.CheckMark == 1) { + learun.alert.warning("学生成绩已审核!"); + return false; + } + if (data.IsEditable == 0) { + if (data.EditUserId == learun.clientdata.get(['userinfo']).account) { + if (modifyDate != null && modifyDate != data.ModifyDate) { + learun.alert.warning("当前班级成绩被修改,请重新获取!"); + return false; + } + } else { + learun.alert.warning("当前班级成绩由账号为" + data.EditUserId + "的教师在使用!"); + return false; + } + } else if (data.IsEditable == 1) { + learun.alert.warning("学生成绩已提交!"); + return false; + } + //提交成绩 + var rowdatas = $('#gridtable').jfGridGet('rowdatas'); + learun.postFormSilence(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/SaveInputScore', { data: JSON.stringify(rowdatas) }, function (res) { + if (res.code == 200) { + //提交成绩:取消占用 + learun.postForm(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/SaveInputScoreStatus', { queryJson: JSON.stringify(query) }, function (res) { + if (res.code == 200) { + refreshGirdData2(); + modifyDate = null; + //隐藏“提交成绩”按钮 + $('#lr_save').hide(); + //显示“开始录入”按钮 + $('#lr_input').show(); + //隐藏“倒计时” + $('.timeBox').hide(); + //停止倒计时 + clearInterval(timer); + //停止五分钟提交成绩 + clearInterval(submitScoreTimer); + } else { + learun.alert.warning("提交成绩:取消占用失败!"); + return false; + } + }); + } else { + learun.alert.warning("提交成绩失败!"); + return false; + } + }); + + } else { + learun.alert.warning("学生成绩不存在!"); + return false; + } + }); + } + }); + // 审核 + $('#lr_check').on('click', function () { + var query = judgeSelect(); + if (query) { + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetEntityByJson?queryJson=' + JSON.stringify(query), function (data) { + if (data != null) { + if (data.CheckMark == 1) { + learun.alert.warning("学生成绩已审核!"); + return false; + } + learun.layerConfirm('是否确认审核当前班级的学生成绩!', function (res) { + if (res) { + //审核成绩 + learun.postForm(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/DoCheckScore', { queryJson: JSON.stringify(query), checkMark: 1 }, function (res) { + if (res.code == 200) { + refreshGirdData2(); + } else { + learun.alert.warning("审核成绩失败!"); + return false; + } + }); + } + }); + } else { + learun.alert.warning("学生成绩不存在!"); + return false; + } + }); + } + }); + // 去审核 + $('#lr_uncheck').on('click', function () { + var query = judgeSelect(); + if (query) { + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetEntityByJson?queryJson=' + JSON.stringify(query), function (data) { + if (data != null) { + if (data.CheckMark != 1) { + learun.alert.warning("学生成绩未审核!"); + return false; + } + learun.layerConfirm('是否确认去审核当前班级的学生成绩!', function (res) { + if (res) { + //去审核成绩 + learun.postForm(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/DoCheckScore', { queryJson: JSON.stringify(query), checkMark: 0 }, function (res) { + if (res.code == 200) { + refreshGirdData2(); + } else { + learun.alert.warning("去审核成绩失败!"); + return false; + } + }); + } + }); + } else { + learun.alert.warning("学生成绩不存在!"); + return false; + } + }); + } + }); + //续时 + $('#addMinutesBtn').on('click', function () { + var query = judgeSelect(); + if (query) { + clearInterval(timer); + var addMinutes = $('#addMinutesBtn').attr('data-minutes'); + var newMinutes = addMinutes; + var minutes = $('#minutes').html(); + if (minutes > 0) { + newMinutes = Number(newMinutes) + Number(minutes); + } + $('#minutes').html(newMinutes); + page.countDown(); + //修改服务时间 + learun.postFormSilence(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/AddMinutes', { queryJson: JSON.stringify(query), minutes: newMinutes }, function (res) { }); + } + }); + //导入更新 + $('#lr_importScore').on('click', function () { + var query = judgeSelect(); + if (query) { + //判断成绩比例是否合理 + //var OrdinaryScoreScale = $('#OrdinaryScoreScale').html(); + //var TermInScoreScale = $('#TermInScoreScale').html(); + //var TermEndScoreScale = $('#TermEndScoreScale').html(); + //var OtherScoreScale = $('#OtherScoreScale').html(); + //var totalScale = Number(OrdinaryScoreScale) + Number(TermInScoreScale) + Number(TermEndScoreScale) + Number(OtherScoreScale); + //if (totalScale !== 100) { + // learun.alert.warning("成绩比例设置不合理!"); + // return false; + //} else { + //判断是否已审核;判断是否被其他教师占用 + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetEntityByJson?queryJson=' + JSON.stringify(query), function (data) { + if (data != null) { + if (data.CheckMark == 1) { + learun.alert.warning("学生成绩已审核!"); + return false; + } + if (data.IsEditable == 0) { + if (data.EditUserId == learun.clientdata.get(['userinfo']).account) { + modifyDate = data.ModifyDate; + } else { + learun.alert.warning("当前班级成绩由账号为" + data.EditUserId + "的教师在使用!"); + return false; + } + } + + rowJson = $('#gridtable').jfGridGet('showData'); + if (rowJson.length <= 0) { + learun.alert.warning("查询结果不存在!"); + return false; + } + columnJson = $('#gridtable').jfGridGet('settingInfo').headData; + //条件 + queryJson = query; + + learun.layerForm({ + id: 'IndexImport', + title: "导入学生成绩", + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/InputScoreIndexImport?type=0', + width: 600, + height: 400, + maxmin: true, + btn: null, + end: function () { + refreshGirdData2(); + } + }); + + } else { + learun.alert.warning("学生成绩不存在!"); + return false; + } + }); + //} + } + + }); + }, + bindSelect: function () { + //校区 + $('#F_SchoolId').lrDataSourceSelect({ + code: 'company', value: 'f_companyid', text: 'f_fullname', select: function (item) { } + }); + $('#F_SchoolId').lrselectSet(learun.clientdata.get(['userinfo']).companyId); + //学年 + $('#AcademicYearNo').lrselect({ + placeholder: "学年", + allowSearch: false, + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetAcademicYearNoData', + value: 'value', + text: 'text', + select: function (item) { + if (!!item) { + $("#LessonNo").lrselectRefresh({ + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetLessonNoDataWithNo?AcademicYearShort=' + item.value + '&Semester=' + $('#Semester').lrselectGet(), + }); + } + } + }); + //学期 + $('#Semester').lrselect({ + placeholder: "学期", + allowSearch: false, + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetSemesterData', + value: 'value', + text: 'text', + select: function (item) { + if (!!item) { + $("#LessonNo").lrselectRefresh({ + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetLessonNoDataWithNo?AcademicYearShort=' + $('#AcademicYearNo').lrselectGet() + '&Semester=' + item.value, + }); + } + } + }); + //课程 + $('#LessonNo').lrselect({ + placeholder: "请选择课程", + allowSearch: true, + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetLessonNoDataWithNo', + value: 'value', + text: 'text', + select: function (item) { + if (!!item) { + $("#EmpNo").lrselectRefresh({ + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetEmpNoData?lessonNo=' + item.value + '&AcademicYearShort=' + $('#AcademicYearNo').lrselectGet() + '&Semester=' + $('#Semester').lrselectGet(), + }); + } + } + }); + //教师 + $('#EmpNo').lrselect({ + placeholder: "请选择教师", + allowSearch: true, + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetEmpNoData', + value: 'value', + text: 'text' + }); + //绑定学年、学期 + $.get('/Home/GetYearAndSemesteResult', function (ref) { + if (ref.code == "200") { + $('#AcademicYearNo').lrselectSet(ref.data.Item1); + $('#Semester').lrselectSet(ref.data.Item3); + } + }.bind(this), "json"); + }, + initGird: function () { + $('#gridtable').jfGrid({ + url: top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/GetList', + headData: headDataFinally, + mainId: 'ScoreId', + isPage: false, + sidx: 'StuNo', + sord: 'asc' + }); + //page.search(); + }, + search: function (param) { + param = param || {}; + $('#gridtable').jfGridSet('reload', { queryJson: JSON.stringify(param) }); + }, + searchScale: function (param) { + param = param || {}; + $.lrSetForm(top.$.rootUrl + '/EducationalAdministration/OpenLessonPlan/GetStuSelectLessonListEntityByJson?queryJson=' + JSON.stringify(param), function (data) { + if (data["StuSelectLessonList"] != null) { + var ssll = data["StuSelectLessonList"]; + $('#OrdinaryScoreScale').html(ssll.OrdinaryScoreScale > 0 ? ssll.OrdinaryScoreScale : 0); + $('#TermInScoreScale').html(ssll.TermInScoreScale > 0 ? ssll.TermInScoreScale : 0); + $('#TermEndScoreScale').html(ssll.TermEndScoreScale > 0 ? ssll.TermEndScoreScale : 0); + $('#OtherScoreScale').html(ssll.OtherScoreScale > 0 ? ssll.OtherScoreScale : 0); + } else { + $('#OrdinaryScoreScale').html(0); + $('#TermInScoreScale').html(0); + $('#TermEndScoreScale').html(0); + $('#OtherScoreScale').html(0); + } + }); + }, + countDown: function () { + var minutes = $('#minutes').html(); + var minutesTemp = minutes; + var seconds = $('#seconds').attr('data-seconds'); + $('#seconds').html(seconds); + var secondsTemp = seconds; + timer = setInterval(function () { + secondsTemp--; + $('#seconds').html(secondsTemp); + if (secondsTemp == 0) { + secondsTemp = seconds; + minutesTemp--; + $('#minutes').html(minutesTemp); + if (minutesTemp == 0) { + //停止倒计时 + clearInterval(timer); + //自动提交成绩 + $('#lr_save').trigger("click"); + } + } + }, 1000); + }, + submitScore: function () { + submitScoreTimer = setInterval(function () { + var rowdatas = $('#gridtable').jfGridGet('rowdatas'); + learun.postFormSilence(top.$.rootUrl + '/EducationalAdministration/StuScoreOnline/SaveInputScore', { data: JSON.stringify(rowdatas) }, function (res) { + }); + }, 300000); + }, + }; + refreshGirdData = function () { + page.search(); + }; + refreshGirdData2 = function () { + var query = judgeSelect(); + if (query) { + //显示不可编辑列头 + headDataFinally = headData.concat(headDataNoEdit); + $("#gridtable")[0].dfop = undefined; + page.initGird(); + + page.search(query); + //page.searchScale(query); + } + }; + judgeSelect = function () { + if (CanInputFlag != "True") { + top.learun.layerConfirm('当前时间不是线上成绩录入时间!', function (res) { }); + return false; + } + + var $content = $('body').find('.lr-layout-tool-left'); + var query = $content.lrGetFormData(); + if (query.F_SchoolId == null || query.F_SchoolId == "") { + learun.alert.warning("请选择校区!"); + return false; + } + if (query.AcademicYearNo == null || query.AcademicYearNo == "") { + learun.alert.warning("请选择学年!"); + return false; + } + if (query.Semester == null || query.Semester == "") { + learun.alert.warning("请选择学期!"); + return false; + } + if (query.LessonNo == null || query.LessonNo == "") { + learun.alert.warning("请选择课程!"); + return false; + } + if (query.EmpNo == null || query.EmpNo == "") { + learun.alert.warning("请选择教师!"); + return false; + } + return query; + }; + page.init(); +} diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj b/Learun.Framework.Ultimate V7/Learun.Application.Web/Learun.Application.Web.csproj index 0621a1e80..bb975cf12 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 @@ -1031,7 +1031,9 @@ + + @@ -8219,6 +8221,8 @@ + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineBLL.cs index 0a2e3839f..5224a3787 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineBLL.cs @@ -545,11 +545,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 教师下拉框信息【学生成绩录入可去审核】 /// /// - public IEnumerable GetEmpNoData(string userAccount, string userType, string lessonNo) + public IEnumerable GetEmpNoData(string userAccount, string userType, string lessonNo, string AcademicYearNo = "", string Semester = "") { try { - return stuScoreOnlineService.GetEmpNoData(userAccount, userType, lessonNo); + return stuScoreOnlineService.GetEmpNoData(userAccount, userType, lessonNo, AcademicYearNo, Semester); } catch (Exception ex) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineIBLL.cs index 1c9c9437e..cdd27dabb 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineIBLL.cs @@ -140,7 +140,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 教师下拉框信息【学生成绩录入可去审核】 /// /// - IEnumerable GetEmpNoData(string userAccount, string userType, string lessonNo); + IEnumerable GetEmpNoData(string userAccount, string userType, string lessonNo, string AcademicYearNo = "", string Semester = ""); /// /// 课程下拉框信息【学生成绩录入可去审核】 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineService.cs index 5a628a84c..4ee311234 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/StuScoreOnline/StuScoreOnlineService.cs @@ -625,7 +625,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } #endregion private static HttpClient Client; - + internal List GetScoreInfo(string queryJson) { try @@ -1145,7 +1145,7 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad /// 教师下拉框信息【学生成绩录入可去审核】 /// /// - public IEnumerable GetEmpNoData(string userAccount, string userType, string lessonNo) + public IEnumerable GetEmpNoData(string userAccount, string userType, string lessonNo, string AcademicYearNo = "", string Semester = "") { try { @@ -1159,6 +1159,10 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad { strSql.Append(" and s.LessonNo='" + lessonNo + "' "); } + if (!string.IsNullOrEmpty(AcademicYearNo)) + { + strSql.Append(" and s.AcademicYearNo='" + AcademicYearNo + "' and s.Semester='" + Semester + "' "); + } var data = this.BaseRepository("CollegeMIS").FindList(strSql.ToString()); data = data.Where(x => !string.IsNullOrEmpty(x.value)).OrderBy(x => x.value); return data; @@ -1604,7 +1608,7 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad //var notpass2 = this.BaseRepository("CollegeMIS") // .FindList(a => a.StuNo == stuNo).Count(); //if ((notpass1 + notpass2) > 0) - if(0>0) + if (0 > 0) { var result = new { @@ -1772,11 +1776,11 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad var Semester = queryParam["Semester"].ToString(); var LessonNo = queryParam["LessonNo"].ToString(); var EmpNo = queryParam["EmpNo"].ToString(); - + var now = DateTime.Now; var loginUserInfo = LoginUserInfo.Get(); this.BaseRepository("CollegeMIS").ExecuteBySql("update StuScoreOnline set IsEditable='0',EditUserId='" + loginUserInfo.account + "',BeginModifyDate='" + now + "' where F_SchoolId='" + F_SchoolId + "' and AcademicYearNo='" + AcademicYearNo + "' and Semester='" + Semester + "' and LessonNo='" + LessonNo + "' and EmpNo='" + EmpNo + "' "); - + } catch (Exception ex) { @@ -1848,11 +1852,11 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad var Semester = queryParam["Semester"].ToString(); var LessonNo = queryParam["LessonNo"].ToString(); var EmpNo = queryParam["EmpNo"].ToString(); - + var now = DateTime.Now; var loginUserInfo = LoginUserInfo.Get(); this.BaseRepository("CollegeMIS").ExecuteBySql($"update StuScoreOnline set IsEditable='1',EditUserId=null,BeginModifyDate=null,ModifyDate='{now}',ModifyUserId='{loginUserInfo.account}',ModifyUserName='{loginUserInfo.realName}' where F_SchoolId='{F_SchoolId}' and AcademicYearNo='{AcademicYearNo}' and Semester='{Semester}' and LessonNo='{LessonNo}' and EmpNo='{EmpNo}' "); - + } catch (Exception ex) { @@ -1880,7 +1884,7 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad var Semester = queryParam["Semester"].ToString(); var LessonNo = queryParam["LessonNo"].ToString(); var EmpNo = queryParam["EmpNo"].ToString(); - + var now = DateTime.Now; var loginUserInfo = new { @@ -2150,16 +2154,18 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad public (DataTable failDt, int snum, int fnum) ExecuteImportExcel(int type, DataTable dt, string fileGuid, string queryJson) { - if (type == 1) - { - //必修 - return ExecuteImportExcelForRequired(dt, fileGuid, queryJson); - } - else - { - //选修 - return ExecuteImportExcelForElective(dt, fileGuid, queryJson); - } + return ExecuteImportExcelForRequired(dt, fileGuid, queryJson); + + //if (type == 1) + //{ + // //必修 + // return ExecuteImportExcelForRequired(dt, fileGuid, queryJson); + //} + //else + //{ + // //选修 + // return ExecuteImportExcelForElective(dt, fileGuid, queryJson); + //} } @@ -2173,7 +2179,7 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad //成功记录数 int snum = 0; //总记录数 - int num = 0; + int num = dt.Rows.Count; var db = this.BaseRepository("CollegeMIS"); var msg = ""; try @@ -2187,21 +2193,16 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad var AcademicYearNo = queryParam["AcademicYearNo"].ToString(); var Semester = queryParam["Semester"].ToString(); var LessonNo = queryParam["LessonNo"].ToString(); - var ClassNo = queryParam["ClassNo"].ToString(); - var classInfoList = db.FindList(); - var lessonInfoList = db.FindList(); - var classInfoEntity = classInfoList.FirstOrDefault(x => x.ClassNo == ClassNo); - var lessonInfoEntity = lessonInfoList.FirstOrDefault(x => x.LessonNo == LessonNo && x.CheckMark == true); + var EmpNo = queryParam["EmpNo"].ToString(); - if (classInfoEntity != null) + //获取成绩比例数据 + //var stuSelectLessonListEntity = db.FindEntity(x => x.F_SchoolId == F_SchoolId && x.AcademicYearNo == AcademicYearNo && x.Semester == Semester && x.LessonNo == LessonNo && x.EmpNo == EmpNo && x.Status == 2); + //if (stuSelectLessonListEntity != null) { - //获取成绩比例数据 - var stuSelectLessonListEntity = db.FindEntity(x => x.F_SchoolId == F_SchoolId && x.AcademicYearNo == AcademicYearNo && x.Semester == Semester && x.OpenLessonDeptNo == classInfoEntity.DeptNo && x.OpenLessonMajorNo == classInfoEntity.MajorNo && x.LessonNo == LessonNo && x.LessonSortNo == "1" && x.ClassNo == ClassNo); - if (stuSelectLessonListEntity != null) + //当前班级学生成绩 + var list = GetList(queryJson).ToList(); + if (list.Any()) { - //当前班级学生成绩 - var list = GetList(queryJson).ToList(); - foreach (DataColumn dc in dt.Columns) { failDt.Columns.Add(dc.ColumnName, dc.DataType); @@ -2213,66 +2214,70 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad { try { - var stuno = dr["学号"].ToString().Trim(); + var stuNo_dr = dr["学生学号"].ToString().Trim(); + var stuName_dr = dr["学生姓名"].ToString().Trim(); var academicYearNo_dr = dr["学年"].ToString().Trim(); var semester_dr = dr["学期"].ToString().Trim(); - var lessoninfo_dr = dr["课程名称"].ToString().Trim(); - var classinfo_dr = dr["班级"].ToString().Trim(); - //var lessonNo_dr = lessonInfoList.FirstOrDefault(x => x.LessonName == lessoninfo_dr)?.LessonNo; - //var classNo_dr = classInfoList.FirstOrDefault(x => x.ClassName == classinfo_dr)?.ClassNo; + var lessonName_dr = dr["课程名称"].ToString().Trim(); - if (!string.IsNullOrEmpty(stuno)) + if (string.IsNullOrEmpty(stuNo_dr)) { - num++; - if (!academicYearNo_dr.Equals(AcademicYearNo) || !semester_dr.Equals(Semester)) - { - dr["导入错误"] = "学年学期与查询条件不匹配!"; - failDt.Rows.Add(dr.ItemArray); - continue; - } - - if (!classinfo_dr.Equals(classInfoEntity.ClassName)) - { - dr["导入错误"] = "班级与查询条件班级(" + classInfoEntity.ClassName + ")不匹配!"; - failDt.Rows.Add(dr.ItemArray); - continue; - } - if (!lessoninfo_dr.Equals(lessonInfoEntity.LessonName)) - { - dr["导入错误"] = "课程与查询条件课程(" + lessonInfoEntity.LessonName + ")不匹配!"; - failDt.Rows.Add(dr.ItemArray); - continue; - } - - if (!lessoninfo_dr.Equals(lessonInfoEntity.LessonName) || !classinfo_dr.Equals(classInfoEntity.ClassName)) - { - dr["导入错误"] = "课程:" + lessonInfoEntity.LessonName + ",班级:" + classInfoEntity.ClassName + "找不到学号为" + stuno + "的学生"; - failDt.Rows.Add(dr.ItemArray); - continue; - } - var item = list.Find(x => x.StuNo == stuno && x.LessonNo == LessonNo && x.ClassNo == ClassNo); - var OrdinaryScore = Convert.ToDecimal(string.IsNullOrEmpty(dr["平时成绩"].ToString().Trim()) ? "0" : dr["平时成绩"].ToString().Trim()); - var TermInScore = Convert.ToDecimal(string.IsNullOrEmpty(dr["期中成绩"].ToString().Trim()) ? "0" : dr["期中成绩"].ToString().Trim()); - var TermEndScore = Convert.ToDecimal(string.IsNullOrEmpty(dr["期末成绩"].ToString().Trim()) ? "0" : dr["期末成绩"].ToString().Trim()); - var OtherScore = Convert.ToDecimal(string.IsNullOrEmpty(dr["其他成绩"].ToString().Trim()) ? "0" : dr["其他成绩"].ToString().Trim()); - if (OrdinaryScore < 0 || TermInScore < 0 || TermEndScore < 0 || OtherScore < 0) - { - dr["导入错误"] = "成绩必须大于0!"; - failDt.Rows.Add(dr.ItemArray); - continue; - } - var Score = Math.Round(Convert.ToDouble(OrdinaryScore * (stuSelectLessonListEntity.OrdinaryScoreScale / 100) + - TermInScore * (stuSelectLessonListEntity.TermInScoreScale / 100) + - TermEndScore * (stuSelectLessonListEntity.TermEndScoreScale / 100) + - OtherScore * (stuSelectLessonListEntity.OtherScoreScale / 100)), MidpointRounding.AwayFromZero); - var remark = dr["备注"].ToString().Trim(); - db.ExecuteBySql($"update StuScoreOnline set OrdinaryScore={OrdinaryScore},TermInScore={TermInScore},TermEndScore={TermEndScore},OtherScore={OtherScore},Score={Score},Remark='{remark}' where ScoreId='{item.ScoreId}' "); - + dr["导入错误"] = "学生学号不能为空!"; + failDt.Rows.Add(dr.ItemArray); + continue; } - else + if (string.IsNullOrEmpty(stuName_dr)) { - break; + dr["导入错误"] = "学生姓名不能为空!"; + failDt.Rows.Add(dr.ItemArray); + continue; } + if (string.IsNullOrEmpty(academicYearNo_dr)) + { + dr["导入错误"] = "学年不能为空!"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + if (string.IsNullOrEmpty(semester_dr)) + { + dr["导入错误"] = "学期不能为空!"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + if (string.IsNullOrEmpty(lessonName_dr)) + { + dr["导入错误"] = "课程名称不能为空!"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + if (!academicYearNo_dr.Equals(AcademicYearNo) || !semester_dr.Equals(Semester)) + { + dr["导入错误"] = "学年学期与查询条件不匹配!"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + if (!lessonName_dr.Equals(list.FirstOrDefault().LessonName)) + { + dr["导入错误"] = "课程名称与查询条件课程(" + list.FirstOrDefault().LessonName + ")不匹配!"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + var item = list.FirstOrDefault(x => x.StuNo == stuNo_dr && x.StuName == stuName_dr && x.LessonNo == LessonNo && x.EmpNo == EmpNo); + if (item == null) + { + dr["导入错误"] = "找不到学生学号为" + stuNo_dr + ",学生姓名为" + stuName_dr + "的学生"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + var TermEndScore = Convert.ToDecimal(string.IsNullOrEmpty(dr["最终核定成绩"].ToString().Trim()) ? "0" : dr["最终核定成绩"].ToString().Trim()); + if (TermEndScore < 0) + { + dr["导入错误"] = "最终核定成绩必须大于0!"; + failDt.Rows.Add(dr.ItemArray); + continue; + } + db.ExecuteBySql($"update StuScoreOnline set TermEndScore={TermEndScore},Score={TermEndScore},Remark='{dr["备注"].ToString().Trim()}' where ScoreId='{item.ScoreId}' "); + } catch (Exception e) { @@ -2291,6 +2296,7 @@ where StuNo not in(Select StuNo from stuscore s where s.Academicyearno = sl.Acad cache.Write(cacheKey + fileGuid, errordt, CacheId.excel); } snum = (num - failDt.Rows.Count) > 0 ? num - failDt.Rows.Count : 0; + } }