# Generated by Django 3.1.4 on 2021-06-07 08:48

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


class Migration(migrations.Migration):

    dependencies = [
        ('company', '0210_companycfg_mes_mgt'),
        ('product', '0015_auto_20210428_1433'),
        ('mes', '0009_auto_20210604_1623'),
    ]

    operations = [
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('customer', models.CharField(blank=True, max_length=100, null=True, verbose_name='客户名称')),
                ('code', models.CharField(blank=True, max_length=20, null=True, verbose_name='订单编号')),
                ('dt_delivery', models.DateField(blank=True, null=True, verbose_name='交货日期')),
                ('dt', models.DateField(blank=True, db_index=True, default=django.utils.timezone.now, null=True, verbose_name='日期')),
                ('tm', models.DateTimeField(blank=True, default=django.utils.timezone.now, null=True, verbose_name='时间')),
                ('is_delete', models.BooleanField(blank=True, db_index=True, default=False, null=True, verbose_name='是否已删除')),
                ('agent', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='order_agent', to='company.company', verbose_name='客户')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='order_company', to='company.company', verbose_name='公司')),
            ],
            options={
                'verbose_name': '生产订单',
                'verbose_name_plural': '生产订单',
            },
        ),
        migrations.AlterField(
            model_name='stkdetails',
            name='store_fr',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='messtkdetials_store_fr', to='mes.storehouse', verbose_name='仓库名称'),
        ),
        migrations.CreateModel(
            name='OrderDetails',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('qty', models.IntegerField(verbose_name='数量')),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='mes.order', verbose_name='生产订单')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='product.product', verbose_name='产成品名称')),
                ('unit', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='orderdetails_unit', to='mes.unit', verbose_name='单位')),
            ],
            options={
                'verbose_name': '生产订单明细',
                'verbose_name_plural': '生产订单明细',
            },
        ),
    ]
