# Generated by Django 2.1.7 on 2020-05-16 11:40

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


class Migration(migrations.Migration):

    dependencies = [
        ('company', '0026_auto_20200515_1254'),
        ('product', '0004_auto_20200511_1642'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('inventory', '0028_auto_20200511_0803'),
    ]

    operations = [
        migrations.CreateModel(
            name='RecipientDetails',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('label_code', models.CharField(db_index=True, max_length=20, verbose_name='标签号码')),
                ('label_pkg', models.SmallIntegerField(db_index=True, verbose_name='标签类型')),
                ('label_id', models.BigIntegerField(db_index=True, verbose_name='标签ID')),
                ('label_pk_id', models.BigIntegerField(db_index=True, verbose_name='标签PKID')),
                ('tm', models.DateTimeField(auto_now_add=True, verbose_name='时间')),
            ],
            options={
                'verbose_name': '业务员领用detail',
                'verbose_name_plural': '业务员领用detail',
            },
        ),
        migrations.CreateModel(
            name='RecipientsBatch',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('code', models.CharField(max_length=20, verbose_name='领用单号')),
                ('reason', models.CharField(max_length=150, verbose_name='领用原因')),
                ('tm', models.DateTimeField(auto_now_add=True, verbose_name='领用时间')),
                ('tm_writeoff', models.DateTimeField(blank=True, null=True, verbose_name='核销完成时间')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='recipient_batch_company', to='company.Company', verbose_name='公司')),
                ('receiver', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='receiver_batch_user', to=settings.AUTH_USER_MODEL, verbose_name='领用人')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='recipient_batch_user', to=settings.AUTH_USER_MODEL, verbose_name='操作员')),
            ],
            options={
                'verbose_name': '业务员领用Batch',
                'verbose_name_plural': '业务员领用Batch',
            },
        ),
        migrations.CreateModel(
            name='RecipientWriteoff',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('label_code', models.CharField(db_index=True, max_length=20, verbose_name='标签号码')),
                ('label_pkg', models.SmallIntegerField(db_index=True, verbose_name='标签类型')),
                ('label_id', models.BigIntegerField(db_index=True, verbose_name='标签ID')),
                ('label_pk_id', models.BigIntegerField(db_index=True, verbose_name='标签PKID')),
                ('tm', models.DateTimeField(auto_now_add=True, verbose_name='核销时间')),
                ('batch', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='inventory.RecipientsBatch', verbose_name='业务员领用Batch')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='recipient_writeoff_company', to='company.Company', verbose_name='公司')),
            ],
            options={
                'verbose_name': '业务员领用核销',
                'verbose_name_plural': '业务员领用核销',
            },
        ),
        migrations.RemoveField(
            model_name='delivery_details',
            name='summary',
        ),
        migrations.RemoveField(
            model_name='receiptbatch',
            name='company',
        ),
        migrations.RemoveField(
            model_name='receiptbatch',
            name='level',
        ),
        migrations.RemoveField(
            model_name='receiptbatch',
            name='product',
        ),
        migrations.RemoveField(
            model_name='receiptbatch',
            name='user',
        ),
        migrations.RemoveField(
            model_name='receiptdetails',
            name='batch',
        ),
        migrations.DeleteModel(
            name='delivery_details',
        ),
        migrations.DeleteModel(
            name='delivery_summary',
        ),
        migrations.DeleteModel(
            name='ReceiptBatch',
        ),
        migrations.DeleteModel(
            name='ReceiptDetails',
        ),
        migrations.AddField(
            model_name='recipientdetails',
            name='batch',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, to='inventory.RecipientsBatch', verbose_name='业务员领用Batch'),
        ),
        migrations.AddField(
            model_name='recipientdetails',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='recipient_detail_company', to='company.Company', verbose_name='公司'),
        ),
        migrations.AddField(
            model_name='recipientdetails',
            name='product',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='recipient_detail_product', to='product.Product', verbose_name='产品名称'),
        ),
        migrations.AlterUniqueTogether(
            name='recipientsbatch',
            unique_together={('company', 'code')},
        ),
    ]
