# Generated by Django 3.2.6 on 2021-11-08 15:35

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


class Migration(migrations.Migration):

    dependencies = [
        ('mtm', '0029_step_type'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('wpm', '0009_wproduct_parent'),
    ]

    operations = [
        migrations.CreateModel(
            name='Operation',
            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='删除标记')),
                ('wproducts', models.JSONField(blank=True, default=list, verbose_name='关联产品ID列表')),
                ('remark', models.CharField(blank=True, max_length=200, null=True, verbose_name='操作备注')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='operation_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('m_state', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='mtm.material', verbose_name='操作时的物料状态')),
                ('p_state', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='mtm.step', verbose_name='操作步骤')),
                ('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='operation_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='OperationMaterial',
            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='删除标记')),
                ('type', models.IntegerField(choices=[(1, '消耗'), (2, '产出')], default=0, verbose_name='类型')),
                ('count', models.IntegerField(verbose_name='消耗或产出数量')),
                ('material', models.ForeignKey(blank=True, null=True, 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='关联的生产操作')),
                ('wmaterial', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='wpm.wmaterial', verbose_name='关联的车间物料')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='OperationRecord',
            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='删除标记')),
                ('create_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='operationrecord_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('form', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mtm.recordform', verbose_name='所用的生产记录表格')),
                ('operation', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='wpm.operation', verbose_name='关联的生产操作')),
                ('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='operationrecord_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='OperationRecordItem',
            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='删除标记')),
                ('field_name', models.CharField(max_length=50, verbose_name='字段名')),
                ('field_key', models.CharField(max_length=50, verbose_name='字段标识')),
                ('field_type', models.CharField(choices=[(1, '生产记录'), (2, '检验记录')], max_length=50, verbose_name='字段类型')),
                ('field_value', models.JSONField(blank=True, default=dict, verbose_name='录入值')),
                ('sort', models.IntegerField(default=1, verbose_name='排序号')),
                ('form_field', models.ForeignKey(db_constraint=False, on_delete=django.db.models.deletion.CASCADE, to='mtm.recordformfield', verbose_name='关联字段')),
                ('operation_record', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='wpm.operation', verbose_name='关联的生产记录')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.RemoveField(
            model_name='wproductmaterial',
            name='material',
        ),
        migrations.RemoveField(
            model_name='wproductmaterial',
            name='wmaterial',
        ),
        migrations.RemoveField(
            model_name='wproductmaterial',
            name='wproduct_action',
        ),
        migrations.RemoveField(
            model_name='wproductrecord',
            name='create_by',
        ),
        migrations.RemoveField(
            model_name='wproductrecord',
            name='form',
        ),
        migrations.RemoveField(
            model_name='wproductrecord',
            name='update_by',
        ),
        migrations.RemoveField(
            model_name='wproductrecord',
            name='wproduct_action',
        ),
        migrations.RemoveField(
            model_name='wproductrecorditem',
            name='form_field',
        ),
        migrations.RemoveField(
            model_name='wproductrecorditem',
            name='wproduct_record',
        ),
        migrations.DeleteModel(
            name='WProductAction',
        ),
        migrations.DeleteModel(
            name='WProductMaterial',
        ),
        migrations.DeleteModel(
            name='WProductRecord',
        ),
        migrations.DeleteModel(
            name='WProductRecordItem',
        ),
    ]
