# Generated by Django 3.2.12 on 2024-06-06 06:46

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 = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('am', '0003_alter_area_access_list'),
        ('system', '0004_auto_20240605_1011'),
        ('django_celery_beat', '0016_alter_crontabschedule_timezone'),
        ('wf', '0002_alter_state_filter_dept'),
    ]

    operations = [
        migrations.CreateModel(
            name='CheckTaskSet',
            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='删除标记')),
                ('note', models.TextField(blank=True, null=True, verbose_name='派发备注')),
                ('expire', models.PositiveSmallIntegerField(default=0, help_text='0代表不设限制直到下个任务派发', verbose_name='执行有效期(h)')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='checktaskset_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('myschedule', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='system.myschedule', verbose_name='周期')),
                ('periodictask', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='checktask_periodictask', to='django_celery_beat.periodictask', verbose_name='关联定时任务')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='CheckWork',
            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=40, verbose_name='名称')),
                ('description', models.TextField(blank=True, null=True, verbose_name='工作描述')),
                ('type', models.PositiveSmallIntegerField(choices=[(10, '手动'), (20, '派发')], default=10, verbose_name='任务类型')),
                ('time_start', models.DateTimeField(verbose_name='开启时间')),
                ('time_end', models.DateTimeField(verbose_name='关闭时间')),
                ('note', models.TextField(blank=True, null=True, verbose_name='检查备注')),
                ('time_check', models.DateTimeField(blank=True, null=True, verbose_name='开始检查时间')),
                ('category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='system.dictionary', verbose_name='工作分类')),
                ('checktaskset', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='dpm.checktaskset', verbose_name='关联派发策略')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='checkwork_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='RiskPoint',
            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=40, verbose_name='名称')),
                ('place', models.CharField(blank=True, max_length=100, null=True, verbose_name='具体地点')),
                ('level', models.PositiveSmallIntegerField(choices=[(10, '低风险'), (20, '一般风险'), (30, '较大风险'), (40, '重大风险')], default=10, verbose_name='风险点等级')),
                ('type', models.PositiveSmallIntegerField(choices=[(10, '作业活动类'), (20, '设备设施类')], default=10, verbose_name='风险点类型')),
                ('manage_level', models.PositiveSmallIntegerField(choices=[(10, '岗位级'), (20, '班组级'), (30, '部门级'), (40, '公司级')], default=10, verbose_name='管控层级')),
                ('area', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='riskpoint_area', to='am.area', verbose_name='所在区域')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='riskpoint_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('dept_res', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='riskpoint_dept_res', to='system.dept', verbose_name='责任部门')),
                ('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='riskpoint_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
                ('user_res', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='riskpoint_user_res', to=settings.AUTH_USER_MODEL, verbose_name='责任人')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Risk',
            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.TextField(verbose_name='项目/步骤')),
                ('level', models.PositiveSmallIntegerField(choices=[(10, '低风险'), (20, '一般风险'), (30, '较大风险'), (40, '重大风险')], default=10, verbose_name='风险等级')),
                ('standard', models.TextField(blank=True, null=True, verbose_name='检查标准')),
                ('hazard_factors', models.TextField(blank=True, null=True, verbose_name='危害因素')),
                ('sort', models.PositiveSmallIntegerField(default=1, verbose_name='排序')),
                ('measure_tech', models.TextField(blank=True, null=True, verbose_name='工程技术措施')),
                ('measure_manage', models.TextField(blank=True, null=True, verbose_name='管理措施')),
                ('measure_edu', models.TextField(blank=True, null=True, verbose_name='培训教育措施')),
                ('measure_protect', models.TextField(blank=True, null=True, verbose_name='个体防护措施')),
                ('measure_emer', models.TextField(blank=True, null=True, verbose_name='应急处置措施')),
                ('riskl', models.DecimalField(blank=True, decimal_places=1, max_digits=6, null=True)),
                ('riske', models.DecimalField(blank=True, decimal_places=1, max_digits=6, null=True)),
                ('riskc', models.DecimalField(blank=True, decimal_places=1, max_digits=6, null=True)),
                ('riskd', models.DecimalField(blank=True, decimal_places=1, max_digits=6, null=True)),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='risk_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('results', models.ManyToManyField(blank=True, related_name='risk_results', to='system.Dictionary', verbose_name='可能后果')),
                ('riskpoint', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='dpm.riskpoint', verbose_name='所属风险点')),
                ('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='risk_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Hazard',
            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='删除标记')),
                ('number', models.CharField(blank=True, max_length=20, null=True, verbose_name='编号')),
                ('state', models.PositiveSmallIntegerField(choices=[(10, '待提交'), (20, '流程中'), (30, '已结束')], default=10, verbose_name='隐患流程状态')),
                ('time_discover', models.DateTimeField(verbose_name='发现时间')),
                ('place', models.CharField(blank=True, max_length=100, null=True, verbose_name='具体地点')),
                ('level', models.PositiveSmallIntegerField(choices=[(10, '无隐患'), (20, '一般隐患'), (30, '重大隐患')], default=10, verbose_name='隐患等级')),
                ('harm_access', models.PositiveSmallIntegerField(choices=[(10, '无伤害'), (20, '轻微伤'), (30, '轻伤'), (40, '重伤'), (50, '死亡')], default=10, verbose_name='伤害评估')),
                ('description', models.TextField(blank=True, null=True, verbose_name='隐患描述')),
                ('reason', models.TextField(blank=True, null=True, verbose_name='原因分析')),
                ('correct_measure', models.TextField(blank=True, null=True, verbose_name='整改措施')),
                ('correct_deadline', models.DateTimeField(blank=True, null=True, verbose_name='整改期限')),
                ('correct_description', models.TextField(blank=True, null=True, verbose_name='整改描述')),
                ('correct_time', models.DateTimeField(blank=True, null=True, verbose_name='整改完成时间')),
                ('area', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='am.area', verbose_name='所在区域')),
                ('category', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='system.dictionary', verbose_name='隐患类别')),
                ('checkwork', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='dpm.checkwork', verbose_name='关联检查工作')),
                ('correct_solution', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to='system.file', verbose_name='整改方案')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='hazard_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('dept_correct', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='hazard_dept_correct', to='system.dept', verbose_name='整改部门')),
                ('dept_res', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='hazard_dept_res', to='system.dept', verbose_name='责任部门')),
                ('photos', models.ManyToManyField(blank=True, related_name='hazard_photos', to='system.File', verbose_name='现场照片')),
                ('photos_done', models.ManyToManyField(blank=True, related_name='hazard_photos_done', to='system.File', verbose_name='整改后照片')),
                ('ticket', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='hazard_ticket', to='wf.ticket', verbose_name='关联工单')),
                ('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='hazard_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
                ('user_correct', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='hazard_user_correct', to=settings.AUTH_USER_MODEL, verbose_name='整改责任人')),
                ('user_discover', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='hazard_user_discover', to=settings.AUTH_USER_MODEL, verbose_name='发现人')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='checkwork',
            name='riskpoint',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='cwork_riskpoint', to='dpm.riskpoint', verbose_name='关联风险点'),
        ),
        migrations.AddField(
            model_name='checkwork',
            name='update_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='checkwork_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人'),
        ),
        migrations.AddField(
            model_name='checkwork',
            name='user_duty',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='指派人'),
        ),
        migrations.AddField(
            model_name='checktaskset',
            name='riskpoint',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='ctask_riskpoint', to='dpm.riskpoint', verbose_name='关联风险点'),
        ),
        migrations.AddField(
            model_name='checktaskset',
            name='update_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='checktaskset_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人'),
        ),
        migrations.AddField(
            model_name='checktaskset',
            name='user_duty',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, to=settings.AUTH_USER_MODEL, verbose_name='指派人'),
        ),
        migrations.CreateModel(
            name='CheckItem',
            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='删除标记')),
                ('result', models.PositiveSmallIntegerField(default=10, verbose_name='检查结果')),
                ('note', models.TextField(blank=True, null=True, verbose_name='备注')),
                ('checkwork', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='citem_checkwork', to='dpm.checkwork', verbose_name='关联检查工作')),
                ('hazard', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='citem_hazard', to='dpm.hazard', verbose_name='关联隐患')),
                ('risk', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='citem_risk', to='dpm.risk', verbose_name='关联风险')),
            ],
            options={
                'abstract': False,
            },
        ),
    ]
