# Generated by Django 5.2.7 on 2025-11-27 08:08

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


class Migration(migrations.Migration):

    dependencies = [
        ('basic_info', '0013_alter_customer_options'),
        ('business', '0003_purchaseorder_status'),
    ]

    operations = [
        migrations.RemoveField(
            model_name='purchaseorder',
            name='total_amount',
        ),
        migrations.AddField(
            model_name='purchaseorder',
            name='warehouse',
            field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='purchase_orders', to='basic_info.warehouse', verbose_name='仓库'),
        ),
        migrations.CreateModel(
            name='PurchaseOrderItem',
            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.PositiveIntegerField(verbose_name='数量')),
                ('unit', models.CharField(max_length=50, 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='条数')),
                ('batch_number', models.PositiveIntegerField(default=1, verbose_name='批次号')),
                ('total_amount', models.DecimalField(decimal_places=2, max_digits=15, verbose_name='总金额')),
                ('remarks', models.TextField(blank=True, null=True, verbose_name='备注')),
                ('product', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='purchase_order_items', to='basic_info.product', verbose_name='产品')),
                ('purchase_order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='business.purchaseorder', verbose_name='采购单')),
            ],
            options={
                'verbose_name': '采购单明细',
                'verbose_name_plural': '采购单明细',
            },
        ),
    ]
