From f5ec3434d3e0b49e2c15f4498c686e4fb76a8f3a Mon Sep 17 00:00:00 2001 From: caoqianming Date: Mon, 13 Mar 2023 16:55:52 +0800 Subject: [PATCH] =?UTF-8?q?hrm=20=E8=80=83=E5=8B=A4=E6=8E=A8=E6=B5=8B?= =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- apps/hrm/services.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/apps/hrm/services.py b/apps/hrm/services.py index 50fa133d..20454c1d 100755 --- a/apps/hrm/services.py +++ b/apps/hrm/services.py @@ -273,6 +273,17 @@ class HrmService: ep.is_atwork = False ep.last_check_time = s_time_f ep.save() + # 判断是否有异常 + # 找到最近的上班时间 + cr_e = ClockRecord.objects.filter(create_time__lte=cr_20.create_time, type=10, employee=ep).order_by('-create_time').first() + if cr_e: + time_d = cr_20.create_time - cr_e.create_time + if time_d < timedelta(hours=7): + cr_20.exception_type = ClockRecord.E_TYPE_LESS + cr_20.save() + elif time_d > timedelta(hours=14): + cr_20.exception_type = ClockRecord.E_TYPE_MORE + cr_20.save() elif data['info']['extend']['enterOrExit'] == 3: # 如果不确定根据时间来 card_type = None