# Generated by Django 5.2.7 on 2025-11-30 08:32

import business.models
import django.db.models.deletion
from django.db import migrations, models


class Migration(migrations.Migration):

    dependencies = [
        ('basic_info', '0016_merchantsetting_type'),
        ('business', '0009_purchaseorderitem_spec'),
    ]

    operations = [
        migrations.CreateModel(
            name='SalesOrder',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('id', models.BigAutoField(primary_key=True, serialize=False)),
                ('sales_date', models.DateField(verbose_name='销售日期')),
                ('kind', models.IntegerField(choices=[(1, '大货'), (2, '样板')], default=1, verbose_name='销售单类型')),
                ('status', models.IntegerField(choices=[(1, '审批中'), (2, '审批通过'), (3, '作废')], default=1, verbose_name='状态')),
                ('remarks', models.TextField(blank=True, null=True, verbose_name='备注')),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='sales_orders', to='basic_info.customer', verbose_name='客户')),
                ('merchant', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='sales_orders', to='basic_info.merchant', verbose_name='所属商户')),
                ('operator', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='sales_orders', to='basic_info.employee', verbose_name='经办人')),
                ('warehouse', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='sales_orders', to='basic_info.warehouse', verbose_name='仓库')),
            ],
            options={
                'verbose_name': '销售单',
                'verbose_name_plural': '销售单',
            },
            bases=(business.models.OrderItemsAggregationMixin, business.models.OrderDirectionMixin, business.models.OrderCounterpartyMixin, models.Model),
        ),
        migrations.CreateModel(
            name='SalesOrderItem',
            fields=[
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('id', models.BigAutoField(primary_key=True, serialize=False)),
                ('price', models.DecimalField(decimal_places=2, max_digits=15, verbose_name='单价')),
                ('color', models.CharField(blank=True, max_length=50, null=True, verbose_name='颜色')),
                ('quantity', models.DecimalField(decimal_places=2, max_digits=10, verbose_name='数量')),
                ('unit', models.CharField(max_length=50, verbose_name='单位')),
                ('spec', models.CharField(blank=True, max_length=100, null=True, verbose_name='规格')),
                ('empty_diff_percent', models.DecimalField(decimal_places=2, max_digits=15, verbose_name='空差百分比')),
                ('quantity_of_rolls', models.CharField(blank=True, max_length=255, null=True, verbose_name='各条数数量')),
                ('num_of_rolls', models.PositiveIntegerField(default=1, verbose_name='条数')),
                ('consume_detail_ids', models.CharField(blank=True, max_length=255, null=True, verbose_name='消耗入库明细ID列表')),
                ('batch_number', models.CharField(blank=True, max_length=100, null=True, verbose_name='批次号')),
                ('remarks', models.TextField(blank=True, null=True, verbose_name='备注')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='sales_order_items', to='basic_info.product', verbose_name='产品')),
                ('sales_order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='business.salesorder', verbose_name='销售单')),
            ],
            options={
                'verbose_name': '销售单明细',
                'verbose_name_plural': '销售单明细',
            },
        ),
    ]
