# Generated by Django 5.2.8 on 2026-01-13 09:45

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        ('basic_info', '0024_frontend_page_and_visible_pages'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.CreateModel(
            name='Shipment',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('shipment_date', models.DateField(help_text='实际出货日期', verbose_name='出货日期')),
                ('remark', models.TextField(blank=True, default='', verbose_name='备注')),
                ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_shipments', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('customer', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='shipments', to='basic_info.customer', verbose_name='客户')),
            ],
            options={
                'verbose_name': '出货单',
                'verbose_name_plural': '出货单',
                'db_table': 'shipment',
                'ordering': ['-created_at'],
            },
        ),
        migrations.CreateModel(
            name='SalesItem',
            fields=[
                ('id', models.BigAutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('created_at', models.DateTimeField(auto_now_add=True, verbose_name='创建时间')),
                ('updated_at', models.DateTimeField(auto_now=True, verbose_name='更新时间')),
                ('name', models.CharField(max_length=200, verbose_name='名称')),
                ('quantity', models.DecimalField(decimal_places=2, max_digits=12, verbose_name='数量')),
                ('unit', models.IntegerField(choices=[(1, '米'), (2, '件'), (3, '码'), (4, '个')], default=2, verbose_name='单位')),
                ('printing_job_id', models.PositiveIntegerField(blank=True, help_text='关联的 PrintingJob ID（可空）', null=True, verbose_name='关联生产任务ID')),
                ('customer_id', models.PositiveIntegerField(blank=True, help_text='销售品级别的客户ID（可空）', null=True, verbose_name='客户ID')),
                ('created_by', models.ForeignKey(null=True, on_delete=django.db.models.deletion.SET_NULL, related_name='created_sales_items', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('shipment', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='items', to='shipment.shipment', verbose_name='出货单')),
            ],
            options={
                'verbose_name': '销售品',
                'verbose_name_plural': '销售品',
                'db_table': 'sales_item',
                'ordering': ['id'],
            },
        ),
    ]
