# Generated by Django 3.2.12 on 2022-08-15 06:02

from django.conf import settings
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('hrm', '0002_initial'),
        ('wf', '0001_initial'),
        ('system', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Visit',
            fields=[
                ('id', models.CharField(editable=False, help_text='主键ID', max_length=20, primary_key=True, serialize=False, verbose_name='主键ID')),
                ('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
                ('is_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
                ('purpose', models.PositiveSmallIntegerField(choices=[(10, '参观'), (20, '拜访'), (30, '面试'), (40, '开会')], verbose_name='来访事由')),
                ('level', models.PositiveSmallIntegerField(choices=[(10, '一般'), (20, '重要')], verbose_name='访问级别')),
                ('company', models.CharField(blank=True, max_length=100, null=True, verbose_name='来访单位')),
                ('state', models.PositiveSmallIntegerField(choices=[(10, '创建中'), (20, '审批中'), (30, '待入厂'), (40, '进行中'), (50, '已完成')], default=10)),
                ('name', models.CharField(max_length=50, verbose_name='来访概述')),
                ('description', models.TextField(blank=True, null=True, verbose_name='来访详述')),
                ('visit_time', models.DateTimeField(verbose_name='来访时间')),
                ('leave_time', models.DateTimeField(verbose_name='离开时间')),
                ('count_people', models.PositiveSmallIntegerField(blank=True, null=True, verbose_name='来访人数')),
                ('belong_dept', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='visit_belong_dept', to='system.dept', verbose_name='所属部门')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='visit_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('receptionist', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='接待人')),
                ('ticket', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='wf.ticket', verbose_name='关联工单')),
                ('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='visit_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Visitor',
            fields=[
                ('id', models.CharField(editable=False, help_text='主键ID', max_length=20, primary_key=True, serialize=False, verbose_name='主键ID')),
                ('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
                ('is_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
                ('name', models.CharField(max_length=20, verbose_name='姓名')),
                ('phone', models.CharField(blank=True, max_length=11, null=True, verbose_name='手机号')),
                ('photo', models.CharField(blank=True, max_length=1000, null=True, verbose_name='证件照')),
                ('id_number', models.CharField(blank=True, max_length=100, null=True, verbose_name='身份证号')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='visitor_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('employee', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='hrm.employee', verbose_name='成员信息')),
                ('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='visitor_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
                ('visit', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='vm.visit', verbose_name='最近所属访问项目')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Vpeople',
            fields=[
                ('id', models.CharField(editable=False, help_text='主键ID', max_length=20, primary_key=True, serialize=False, verbose_name='主键ID')),
                ('create_time', models.DateTimeField(default=django.utils.timezone.now, help_text='创建时间', verbose_name='创建时间')),
                ('update_time', models.DateTimeField(auto_now=True, help_text='修改时间', verbose_name='修改时间')),
                ('is_deleted', models.BooleanField(default=False, help_text='删除标记', verbose_name='删除标记')),
                ('is_main', models.BooleanField(default=False, verbose_name='是否主访人')),
                ('visit', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='vm.visit', verbose_name='关联访问项目')),
                ('visitor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='vm.visitor', verbose_name='访客')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='visit',
            name='visitors',
            field=models.ManyToManyField(related_name='v_visitors', through='vm.Vpeople', to='vm.Visitor'),
        ),
    ]
