# Generated by Django 3.2.12 on 2024-01-10 09:37

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 = [
        ('system', '0003_alter_permission_parent'),
        ('mtm', '0025_auto_20231120_1139'),
        ('em', '0010_auto_20240110_1232'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Drain',
            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='删除标记')),
                ('type', models.PositiveSmallIntegerField(choices=[
                 (10, '排放口'), (20, '污染源')], help_text="((10, '排放口'), (20, '污染源'))", verbose_name='类型')),
                ('number', models.CharField(max_length=20, verbose_name='编号')),
                ('name', models.CharField(max_length=20, verbose_name='名称')),
                ('level', models.PositiveSmallIntegerField(choices=[
                 (10, '主要排放口'), (20, '次要排放口')], default=20, help_text="((10, '主要排放口'), (20, '次要排放口'))", verbose_name='排口等级')),
                ('cate', models.CharField(blank=True, choices=[('product', '生产工艺'), ('mtrans', '物料输送'), (
                    'mstore', '物料储存')], help_text="(('product', '生产工艺'), ('mtrans', '物料输送'), ('mstore', '物料储存'))", max_length=10, null=True, verbose_name='分类')),
                ('height', models.PositiveSmallIntegerField(
                    default=0, verbose_name='排气筒高度')),
                ('treatment_capacity', models.CharField(
                    default='', max_length=20, verbose_name='处理量')),
                ('pm_limit', models.FloatField(default=10,
                 help_text='单位:mg/m³', verbose_name='PM超低排放限值')),
                ('measure', models.CharField(default='',
                 max_length=20, verbose_name='治理措施')),
                ('coordinates', models.JSONField(
                    default=dict, null=True, verbose_name='坐标')),
                ('belong_dept', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL,
                 related_name='drain_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='drain_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='DrainEquip',
            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='删除标记')),
                ('params_list', models.JSONField(
                    default=list, null=True, verbose_name='监测参数列表')),
                ('drain', models.ForeignKey(
                    on_delete=django.db.models.deletion.CASCADE, to='enp.drain', verbose_name='排口')),
                ('equipment', models.ForeignKey(
                    on_delete=django.db.models.deletion.CASCADE, to='em.equipment', verbose_name='关联设备')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='drain',
            name='equipments',
            field=models.ManyToManyField(blank=True, related_name='drain_equipments',
                                         through='enp.DrainEquip', to='em.Equipment', verbose_name='关联设备'),
        ),
        migrations.AddField(
            model_name='drain',
            name='mgroup',
            field=models.ForeignKey(
                on_delete=django.db.models.deletion.CASCADE, to='mtm.mgroup', verbose_name='所属工段'),
        ),
        migrations.AddField(
            model_name='drain',
            name='update_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL,
                                    related_name='drain_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人'),
        ),
    ]
