# Generated by Django 5.2.7 on 2025-12-01 08:22

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', '0013_balancechangerecord'),
    ]

    operations = [
        migrations.AlterField(
            model_name='balancechangerecord',
            name='source_type',
            field=models.IntegerField(choices=[(1, '采购单'), (2, '销售单'), (3, '付款单'), (4, '收款单'), (5, '采购退货单'), (6, '销售退货单')], verbose_name='来源业务类型'),
        ),
        migrations.CreateModel(
            name='PurchaseReturnOrder',
            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)),
                ('return_date', models.DateField(verbose_name='退货日期')),
                ('status', models.IntegerField(choices=[(1, '审批中'), (2, '审批通过'), (3, '作废')], default=1, verbose_name='状态')),
                ('remarks', models.TextField(blank=True, null=True, verbose_name='备注')),
                ('merchant', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='purchase_return_orders', to='basic_info.merchant', verbose_name='所属商户')),
                ('operator', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='purchase_return_orders', to='basic_info.employee', verbose_name='经办人')),
                ('purchase_order', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='return_orders', to='business.purchaseorder', verbose_name='原采购单')),
                ('supplier', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='purchase_return_orders', to='basic_info.supplier', verbose_name='供应商')),
                ('warehouse', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='purchase_return_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='PurchaseReturnOrderItem',
            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='purchase_return_order_items', to='basic_info.product', verbose_name='产品')),
                ('purchase_return_order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='business.purchasereturnorder', verbose_name='采购退货单')),
            ],
            options={
                'verbose_name': '采购退货明细',
                'verbose_name_plural': '采购退货明细',
            },
        ),
        migrations.CreateModel(
            name='SalesReturnOrder',
            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)),
                ('return_date', models.DateField(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_return_orders', to='basic_info.customer', verbose_name='客户')),
                ('merchant', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='sales_return_orders', to='basic_info.merchant', verbose_name='所属商户')),
                ('operator', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='sales_return_orders', to='basic_info.employee', verbose_name='经办人')),
                ('sales_order', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='return_orders', to='business.salesorder', verbose_name='原销售单')),
                ('warehouse', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='sales_return_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='SalesReturnOrderItem',
            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_return_order_items', to='basic_info.product', verbose_name='产品')),
                ('sales_return_order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='business.salesreturnorder', verbose_name='销售退货单')),
            ],
            options={
                'verbose_name': '销售退货明细',
                'verbose_name_plural': '销售退货明细',
            },
        ),
    ]
