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.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/LogisticsManagement/Controllers/ADR_RecordController.cs b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/LogisticsManagement/Controllers/ADR_RecordController.cs index e927eddc6..942dae362 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 @@ -206,6 +206,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.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 000000000..9ac9cb1cb Binary files /dev/null and b/Learun.Framework.Ultimate V7/Learun.Application.Web/Content/excel/ArrangeLessonTermImport.xls differ 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..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 @@ -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,26 @@ 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(); + 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, "); + 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 "); @@ -2247,6 +2262,175 @@ 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("CollegeMIS").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().FindList(x => x.F_EnabledMark == 1).ToList().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++; + } + else + { + throw (new Exception("当前数据重复")); + } + #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); + } + } + } + + } 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 ca704aad7..a128454d6 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 2477bf09b..878e7e350 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, @@ -264,7 +250,17 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration 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 7950b754a..3ad30d470 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 获取数据 /// @@ -542,6 +543,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); + } + } + } + + } } 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()