# Generated by Django 3.2.6 on 2021-11-17 14:54

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


class Migration(migrations.Migration):

    dependencies = [
        ('mtm', '0035_auto_20211117_1637'),
        ('pm', '0013_alter_subproductionplan_subproduction'),
        ('wpm', '0013_auto_20211116_0841'),
    ]

    operations = [
        migrations.RenameField(
            model_name='operation',
            old_name='p_state',
            new_name='step',
        ),
        migrations.RemoveField(
            model_name='operation',
            name='m_state',
        ),
        migrations.RemoveField(
            model_name='operation',
            name='wproducts',
        ),
        migrations.CreateModel(
            name='OperationWproduct',
            fields=[
                ('id', models.BigAutoField(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='删除标记')),
                ('number', models.CharField(blank=True, max_length=50, null=True, verbose_name='物品编号')),
                ('material', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mtm.material', verbose_name='操作时的物料状态')),
                ('operation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='wpm.operation', verbose_name='关联操作')),
                ('production_plan', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pm.productionplan', verbose_name='当前主生产计划')),
                ('subproduction_plan', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pm.subproductionplan', verbose_name='当前子生产计划')),
                ('wproduct', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='wpm.wproduct', verbose_name='关联半成品')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='operation',
            name='wproducts',
            field=models.ManyToManyField(through='wpm.OperationWproduct', to='wpm.WProduct', verbose_name='关联半成品'),
        ),
    ]
