@@ -8,11 +8,14 @@ | |||
<div class="lr-layout-tool"> | |||
<div class="lr-layout-tool-left"> | |||
<div class="lr-layout-tool-item"> | |||
<div id="datesearch" style="min-width:150px"></div> | |||
<div id="datesearch" style="min-width:150px"></div> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<div id="weeks" style="min-width:150px"></div> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<div id="DeptNo" style="min-width:200px"></div> | |||
</div> | |||
<div class="lr-layout-tool-item"> | |||
<a id="btn_Search" class="btn btn-primary btn-sm"><i class="fa fa-search"></i> 查询</a> | |||
</div> | |||
@@ -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 () { | |||
@@ -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 视图功能 | |||
/// <summary> | |||
@@ -353,7 +354,35 @@ namespace Learun.Application.Web.Areas.LR_SystemModule.Controllers | |||
return Fail("导入数据失败!"); | |||
} | |||
} | |||
/// <summary> | |||
/// | |||
/// </summary> | |||
/// <param name="fileId"></param> | |||
/// <param name="chunks"></param> | |||
/// <param name="ext"></param> | |||
/// <returns></returns> | |||
[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("导入数据失败!"); | |||
} | |||
} | |||
/// <summary> | |||
/// 下载文件(导入文件未被导入的数据) | |||
/// </summary> | |||
@@ -206,6 +206,31 @@ namespace Learun.Application.Web.Areas.LogisticsManagement.Controllers | |||
{ | |||
UserInfo userInfo = LoginUserInfo.Get(); | |||
ADR_RecordEntity entity = strEntity.ToObject<ADR_RecordEntity>(); | |||
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("保存成功!"); | |||
} | |||
@@ -4,29 +4,30 @@ | |||
} | |||
<div class="lr-form-wrap"> | |||
<div class="col-xs-12 lr-form-item" data-table="ADR_Record"> | |||
<div class="lr-form-item-title">员工名字</div> | |||
<div id="UserNo" type="text" class="form-control"></div> | |||
<div class="lr-form-item-title">员工名字<font face="宋体">*</font></div> | |||
<div id="UserNo" type="text" class="form-control" isvalid="yes" checkexpession="NotNull" ></div> | |||
<input id="UserName" type="hidden" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="ADR_Record"> | |||
<div class="lr-form-item-title">考勤类型</div> | |||
<div id="ADType"></div> | |||
<div class="lr-form-item-title">考勤类型<font face="宋体">*</font></div> | |||
<div id="ADType" isvalid="yes" checkexpession="NotNull" ></div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="ADR_Record"> | |||
<div class="lr-form-item-title">考勤时间</div> | |||
<input id="ADTime" type="text" class="form-control lr-input-wdatepicker" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss',onpicked: function () { $('#ADTime').trigger('change'); } })" /> | |||
<div class="lr-form-item-title">考勤时间<font face="宋体">*</font></div> | |||
<input id="ADTime" type="text" class="form-control lr-input-wdatepicker" isvalid="yes" checkexpession="NotNull" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss',onpicked: function () { $('#ADTime').trigger('change'); } })" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="ADR_Record"> | |||
<div class="lr-form-item-title">打卡时间</div> | |||
<input id="ClockTime" type="text" class="form-control lr-input-wdatepicker" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss',onpicked: function () { $('#ClockTime').trigger('change'); } })" /> | |||
<div class="lr-form-item-title">打卡时间<font face="宋体">*</font></div> | |||
<input id="ClockTime" type="text" class="form-control lr-input-wdatepicker" isvalid="yes" checkexpession="NotNull" onfocus="WdatePicker({ dateFmt:'yyyy-MM-dd HH:mm:ss',onpicked: function () { $('#ClockTime').trigger('change'); } })" /> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="ADR_Record"> | |||
<div class="lr-form-item-title">打卡状态</div> | |||
<div id="ClockStatus"> | |||
<div class="lr-form-item-title">打卡状态<font face="宋体">*</font></div> | |||
<div id="ClockStatus" isvalid="yes" checkexpession="NotNull" > | |||
</div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="ADR_Record"> | |||
<div class="lr-form-item-title">是否外勤</div> | |||
<div id="AIsOut"> | |||
<div class="lr-form-item-title">是否外勤<font face="宋体">*</font></div> | |||
<div id="AIsOut" isvalid="yes" checkexpession="NotNull" > | |||
</div> | |||
</div> | |||
<div class="col-xs-12 lr-form-item" data-table="ADR_Record"> | |||
@@ -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) { | |||
@@ -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) { | |||
@@ -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(); | |||
} | |||
/// <summary> | |||
/// 导入页面 | |||
/// <summary> | |||
/// <returns></returns> | |||
[HttpGet] | |||
public ActionResult ImportForm() | |||
{ | |||
return View(); | |||
} | |||
/// <summary> | |||
/// 课程表【教务】 | |||
@@ -689,5 +700,27 @@ namespace Learun.Application.Web.Areas.PersonnelManagement.Controllers | |||
#endregion | |||
/// <summary> | |||
/// 导入数据 | |||
/// </summary> | |||
/// <returns></returns> | |||
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; | |||
} | |||
} | |||
} | |||
} |
@@ -0,0 +1,24 @@ | |||
@{ | |||
ViewBag.Title = "Form"; | |||
Layout = "~/Views/Shared/_Form.cshtml"; | |||
} | |||
<link href="~/Content/webuploader/webuploader.css" rel="stylesheet" /> | |||
<script src="~/Content/webuploader/webuploader.nolog.min.js"></script> | |||
@Html.AppendCssFile("/Areas/PersonnelManagement/Views/TimeTable/ImportForm.css") | |||
<div class="lr-form-layout lr-form-layout-top-bottom"> | |||
<div class="lr-form-layout-header"> | |||
<div id="lr_add_file_btn"><i class="fa fa-cloud-upload"></i><span class="lrlt">上传文件</span></div> | |||
<div class="webuploader-pick" id="lr_down_file_btn"><i class="fa fa-download"></i><span class="lrlt">下载模板</span></div> | |||
</div> | |||
<div class="lr-form-layout-body"> | |||
<div class="lr-form-file-queue-wrap" id="lr_form_file_queue"> | |||
<div class="lr-form-file-queue" id="lr_form_file_queue_list"> | |||
</div> | |||
<div class="lr-form-file-queue-bg"> | |||
<h1><span class="lrlt">试试将电脑里的文件拖拽到此上传</span></h1> | |||
</div> | |||
</div> | |||
</div> | |||
</div> | |||
@Html.AppendJsFile("/Areas/PersonnelManagement/Views/TimeTable/ImportForm.js") |
@@ -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; | |||
} |
@@ -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('<div class="lr-msg2"><span>' + res.data.Success + '</span><span>/</span><span style="color:#b94a48;" >' + res.data.Fail + '</span></div>'); | |||
// 如果有失败 | |||
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('<div class="lr-msg"><i class="fa fa-exclamation-circle"></i></div>'); | |||
} | |||
}); | |||
} | |||
// 触发清楚文件碎片 | |||
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('<div class="lr-msg"><i class="fa fa-exclamation-circle"></i></div>'); | |||
} | |||
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 = $('<div class="lr-form-file-queue-item" id="lr_filequeue_' + file.id + '" ></div>'); | |||
$item.append('<div class="lr-file-image"><img src="' + top.$.rootUrl + '/Content/images/filetype/' + file.ext + '.png"></div>'); | |||
$item.append('<span class="lr-file-name">' + file.name + '(' + learun.countFileSize(file.size) + ')</span>'); | |||
$('#lr_form_file_queue_list').append($item); | |||
}, | |||
uploadStart: function (file) { | |||
var $fileItem = $('#lr_form_file_queue_list').find('#lr_filequeue_' + file.id); | |||
$fileItem.append('<div class="lr-uploader-progress"><div class="lr-uploader-progress-bar" style="width:0%;"></div></div>'); | |||
}, | |||
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(); | |||
} |
@@ -135,6 +135,7 @@ | |||
<div class=" btn-group btn-group-sm"> | |||
<a id="lr_refresh" class="btn btn-default"><i class="fa fa-refresh"></i></a> | |||
<a id="perBtn" class="btn btn-default"><i class="fa fa-print"></i> 打印课程表</a> | |||
<a id="lr_import" class="btn btn-default"><i class="fa fa-plus"></i> 导入</a> | |||
</div> | |||
<div class=" btn-group btn-group-sm" learun-authorize="yes"> | |||
<a id="emptyByCondition" class="btn btn-default"><i class="fa fa-trash-o"></i> 按条件清空排课数据</a> | |||
@@ -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: [ | |||
// { | |||
@@ -1784,6 +1784,8 @@ | |||
<Content Include="Areas\PersonnelManagement\Views\TeacherLeaveManagement\FormView.js" /> | |||
<Content Include="Areas\PersonnelManagement\Views\TeacherOvertimeManagement\FormView.js" /> | |||
<Content Include="Areas\PersonnelManagement\Views\TimeTable\ClassIndexInEducation.js" /> | |||
<Content Include="Areas\PersonnelManagement\Views\TimeTable\ImportForm.css" /> | |||
<Content Include="Areas\PersonnelManagement\Views\TimeTable\ImportForm.js" /> | |||
<Content Include="Areas\PersonnelManagement\Views\TimeTable\IndexInEducationSelect_.js" /> | |||
<Content Include="Areas\PersonnelManagement\Views\TimeTable\SchoolLesson.js" /> | |||
<Content Include="Areas\PersonnelManagement\Views\WorkStudyPositionApply\CheckIndex.js" /> | |||
@@ -8338,6 +8340,8 @@ | |||
<Content Include="Areas\EducationalAdministration\Views\StuFellowship\FormOfStudent.cshtml" /> | |||
<Content Include="Areas\EducationalAdministration\Views\SchoolLevelScholarship\FormOfStudent.cshtml" /> | |||
<Content Include="Areas\EducationalAdministration\Views\SchoolLevelScholarship\IndexInStuScoreOfStudent.cshtml" /> | |||
<Content Include="Content\excel\ArrangeLessonTermImport.xls" /> | |||
<Content Include="Areas\PersonnelManagement\Views\TimeTable\ImportForm.cshtml" /> | |||
<None Include="Properties\PublishProfiles\CustomProfile.pubxml" /> | |||
<None Include="Properties\PublishProfiles\FolderProfile.pubxml" /> | |||
<Content Include="Views\Login\Default-beifen.cshtml" /> | |||
@@ -617,5 +617,31 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
var data = arrangeLessonTermService.InitAsyncDataByCondition(entity); | |||
return data; | |||
} | |||
/// <summary> | |||
/// 导入 | |||
/// </summary> | |||
/// <param name="dt"></param> | |||
/// <param name="fileId"></param> | |||
/// <returns></returns> | |||
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); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -11,7 +11,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// 日 期:2019-02-27 11:05 | |||
/// 描 述:排课 | |||
/// </summary> | |||
public class ArrangeLessonTermEntity | |||
public class ArrangeLessonTermEntity | |||
{ | |||
#region 实体成员 | |||
@@ -158,6 +158,18 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// <returns></returns> | |||
[Column("F_SCHOOLID")] | |||
public string F_SchoolId { get; set; } | |||
/// <summary> | |||
/// 插入时间 | |||
/// </summary> | |||
/// <returns></returns> | |||
[Column("INSERTDATE")] | |||
public DateTime? InsertDate { get; set; } | |||
/// <summary> | |||
/// 导入标识 | |||
/// </summary> | |||
/// <returns></returns> | |||
[Column("ISIMPORT")] | |||
public bool? IsImport { get; set; } | |||
[NotMapped] public string lessoncount { get; set; } | |||
[NotMapped] public string coefficient { get; set; } | |||
@@ -158,5 +158,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
IEnumerable<TimeTable> GetAllClassLesson(string academicYearNo, string semester); | |||
bool InitAsyncDataByCondition(ArrangeLessonTermEntity entity); | |||
string ArrangeLessonTermImport(DataTable dt, string fileId); | |||
} | |||
} |
@@ -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 | |||
} | |||
} | |||
} | |||
/// <summary> | |||
/// 导入 | |||
/// </summary> | |||
/// <param name="dt"></param> | |||
/// <param name="fileId"></param> | |||
/// <returns></returns> | |||
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<ArrangeLessonTermEntity> ArrangeLessonTermHistory = db.FindList<ArrangeLessonTermEntity>("select * from ArrangeLessonTerm"); | |||
var ArrangeLessonTerminsert = new List<ArrangeLessonTermEntity>(); | |||
// 循环遍历导入 | |||
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<LessonInfoEntity>(x => x.LessonName == LessonName); | |||
var classEntity = BaseRepository("CollegeMIS").FindEntity<ClassInfoEntity>(x => x.ClassName == ClassName); | |||
var classroomEntity = BaseRepository("CollegeMIS").FindEntity<ClassroomInfoEntity>(x => x.ClassroomName == ClassroomName); | |||
var CompanyEntity = BaseRepository().FindList<CompanyEntity>(x => x.F_EnabledMark == 1).ToList().FirstOrDefault(); | |||
var empinfoEntity = BaseRepository("CollegeMIS").FindEntity<EmpInfoEntity>(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<string>(cacheKey + fileId, errordt, CacheId.excel); | |||
} | |||
} | |||
return snum + "|" + fnum; | |||
} | |||
catch (Exception ex) | |||
{ | |||
if (ex is ExceptionEx) | |||
{ | |||
throw; | |||
} | |||
else | |||
{ | |||
throw ExceptionEx.ThrowServiceException(ex); | |||
} | |||
} | |||
} | |||
} | |||
@@ -104,7 +104,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration | |||
/// 是否一致 | |||
/// </summary> | |||
[Column("ISFIT")] | |||
public bool IsFit { get; set; } | |||
public bool? IsFit { get; set; } | |||
/// <summary> | |||
/// 拍照图片 | |||
@@ -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<Teach_attendanceEntity>(strSql.ToString(), dp, pagination) | |||
var data = this.BaseRepository("CollegeMIS").FindList<Teach_attendanceEntity>(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) | |||
@@ -108,7 +108,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
/// 是否一致 | |||
/// </summary> | |||
[Column("ISFIT")] | |||
public bool IsFit { get; set; } | |||
public bool? IsFit { get; set; } | |||
/// <summary> | |||
/// 拍照图片 | |||
@@ -19,6 +19,7 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
/// </summary> | |||
public class ADR_RecordService : RepositoryFactory | |||
{ | |||
private ADR_RestrictionService aDR_RestrictionService = new ADR_RestrictionService(); | |||
#region 获取数据 | |||
/// <summary> | |||
@@ -542,6 +543,9 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement | |||
entity.Create(); | |||
this.BaseRepository("CollegeMIS").Insert(entity); | |||
} | |||
//同步修改授课考勤打卡 | |||
aDR_RestrictionService.ClockInModifyTeachAttendance(entity); | |||
} | |||
catch (Exception ex) | |||
{ | |||
@@ -172,7 +172,7 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement | |||
/// 考勤打卡教师 | |||
/// </summary> | |||
/// <returns></returns> | |||
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 | |||
/// <param name="altId"></param> | |||
/// <param name="alToeId"></param> | |||
/// <returns></returns> | |||
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 | |||
} | |||
} | |||
/// <summary> | |||
/// 坐班考勤打卡同步修改授课考勤打卡 | |||
/// </summary> | |||
/// <param name="aDR_RecordEntity"></param> | |||
/// <returns></returns> | |||
public void ClockInModifyTeachAttendance(ADR_RecordEntity entity) | |||
{ | |||
var db = this.BaseRepository("CollegeMIS").BeginTrans(); | |||
try | |||
{ | |||
//根据年月日用户查找考勤打卡记录;判断是否有下班的记录,有则下一步,无则退出; | |||
//下一步:查找用户当日的所有课程,只有在上班-下班打卡时间范围内的课往授课考勤表中写入/更新为正常打卡,其余为异常打卡(缺勤); | |||
var adrRecordList = this.BaseRepository("CollegeMIS").FindList<ADR_RecordEntity>(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<ArrangeLessonTermEntity>(); | |||
//必修课 | |||
var lessons = BaseRepository("CollegeMIS").FindList<ArrangeLessonTermEntity>(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<ArrangeLessonTermEntity>($@"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<Teach_attendanceEntity>(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); | |||
} | |||
} | |||
} | |||
} | |||
} |
@@ -39,10 +39,10 @@ | |||
</view> | |||
<view id='container'></view> | |||
<!-- 弹层 --> | |||
<l-modal v-model="modal" title="选择打卡类型"> | |||
<!-- <l-modal v-model="modal" title="选择打卡类型"> | |||
<l-button @click="toAttendanceCardTeacher" color="blue" class="block" block>授课打卡</l-button> | |||
<l-button @click="()=>{modal = false;}" line="blue" class="block margin-top-sm" block>坐班打卡</l-button> | |||
</l-modal> | |||
</l-modal> --> | |||
</view> | |||
</template> | |||
@@ -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() | |||