# Generated by Django 3.2.12 on 2023-06-20 09:05

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 = [
        ('mtm', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='SfLog',
            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='删除标记')),
                ('start_time', models.DateTimeField(verbose_name='值班开始')),
                ('end_time', models.DateTimeField(verbose_name='值班结束')),
                ('note', models.TextField(blank=True, null=True, verbose_name='其他备注')),
                ('qua_data', models.JSONField(blank=True, null=True, verbose_name='质检数据')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='sflog_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('leader', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to=settings.AUTH_USER_MODEL, verbose_name='班长')),
                ('mgroup', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mtm.mgroup', verbose_name='关联工段')),
                ('shift', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mtm.shift', verbose_name='当班班次')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='StLog',
            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='删除标记')),
                ('start_time', models.DateTimeField(verbose_name='停机开始')),
                ('end_time', models.DateTimeField(blank=True, null=True, verbose_name='停机结束')),
                ('duration', models.FloatField(blank=True, null=True, verbose_name='停机时长(h)')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='stlog_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('mgroup', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mtm.mgroup', verbose_name='关联工段')),
                ('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='stlog_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='StSfLog',
            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_current_down', models.BooleanField(default=False, verbose_name='是否本班停机')),
                ('reason', models.TextField(blank=True, null=True, verbose_name='停机原因')),
                ('sflog', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='wpm.sflog', verbose_name='关联值班记录')),
                ('stlog', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='wpm.stlog', verbose_name='关联停机记录')),
            ],
            options={
                'ordering': ['sflog__start_time'],
            },
        ),
        migrations.AddField(
            model_name='sflog',
            name='stlogs',
            field=models.ManyToManyField(through='wpm.StSfLog', to='wpm.StLog', verbose_name='关联停机记录'),
        ),
        migrations.AddField(
            model_name='sflog',
            name='team',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mtm.team', verbose_name='班组'),
        ),
        migrations.AddField(
            model_name='sflog',
            name='update_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='sflog_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人'),
        ),
    ]
