# Generated by Django 3.1.4 on 2022-07-07 14:51

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


class Migration(migrations.Migration):

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('product', '0034_product_shelf_life'),
        ('company', '0300_user_roles'),
        ('sales', '0285_fakelabel_ancestor'),
    ]

    operations = [
        migrations.CreateModel(
            name='CouponBatch',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('dt', models.DateField(auto_now_add=True, db_index=True, verbose_name='日期')),
                ('tm', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('remark', models.CharField(blank=True, max_length=100, null=True, verbose_name='备注说明')),
            ],
            options={
                'verbose_name': '终端活动扫码',
                'verbose_name_plural': '终端活动扫码',
            },
        ),
        migrations.AlterField(
            model_name='activities',
            name='target',
            field=models.SmallIntegerField(choices=[(1, '消费者扫码'), (1, '经销商物料回收扫码')], default=1, verbose_name='活动对象'),
        ),
        migrations.CreateModel(
            name='CouponDetails',
            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, unique=True, verbose_name='标签号码')),
                ('label_pkg', models.SmallIntegerField(blank=True, db_index=True, null=True, verbose_name='标签类型')),
                ('label_id', models.BigIntegerField(blank=True, db_index=True, null=True, verbose_name='标签ID')),
                ('label_pk_id', models.BigIntegerField(blank=True, db_index=True, null=True, verbose_name='主箱标ID')),
                ('ancestor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='coupondetails_ancestor', to='company.company', verbose_name='所属企业')),
                ('batch', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='coupondetails_company', to='sales.couponbatch', verbose_name='活动扫码batch')),
                ('company', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='coupondetails_company', to='company.company', verbose_name='扫码单位')),
                ('product', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='coupondetails_product', to='product.product', verbose_name='产品名称')),
            ],
            options={
                'verbose_name': '终端活动扫码明细',
                'verbose_name_plural': '终端活动扫码明细',
            },
        ),
        migrations.AddField(
            model_name='couponbatch',
            name='activity',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='coupounbatch_activity', to='sales.activities', verbose_name='所属活动'),
        ),
        migrations.AddField(
            model_name='couponbatch',
            name='ancestor',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='couponbatch_ancestor', to='company.company', verbose_name='所属企业'),
        ),
        migrations.AddField(
            model_name='couponbatch',
            name='award',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='coupounbatch_award', to='sales.activityawards', verbose_name='奖项'),
        ),
        migrations.AddField(
            model_name='couponbatch',
            name='company',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='couponbatch_company', to='company.company', verbose_name='扫码单位'),
        ),
        migrations.AddField(
            model_name='couponbatch',
            name='user',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='coupounbatch_user', to=settings.AUTH_USER_MODEL, verbose_name='操作人'),
        ),
    ]
