feat: 打卡增加备注字段
This commit is contained in:
parent
225dcfddd6
commit
4d80d58554
|
@ -0,0 +1,18 @@
|
|||
# Generated by Django 3.2.12 on 2023-09-15 02:50
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('hrm', '0014_rename_facenet_data_employee_face_data'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AddField(
|
||||
model_name='clockrecord',
|
||||
name='note',
|
||||
field=models.CharField(default='', max_length=20, verbose_name='备注'),
|
||||
),
|
||||
]
|
|
@ -100,7 +100,7 @@ class ClockRecord(BaseModel):
|
|||
trigger = models.CharField('触发', max_length=20)
|
||||
detail = models.JSONField('相关记录', default=dict, null=False, blank=True) # 里面主要有对应的ID值
|
||||
exception_type = models.PositiveSmallIntegerField('异常类型', choices=E_TYPE_CHOISE, null=True, blank=True)
|
||||
|
||||
note = models.CharField('备注', max_length=20, default='')
|
||||
|
||||
class Certificate(CommonAModel):
|
||||
"""
|
||||
|
|
|
@ -281,23 +281,26 @@ class HrmService:
|
|||
|
||||
card_type = 30
|
||||
trigger = 'door'
|
||||
note = ''
|
||||
if e_type == 1:
|
||||
card_type = 10
|
||||
elif e_type == 2:
|
||||
card_type = 20
|
||||
elif e_type == 3:
|
||||
time_10_x = datetime(year=s_time_f.year, month=s_time_f.month,
|
||||
day=s_time_f.day, hour=3, minute=0, second=0, tzinfo=tzinfo)
|
||||
day=s_time_f.day, hour=7, minute=20, second=0, tzinfo=tzinfo)
|
||||
time_10_y = datetime(year=s_time_f.year, month=s_time_f.month,
|
||||
day=s_time_f.day, hour=11, minute=0, second=0, tzinfo=tzinfo)
|
||||
time_20_x = datetime(year=s_time_f.year, month=s_time_f.month,
|
||||
day=s_time_f.day, hour=16, minute=0, second=0, tzinfo=tzinfo)
|
||||
time_20_y = datetime(year=s_time_f.year, month=s_time_f.month,
|
||||
day=s_time_f.day, hour=23, minute=0, second=0, tzinfo=tzinfo)
|
||||
day=s_time_f.day, hour=18, minute=10, second=0, tzinfo=tzinfo)
|
||||
if time_10_x < s_time_f < time_10_y:
|
||||
card_type = 10
|
||||
elif time_20_x < s_time_f < time_20_y:
|
||||
card_type = 20
|
||||
if card_type == 30:
|
||||
note = '非打卡时间范围'
|
||||
trigger = 'panel'
|
||||
|
||||
# 先直接创建记录
|
||||
|
@ -312,6 +315,7 @@ class HrmService:
|
|||
cr.exception_type = None
|
||||
cr.trigger = trigger
|
||||
cr.detail = detail
|
||||
cr.note = note
|
||||
cr.save()
|
||||
|
||||
if card_type == 10:
|
||||
|
|
Loading…
Reference in New Issue