# Generated by Django 3.2.12 on 2025-01-02 01:58

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('wpm', '0078_auto_20250102_0958'),
        ('inm', '0023_auto_20250102_0858'),
        ('mtm', '0048_auto_20241218_1431'),
        ('qm', '0032_defect_note'),
    ]

    operations = [
        migrations.CreateModel(
            name='WprDefect',
            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='是否主要缺陷')),
                ('defect', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='qm.defect', verbose_name='关联缺陷项')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Wpr',
            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=50, null=True, unique=True, verbose_name='编号')),
                ('state', models.PositiveSmallIntegerField(choices=[(10, '合格'), (20, '不合格'), (30, '返修'), (40, '检验'), (50, '报废')], default=10, verbose_name='状态')),
                ('defects', models.ManyToManyField(through='wpmw.WprDefect', to='qm.Defect', verbose_name='缺陷项')),
                ('material', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mtm.material', verbose_name='当前物料形态')),
                ('mb', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='inm.materialbatch', verbose_name='仓库物料')),
                ('wm', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='wpm.wmaterial', verbose_name='车间物料')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='wprdefect',
            name='wpr',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='wpmw.wpr', verbose_name='关联产物'),
        ),
    ]
