# Generated by Django 3.2.12 on 2023-09-18 05:42

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', '0002_myschedule'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('mtm', '0009_process'),
    ]

    operations = [
        migrations.CreateModel(
            name='PuOrder',
            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='删除标记')),
                ('state', models.PositiveSmallIntegerField(choices=[(10, '创建中'), (20, '已提交'), (30, '到货中'), (40, '已完成')], default=10, help_text="((10, '创建中'), (20, '已提交'), (30, '到货中'), (40, '已完成'))", verbose_name='状态')),
                ('number', models.CharField(blank=True, max_length=20, null=True, verbose_name='订单编号')),
                ('delivery_date', models.DateField(blank=True, null=True, verbose_name='截止到货日期')),
                ('submit_time', models.DateTimeField(blank=True, null=True, verbose_name='提交时间')),
                ('belong_dept', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='puorder_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='puorder_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='PuPlan',
            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='删除标记')),
                ('state', models.PositiveSmallIntegerField(choices=[(10, '创建中'), (20, '已提交'), (30, '下单中'), (40, '下单完成'), (50, '已完成')], default=10, help_text="((10, '创建中'), (20, '已提交'), (30, '下单中'), (40, '下单完成'), (50, '已完成'))", verbose_name='状态')),
                ('number', models.CharField(max_length=20, verbose_name='编号')),
                ('name', models.CharField(blank=True, max_length=50, null=True, verbose_name='名称')),
                ('submit_time', models.DateTimeField(blank=True, null=True, verbose_name='提交时间')),
                ('belong_dept', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='puplan_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='puplan_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='puplan_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='Supplier',
            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='删除标记')),
                ('name', models.CharField(max_length=50, verbose_name='供应商名称')),
                ('contact', models.CharField(max_length=20, verbose_name='联系人')),
                ('contact_phone', models.CharField(max_length=11, verbose_name='联系电话')),
                ('address', models.CharField(default='', max_length=200, verbose_name='地址')),
                ('belong_dept', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='supplier_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='supplier_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='supplier_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='PuPlanItem',
            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='删除标记')),
                ('need_count', models.PositiveIntegerField(verbose_name='所属数量')),
                ('need_date', models.DateField(verbose_name='需求日期')),
                ('note', models.TextField(default='', verbose_name='备注')),
                ('belong_dept', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='puplanitem_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='puplanitem_create_by', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('material', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mtm.material', verbose_name='所需物料')),
                ('pu_order', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='puplan_item_puorder', to='pum.puorder', verbose_name='关联采购订单')),
                ('pu_plan', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='item_puplan', to='pum.puplan', verbose_name='采购计划')),
                ('update_by', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='puplanitem_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.CreateModel(
            name='PuOrderItem',
            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='删除标记')),
                ('count', models.PositiveIntegerField(default=0, verbose_name='所需数量')),
                ('delivered_count', models.PositiveIntegerField(default=0, verbose_name='已到货数量')),
                ('material', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mtm.material', verbose_name='物料')),
                ('pu_order', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='item_puorder', to='pum.puorder', verbose_name='关联采购订单')),
            ],
            options={
                'abstract': False,
            },
        ),
        migrations.AddField(
            model_name='puorder',
            name='supplier',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='pum.supplier', verbose_name='供应商'),
        ),
        migrations.AddField(
            model_name='puorder',
            name='update_by',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='puorder_update_by', to=settings.AUTH_USER_MODEL, verbose_name='最后编辑人'),
        ),
    ]
