From 27e5fc50c6887d63a0377f376f01eb3d74219084 Mon Sep 17 00:00:00 2001 From: zzj <31836194@qq.com> Date: Wed, 13 Dec 2023 17:17:06 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E8=AF=BE=E6=97=B6=E8=B4=B9=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E5=8A=A0=E7=B3=BB=E9=83=A8=E6=90=9C=E7=B4=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ArrangeLessonTerm/coursestatictis.cshtml | 5 ++++- .../ArrangeLessonTerm/coursestatictis.js | 4 +++- .../ArrangeLessonTermService.cs | 21 ++++++++++++++----- 3 files changed, 23 insertions(+), 7 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/coursestatictis.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/coursestatictis.cshtml index 0e88b77d0..2d428698d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/coursestatictis.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/coursestatictis.cshtml @@ -8,11 +8,14 @@
-
+
+
+
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/coursestatictis.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/coursestatictis.js index cfa3f82ba..f1d5dceb4 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/coursestatictis.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/ArrangeLessonTerm/coursestatictis.js @@ -31,6 +31,7 @@ var bootstrap = function ($, learun) { text: "text", value: "value", }) + $('#DeptNo').lrDataSourceSelect({ code: 'CdDeptInfo', value: 'deptno', text: 'deptname' }); //$('#datesearch').lrdate({ // dfdata: [ // { name: '今天', begin: function () { return learun.getDate('yyyy-MM-dd 00:00:00') }, end: function () { return learun.getDate('yyyy-MM-dd 23:59:59') } }, @@ -61,7 +62,8 @@ var bootstrap = function ($, learun) { $('#btn_Search').on('click', function () { var month = $('#datesearch').lrselectGet(); var weeks = $('#weeks').lrselectGet(); - page.search({ month: month, weeks: weeks }); + var deptNo = $('#DeptNo').lrselectGet(); + page.search({ month: month, weeks: weeks, deptNo: deptNo }); }); // 刷新 $('#lr_refresh').on('click', function () { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs index e73359e69..9ea6c0ed9 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs @@ -2222,14 +2222,25 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les var strSql = new StringBuilder(); var queryParam = queryJson.ToJObject(); int month = queryParam["month"] == null ? DateTime.Now.Month : queryParam["month"].ToInt() ; + if (month < 1 || month > 12) month = DateTime.Now.Month; + int weeks = queryParam["weeks"] == null ? 4 : queryParam["weeks"].ToInt(); + if (weeks < 1 || weeks > 4) weeks = 4; + var deptNo = queryParam["deptNo"] == null? string.Empty : queryParam["deptNo"].ToString(); string starttime = DateTime.Now.Year.ToString()+"-" + month + "-1 00:00:00"; string endtime = DateTime.Now.Year.ToString() + "-" + month + "-"+ DateTime.DaysInMonth(DateTime.Now.Year, month) +" 23:59:59"; - strSql.Append("select a.*,b.jobrank as zhiwu,b.F_DepartmentId as dept,b.feestandard,b.Weekcourses,ta.actcourses as monthactcourses,ta.actcourses-(b.Weekcourses*"+ (queryParam["weeks"]==null?4: queryParam["weeks"]) + ") as zhesuan_monthactcourses, "); - strSql.Append(" case when b.jobrank in('5') then (ta.actcourses-" + (queryParam["weeks"]==null ? 4 : queryParam["weeks"]) + "*b.Weekcourses)*b.feestandard/2 "); - strSql.Append(" when b.jobrank in('6') then (ta.actcourses-" + (queryParam["weeks"]==null ? 4 : queryParam["weeks"]) + "*b.Weekcourses)*b.feestandard "); - strSql.Append("when b.jobrank in(1,2,3,4) then (case when ta.actcourses<=(" + (queryParam["weeks"]==null ? 4 : queryParam["weeks"]) + "*b.weekcourses)/2 then ta.actcourses*b.feestandard else " + (queryParam["weeks"] == null ? 4 : queryParam["weeks"]) + "*b.weekcourses*b.feestandard/2 end) end as actfeestandard "); + strSql.Append("select a.*,b.jobrank as zhiwu,b.F_DepartmentId as dept,b.feestandard,b.Weekcourses,ta.actcourses as monthactcourses,ta.actcourses-(b.Weekcourses*"+ weeks + ") as zhesuan_monthactcourses, "); + strSql.Append(" case when b.jobrank in('5') then (ta.actcourses-" + weeks + "*b.Weekcourses)*b.feestandard/2 "); + strSql.Append(" when b.jobrank in('6') then (ta.actcourses-" + weeks + "*b.Weekcourses)*b.feestandard "); + strSql.Append("when b.jobrank in(1,2,3,4) then (case when ta.actcourses<=(" + weeks + "*b.weekcourses)/2 then ta.actcourses*b.feestandard else " + weeks + "*b.weekcourses*b.feestandard/2 end) end as actfeestandard "); strSql.Append("from "); - strSql.Append("(select count(*) as courses,a.empno,a.empname from ArrangeLessonTerm a where lessondate between '"+ starttime + "' and '" + endtime + "' group by a.empno,a.empname ) a "); + if(string.IsNullOrWhiteSpace(deptNo)) + { + strSql.Append("(select count(*) as courses,a.empno,a.empname from ArrangeLessonTerm a where lessondate between '" + starttime + "' and '" + endtime + "' group by a.empno,a.empname ) a "); + } + else + { + strSql.Append("(select count(*) as courses,a.empno,a.empname from ArrangeLessonTerm a where DeptNo='" + deptNo + "' and lessondate between '" + starttime + "' and '" + endtime + "' group by a.empno,a.empname ) a "); + } strSql.Append("left join (select count(*) as actcourses,empno from Teach_attendance where clocktime between '" + starttime + "' and '" + endtime + "' group by empno) ta on ta.empno=a.empno "); strSql.Append("left join empinfo b on a.empno=b.empno "); strSql.Append("where a.empno is not null "); From ecf0bcea8b8c6aee6aabbf8de83096197bb78393 Mon Sep 17 00:00:00 2001 From: ndbs Date: Thu, 14 Dec 2023 15:14:51 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=AF=BE=E8=A1=A8=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ExcelImportController.cs | 31 ++- .../Controllers/TimeTableController.cs | 33 +++ .../Views/TimeTable/ImportForm.cshtml | 24 ++ .../Views/TimeTable/ImportForm.css | 136 ++++++++++ .../Views/TimeTable/ImportForm.js | 241 ++++++++++++++++++ .../Views/TimeTable/IndexInEducation.cshtml | 1 + .../Views/TimeTable/IndexInEducation.js | 11 + .../Content/excel/ArrangeLessonTermImport.xls | Bin 0 -> 18944 bytes .../Learun.Application.Web.csproj | 4 + .../ArrangeLessonTerm/ArrangeLessonTermBLL.cs | 26 ++ .../ArrangeLessonTermEntity.cs | 14 +- .../ArrangeLessonTermIBLL.cs | 2 + .../ArrangeLessonTermService.cs | 195 +++++++++++++- 13 files changed, 703 insertions(+), 15 deletions(-) create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ImportForm.cshtml create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ImportForm.css create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ImportForm.js create mode 100644 Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/ArrangeLessonTermImport.xls diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs index d9de38493..270eaff8c 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LR_SystemModule/Controllers/ExcelImportController.cs @@ -24,6 +24,7 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers private AnnexesFileIBLL annexesFileIBLL = new AnnexesFileBLL(); private StuInfoBasicIBLL stuInfoBasicIBLL = new StuInfoBasicBLL(); private Ass_FixAssetsIBLL ass_FixAssetsIBLL = new Ass_FixAssetsBLL(); + private ArrangeLessonTermIBLL arrangeLessonTermIBLL = new ArrangeLessonTermBLL(); #region 视图功能 /// @@ -353,7 +354,35 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers return Fail("导入数据失败!"); } } - + /// + /// + /// + /// + /// + /// + /// + [HttpPost] + [ValidateAntiForgeryToken] + public ActionResult ArrangeLessonTermImport(string fileId, int chunks, string ext) + { + UserInfo userInfo = LoginUserInfo.Get(); + string path = annexesFileIBLL.SaveAnnexes(fileId, fileId + "." + ext, chunks, userInfo); + if (!string.IsNullOrEmpty(path)) + { + DataTable dt = ExcelHelper.ExcelImport(path); + var res = arrangeLessonTermIBLL.ArrangeLessonTermImport(dt, fileId); + var data = new + { + Success = res.Split('|')[0], + Fail = res.Split('|')[1] + }; + return JsonResult(data); + } + else + { + return Fail("导入数据失败!"); + } + } /// /// 下载文件(导入文件未被导入的数据) /// diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/TimeTableController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/TimeTableController.cs index 67838a503..7da7e3bbd 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/TimeTableController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Controllers/TimeTableController.cs @@ -8,6 +8,7 @@ using System; using System.Linq; using System.Threading.Tasks; using Newtonsoft.Json; +using System.IO; namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers { @@ -74,6 +75,16 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers return View(); } + /// + /// 导入页面 + /// + /// + [HttpGet] + public ActionResult ImportForm() + { + return View(); + } + /// /// 课程表【教务】 @@ -689,5 +700,27 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers #endregion + /// + /// 导入数据 + /// + /// + public ActionResult DownTemplate() + { + FileStreamResult result = null; + try + { + var path = Server.MapPath("~/Content/excel/"); + var pathoffull = path + "ArrangeLessonTermImport.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; + } + } + } } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ImportForm.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ImportForm.cshtml new file mode 100644 index 000000000..f73eea927 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ImportForm.cshtml @@ -0,0 +1,24 @@ +@{ + ViewBag.Title = "Form"; + Layout = "~/Views/Shared/_Form.cshtml"; +} + + +@Html.AppendCssFile("/Areas/PersonnelManagement/Views/TimeTable/ImportForm.css") +
+
+
上传文件
+
下载模板
+
+
+
+
+ +
+
+

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

+
+
+
+
+@Html.AppendJsFile("/Areas/PersonnelManagement/Views/TimeTable/ImportForm.js") diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ImportForm.css b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ImportForm.css new file mode 100644 index 000000000..04b556b7a --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ImportForm.css @@ -0,0 +1,136 @@ +.lr-form-layout-body { + padding:0 5px 5px 5px; +} +.lr-form-file-queue-wrap { + position:relative; + width:100%; + height:100%; + border:1px solid #ddd; + border-radius:4px; +} +.lr-form-file-queue { + position:relative; +} +.lr-form-file-queue { + position:relative; +} +.lr-form-file-queue-item { + position:relative; + width:100%; + height:50px; + border-bottom:1px solid #ddd; + padding-left:60px; + +} +.lr-file-image { + position:absolute; + top:5px; + left:5px; +} +.lr-file-image img { + width:40px; + height:40px; +} +.lr-file-name{ + line-height:50px; + +} +.lr-msg { + position:absolute; + top:0; + right:5px; + font-size: 25px; + line-height:50px; +} +.lr-msg .fa-check-circle{ + color: #5cb85c; +} +.lr-msg .fa-exclamation-circle { + color: #b94a48; +} +.lr-msg2 { + position:absolute; + top:0; + right:5px; + line-height:50px; +} +.lr-msg2 span { + color:#333; + font-size:14px; + margin-right:5px; +} + +.lr-tool-bar { + position:absolute; + top:0; + right:35px; + font-size: 25px; + line-height:50px; + color:#666; + cursor:pointer; +} +.lr-tool-bar > i { + margin-left:8px; +} + +.lr-tool-bar .fa-minus-circle { + color: #b94a48; +} +.lr-tool-bar .fa-cloud-download { + color: #3498db; +} + +.lr-uploader-progress { + position:absolute; + bottom:2px; + left:60px; + height:4px; + width:500px; + width:calc(100% - 90px); +} +.lr-uploader-progress-bar { + position:relative; + height:100%; + background-color:#039cfd; + border-radius:4px; +} + + +.lr-form-file-queue-bg { + position:absolute; + top:50%; + left:50%; + width:300px; + height:30px; + line-height:30px; + + margin:-15px 0 0 -150px; +} +.lr-form-file-queue-bg h1 { + color: #666; + font-size: 20px; + font-family: Microsoft Yahei; + padding-bottom: 2px; + margin: 0; +} +#lr_down_file_btn { + position:absolute; + right:5px; + background:#fff; + border:1px solid #ddd; + color:#333; +} +#lr_down_file_btn:hover { + color:#337ab7; +} +/*对百度插件的样式重写*/ +.webuploader-container { + position:absolute; +} +.webuploader-pick { + padding:8px 15px; + background-color:#039cfd; +} +.webuploader-pick-hover { + background-color:#027dcb; +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ImportForm.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ImportForm.js new file mode 100644 index 000000000..93a7c49ee --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/ImportForm.js @@ -0,0 +1,241 @@ +/* + * 版 本 Learun-ADMS-Ultimate V7.0.0 数字化智慧校园(http://www.learun.cn) + * Copyright (c) 2013-2018 北京泉江科技有限公司 + * 创建人:陈彬彬 + * 日 期:2023.03.01 + * 描 述:导入班级学籍信息 + */ +var id = request('id'); + +var keyVaule = ''; + +var bootstrap = function ($, learun) { + "use strict"; + + var page1 = { + init: function () { + page.bind(); + page.initData(); + }, + bind: function () { + $('#lr_add_format').on('click', function () { + currentColRow = null; + learun.layerForm({ + id: 'FormatForm', + title: '添加', + url: top.$.rootUrl + '/LR_SystemModule/CodeRule/FormatForm', + width: 450, + height: 310, + callBack: function (id) { + return top[id].acceptClick(function (data) { + $('#gridtable').jfGridSet('addRow', { row: data }); + }); + } + }); + }); + $('#lr_edit_format').on('click', function () { + currentColRow = $('#gridtable').jfGridGet('rowdata'); + var _id = currentColRow ? currentColRow.itemTypeName : ''; + if (learun.checkrow(_id)) { + learun.layerForm({ + id: 'FormatForm', + title: '修改', + url: top.$.rootUrl + '/LR_SystemModule/CodeRule/FormatForm', + width: 450, + height: 310, + callBack: function (id) { + return top[id].acceptClick(function (data) { + $('#gridtable').jfGridSet('updateRow', { row: data }); + }); + } + }); + } + + }); + $('#lr_delete_format').on('click', function () { + currentColRow = null; + var row = $('#gridtable').jfGridGet('rowdata'); + var _id = row ? row.itemTypeName : ''; + if (learun.checkrow(_id)) { + learun.layerConfirm('是否确认删除该项!', function (res, index) { + if (res) { + $('#gridtable').jfGridSet('removeRow'); + top.layer.close(index); //再执行关闭 + } + }); + } + }); + + $('#gridtable').jfGrid({ + headData: [ + { label: "前缀", name: "itemTypeName", width: 120, align: "left" }, + { label: "格式", name: "formatStr", width: 120, align: "left" }, + { label: "步长", name: "stepValue", width: 100, align: "left" }, + { label: "初始值", name: "initValue", width: 120, align: "left" }, + { label: "说明", name: "description", width: 180, align: "left" } + ] + }); + + /*检测重复项*/ + $('#F_EnCode').on('blur', function () { + $.lrExistField(keyValue, 'F_EnCode', top.$.rootUrl + '/LR_SystemModule/CodeRule/ExistEnCode'); + }); + $('#F_FullName').on('blur', function () { + $.lrExistField(keyValue, 'F_FullName', top.$.rootUrl + '/LR_SystemModule/CodeRule/ExistFullName'); + }); + }, + initData: function () { + if (!!selectedRow) { + keyValue = selectedRow.F_RuleId; + $('#form').lrSetFormData(selectedRow); + var formatdata = JSON.parse(selectedRow.F_RuleFormatJson); + $('#gridtable').jfGridSet('refreshdata', formatdata); + } + } + }; + + var fileInfo = {}; + + // 触发合并文件碎片 + var mergeFileChunks = function (file) { + + + var param = {}; + param['__RequestVerificationToken'] = $.lrToken; + param['fileId'] = fileInfo[file.id].fileGuid; + param['chunks'] = fileInfo[file.id].chunks; + param['ext'] = file.ext; + param['templateId'] = id; + console.log(111) + learun.httpAsyncPost(top.$.rootUrl + "/LR_SystemModule/ExcelImport/ArrangeLessonTermImport", 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 { + $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 page = { + uploader: null, + init: function () { + /*模板下载*/ + $('#lr_down_file_btn').on('click', function () { + learun.download({ url: top.$.rootUrl + '/PersonnelManagement/TimeTable/DownTemplate', param: { keyValue: id, __RequestVerificationToken: $.lrToken }, method: 'POST' }); + }); + if (!WebUploader.Uploader.support()) { + alert('Web Uploader 不支持您的浏览器!如果你使用的是IE浏览器,请尝试升级 flash 播放器'); + throw new Error('WebUploader does not support the browser you are using.'); + } + + 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: true, + // 不压缩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').lrscroll(); + + }, + 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(); + +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.cshtml index 947a1ae2d..bbc3a9acd 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.cshtml @@ -135,6 +135,7 @@
 按条件清空排课数据 diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.js index 381cb06d0..d8aac790f 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/PersonnelManagement/Views/TimeTable/IndexInEducation.js @@ -105,6 +105,17 @@ var bootstrap = function ($, learun) { $('#lr_refresh').on('click', function () { location.reload(); }); + //导入弹窗 + $('#lr_import').on('click', function () { + learun.layerForm({ + id: 'form_import', + title: '导入数据', + url: top.$.rootUrl + '/PersonnelManagement/TimeTable/ImportForm', + width: 600, + height: 400, + btn: null + }); + }); //$('#datesearch').lrdate({ // dfdata: [ // { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/ArrangeLessonTermImport.xls b/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/ArrangeLessonTermImport.xls new file mode 100644 index 0000000000000000000000000000000000000000..9ac9cb1cb7fe14d74a109e88b60300c4c8de1675 GIT binary patch literal 18944 zcmeHP30zLu`#?Wz_k@C{U1c#e}$`qNGklL6CvqI#=|*{WI}6vdN6_>!w|s*Ga(<3gq)_1q!)dn zkNzw6xz#w{;Rqpl8ao<)68nmtJv)I0-f z-h;%zG3HYMSULt!KF)zSem=E)H1AH+1ndnalgT*vi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ob@fK8iY-C&KB~q-`_c)ReD24b;LD z_@i!wYleX&JYjQ03mh84XHw^*Y6mpsH^Wzx>g25_{naG$M}KLh)9Onrbr_{gzzW#F z!1xp1F>2yYH2iRs3*UWcQ`fq1#2>=($%h@km-mYe^^2n9_LSU#I?kjdxuC-Y8+=a$ zuZ_NjoHNu)%n;JEDD6Dz*g>TI%&#Ns8aKG69v@pyRZp_>e;C={y0XV2W=^sX+?+;w`Y=184Y7i>pTtQ_biPsdyAY$cLex z&uYJT@UlJhMDPxsplhhCyavS9f<%5BlE_kqu8UtHD)peh9Hs#OclbAD0GkqfAoI&6 zY+mdR*q^XXvG3q_+Stc&)M~b*|L*&5wE187_h$g_N*ooUy_Q>nO-{9WqqY%uW1Op2 zcl@FlI>_mk-yQs`&*)FfT=Vy5P-XeoB>JgDYdIpKUX!`(vnU_!QBU4k!k$#o`u}BT zn8K;hqorQ&v~dm)kTU^<YfOFnH9xdmAF}5dS3>zFX ztIgoFnZa4^Ag})D zAGhL4MUk_qPT?x3zhlE5Yz<`z*+P)@h6q)mII)E@gk0nb=WJhyIuQLKO4b?kl}QhH z2#=#4$`h#n0P%VMkH8mD*|Qu#{%yc#Ck=Gw9}1sa{y$W#2;<&56ST@ zIbLxLu0BA)4f_n=d)){}c;{``2O709tEDz7#lmyHE{|NsFU5hM( 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 fe55e0f52..0ec74ad0f 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 @@ -1784,6 +1784,8 @@ + + @@ -8338,6 +8340,8 @@ + + diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs index 39419d9e0..84da44949 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermBLL.cs @@ -617,5 +617,31 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration var data = arrangeLessonTermService.InitAsyncDataByCondition(entity); return data; } + + + /// + /// 导入 + /// + /// + /// + /// + public string ArrangeLessonTermImport(DataTable dt, string fileId) + { + try + { + return arrangeLessonTermService.ArrangeLessonTermImport(dt, fileId); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermEntity.cs index 5f3dd4056..43b96da75 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermEntity.cs @@ -11,7 +11,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 日 期:2019-02-27 11:05 /// 描 述:排课 ///
- public class ArrangeLessonTermEntity + public class ArrangeLessonTermEntity { #region 实体成员 @@ -158,6 +158,18 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// [Column("F_SCHOOLID")] public string F_SchoolId { get; set; } + /// + /// 插入时间 + /// + /// + [Column("INSERTDATE")] + public DateTime? InsertDate { get; set; } + /// + /// 导入标识 + /// + /// + [Column("ISIMPORT")] + public bool? IsImport { get; set; } [NotMapped] public string lessoncount { get; set; } [NotMapped] public string coefficient { get; set; } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs index 40dd5b26d..88994d97e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermIBLL.cs @@ -158,5 +158,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration IEnumerable GetAllClassLesson(string academicYearNo, string semester); bool InitAsyncDataByCondition(ArrangeLessonTermEntity entity); + + string ArrangeLessonTermImport(DataTable dt, string fileId); } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs index e73359e69..50892abc6 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs @@ -1,18 +1,17 @@ using Dapper; +using Learun.Application.Organization; +using Learun.Cache.Base; +using Learun.Cache.Factory; using Learun.DataBase.Repository; using Learun.Util; +using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Data; -using System.Diagnostics; using System.Linq; using System.Net.Http; -using System.Runtime.InteropServices; using System.Text; using System.Threading.Tasks; -using Learun.Application.Base.SystemModule; -using Learun.Application.Organization; -using Newtonsoft.Json; using static Learun.Application.TwoDevelopment.EducationalAdministration.ArrangeExamTermService; namespace Learun.Application.TwoDevelopment.EducationalAdministration @@ -27,6 +26,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration public class ArrangeLessonTermService : RepositoryFactory { + #region 缓存定义 + private ICache cache = CacheFactory.CaChe(); + private string cacheKey = "Learun_adms_excelError_"; + #endregion + private static readonly HttpClient Client; static ArrangeLessonTermService() { @@ -2221,15 +2225,15 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les { var strSql = new StringBuilder(); var queryParam = queryJson.ToJObject(); - int month = queryParam["month"] == null ? DateTime.Now.Month : queryParam["month"].ToInt() ; - string starttime = DateTime.Now.Year.ToString()+"-" + month + "-1 00:00:00"; - string endtime = DateTime.Now.Year.ToString() + "-" + month + "-"+ DateTime.DaysInMonth(DateTime.Now.Year, month) +" 23:59:59"; - strSql.Append("select a.*,b.jobrank as zhiwu,b.F_DepartmentId as dept,b.feestandard,b.Weekcourses,ta.actcourses as monthactcourses,ta.actcourses-(b.Weekcourses*"+ (queryParam["weeks"]==null?4: queryParam["weeks"]) + ") as zhesuan_monthactcourses, "); - strSql.Append(" case when b.jobrank in('5') then (ta.actcourses-" + (queryParam["weeks"]==null ? 4 : queryParam["weeks"]) + "*b.Weekcourses)*b.feestandard/2 "); - strSql.Append(" when b.jobrank in('6') then (ta.actcourses-" + (queryParam["weeks"]==null ? 4 : queryParam["weeks"]) + "*b.Weekcourses)*b.feestandard "); - strSql.Append("when b.jobrank in(1,2,3,4) then (case when ta.actcourses<=(" + (queryParam["weeks"]==null ? 4 : queryParam["weeks"]) + "*b.weekcourses)/2 then ta.actcourses*b.feestandard else " + (queryParam["weeks"] == null ? 4 : queryParam["weeks"]) + "*b.weekcourses*b.feestandard/2 end) end as actfeestandard "); + int month = queryParam["month"] == null ? DateTime.Now.Month : queryParam["month"].ToInt(); + string starttime = DateTime.Now.Year.ToString() + "-" + month + "-1 00:00:00"; + string endtime = DateTime.Now.Year.ToString() + "-" + month + "-" + DateTime.DaysInMonth(DateTime.Now.Year, month) + " 23:59:59"; + strSql.Append("select a.*,b.jobrank as zhiwu,b.F_DepartmentId as dept,b.feestandard,b.Weekcourses,ta.actcourses as monthactcourses,ta.actcourses-(b.Weekcourses*" + (queryParam["weeks"] == null ? 4 : queryParam["weeks"]) + ") as zhesuan_monthactcourses, "); + strSql.Append(" case when b.jobrank in('5') then (ta.actcourses-" + (queryParam["weeks"] == null ? 4 : queryParam["weeks"]) + "*b.Weekcourses)*b.feestandard/2 "); + strSql.Append(" when b.jobrank in('6') then (ta.actcourses-" + (queryParam["weeks"] == null ? 4 : queryParam["weeks"]) + "*b.Weekcourses)*b.feestandard "); + strSql.Append("when b.jobrank in(1,2,3,4) then (case when ta.actcourses<=(" + (queryParam["weeks"] == null ? 4 : queryParam["weeks"]) + "*b.weekcourses)/2 then ta.actcourses*b.feestandard else " + (queryParam["weeks"] == null ? 4 : queryParam["weeks"]) + "*b.weekcourses*b.feestandard/2 end) end as actfeestandard "); strSql.Append("from "); - strSql.Append("(select count(*) as courses,a.empno,a.empname from ArrangeLessonTerm a where lessondate between '"+ starttime + "' and '" + endtime + "' group by a.empno,a.empname ) a "); + strSql.Append("(select count(*) as courses,a.empno,a.empname from ArrangeLessonTerm a where lessondate between '" + starttime + "' and '" + endtime + "' group by a.empno,a.empname ) a "); strSql.Append("left join (select count(*) as actcourses,empno from Teach_attendance where clocktime between '" + starttime + "' and '" + endtime + "' group by empno) ta on ta.empno=a.empno "); strSql.Append("left join empinfo b on a.empno=b.empno "); strSql.Append("where a.empno is not null "); @@ -2247,6 +2251,171 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les } } } + + + /// + /// 导入 + /// + /// + /// + /// + public string ArrangeLessonTermImport(DataTable dt, string fileId) + { + try + { + int snum = 0; + int fnum = 0; + if (dt.Rows.Count > 0) + { + DataTable failDt = new DataTable(); + dt.Columns.Add("导入错误", typeof(string)); + foreach (DataColumn dc in dt.Columns) + { + failDt.Columns.Add(dc.ColumnName, dc.DataType); + } + var db = this.BaseRepository().BeginTrans(); + + IEnumerable ArrangeLessonTermHistory = db.FindList("select * from ArrangeLessonTerm"); + var ArrangeLessonTerminsert = new List(); + + // 循环遍历导入 + foreach (DataRow dr in dt.Rows) + { + try + { + #region 必填项空验证 + if (dr["上课日期"].ToString().IsEmpty()) + { + throw (new Exception("资上课日期不能为空")); + } + if (dr["开始时间"].ToString().IsEmpty()) + { + throw (new Exception("开始时间不能为空")); + } + if (dr["结束时间"].ToString().IsEmpty()) + { + throw (new Exception("结束时间不能为空")); + } + if (dr["学年"].ToString().IsEmpty()) + { + throw (new Exception("学年不能为空")); + } + if (dr["学期"].ToString().IsEmpty()) + { + throw (new Exception("学期入账日期不能为空")); + } + if (dr["班级"].ToString().IsEmpty()) + { + throw (new Exception("班级类型不能为空")); + } + if (dr["课程"].ToString().IsEmpty()) + { + throw (new Exception("课程不能为空")); + } + if (dr["教师姓名"].ToString().IsEmpty()) + { + throw (new Exception("教师姓名不能为空")); + } + if (dr["上课时间"].ToString().IsEmpty()) + { + throw (new Exception("上课时间不能为空")); + } + if (dr["是否必修课"].ToString().IsEmpty()) + { + throw (new Exception("是否必修课不能为空")); + } + #endregion + //插入时间 + var Insertdate = DateTime.Now; + var LessonName = dr["课程"].ToString(); + var ClassName = dr["班级"].ToString(); + var ClassroomName = dr["教室"].ToString(); + var EmpName = dr["教师姓名"].ToString(); + //基础数据 + var lessonEntity = BaseRepository("CollegeMIS").FindEntity(x => x.LessonName == LessonName); + var classEntity = BaseRepository("CollegeMIS").FindEntity(x => x.ClassName == ClassName); + var classroomEntity = BaseRepository("CollegeMIS").FindEntity(x => x.ClassroomName == ClassroomName); + var CompanyEntity = BaseRepository("CollegeMIS").FindList().FirstOrDefault(); + var empinfoEntity = BaseRepository("CollegeMIS").FindEntity(x => x.EmpName == EmpName); + + //写入要导入替换的数据 + ArrangeLessonTermEntity arrangeLessonTermEntity = new ArrangeLessonTermEntity + { + ALTId = Guid.NewGuid().ToString(), + LessonDate = dr["上课日期"].ToDate(), + StartTime = dr["开始时间"].ToString(), + EndTime = dr["结束时间"].ToString(), + AcademicYearNo = dr["学年"].ToString(), + Semester = dr["学期"].ToString(), + DeptNo = classEntity.DeptNo, + MajorNo = classEntity.MajorNo, + LessonNo = lessonEntity.LessonNo, + LessonName = lessonEntity.LessonName, + TeachClassNo = lessonEntity.LessonName + classEntity.ClassNo, + EmpNo = empinfoEntity.EmpNo, + EmpName = empinfoEntity.EmpName, + ClassroomNo = classroomEntity.ClassroomNo, + LessonTime = dr["上课时间"].ToString(), + LessonSortNo = dr["是否必修课"].ToString() == "是" ? "1" : "0", + //默认数据 + CheckMark = "1", + InsertDate = Insertdate, + IsImport = true, + F_SchoolId = CompanyEntity.F_CompanyId, + + }; + + #region 判断是否重复 + if (ArrangeLessonTermHistory.Count(m => m.AcademicYearNo == arrangeLessonTermEntity.AcademicYearNo && m.Semester == arrangeLessonTermEntity.Semester + && m.LessonNo == arrangeLessonTermEntity.LessonNo && m.LessonDate.Value.Date == arrangeLessonTermEntity.LessonDate.Value.Date + && m.DeptNo == arrangeLessonTermEntity.DeptNo && m.MajorNo == arrangeLessonTermEntity.MajorNo + && m.TeachClassNo == arrangeLessonTermEntity.TeachClassNo && m.EmpNo == arrangeLessonTermEntity.EmpNo + && m.ClassroomNo == arrangeLessonTermEntity.ClassroomNo && m.LessonTime == arrangeLessonTermEntity.LessonTime + && m.F_SchoolId == arrangeLessonTermEntity.F_SchoolId) == 0 + && ArrangeLessonTerminsert.Count(m => m.AcademicYearNo == arrangeLessonTermEntity.AcademicYearNo && m.Semester == arrangeLessonTermEntity.Semester + && m.LessonNo == arrangeLessonTermEntity.LessonNo && m.LessonDate.Value.Date == arrangeLessonTermEntity.LessonDate.Value.Date + && m.DeptNo == arrangeLessonTermEntity.DeptNo && m.MajorNo == arrangeLessonTermEntity.MajorNo + && m.TeachClassNo == arrangeLessonTermEntity.TeachClassNo && m.EmpNo == arrangeLessonTermEntity.EmpNo + && m.ClassroomNo == arrangeLessonTermEntity.ClassroomNo && m.LessonTime == arrangeLessonTermEntity.LessonTime + && m.F_SchoolId == arrangeLessonTermEntity.F_SchoolId) == 0) + { + ArrangeLessonTerminsert.Add(arrangeLessonTermEntity); + snum++; + } + #endregion + } + catch (Exception ex) + { + fnum++; + dr["导入错误"] = ex.Message; + failDt.Rows.Add(dr.ItemArray); + } + } + //执行导入 + db.Insert(ArrangeLessonTerminsert); + db.Commit(); + if (failDt.Rows.Count > 0) + { + string errordt = failDt.ToJson(); + cache.Write(cacheKey + fileId, errordt, CacheId.excel); + } + } + return snum + "|" + fnum; + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + } From c001caa112bc0f81a391b4159b94a4140d4be370 Mon Sep 17 00:00:00 2001 From: ndbs Date: Thu, 14 Dec 2023 15:45:42 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E8=AF=BE=E8=A1=A8=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E7=BB=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ArrangeLessonTermService.cs | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs index 38f3333e9..045dc8f19 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/ArrangeLessonTerm/ArrangeLessonTermService.cs @@ -2225,19 +2225,19 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les { var strSql = new StringBuilder(); var queryParam = queryJson.ToJObject(); - int month = queryParam["month"] == null ? DateTime.Now.Month : queryParam["month"].ToInt() ; + int month = queryParam["month"] == null ? DateTime.Now.Month : queryParam["month"].ToInt(); if (month < 1 || month > 12) month = DateTime.Now.Month; int weeks = queryParam["weeks"] == null ? 4 : queryParam["weeks"].ToInt(); if (weeks < 1 || weeks > 4) weeks = 4; - var deptNo = queryParam["deptNo"] == null? string.Empty : queryParam["deptNo"].ToString(); - string starttime = DateTime.Now.Year.ToString()+"-" + month + "-1 00:00:00"; - string endtime = DateTime.Now.Year.ToString() + "-" + month + "-"+ DateTime.DaysInMonth(DateTime.Now.Year, month) +" 23:59:59"; - strSql.Append("select a.*,b.jobrank as zhiwu,b.F_DepartmentId as dept,b.feestandard,b.Weekcourses,ta.actcourses as monthactcourses,ta.actcourses-(b.Weekcourses*"+ weeks + ") as zhesuan_monthactcourses, "); + var deptNo = queryParam["deptNo"] == null ? string.Empty : queryParam["deptNo"].ToString(); + string starttime = DateTime.Now.Year.ToString() + "-" + month + "-1 00:00:00"; + string endtime = DateTime.Now.Year.ToString() + "-" + month + "-" + DateTime.DaysInMonth(DateTime.Now.Year, month) + " 23:59:59"; + strSql.Append("select a.*,b.jobrank as zhiwu,b.F_DepartmentId as dept,b.feestandard,b.Weekcourses,ta.actcourses as monthactcourses,ta.actcourses-(b.Weekcourses*" + weeks + ") as zhesuan_monthactcourses, "); strSql.Append(" case when b.jobrank in('5') then (ta.actcourses-" + weeks + "*b.Weekcourses)*b.feestandard/2 "); strSql.Append(" when b.jobrank in('6') then (ta.actcourses-" + weeks + "*b.Weekcourses)*b.feestandard "); strSql.Append("when b.jobrank in(1,2,3,4) then (case when ta.actcourses<=(" + weeks + "*b.weekcourses)/2 then ta.actcourses*b.feestandard else " + weeks + "*b.weekcourses*b.feestandard/2 end) end as actfeestandard "); strSql.Append("from "); - if(string.IsNullOrWhiteSpace(deptNo)) + if (string.IsNullOrWhiteSpace(deptNo)) { strSql.Append("(select count(*) as courses,a.empno,a.empname from ArrangeLessonTerm a where lessondate between '" + starttime + "' and '" + endtime + "' group by a.empno,a.empname ) a "); } @@ -2284,7 +2284,7 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les { failDt.Columns.Add(dc.ColumnName, dc.DataType); } - var db = this.BaseRepository().BeginTrans(); + var db = this.BaseRepository("CollegeMIS").BeginTrans(); IEnumerable ArrangeLessonTermHistory = db.FindList("select * from ArrangeLessonTerm"); var ArrangeLessonTerminsert = new List(); @@ -2346,7 +2346,7 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les var lessonEntity = BaseRepository("CollegeMIS").FindEntity(x => x.LessonName == LessonName); var classEntity = BaseRepository("CollegeMIS").FindEntity(x => x.ClassName == ClassName); var classroomEntity = BaseRepository("CollegeMIS").FindEntity(x => x.ClassroomName == ClassroomName); - var CompanyEntity = BaseRepository("CollegeMIS").FindList().FirstOrDefault(); + var CompanyEntity = BaseRepository().FindList(x => x.F_EnabledMark == 1).ToList().FirstOrDefault(); var empinfoEntity = BaseRepository("CollegeMIS").FindEntity(x => x.EmpName == EmpName); //写入要导入替换的数据 @@ -2393,6 +2393,10 @@ group by AcademicYearNo,Semester,DeptNo,MajorNo,LessonNo,TeachClassNo,EmpNo,Les ArrangeLessonTerminsert.Add(arrangeLessonTermEntity); snum++; } + else + { + throw (new Exception("当前数据重复")); + } #endregion } catch (Exception ex) From ee832a06bd143444c601ffc95ae44e16bb35d831 Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Fri, 15 Dec 2023 12:29:19 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91?= =?UTF-8?q?=E7=A7=BB=E5=8A=A8=E7=AB=AF=EF=BC=9A=E5=9D=90=E7=8F=AD=E8=80=83?= =?UTF-8?q?=E5=8B=A4=E6=89=93=E5=8D=A1=EF=BC=8C=E5=8F=96=E6=B6=88=E9=80=89?= =?UTF-8?q?=E6=8B=A9=E5=9D=90=E7=8F=AD=E5=92=8C=E6=8E=88=E8=AF=BE=E7=9A=84?= =?UTF-8?q?=E5=BC=B9=E5=B1=82=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../LearunApp-2.2.0/pages/AttendanceCard/list.vue | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/list.vue b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/list.vue index fb4a02c9f..7a5f373d1 100644 --- a/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/list.vue +++ b/Learun.Framework.Ultimate V7/LearunApp-2.2.0/pages/AttendanceCard/list.vue @@ -39,10 +39,10 @@ - + @@ -92,7 +92,7 @@ map: null, postData: {}, isGetingLocal:false, - modal:false, + // modal:false, } }, @@ -109,8 +109,8 @@ this.timer = setInterval(this.getCurrentTime, 1000) //判断教师是否授课,显示弹层 - let hasLesson = await this.judgeTeacherIsHasLesson() - this.modal = hasLesson + // let hasLesson = await this.judgeTeacherIsHasLesson() + // this.modal = hasLesson let res = await this.judgeIsDK() From 439fe5eab5cc2785d0d279a54d51a52fc067d30f Mon Sep 17 00:00:00 2001 From: dyy <807692433@qq.com> Date: Fri, 15 Dec 2023 12:31:30 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E3=80=90=E4=BF=AE=E6=94=B9=E3=80=91?= =?UTF-8?q?=E8=A1=A5=E5=8D=A1=E3=80=81=E5=9D=90=E7=8F=AD=E6=89=93=E5=8D=A1?= =?UTF-8?q?=EF=BC=9A=E5=90=8C=E6=AD=A5=E4=BF=AE=E6=94=B9=E6=8E=88=E8=AF=BE?= =?UTF-8?q?=E8=80=83=E5=8B=A4=E7=8A=B6=E6=80=81=EF=BC=9B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controllers/ADR_RecordController.cs | 25 +++ .../Views/ADR_Record/Form.cshtml | 25 +-- .../Views/ADR_Record/Form.js | 8 +- .../Views/ADR_Record/Index.js | 2 +- .../TeachAttendance/TeachAttendanceEntity.cs | 2 +- .../TeachAttendance/TeachAttendanceService.cs | 28 ++-- .../ADR_Record/ADR_RecordEntity.cs | 2 +- .../ADR_Record/ADR_RecordService.cs | 4 + .../ADR_Restriction/ADR_RestrictionService.cs | 149 +++++++++++++++++- 9 files changed, 205 insertions(+), 40 deletions(-) diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/ADR_RecordController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/ADR_RecordController.cs index 5a9692ee1..d69f8937e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/ADR_RecordController.cs +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/ADR_RecordController.cs @@ -194,6 +194,31 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers { UserInfo userInfo = LoginUserInfo.Get(); ADR_RecordEntity entity = strEntity.ToObject(); + entity.ADYear = entity.ADTime.Value.Year.ToString(); + entity.ADMonth = entity.ADTime.Value.Month.ToString(); + entity.ADDay = entity.ADTime.Value.Day.ToString().PadLeft(2, '0'); + + //判断是否存在打卡记录,做去重; + var list = aDR_RecordIBLL.GetADR_RecordEntityByEmpNo(entity.ADYear, entity.ADMonth, entity.ADDay, entity.UserNo); + if (list.Any()) + { + var model = list.FirstOrDefault(x => x.ADType == entity.ADType); + if (string.IsNullOrEmpty(keyValue)) + { + if (model != null) + { + return Fail("员工当日已存在相同的考勤类型!"); + } + } + else + { + if (model.ID != keyValue) + { + return Fail("员工当日已存在相同的考勤类型!"); + } + } + } + aDR_RecordIBLL.SaveEntity(keyValue, entity); return Success("保存成功!"); } diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/Form.cshtml index b63473ef5..399cb7c99 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/Form.cshtml @@ -4,29 +4,30 @@ }
-
员工名字
-
+
员工名字*
+
+
-
考勤类型
-
+
考勤类型*
+
-
考勤时间
- +
考勤时间*
+
-
打卡时间
- +
打卡时间*
+
-
打卡状态
-
+
打卡状态*
+
-
是否外勤
-
+
是否外勤*
+
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/Form.js index ed8e4f021..4726eefa2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/Form.js @@ -25,7 +25,13 @@ var bootstrap = function ($, learun) { $('#ClockStatus').lrDataItemSelect({ code: 'ADStatus' }); $('#AIsOut').lrDataItemSelect({ code: 'YesOrNoBit' }); $('#ADPhoto').lrUploader(); - $('#UserNo').lrDataSourceSelect({ code: 'BaseUser', value: 'f_account', text: 'f_realname' }); + $('#UserNo').lrDataSourceSelect({ code: 'BaseUser', value: 'f_account', text: 'f_realname', + select: function(item){ + if(item){ + $('#UserName').val(item.f_realname); + } + } + }); }, initData: function () { if (!!keyValue) { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/Index.js index 7f3305617..3e731bd62 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Views/ADR_Record/Index.js @@ -169,7 +169,7 @@ var bootstrap = function ($, learun) { ], mainId: 'ID', isPage: true, - sidx: "UserNo,ADYear,ADMonth,ADDay,ClockTime", + sidx: "ADYear,ADMonth,ADDay,UserNo,ADType", }); }, search: function (param) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachAttendance/TeachAttendanceEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachAttendance/TeachAttendanceEntity.cs index d9a36a414..2d18227d2 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachAttendance/TeachAttendanceEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachAttendance/TeachAttendanceEntity.cs @@ -104,7 +104,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// 是否一致 ///
[Column("ISFIT")] - public bool IsFit { get; set; } + public bool? IsFit { get; set; } /// /// 拍照图片 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachAttendance/TeachAttendanceService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachAttendance/TeachAttendanceService.cs index d0f614708..d2613be4d 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachAttendance/TeachAttendanceService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/TeachAttendance/TeachAttendanceService.cs @@ -167,26 +167,12 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration strSql1 += " AND e.F_DepartmentId = @F_DepartmentId"; strSql2 += " AND e.F_DepartmentId = @F_DepartmentId"; } - if (!queryParam["ClockStatus"].IsEmpty()) - { - dp.Add("ClockStatus", queryParam["ClockStatus"].ToString(), DbType.String); - if (queryParam["ClockStatus"].ToString() == "6" || queryParam["ClockStatus"].ToString() == "0")//缺勤、旷工 - { - strSql1 += " AND t.ClockStatus is null"; - strSql2 += " AND t.ClockStatus is null"; - } - else - { - strSql1 += " AND t.ClockStatus = @ClockStatus"; - strSql2 += " AND t.ClockStatus = @ClockStatus"; - } - } var strSql = new StringBuilder(); strSql.Append(strSql1); strSql.Append(" union "); strSql.Append(strSql2); //某天记录列表 - var data = this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp, pagination) + var data = this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp) .GroupBy(a => new { a.ALTIdInArrange, @@ -254,7 +240,17 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration item.WorkMinutes = WholeMinutes == item.QueQinMinutes ? 0 : WholeMinutes - item.ChidaoMinutes - item.ZaoTuiMinutes - item.QueQinMinutes; result.Add(item); } - + if (!queryParam["ClockStatus"].IsEmpty()) + { + if (queryParam["ClockStatus"].ToString() == "0")//旷工 + { + result = result.Where(x => x.ADStatusWork == "6" || x.ADStatusClose == "6").ToList(); + } + else + { + result = result.Where(x => x.ADStatusWork == queryParam["ClockStatus"].ToString() || x.ADStatusClose == queryParam["ClockStatus"].ToString()).ToList(); + } + } return result; } catch (Exception ex) diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordEntity.cs index 31676b289..dca53f756 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordEntity.cs @@ -108,7 +108,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// 是否一致 /// [Column("ISFIT")] - public bool IsFit { get; set; } + public bool? IsFit { get; set; } /// /// 拍照图片 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordService.cs index e7e6b648b..2bf697618 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/LogisticsManagement/ADR_Record/ADR_RecordService.cs @@ -19,6 +19,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// public class ADR_RecordService : RepositoryFactory { + private ADR_RestrictionService aDR_RestrictionService = new ADR_RestrictionService(); #region 获取数据 /// @@ -533,6 +534,9 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement entity.Create(); this.BaseRepository("CollegeMIS").Insert(entity); } + + //同步修改授课考勤打卡 + aDR_RestrictionService.ClockInModifyTeachAttendance(entity); } catch (Exception ex) { diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs index 1ae14b755..62550e434 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionService.cs @@ -172,7 +172,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// 考勤打卡教师 /// /// - public bool ClockIn(decimal ALon, decimal ALat, bool AIsOut, string ARemark, string ADPhoto, string ClockPlace,string img) + public bool ClockIn(decimal ALon, decimal ALat, bool AIsOut, string ARemark, string ADPhoto, string ClockPlace, string img) { try { @@ -436,13 +436,17 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement firstoffworkentity.ADPhoto = ADPhoto; firstoffworkentity.AIsOut = AIsOut; this.BaseRepository("CollegeMIS").ExecuteBySql("update ADR_Record set ADTime='" + firstoffworkentity.ADTime + "',ClockTime='" + firstoffworkentity.ClockTime + "',ClockStatus='" + firstoffworkentity.ClockStatus + "',ADPhoto='" + firstoffworkentity.ADPhoto + "' where ID='" + firstoffworkentity.ID + "'"); + //同步修改授课考勤打卡 + ClockInModifyTeachAttendance(adrRecordEntity); return true; } //考勤记录 this.BaseRepository("CollegeMIS").ExecuteBySql("insert into ADR_Record(ID, UserNo, ADType, ADTime, ClockTime, ClockStatus, ClockPlace,Img, ADYear, ADMonth, ADDay, ADPhoto,ALon,ALat,AIsOut,ARemark) values(" + "'" + adrRecordEntity.ID + "','" + adrRecordEntity.UserNo + "','" + adrRecordEntity.ADType + "','" + adrRecordEntity.ADTime + "'," + - "'" + adrRecordEntity.ClockTime + "','" + adrRecordEntity.ClockStatus + "','" + adrRecordEntity.ClockPlace + "','"+adrRecordEntity.Img+"','" + adrRecordEntity.ADYear + "'," + + "'" + adrRecordEntity.ClockTime + "','" + adrRecordEntity.ClockStatus + "','" + adrRecordEntity.ClockPlace + "','" + adrRecordEntity.Img + "','" + adrRecordEntity.ADYear + "'," + "'" + adrRecordEntity.ADMonth + "','" + adrRecordEntity.ADDay + "','" + adrRecordEntity.ADPhoto + "'," + adrRecordEntity.ALon + "," + adrRecordEntity.ALat + ",'" + adrRecordEntity.AIsOut + "','" + adrRecordEntity.ARemark + "')"); + //同步修改授课考勤打卡 + ClockInModifyTeachAttendance(adrRecordEntity); return true; } #endregion @@ -557,7 +561,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement { this.BaseRepository("CollegeMIS").ExecuteBySql("insert into ADR_Record(ID, UserNo, ADType, ADTime, ClockTime, ClockStatus, ClockPlace,Img, ADYear, ADMonth, ADDay, ADPhoto,ALon,ALat,AIsOut,ARemark) values(" + "'" + adrRecordEntity.ID + "','" + adrRecordEntity.UserNo + "','" + adrRecordEntity.ADType + "','" + adrRecordEntity.ADTime + "'," + - "'" + adrRecordEntity.ClockTime + "','" + adrRecordEntity.ClockStatus + "','" + adrRecordEntity.ClockPlace + "','"+adrRecordEntity.Img+"','" + adrRecordEntity.ADYear + "'," + + "'" + adrRecordEntity.ClockTime + "','" + adrRecordEntity.ClockStatus + "','" + adrRecordEntity.ClockPlace + "','" + adrRecordEntity.Img + "','" + adrRecordEntity.ADYear + "'," + "'" + adrRecordEntity.ADMonth + "','" + adrRecordEntity.ADDay + "','" + adrRecordEntity.ADPhoto + "'," + adrRecordEntity.ALon + "," + adrRecordEntity.ALat + ",'" + adrRecordEntity.AIsOut + "','" + adrRecordEntity.ARemark + "')"); return true; } @@ -648,7 +652,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement { this.BaseRepository("CollegeMIS").ExecuteBySql("insert into ADR_Record(ID, UserNo, ADType, ADTime, ClockTime, ClockStatus, ClockPlace,Img, ADYear, ADMonth, ADDay, ADPhoto,ALon,ALat,AIsOut,ARemark) values(" + "'" + adrRecordEntity.ID + "','" + adrRecordEntity.UserNo + "','" + adrRecordEntity.ADType + "','" + adrRecordEntity.ADTime + "'," + - "'" + adrRecordEntity.ClockTime + "','" + adrRecordEntity.ClockStatus + "','" + adrRecordEntity.ClockPlace + "','"+adrRecordEntity.Img+"','" + adrRecordEntity.ADYear + "'," + + "'" + adrRecordEntity.ClockTime + "','" + adrRecordEntity.ClockStatus + "','" + adrRecordEntity.ClockPlace + "','" + adrRecordEntity.Img + "','" + adrRecordEntity.ADYear + "'," + "'" + adrRecordEntity.ADMonth + "','" + adrRecordEntity.ADDay + "','" + adrRecordEntity.ADPhoto + "'," + adrRecordEntity.ALon + "," + adrRecordEntity.ALat + ",'" + adrRecordEntity.AIsOut + "','" + adrRecordEntity.ARemark + "')"); } return true; @@ -1033,13 +1037,17 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement firstoffworkentity.ClockStatus = ClockStatus; //firstoffworkentity.ADPhoto = str; this.BaseRepository("CollegeMIS").ExecuteBySql("update ADR_Record set ADTime='" + firstoffworkentity.ADTime + "',ClockTime='" + firstoffworkentity.ClockTime + "',ClockStatus='" + firstoffworkentity.ClockStatus + "',ADPhoto='" + firstoffworkentity.ADPhoto + "' where ID='" + firstoffworkentity.ID + "'"); + //同步修改授课考勤打卡 + ClockInModifyTeachAttendance(adrRecordEntity); return true; } //考勤记录 this.BaseRepository("CollegeMIS").ExecuteBySql("insert into ADR_Record(ID, UserNo, ADType, ADTime, ClockTime, ClockStatus, ClockPlace,Img, ADYear, ADMonth, ADDay, ADPhoto,ALon,ALat,AIsOut,ARemark) values(" + "'" + adrRecordEntity.ID + "','" + adrRecordEntity.UserNo + "','" + adrRecordEntity.ADType + "','" + adrRecordEntity.ADTime + "'," + - "'" + adrRecordEntity.ClockTime + "','" + adrRecordEntity.ClockStatus + "','" + adrRecordEntity.ClockPlace + "','"+ adrRecordEntity.Img + "','" + adrRecordEntity.ADYear + "'," + + "'" + adrRecordEntity.ClockTime + "','" + adrRecordEntity.ClockStatus + "','" + adrRecordEntity.ClockPlace + "','" + adrRecordEntity.Img + "','" + adrRecordEntity.ADYear + "'," + "'" + adrRecordEntity.ADMonth + "','" + adrRecordEntity.ADDay + "','" + adrRecordEntity.ADPhoto + "'," + adrRecordEntity.ALon + "," + adrRecordEntity.ALat + ",'" + adrRecordEntity.AIsOut + "','" + adrRecordEntity.ARemark + "')"); + //同步修改授课考勤打卡 + ClockInModifyTeachAttendance(adrRecordEntity); return true; } @@ -1194,6 +1202,10 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement { adrresult.AttendanceType = 2; adrresult.AttendanceTypeString = "迟到打卡"; + var userWorkTime = attendancerecordList.Where(m => m.ADType == "1").OrderByDescending(m => m.ADTime).FirstOrDefault()?.ADTime.Value; + var userCloseTime = attendancerecordList.Where(m => m.ADType == "2").OrderByDescending(m => m.ADTime).FirstOrDefault()?.ADTime.Value; + adrresult.UserWorkTime = userWorkTime != null ? userWorkTime.ToString() : ""; + adrresult.UserCloseTime = userCloseTime != null ? userCloseTime.ToString() : ""; return adrresult; } //下班 @@ -1572,7 +1584,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement return adrresult; } } - + adrresult.AttendanceType = 5; adrresult.AttendanceTypeString = "不在考勤时间范围"; return adrresult; @@ -1805,7 +1817,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement and a.AcademicYearNo='{say.AcademicYearShort}' and a.Semester='{say.Semester}' and a.LessonDate ='{datenow}' and a.CheckMark='1' "); - wholeLessonList.AddRange(lessonelective); + wholeLessonList.AddRange(lessonelective); //当前打卡课程判断 foreach (var arrangeLessonTermEntity in wholeLessonList.OrderBy(x => Convert.ToInt32(x.LessonTime.Substring(1)))) { @@ -1912,7 +1924,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement /// /// /// - public bool ClockInTeacher(decimal aLon, decimal aLat, bool aIsOut, string aRemark, string adPhoto, string clockPlace, string lessonSortNo, string altId, string alToeId,string Img) + public bool ClockInTeacher(decimal aLon, decimal aLat, bool aIsOut, string aRemark, string adPhoto, string clockPlace, string lessonSortNo, string altId, string alToeId, string Img) { try { @@ -2027,5 +2039,126 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } + /// + /// 坐班考勤打卡同步修改授课考勤打卡 + /// + /// + /// + public void ClockInModifyTeachAttendance(ADR_RecordEntity entity) + { + var db = this.BaseRepository("CollegeMIS").BeginTrans(); + try + { + //根据年月日用户查找考勤打卡记录;判断是否有下班的记录,有则下一步,无则退出; + //下一步:查找用户当日的所有课程,只有在上班-下班打卡时间范围内的课往授课考勤表中写入/更新为正常打卡,其余为异常打卡(缺勤); + var adrRecordList = this.BaseRepository("CollegeMIS").FindList(x => x.UserNo == entity.UserNo && x.ADYear == entity.ADYear && x.ADMonth == entity.ADMonth && x.ADDay == entity.ADDay); + if (adrRecordList.Any() && adrRecordList.Count(x => x.ADType == "2") > 0 && adrRecordList.Count(x => x.ADType == "1") > 0) + { + var adtype1 = adrRecordList.FirstOrDefault(x => x.ADType == "1");//上班 + var adtype2 = adrRecordList.FirstOrDefault(x => x.ADType == "2");//下班 + var adtime1 = adtype1.ADTime.Value.TimeOfDay;//上班打卡时间 + var adtime2 = adtype2.ADTime.Value.TimeOfDay;//下班打卡时间 + + //当前服务器日期 + var datenow = entity.ADTime.Value.ToString("yyyy-MM-dd"); + DateTime datenowdatetime = Convert.ToDateTime(datenow); + //当前学年学期信息 + var say = Common.GetSemesterAndYear(entity.ADTime.Value.ToString()); + //全天课程 + var wholeLessonList = new List(); + //必修课 + var lessons = BaseRepository("CollegeMIS").FindList(m => m.AcademicYearNo == say.AcademicYearShort && m.Semester == say.Semester + && m.EmpNo == entity.UserNo && m.LessonDate.Value == datenowdatetime); + wholeLessonList.AddRange(lessons); + //选修课 + var lessonelective = BaseRepository("CollegeMIS").FindList($@"select a.Id as ALTId, a.LessonDate, a.AcademicYearNo, a.Semester, a.LessonNo, a.LessonName, a.LessonSortNo, + case when LEN(a.LessonTime)>0 then SUBSTRING(a.LessonTime,1,CHARINDEX('-',a.LessonTime)-1) else '' end as StartTime, + case when LEN(a.LessonTime)>0 then SUBSTRING(a.LessonTime,CHARINDEX('-',a.LessonTime)+1,LEN(a.LessonTime)-CHARINDEX('-',a.LessonTime)) else '' end as EndTime, + a.LessonSection as LessonTime, a.EmpNo, a.EmpName, a.ClassRoomNo as ClassroomNo, a.CheckMark, a.F_SchoolId + from ArrangeLessonTermOfElective a + where a.EmpNo='{entity.UserNo}' + and a.AcademicYearNo='{say.AcademicYearShort}' and a.Semester='{say.Semester}' + and a.LessonDate ='{datenow}' + and a.CheckMark='1' "); + wholeLessonList.AddRange(lessonelective); + wholeLessonList = wholeLessonList.OrderBy(x => Convert.ToInt32(x.LessonTime.Substring(1))).ToList(); + + //删除当天课程的授课考勤记录 + var preALTIdList = wholeLessonList.Select(x => x.ALTId); + var preTeachAttendanceList = this.BaseRepository("CollegeMIS").FindList(x => x.EmpNo == entity.UserNo && preALTIdList.Contains(x.ALTId)); + if (preTeachAttendanceList.Any()) + { + db.ExecuteBySql($"delete from Teach_Attendance where ID in ('{string.Join("','",preTeachAttendanceList.Select(x => x.ID)) }')"); + } + + //上班-下班打卡时间范围内的课 + foreach (var item in wholeLessonList) + { + //上课 + if (TimeSpan.Parse(item.StartTime) >= adtime1 && TimeSpan.Parse(item.StartTime) <= adtime2) + { + //写入授课考勤打卡 + Teach_attendanceEntity teach_AttendanceEntity = new Teach_attendanceEntity(); + teach_AttendanceEntity.Create(); + teach_AttendanceEntity.EmpNo = entity.UserNo; + teach_AttendanceEntity.EmpName = entity.UserName; + teach_AttendanceEntity.ALTId = item.ALTId; + teach_AttendanceEntity.LessonSortNo = item.LessonSortNo; + teach_AttendanceEntity.ADType = "1"; + teach_AttendanceEntity.ADTime = entity.ADTime; + teach_AttendanceEntity.ClockTime = entity.ADTime; + teach_AttendanceEntity.ClockStatus = "1"; + teach_AttendanceEntity.ClockPlace = entity.ClockPlace; + teach_AttendanceEntity.ADPhoto = entity.ADPhoto; + teach_AttendanceEntity.ALon = entity.ALon; + teach_AttendanceEntity.ALat = entity.ALat; + teach_AttendanceEntity.AIsOut = entity.AIsOut; + teach_AttendanceEntity.ARemark = entity.ARemark; + teach_AttendanceEntity.Img = entity.Img; + db.Insert(teach_AttendanceEntity); + } + //下课 + if (TimeSpan.Parse(item.EndTime) >= adtime1 && TimeSpan.Parse(item.EndTime) <= adtime2) + { + //写入授课考勤打卡 + Teach_attendanceEntity teach_AttendanceEntity = new Teach_attendanceEntity(); + teach_AttendanceEntity.Create(); + teach_AttendanceEntity.EmpNo = entity.UserNo; + teach_AttendanceEntity.EmpName = entity.UserName; + teach_AttendanceEntity.ALTId = item.ALTId; + teach_AttendanceEntity.LessonSortNo = item.LessonSortNo; + teach_AttendanceEntity.ADType = "2"; + teach_AttendanceEntity.ADTime = entity.ADTime; + teach_AttendanceEntity.ClockTime = entity.ADTime; + teach_AttendanceEntity.ClockStatus = "1"; + teach_AttendanceEntity.ClockPlace = entity.ClockPlace; + teach_AttendanceEntity.ADPhoto = entity.ADPhoto; + teach_AttendanceEntity.ALon = entity.ALon; + teach_AttendanceEntity.ALat = entity.ALat; + teach_AttendanceEntity.AIsOut = entity.AIsOut; + teach_AttendanceEntity.ARemark = entity.ARemark; + teach_AttendanceEntity.Img = entity.Img; + db.Insert(teach_AttendanceEntity); + } + } + + } + db.Commit(); + } + catch (Exception ex) + { + db.Rollback(); + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } + + } }