# Generated by Django 3.0.5 on 2022-05-16 02:44

from django.conf import settings
import django.contrib.postgres.fields.jsonb
from django.db import migrations, models
import django.db.models.deletion
import django.utils.timezone


class Migration(migrations.Migration):

    dependencies = [
        ('system', '0020_auto_20220513_0926'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('ability', '0024_auto_20220316_0858'),
    ]

    operations = [
        migrations.CreateModel(
            name='QualiLib',
            fields=[
                ('id', models.AutoField(auto_created=True, 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='名称')),
                ('levels', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=list, null=True, verbose_name='等级')),
                ('scopes', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=list, null=True, verbose_name='范围')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Quali',
            fields=[
                ('id', models.AutoField(auto_created=True, 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='资质名称')),
                ('type', models.PositiveSmallIntegerField(choices=[('CMA', 'CMA'), ('CNAS', 'CNAS'), ('OTHER', 'OTHER')], verbose_name='资质类型')),
                ('grade', models.PositiveSmallIntegerField(verbose_name='等级')),
                ('scope', models.TextField(blank=True, null=True, verbose_name='范围')),
                ('level', models.CharField(max_length=10, verbose_name='等级')),
                ('description', models.TextField(blank=True, null=True, verbose_name='描述')),
                ('end_date', models.DateField(blank=True, null=True, verbose_name='截至日期')),
                ('city', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='quali_city', to='system.City')),
                ('citys', models.ManyToManyField(related_name='quali_citys', to='system.City', verbose_name='备案城市')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='quali_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('org', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='system.Organization', verbose_name='所属单位')),
                ('province', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='system.Province')),
                ('qualilib', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='ability.QualiLib', verbose_name='关联资质库')),
                ('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='quali_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='QTask',
            fields=[
                ('id', models.AutoField(auto_created=True, 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=100, verbose_name='名称')),
                ('end_date', models.DateField(blank=True, null=True, verbose_name='截止时间')),
                ('state', models.CharField(choices=[('待发布', '待发布'), ('进行中', '进行中'), ('已关闭', '已关闭')], default='待发布', max_length=50, verbose_name='任务状态')),
                ('belong_dept', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='qtask_belong_dept', to='system.Organization', verbose_name='所属部门')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='qtask_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='qtask_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
            ],
            options={
                'verbose_name': '资质报送任务',
                'verbose_name_plural': '资质报送任务',
            },
        ),
        migrations.CreateModel(
            name='QOrg',
            fields=[
                ('id', models.AutoField(auto_created=True, 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='删除标记')),
                ('count', models.PositiveIntegerField(default=0)),
                ('count_confirmed', models.PositiveIntegerField(default=0)),
                ('org', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='qorg_org', to='system.Organization', verbose_name='关联公司')),
                ('qtask', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='qorg_qtask', to='ability.QTask', verbose_name='关联任务')),
            ],
            options={
                'verbose_name': '资质报送任务部门',
                'verbose_name_plural': '资质报送任务部门',
            },
        ),
        migrations.CreateModel(
            name='QActionItem',
            fields=[
                ('id', models.AutoField(auto_created=True, 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='删除标记')),
                ('action', models.PositiveSmallIntegerField(blank=True, choices=[('update', '更新'), ('citys:add', '新增备案城市'), ('citys:remove', '移除备案城市')], null=True, verbose_name='操作类型')),
                ('field', models.CharField(max_length=20, verbose_name='变动字段')),
                ('value1', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, null=True, verbose_name='原值')),
                ('value2', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, null=True, verbose_name='新值')),
                ('city', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='system.City')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='QAction',
            fields=[
                ('id', models.AutoField(auto_created=True, 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='删除标记')),
                ('action', models.CharField(choices=[('service:update', '更新服务'), ('quali:create', '新增资质'), ('quali:update', '更新资质'), ('ablity:create', '新增能力')], max_length=20, verbose_name='操作类型')),
                ('num', models.PositiveIntegerField(blank=True, null=True, verbose_name='新增能力数量')),
                ('value1', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, null=True, verbose_name='值1')),
                ('value2', django.contrib.postgres.fields.jsonb.JSONField(blank=True, default=dict, null=True, verbose_name='值2')),
                ('confirmed', models.BooleanField(default=False, verbose_name='是否确认')),
                ('afield', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='quali_afield', to='system.Dict', verbose_name='所属领域')),
                ('atype', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='quali_atype', to='system.Dict', verbose_name='能力类型')),
                ('belong_dept', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='qaction_belong_dept', to='system.Organization', verbose_name='所属部门')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='qaction_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('file', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='system.File', verbose_name='能力文件')),
                ('qtask', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='ability.QOrg')),
                ('quali', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='ability.Quali', verbose_name='操作资质')),
                ('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='qaction_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
            ],
            options={
                'abstract': False,
            },
        ),
    ]
