diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSignUp/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSignUp/Form.cshtml index 4101ee550..9c397f327 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSignUp/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSignUp/Form.cshtml @@ -3,9 +3,10 @@ Layout = "~/Views/Shared/_Form.cshtml"; }
-
+
学生名字
- +
+
实习单位
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSignUp/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSignUp/Form.js index 7102358b2..e2b53abfb 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSignUp/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSignUp/Form.js @@ -15,6 +15,12 @@ var bootstrap = function ($, learun) { page.initData(); }, bind: function () { + $('#StudentID').lrselect({ + text: 'stuname', + value: 'stucode', + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=StuInfoBasic', + + }); $('#Status').lrRadioCheckbox({ type: 'radio', code: 'YesOrNoInt', @@ -71,6 +77,7 @@ var bootstrap = function ($, learun) { if (!$('body').lrValidform()) { return false; } + $("#StudentName").val($("#StudentID").find(".lr-select-placeholder").text()); var postData = { strEntity: JSON.stringify($('body').lrGetFormData()) }; diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSignUp/Index.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSignUp/Index.js index 679c17903..5b0bd1b32 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSignUp/Index.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSignUp/Index.js @@ -68,7 +68,7 @@ var bootstrap = function ($, learun) { $('#gridtable').lrAuthorizeJfGrid({ url: top.$.rootUrl + '/EducationalAdministration/InternShipSignUp/GetPageList', headData: [ - { label: "学生名字", name: "StudentID", width: 100, align: "left" }, + { label: "学生名字", name: "StudentName", width: 100, align: "left" }, { label: "实习单位", name: "IUnit", width: 100, align: "left", formatterAsync: function (callback, value, row, op, $cell) { diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSummary/Form.cshtml b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSummary/Form.cshtml index 118b12581..af2065fa1 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSummary/Form.cshtml +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSummary/Form.cshtml @@ -3,9 +3,10 @@ Layout = "~/Views/Shared/_Form.cshtml"; }
-
-
学生名称
- +
+
学生
+
+
总结名称
diff --git a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSummary/Form.js b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSummary/Form.js index 0fd9084ab..57c26cb27 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSummary/Form.js +++ b/Learun.Framework.Ultimate V7/Learun.Application.Web/Areas/EducationalAdministration/Views/InternShipSummary/Form.js @@ -15,6 +15,12 @@ var bootstrap = function ($, learun) { page.initData(); }, bind: function () { + $('#StudentNo').lrselect({ + text: 'stuname', + value: 'stucode', + url: top.$.rootUrl + '/LR_SystemModule/DataSource/GetDataTable?code=StuInfoBasic', + + }); }, initData: function () { if (!!keyValue) { @@ -36,6 +42,7 @@ var bootstrap = function ($, learun) { if (!$('body').lrValidform()) { return false; } + $("#Student").val($("#StudentNo").find(".lr-select-placeholder").text()); var postData = { strEntity: JSON.stringify($('body').lrGetFormData()) }; diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj index a5eb08ffe..454e8a0a8 100644 --- a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Learun.Application.WebApi.csproj @@ -190,10 +190,12 @@ + + diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/AttendanceApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/AttendanceApi.cs new file mode 100644 index 000000000..fd53a0457 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/AttendanceApi.cs @@ -0,0 +1,258 @@ +using Learun.Application.Base.SystemModule; +using Learun.Application.TwoDevelopment.EducationalAdministration; +using Learun.Application.TwoDevelopment.LogisticsManagement; +using Learun.Application.TwoDevelopment.PersonnelManagement; +using Learun.Util; +using Nancy; +using System; +using System.Collections.Generic; +using System.IO; + +namespace Learun.Application.WebApi.Modules +{ + /// + /// 考勤打卡功能 + /// + public class AttendanceApi : BaseApi + { + public AttendanceApi() + : base("/learun/adms/attendance") + { + //判断当前时间是否可以打卡 + //Get["/IsAttendance"] = IsAttendance; + //上下班打卡 + Post["/clockin"] = ClockIn; + //获取考勤打卡记录 + //Get["/getrecordpagelist"] = GetRecordPageList; + //判断学生当前打卡状态 + //Get["IsAttendanceStudent"] = IsAttendanceStudent; + //学生打卡 + //Post["/clockinStudent"] = ClockInStudent; + //打卡记录 + //Get["/GetTeacherRecord"] = GetTeacherRecord; + + //教师上下课打卡:判断当前打卡状态 + //Get["IsAttendanceTeacher"] = IsAttendanceTeacher; + //教师上下课打卡 + //Post["/clockinTeacher"] = ClockInTeacher; + + //判断教师是否授课 + //Get["JudgeTeacherIsHasLesson"] = JudgeTeacherIsHasLesson; + } + private ADR_RestrictionIBLL adr_RestrictionBLL = new ADR_RestrictionBLL(); + private ADR_RecordIBLL adr_RecordBLL = new ADR_RecordBLL(); + private EmpInfoIBLL empInfoIBLL = new EmpInfoBLL(); + + + //public Response GetTeacherRecord(dynamic _) + //{ + // ReqPageParam parameter = this.GetReqData(); + // var res = adr_RecordBLL.GetList(parameter.queryJson); + // var jsondata = + // new + // { + // data = res + // }; + // return Success(jsondata); + //} + + /// + /// 判断当前时间是否可以打卡 + /// + /// + /// + //public Response IsAttendance(dynamic _) + //{ + // var res = adr_RestrictionBLL.IsAttendance(); + // var jsondata = + // new + // { + // data = res + // }; + // return Success(jsondata); + //} + /// + /// 学生打卡判断 + /// + /// + /// + //public Response IsAttendanceStudent(dynamic _) + //{ + // var res = adr_RestrictionBLL.IsAttendanceStudent(); + // var jsondata = + // new + // { + // data = res + // }; + // return Success(jsondata); + //} + + public class Attendance + { + public decimal ALon { get; set; } + public decimal ALat { get; set; } + public bool AIsOut { get; set; } + public string ARemark { get; set; } + public string ADPhoto { get; set; } + public string ClockPlace { get; set; } + public string LessonSortNo { get; set; } + public string ALTId { get; set; } + public string ALTOEId { get; set; } + public string Img { get; set; } + } + + /// + /// 上下班打卡 + /// + /// + /// + public Response ClockIn(dynamic _) + { + + Attendance parameter = this.GetReqData(); + var userinfo = LoginUserInfo.Get(); + //员工账号 + string EmpNo = userinfo.account; + string result = "0"; + //if (parameter.AIsOut) + //{ + // result = "1"; + //} + //else + //{ + //根据用户编号获取用户头像 + var einfo = empInfoIBLL.GetEmpInfoEntityByEmpNo(EmpNo); + if (einfo == null) + { + return Fail("用户数据错误!"); + } + string userimg = einfo.Photo; + string imgid = parameter.Img; + + + //} + if (result == "1") + { + adr_RestrictionBLL.ClockIn(parameter.ALon, parameter.ALat, parameter.AIsOut, parameter.ARemark, parameter.ADPhoto, parameter.ClockPlace, parameter.Img); + + return Success("打卡成功"); + } + else + { + return Fail("打卡照片异常,请重新拍照!"); + } + + + } + /// + /// 学生打卡 + /// + /// + /// + //public Response ClockInStudent(dynamic _) + //{ + // Attendance parameter = this.GetReqData(); + + // adr_RestrictionBLL.ClockInStudent(parameter.ALon, parameter.ALat, parameter.AIsOut, parameter.ARemark, parameter.ADPhoto, parameter.ClockPlace, parameter.LessonSortNo, parameter.ALTId, parameter.ALTOEId); + + // return Success("打卡成功"); + //} + /// + /// 打卡 + /// + /// + /// + //public Response GetRecordPageList(dynamic _) + //{ + // ReqPageParam parameter = this.GetReqData(); + // var data = adr_RecordBLL.GetPageList(parameter.pagination, parameter.queryJson); + // var jsonData = new + // { + // rows = data, + // total = parameter.pagination.total, + // page = parameter.pagination.page, + // records = parameter.pagination.records + // }; + // return Success(jsonData); + //} + + /// + /// 教师上下课打卡:判断当前打卡状态 + /// + /// + /// + //public Response IsAttendanceTeacher(dynamic _) + //{ + // var res = adr_RestrictionBLL.IsAttendanceTeacher(); + // var jsondata = + // new + // { + // data = res + // }; + // return Success(jsondata); + //} + /// + /// 教师上下课打卡 + /// + /// + /// + //public Response ClockInTeacher(dynamic _) + //{ + // Attendance parameter = this.GetReqData(); + + // var userinfo = LoginUserInfo.Get(); + // //员工账号 + // string EmpNo = userinfo.account; + + // //根据用户编号获取用户头像 + // var einfo = empInfoIBLL.GetEmpInfoEntityByEmpNo(EmpNo); + // if (einfo == null) + // { + // return Fail("用户数据错误!"); + // } + // string userimg = einfo.Photo; + // string imgid = parameter.Img; + + // var url = Config.GetValue("FaceCheckApi"); + + // string result = Util.HttpMethods.HttpGet($"{url}{userimg}/{imgid}"); + // if (result == "1") + // { + // adr_RestrictionBLL.ClockInTeacher(parameter.ALon, parameter.ALat, parameter.AIsOut, parameter.ARemark, parameter.ADPhoto, parameter.ClockPlace, parameter.LessonSortNo, parameter.ALTId, parameter.ALTOEId, parameter.Img); + + // return Success("打卡成功"); + // } + // else + // { + // return Fail("打卡照片异常,请重新拍照!"); + // } + + + //} + + /// + /// 判断教师是否授课 + /// + /// + /// + //public Response JudgeTeacherIsHasLesson(dynamic _) + //{ + // var jsondata = + // new + // { + // data = false + // }; + // var empInfo = empInfoIBLL.GetEmpInfoEntityByEmpNo(userInfo.account); + // if (empInfo == null) + // { + // return Success(jsondata); + // } + // if (empInfo.IsHasLesson == true)//授课 + // { + // jsondata = new { data = true }; + // return Success(jsondata); + // } + // return Success(jsondata); + //} + } +} \ No newline at end of file diff --git a/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Hetian/HeTianApi.cs b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Hetian/HeTianApi.cs new file mode 100644 index 000000000..400264268 --- /dev/null +++ b/Learun.Framework.Ultimate V7/Learun.Application.WebApi/Modules/Hetian/HeTianApi.cs @@ -0,0 +1,101 @@ +using Learun.Application.Base.SystemModule; +using Learun.Application.TwoDevelopment.Ask; +using Learun.Application.TwoDevelopment.EducationalAdministration; +using Learun.Util; +using Nancy; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using System.Threading.Tasks; + +namespace Learun.Application.WebApi.Modules.Hetian +{ + public class HeTianApi : BaseApi + { + //ht 和田 sx 实习 + public HeTianApi() : base("/api/ht/") + { + Get["/sx/comp"] = GetComp;// 实习单位列表 + Get["/sx/pos"] = GetPos;// 实习岗位列表 + Get["/sx/list"] = GetBaomin;// 获取报名列表 + Post["/sx/bm"] = Baomin; //报名实习 + Get["/zj/my"] = GetZongjie;// 获取总结 + Post["/zj/sub"] = Zongjie; //提交总结 + } + private InternShipSignUpIBLL internShipSignUpIBLL = new InternShipSignUpBLL(); + private InternShipSummaryIBLL internShipSummaryIBLL = new InternShipSummaryBLL(); + private DataSourceIBLL dataSourceIBLL = new DataSourceBLL(); + + /// + /// 实习单位 + /// + /// + public Response GetComp(dynamic _) + { + var data = dataSourceIBLL.GetDataTable("PracticeBase", ""); + return Success(data); + } + /// + /// 实习岗位 + /// + /// + public Response GetPos(dynamic _) + { + var dw = GetReqData(); + var data = dataSourceIBLL.GetDataTable("PBPost", "PBID='" + dw + "'"); + return Success(data); + } + + /// + /// 报名列表 + /// + /// + /// + public Response GetBaomin(dynamic _) + { + var list = internShipSignUpIBLL.GetMyList(userInfo.account); + + return Success(list); + } + + /// + /// 报名 + /// + /// + /// + public Response Baomin(dynamic _) + { + var queryJson = GetReqData(); + var queryParam = queryJson.ToObject(); + internShipSignUpIBLL.SaveEntity("", queryParam); + + return Success(true); + } + /// + /// 获取总结 + /// + /// + /// + public Response GetZongjie(dynamic _) + { + var list = internShipSummaryIBLL.GetMy(userInfo.account); + + return Success(list); + } + /// + /// 总结 + /// + /// + /// + public Response Zongjie(dynamic _) + { + var queryJson = GetReqData(); + var queryParam = queryJson.ToObject(); + internShipSummaryIBLL.SaveEntity("", queryParam); + + return Success(true); + } + + } +} diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSignUp/InternShipSignUpBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSignUp/InternShipSignUpBLL.cs index c5cc367b1..e7aa4983b 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSignUp/InternShipSignUpBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSignUp/InternShipSignUpBLL.cs @@ -2,6 +2,7 @@ using System; using System.Data; using System.Collections.Generic; +using static Dapper.SqlMapper; namespace Learun.Application.TwoDevelopment.EducationalAdministration { @@ -118,6 +119,25 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + public IEnumerable GetMyList(string acc) + { + try + { + return internShipSignUpService.GetMyList(acc); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSignUp/InternShipSignUpEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSignUp/InternShipSignUpEntity.cs index 845d34a98..a3ec6e5cf 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSignUp/InternShipSignUpEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSignUp/InternShipSignUpEntity.cs @@ -24,6 +24,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration /// [Column("STUDENTID")] public string StudentID { get; set; } + [Column("STUDENTNAME")] + public string StudentName { get; set; } /// /// 实习单位 /// diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSignUp/InternShipSignUpIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSignUp/InternShipSignUpIBLL.cs index 71f215717..f68f15a4e 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSignUp/InternShipSignUpIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSignUp/InternShipSignUpIBLL.cs @@ -45,5 +45,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration void SaveEntity(string keyValue, InternShipSignUpEntity entity); #endregion + IEnumerable GetMyList(string acc); } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSignUp/InternShipSignUpService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSignUp/InternShipSignUpService.cs index 660d9eedd..69abde474 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSignUp/InternShipSignUpService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSignUp/InternShipSignUpService.cs @@ -31,15 +31,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration var strSql = new StringBuilder(); strSql.Append("SELECT "); strSql.Append(@" - t.ID, - t.StudentID, - t.IUnit, - t.IPost, - t.ITime, - t.Mobile, - t.Cjhecker, - t.Status, - t.IContent + * "); strSql.Append(" FROM InternShipSignUp t "); strSql.Append(" WHERE 1=1 "); @@ -49,7 +41,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration if (!queryParam["StudentID"].IsEmpty()) { dp.Add("StudentID", "%" + queryParam["StudentID"].ToString() + "%", DbType.String); - strSql.Append(" AND t.StudentID Like @StudentID "); + strSql.Append(" AND t.StudentName Like @StudentID "); } if (!queryParam["Mobile"].IsEmpty()) { @@ -157,6 +149,35 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } #endregion - + public IEnumerable GetMyList(string acc) + { + try + { + // 虚拟参数 + var dp = new DynamicParameters(new { }); + dp.Add("StudentID", "" + acc + "", DbType.String); + var strSql = new StringBuilder(); + strSql.Append("SELECT "); + strSql.Append(@" + * + "); + strSql.Append(" FROM InternShipSignUp t "); + strSql.Append(" WHERE StudentID=@StudentID "); + + + return this.BaseRepository("CollegeMIS").FindList(strSql.ToString(), dp); + } + 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/InternShipSummary/InternShipSummaryBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSummary/InternShipSummaryBLL.cs index a6cd7fdf7..96354b1af 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSummary/InternShipSummaryBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSummary/InternShipSummaryBLL.cs @@ -118,6 +118,25 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration } } + public InternShipSummaryEntity GetMy(string acc) + { + try + { + return internShipSummaryService.GetMy(acc); + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowBusinessException(ex); + } + } + } + #endregion } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSummary/InternShipSummaryEntity.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSummary/InternShipSummaryEntity.cs index 7fd7f643f..bd68e8160 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSummary/InternShipSummaryEntity.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSummary/InternShipSummaryEntity.cs @@ -25,6 +25,11 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration [Column("STUDENT")] public string Student { get; set; } /// + /// 学生编号 + /// + [Column("STUDENTNO")] + public string StudentNo { get; set; } + /// /// 总结名称 /// [Column("SUMMARYNAME")] diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSummary/InternShipSummaryIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSummary/InternShipSummaryIBLL.cs index 66e4302ff..294c19825 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSummary/InternShipSummaryIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSummary/InternShipSummaryIBLL.cs @@ -45,5 +45,6 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration void SaveEntity(string keyValue, InternShipSummaryEntity entity); #endregion + InternShipSummaryEntity GetMy(string acc); } } diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSummary/InternShipSummaryService.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSummary/InternShipSummaryService.cs index 83046513e..6409848b5 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSummary/InternShipSummaryService.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/EducationalAdministration/InternShipSummary/InternShipSummaryService.cs @@ -4,6 +4,7 @@ using Learun.Util; using System; using System.Collections.Generic; using System.Data; +using System.Linq; using System.Text; namespace Learun.Application.TwoDevelopment.EducationalAdministration @@ -31,13 +32,7 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration var strSql = new StringBuilder(); strSql.Append("SELECT "); strSql.Append(@" - t.ID, - t.Student, - t.SummaryName, - t.AddTime, - t.Mobile, - t.Remark, - t.SummaryContent + * "); strSql.Append(" FROM InternShipSummary t "); strSql.Append(" WHERE 1=1 "); @@ -138,6 +133,8 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration else { entity.Create(); + var c= this.BaseRepository("CollegeMIS").FindList(x=>x.StudentNo==entity.StudentNo).Count(); + if (c > 0) throw new Exception("实习总结已提交"); this.BaseRepository("CollegeMIS").Insert(entity); } } @@ -156,5 +153,24 @@ namespace Learun.Application.TwoDevelopment.EducationalAdministration #endregion + + public InternShipSummaryEntity GetMy(string acc) + { + try + { + return this.BaseRepository("CollegeMIS").FindEntity(x=>x.StudentNo==acc); + } + 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/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 dc6529489..630aaaff7 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 @@ -79,6 +79,16 @@ namespace Learun.Application.TwoDevelopment.LogisticsManagement /// [Column("ADPHOTO")] public string ADPhoto { get; set; } + /// + /// 经度 + /// + [Column("ALON")] + public decimal ALon { get; set; } + /// + /// 纬度 + /// + [Column("ALAT")] + public decimal ALat { get; set; } #endregion #region 扩展操作 diff --git a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionBLL.cs index 9fb2465f9..6f85d1b38 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionBLL.cs @@ -162,5 +162,27 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement #endregion + /// + /// 打卡 + /// + /// + public bool ClockIn(decimal ALon, decimal ALat, bool AIsOut, string ARemark, string ADPhoto, string ClockPlace, string img) + { + try + { + return aDR_RestrictionService.ClockIn(ALon, ALat, AIsOut, ARemark, ADPhoto, ClockPlace, img); + } + 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/PersonnelManagement/ADR_Restriction/ADR_RestrictionIBLL.cs b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionIBLL.cs index 67e6c66a2..4121d4509 100644 --- a/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionIBLL.cs +++ b/Learun.Framework.Ultimate V7/Learun.Framework.Module/Learun.Application.Module/Learun.Application.TwoDevelopment/PersonnelManagement/ADR_Restriction/ADR_RestrictionIBLL.cs @@ -50,5 +50,11 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement #endregion ADR_RestrictionEntity GetADR_RestrictionEntityEnabled(); + + /// + /// 打卡 + /// + /// + bool ClockIn(decimal ALon, decimal ALat, bool AIsOut, string ARemark, string ADPhoto, string ClockPlace, string Img); } } 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 e99a5596a..6ccd42b1f 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 @@ -1,9 +1,12 @@ using Dapper; +using Learun.Application.TwoDevelopment.EducationalAdministration; +using Learun.Application.TwoDevelopment.LogisticsManagement; using Learun.DataBase.Repository; using Learun.Util; using System; using System.Collections.Generic; using System.Data; +using System.Linq; using System.Text; namespace Learun.Application.TwoDevelopment.PersonnelManagement @@ -205,5 +208,652 @@ namespace Learun.Application.TwoDevelopment.PersonnelManagement } } } + + /// + /// 打卡 + /// + /// + public bool ClockIn(decimal ALon, decimal ALat, bool AIsOut, string ARemark, string ADPhoto, string ClockPlace, string img) + { + try + { + // var attendancerulEntity = this.BaseRepository("CollegeMIS").FindEntity(m => m.REnable == true); + var userinfo = LoginUserInfo.Get(); + //员工账号 + string EmpNo = userinfo.account; + var empInfo = this.BaseRepository("CollegeMIS").FindEntity(x => x.StuCode == EmpNo); + if (empInfo == null) + { + throw new Exception("未找到该同学"); + } + + //考勤状态 + string ADType = "1"; + //考勤结果 + string ClockStatus = "1"; + //当前服务器日期 + var datenow = DateTime.Now.ToString("yyyy-MM-dd"); + + var datetimenow = DateTime.Now; + + //当前时间年月日时分秒 + string strTimeYear = (datetimenow.Year).ToString(); + string strTimeMonth = (datetimenow.Month).ToString("d2"); + string strTimeDay = (datetimenow.Day).ToString("d2"); + string strTimeHour = (datetimenow.Hour).ToString("d2"); + string strTimeMinute = (datetimenow.Minute).ToString("d2"); + string strTimeSecond = (datetimenow.Second).ToString("d2"); + string strTime = strTimeYear + "-" + strTimeMonth + "-" + strTimeDay + " " + strTimeHour + ":" + + strTimeMinute + ":" + strTimeSecond; + + //设备事件时间(在这里,=当前时间) + DateTime devicetime = Convert.ToDateTime(strTime); + + #region + //上班时间 + //DateTime workDateTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.WorkTime); + ////上班考勤时间段 + //DateTime signInStartTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignInStartTime); + //DateTime signInEndTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignInEndTime); + + ////下班时间 + //DateTime offworkDateTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.CloseTime); + ////下班考勤时间段 + //DateTime signOutStartTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutStartTime); + //DateTime signOutEndTime = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutEndTime); + + ////中午下班时间 + //DateTime offworkDateTimelunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.NoonCloseTime); + ////中午上班时间 + //DateTime workDateTimelunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.NoonWorkTime); + ////中午下班考勤时间段 + //DateTime offworkstartlunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutStartTime2); + //DateTime offworkendlunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignOutEndTime2); + ////中午上班考勤时间段 + //DateTime workstartlunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignInStartTime2); + //DateTime workendlunch = Convert.ToDateTime(datenow + " " + attendancerulEntity.SignInEndTime2); + + + //var leaveTime = attendancerulEntity.LeaveOverTime ?? 0; + //var overTime = attendancerulEntity.LateOvertime ?? 0; + #endregion + + //2021.12.30 上下班设置时间段打卡 + #region 二次打卡 + //判断打卡次数 + //if (attendancerulEntity.ClockTime == "二次打卡") + //{ + //上下班正常打卡 + //if (devicetime >= signInStartTime && devicetime <= signInEndTime) + //if (devicetime <= signInEndTime) + //{ + //ADType = "1";//上班 + //ClockStatus = "1";//正常 + //} + //else if (devicetime >= signOutStartTime && devicetime <= signOutEndTime) + //else if (devicetime >= signOutStartTime) + //{ + // ADType = "2";//下班 + // ClockStatus = "1";//正常 + //} + //else if (devicetime < signOutStartTime && devicetime > signInEndTime)//小于下班时间 + //{ + //首先判断是上班还是下班 + //该用户当日有签到记录视为下班签退 + var attendancerecord = this.BaseRepository("CollegeMIS").FindList( + "select * from ADR_Record where ADYear='" + strTimeYear + "' and ADMonth='" + + strTimeMonth + "' and ADDay='" + strTimeDay + "' and UserNo='" + EmpNo + + "' and ADType='1'").ToList(); + + if (attendancerecord.Count() > 0)//如果存在上班考勤记录 + { + ADType = "2";//下班 + + //if (devicetime < workDateTimelunch) + //{ + // DateTime offworkDateTimeFree1 = offworkstartlunch.AddMinutes(-leaveTime); + // if (devicetime < offworkDateTimeFree1) + // { + // ClockStatus = "3"; + // } + // else + // { + // ClockStatus = "1"; + // } + + //} + //else + //{ + // if (devicetime >= (signOutStartTime.AddMinutes(-leaveTime))) + // { + // ClockStatus = "1"; + // } + // else + // { + // ClockStatus = "3"; + // } + //} + + } + //else//判断为上班迟到 + //{ + // if (devicetime < offworkstartlunch.AddMinutes(-leaveTime)) + // { + // ADType = "1"; + // ClockStatus = "2"; + // } + // else if (devicetime >= offworkstartlunch.AddMinutes(-leaveTime) && devicetime <= offworkendlunch) + // { + // ADType = "2"; + // ClockStatus = "1"; + // } + // else if (devicetime >= workstartlunch && devicetime <= workendlunch.AddMinutes(overTime)) + // { + // ADType = "1"; + // ClockStatus = "1"; + // } + // else + // { + // ADType = "1"; + // ClockStatus = "2"; + // } + + //} + //} + + + ADR_RecordEntity adrRecordEntity = new ADR_RecordEntity(); + adrRecordEntity.Create(); + adrRecordEntity.UserName = userinfo.realName; + adrRecordEntity.UserNo = EmpNo; + adrRecordEntity.ADType = ADType; + adrRecordEntity.ADTime = datetimenow; + adrRecordEntity.ClockTime = devicetime; + adrRecordEntity.ClockStatus = ClockStatus; + //if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.DName)) + //{ + // adrRecordEntity.ClockPlace = deviceEntity.DName; + //} + //else + //{ + // adrRecordEntity.ClockPlace = "未知"; + //} + adrRecordEntity.ADYear = strTimeYear; + adrRecordEntity.ADMonth = strTimeMonth; + adrRecordEntity.ADDay = strTimeDay; + adrRecordEntity.ALon = ALon; + adrRecordEntity.ALat = ALat; + //adrRecordEntity.AIsOut = AIsOut; + //adrRecordEntity.ARemark = ARemark; + adrRecordEntity.ADPhoto = ADPhoto; + adrRecordEntity.ClockPlace = ClockPlace; + //adrRecordEntity.Img = img; + //adrRecordEntity.IsFit = true; + ////记录日志 + //ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity(); + //adrDeviceLogEntity.Create(); + //if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.Id)) + //{ + // adrDeviceLogEntity.DeviceId = deviceEntity.Id; + // stringAlarm += ",设备IP:" + deviceEntity.IpAddress; + //} + + //adrDeviceLogEntity.LogData = stringAlarm; + //adrDeviceLogEntity.LogType = "0"; + //connmis.Execute("insert into ADR_DeviceLog(LogId,DeviceId, LogType, LogData, F_CreateDate, F_CreateUserId, F_CreateUserName) values(" + + // "'" + adrDeviceLogEntity.LogId + "','" + adrDeviceLogEntity.DeviceId + "','" + adrDeviceLogEntity.LogType + "'," + + // "'" + adrDeviceLogEntity.LogData + "','" + adrDeviceLogEntity.F_CreateDate + "','system','自动化服务')"); + //去重 + //获取当日考勤记录 + var attendancerecordlist = this.BaseRepository("CollegeMIS").FindList("select * from ADR_Record where ADYear='" + strTimeYear + "' and ADMonth='" + strTimeMonth + "' and ADDay='" + strTimeDay + "' and UserNo='" + EmpNo + "'").ToList(); + //签到去重 + if (adrRecordEntity.ADType == "1" && attendancerecordlist.Count(m => m.ADType == "1") > 0)//签过到了 + { + //每日保留第一次签到记录 + return true; + } + //签退去重 + if (adrRecordEntity.ADType == "2" && attendancerecordlist.Count(m => m.ADType == "2") > 0)//签过退了 + { + //更新签退时间,签退状态 + var firstoffworkentity = attendancerecordlist.FirstOrDefault(m => m.ADType == "2"); + firstoffworkentity.ADTime = datetimenow; + firstoffworkentity.ClockTime = devicetime; + firstoffworkentity.ClockStatus = ClockStatus; + //firstoffworkentity.ARemark = ARemark; + firstoffworkentity.ClockPlace = ClockPlace; + //firstoffworkentity.Img = img; + 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, ADYear, ADMonth, ADDay, ADPhoto,ALon,ALat) values('" + adrRecordEntity.ID + "','" + adrRecordEntity.UserNo + "','" + adrRecordEntity.ADType + "','" + adrRecordEntity.ADTime + "','" + adrRecordEntity.ClockTime + "','" + adrRecordEntity.ClockStatus + "','" + adrRecordEntity.ClockPlace + "','" + adrRecordEntity.ADYear + "','" + adrRecordEntity.ADMonth + "','" + adrRecordEntity.ADDay + "','" + adrRecordEntity.ADPhoto + "'," + adrRecordEntity.ALon + "," + adrRecordEntity.ALat + ")"); + //同步修改授课考勤打卡 + //ClockInModifyTeachAttendance(adrRecordEntity); + return true; + //} + #endregion + + #region 四次打卡 + //else//四次打卡 + //{ + + // //首先判断是否在中午考勤时间段 + // //如果在中午下班考勤时间段 + // if (offworkstartlunch <= devicetime && devicetime <= offworkendlunch) + // { + // //早退判断 + // if (devicetime < offworkDateTimelunch) + // { + // //早退 + // //允许早退判断 + // if (attendancerulEntity.LeaveOverTime.HasValue && attendancerulEntity.LeaveOverTime != 0) + // { + // //中午下班最早签退时间 + // DateTime offworkDateTimeFree = offworkDateTimelunch.AddMinutes(-Convert.ToDouble(attendancerulEntity.LeaveOverTime)); + // if (devicetime > offworkDateTimeFree) + // { + // //正常 + // ADType = "8";//中午下班 + // ClockStatus = "1";//正常 + // } + // else + // { + // //早退 + // ADType = "8";//中午下班 + // ClockStatus = "3";//早退 + // } + // } + // else + // { + // //早退 + // ADType = "8";//中午下班 + // ClockStatus = "3";//早退 + // } + // } + // else + // { + // //正常 + // ADType = "8";//中午下班 + // ClockStatus = "1";//正常 + // } + // //写入考勤数据 + // ADR_RecordEntity adrRecordEntity = new ADR_RecordEntity(); + // adrRecordEntity.Create(); + // adrRecordEntity.UserNo = EmpNo; + // adrRecordEntity.ADType = ADType; + // adrRecordEntity.ADTime = datetimenow; + // adrRecordEntity.ClockTime = devicetime; + // adrRecordEntity.ClockStatus = ClockStatus; + // //if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.DName)) + // //{ + // // adrRecordEntity.ClockPlace = deviceEntity.DName; + // //} + // //else + // //{ + // // adrRecordEntity.ClockPlace = "未知"; + // //} + // adrRecordEntity.ADYear = strTimeYear; + // adrRecordEntity.ADMonth = strTimeMonth; + // adrRecordEntity.ADDay = strTimeDay; + // adrRecordEntity.ALon = ALon; + // adrRecordEntity.ALat = ALat; + // adrRecordEntity.AIsOut = AIsOut; + // adrRecordEntity.ARemark = ARemark; + // adrRecordEntity.ADPhoto = ADPhoto; + // adrRecordEntity.ClockPlace = ClockPlace; + // adrRecordEntity.Img = img; + // adrRecordEntity.IsFit = true; + // ////记录日志 + // //ADR_DeviceLogEntity adrDeviceLogEntity = new ADR_DeviceLogEntity(); + // //adrDeviceLogEntity.Create(); + // //if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.Id)) + // //{ + // // adrDeviceLogEntity.DeviceId = deviceEntity.Id; + // // stringAlarm += ",设备IP:" + deviceEntity.IpAddress; + // //} + + // //adrDeviceLogEntity.LogData = stringAlarm; + // //adrDeviceLogEntity.LogType = "0"; + // //connmis.Execute("insert into ADR_DeviceLog(LogId,DeviceId, LogType, LogData, F_CreateDate, F_CreateUserId, F_CreateUserName) values(" + + // // "'" + adrDeviceLogEntity.LogId + "','" + adrDeviceLogEntity.DeviceId + "','" + adrDeviceLogEntity.LogType + "'," + + // // "'" + adrDeviceLogEntity.LogData + "','" + adrDeviceLogEntity.F_CreateDate + "','system','自动化服务')"); + + // //考勤记录 + // //去重 + // var attendancerecordlist = this.BaseRepository("CollegeMIS").FindList("select * from ADR_Record where ADYear='" + strTimeYear + "' and ADMonth='" + strTimeMonth + "' and ADDay='" + strTimeDay + "' and UserNo='" + EmpNo + "'").ToList(); + // if (attendancerecordlist.Count(m => m.ADType == "8") > 0)//存在中午下班记录更新记录 + // { + // var firstoffworkentity = attendancerecordlist.FirstOrDefault(m => m.ADType == "8"); + // firstoffworkentity.ADTime = datetimenow; + // firstoffworkentity.ClockTime = devicetime; + // firstoffworkentity.ClockStatus = ClockStatus; + + // this.BaseRepository("CollegeMIS").ExecuteBySql("update ADR_Record set ADTime='" + firstoffworkentity.ADTime + "',ClockTime='" + firstoffworkentity.ClockTime + "',ClockStatus='" + firstoffworkentity.ClockStatus + "',ADPhoto='" + firstoffworkentity.ADPhoto + "' where ID='" + firstoffworkentity.ID + "'"); + // return true; + // } + // else + // { + // this.BaseRepository("CollegeMIS").ExecuteBySql("insert into ADR_Record(ID, UserNo, ADType, ADTime, ClockTime, ClockStatus, ClockPlace,Img, ADYear, ADMonth, ADDay, ADPhoto,ALon,ALat,AIsOut,IsFit,ARemark) values(" + + // "'" + adrRecordEntity.ID + "','" + adrRecordEntity.UserNo + "','" + adrRecordEntity.ADType + "','" + adrRecordEntity.ADTime + "'," + + // "'" + adrRecordEntity.ClockTime + "','" + adrRecordEntity.ClockStatus + "','" + adrRecordEntity.ClockPlace + "','" + adrRecordEntity.Img + "','" + adrRecordEntity.ADYear + "'," + + // "'" + adrRecordEntity.ADMonth + "','" + adrRecordEntity.ADDay + "','" + adrRecordEntity.ADPhoto + "'," + adrRecordEntity.ALon + "," + adrRecordEntity.ALat + ",'" + adrRecordEntity.AIsOut + "','" + adrRecordEntity.IsFit + "','" + adrRecordEntity.ARemark + "')"); + // return true; + // } + // } + // //如果在中午上班考勤时间段 + // else if (workstartlunch <= devicetime && devicetime <= workendlunch) + // { + // //迟到判断 + // if (devicetime > workDateTimelunch) + // { + // //迟到 + // //允许迟到判断 + // if (attendancerulEntity.LateOvertime.HasValue && attendancerulEntity.LateOvertime != 0) + // { + // //中午上班最晚签到时间 + // DateTime workDateTimeFree = workDateTimelunch.AddMinutes(Convert.ToDouble(attendancerulEntity.LateOvertime)); + // if (devicetime < workDateTimeFree) + // { + // //正常 + // ADType = "7";//中午上班 + // ClockStatus = "1";//正常 + // } + // else + // { + // //迟到 + // ADType = "7";//中午上班 + // ClockStatus = "2";//迟到 + // } + // } + // else + // { + // //迟到 + // ADType = "7";//中午上班 + // ClockStatus = "2";//迟到 + // } + // } + // else + // { + // //正常 + // ADType = "7";//中午下班 + // ClockStatus = "1";//正常 + // } + // //写入考勤数据 + // ADR_RecordEntity adrRecordEntity = new ADR_RecordEntity(); + // adrRecordEntity.Create(); + // adrRecordEntity.UserNo = EmpNo; + // adrRecordEntity.ADType = ADType; + // adrRecordEntity.ADTime = datetimenow; + // adrRecordEntity.ClockTime = devicetime; + // adrRecordEntity.ClockStatus = ClockStatus; + // //if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.DName)) + // //{ + // // adrRecordEntity.ClockPlace = deviceEntity.DName; + // //} + // //else + // //{ + // // adrRecordEntity.ClockPlace = "未知"; + // //} + // adrRecordEntity.ADYear = strTimeYear; + // adrRecordEntity.ADMonth = strTimeMonth; + // adrRecordEntity.ADDay = strTimeDay; + // adrRecordEntity.ALon = ALon; + // adrRecordEntity.ALat = ALat; + // adrRecordEntity.AIsOut = AIsOut; + // adrRecordEntity.ARemark = ARemark; + // adrRecordEntity.ADPhoto = ADPhoto; + // adrRecordEntity.ClockPlace = ClockPlace; + // adrRecordEntity.Img = img; + // adrRecordEntity.IsFit = true; + + // //考勤记录 + // //去重 + // var attendancerecordlist = this.BaseRepository("CollegeMIS").FindList("select * from ADR_Record where ADYear='" + strTimeYear + "' and ADMonth='" + strTimeMonth + "' and ADDay='" + strTimeDay + "' and UserNo='" + EmpNo + "'").ToList(); + // if (attendancerecordlist.Count(m => m.ADType == "7") == 0) + // { + // this.BaseRepository("CollegeMIS").ExecuteBySql("insert into ADR_Record(ID, UserNo, ADType, ADTime, ClockTime, ClockStatus, ClockPlace,Img, ADYear, ADMonth, ADDay, ADPhoto,ALon,ALat,AIsOut,IsFit,ARemark) values(" + + // "'" + adrRecordEntity.ID + "','" + adrRecordEntity.UserNo + "','" + adrRecordEntity.ADType + "','" + adrRecordEntity.ADTime + "'," + + // "'" + adrRecordEntity.ClockTime + "','" + adrRecordEntity.ClockStatus + "','" + adrRecordEntity.ClockPlace + "','" + adrRecordEntity.Img + "','" + adrRecordEntity.ADYear + "'," + + // "'" + adrRecordEntity.ADMonth + "','" + adrRecordEntity.ADDay + "','" + adrRecordEntity.ADPhoto + "'," + adrRecordEntity.ALon + "," + adrRecordEntity.ALat + ",'" + adrRecordEntity.AIsOut + "','" + adrRecordEntity.IsFit + "','" + adrRecordEntity.ARemark + "')"); + // } + // return true; + // } + // else//不在中午考勤时间段判断迟到早退 + // { + + // if (devicetime <= signInEndTime) + // { + // ADType = "1";//上班 + // ClockStatus = "1";//正常 + // } + // else if (devicetime >= signOutStartTime) + // { + // ADType = "2";//下班 + // ClockStatus = "1";//正常 + // } + // else + // { + // //该用户当日有签到记录视为下班签退 + // var attendancerecord = this.BaseRepository("CollegeMIS").FindList("select * from ADR_Record where ADYear='" + strTimeYear + "' and ADMonth='" + strTimeMonth + "' and ADDay='" + strTimeDay + "' and UserNo='" + EmpNo + "'"); + // //首先判断上午考勤还是下午考勤 + // //如果小于中午下班时间 + // if (devicetime < offworkDateTimelunch) + // { + // //迟到 + // //无上班记录视为迟到 + // if (attendancerecord.Count(m => m.ADType == "1") == 0) + // { + // //上班迟到 + // //获取迟到范围 + // if (attendancerulEntity.LateOvertime.HasValue && attendancerulEntity.LateOvertime != 0) + // { + // DateTime workDateTimeFree = workDateTime.AddMinutes(Convert.ToDouble(attendancerulEntity.LateOvertime)); + // if (devicetime <= workDateTimeFree)//在允许迟到范围内记为正常 + // { + // ADType = "1";//上班 + // ClockStatus = "1";//正常 + // } + // else + // { + // ADType = "1";//上班 + // ClockStatus = "2";//迟到 + // } + // } + // else + // { + // ADType = "1";//上班 + // ClockStatus = "2";//迟到 + // } + // } + // //早退 + // //有签到记录视为早退 + // else + // { + // //获取早退范围 + // if (attendancerulEntity.LeaveOverTime.HasValue && attendancerulEntity.LeaveOverTime != 0) + // { + // //最早签退时间 + // DateTime offworkDateTimeFree = offworkDateTime.AddMinutes(-Convert.ToDouble(attendancerulEntity.LeaveOverTime)); + // if (devicetime >= offworkDateTimeFree)//在允许早退范围内记为正常 + // { + // ADType = "8";//中午下班 + // ClockStatus = "1";//正常 + // } + // else//超出早退范围视为早退 + // { + // ADType = "8";//中午下班 + // ClockStatus = "3";//早退 + // } + // } + // else + // { + // ADType = "8";//中午下班 + // ClockStatus = "3";//早退 + // } + + // } + // } + // else if (devicetime > workDateTimelunch)//如果大于中午上班时间,且上级if判断小于下班时间 + // //判断为下午上班打卡迟到或早退 + // { + // //如果存在中午签到记录 + // //判断为下班早退 + // if (attendancerecord.Count(m => m.ADType == "7") > 0) + // { + // //早退判断 + // //获取早退范围 + // if (attendancerulEntity.LeaveOverTime.HasValue && attendancerulEntity.LeaveOverTime != 0) + // { + // DateTime offworkDateTimeFree = offworkDateTime.AddMinutes(-Convert.ToDouble(attendancerulEntity.LeaveOverTime)); + // if (devicetime >= offworkDateTimeFree)//在允许早退范围内记为正常 + // { + // ADType = "2";//下班 + // ClockStatus = "1";//正常 + // } + // else//超出早退范围视为早退 + // { + // ADType = "2";//下班 + // ClockStatus = "3";//早退 + // } + // } + // else + // { + // ADType = "2";//下班 + // ClockStatus = "3";//早退 + // } + // } + // else + // { + // //获取迟到范围 + // if (attendancerulEntity.LateOvertime.HasValue && attendancerulEntity.LateOvertime != 0) + // { + // //最晚签到时间 + // DateTime workDateTimeFree = workDateTimelunch.AddMinutes(Convert.ToDouble(attendancerulEntity.LateOvertime)); + // if (devicetime <= workDateTimeFree)//在允许迟到范围内记为正常 + // { + // ADType = "7";//中午上班 + // ClockStatus = "1";//正常 + // } + // else + // { + // ADType = "7";//中午上班 + // ClockStatus = "2";//迟到 + // } + // } + // else + // { + // ADType = "7";//中午上班 + // ClockStatus = "2";//迟到 + // } + // } + // } + // } + + // ADR_RecordEntity adrRecordEntity = new ADR_RecordEntity(); + // adrRecordEntity.Create(); + // adrRecordEntity.UserNo = EmpNo; + // adrRecordEntity.ADType = ADType; + // adrRecordEntity.ADTime = datetimenow; + // adrRecordEntity.ClockTime = devicetime; + // adrRecordEntity.ClockStatus = ClockStatus; + // //if (deviceEntity != null && !string.IsNullOrEmpty(deviceEntity.DName)) + // //{ + // // adrRecordEntity.ClockPlace = deviceEntity.DName; + // //} + // //else + // //{ + // // adrRecordEntity.ClockPlace = "未知"; + // //} + // adrRecordEntity.ADYear = strTimeYear; + // adrRecordEntity.ADMonth = strTimeMonth; + // adrRecordEntity.ADDay = strTimeDay; + // adrRecordEntity.ALon = ALon; + // adrRecordEntity.ALat = ALat; + // adrRecordEntity.AIsOut = AIsOut; + // adrRecordEntity.ARemark = ARemark; + // adrRecordEntity.ADPhoto = ADPhoto; + // adrRecordEntity.ClockPlace = ClockPlace; + // adrRecordEntity.Img = img; + // adrRecordEntity.IsFit = true; + + + // //去重 + // //获取当日考勤记录 + // var attendancerecordlist = this.BaseRepository("CollegeMIS").FindList("select * from ADR_Record where ADYear='" + strTimeYear + "' and ADMonth='" + strTimeMonth + "' and ADDay='" + strTimeDay + "' and UserNo='" + EmpNo + "'").ToList(); + // //签到去重 + // if (adrRecordEntity.ADType == "1" && attendancerecordlist.Count(m => m.ADType == "1") > 0)//签过到了 + // { + // //每日保留第一次签到记录 + // return true; + // } + // //中午签到去重 + // if (adrRecordEntity.ADType == "7" && attendancerecordlist.Count(m => m.ADType == "7") > 0)//中午签过到了 + // { + // //每日保留第一次中午签到记录 + // return true; + // } + // //中午签退去重 + // if (adrRecordEntity.ADType == "8" && attendancerecordlist.Count(m => m.ADType == "8") > 0)//中午签过退了 + // { + // //更新签退时间,签退状态 + // var firstoffworkentity = attendancerecordlist.FirstOrDefault(m => m.ADType == "8"); + // firstoffworkentity.ADTime = datetimenow; + // firstoffworkentity.ClockTime = devicetime; + // 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 + "'"); + // return true; + // } + // //签退去重 + // if (adrRecordEntity.ADType == "2" && attendancerecordlist.Count(m => m.ADType == "2") > 0)//签过退了 + // { + // //更新签退时间,签退状态 + // var firstoffworkentity = attendancerecordlist.FirstOrDefault(m => m.ADType == "2"); + // firstoffworkentity.ADTime = datetimenow; + // firstoffworkentity.ClockTime = devicetime; + // 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,IsFit,ARemark) values(" + + // "'" + adrRecordEntity.ID + "','" + adrRecordEntity.UserNo + "','" + adrRecordEntity.ADType + "','" + adrRecordEntity.ADTime + "'," + + // "'" + adrRecordEntity.ClockTime + "','" + adrRecordEntity.ClockStatus + "','" + adrRecordEntity.ClockPlace + "','" + adrRecordEntity.Img + "','" + adrRecordEntity.ADYear + "'," + + // "'" + adrRecordEntity.ADMonth + "','" + adrRecordEntity.ADDay + "','" + adrRecordEntity.ADPhoto + "'," + adrRecordEntity.ALon + "," + adrRecordEntity.ALat + ",'" + adrRecordEntity.AIsOut + "','" + adrRecordEntity.IsFit + "','" + adrRecordEntity.ARemark + "')"); + // //同步修改授课考勤打卡 + // //ClockInModifyTeachAttendance(adrRecordEntity); + // return true; + // } + + //} + #endregion + + + //} + + + //return true; + + } + catch (Exception ex) + { + if (ex is ExceptionEx) + { + throw; + } + else + { + throw ExceptionEx.ThrowServiceException(ex); + } + } + } } }