# Generated by Django 5.2.8 on 2026-05-08 08:43

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


class Migration(migrations.Migration):

    dependencies = [
        ('basic_info', '0026_transportvehicle_and_capacity'),
        ('contenttypes', '0002_remove_content_type_name'),
        ('mes', '0001_initial'),
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
    ]

    operations = [
        migrations.AddField(
            model_name='device',
            name='capacity_unit',
            field=models.IntegerField(choices=[(1, '米'), (2, '码')], default=1, verbose_name='产能单位'),
        ),
        migrations.AddField(
            model_name='device',
            name='peak_capacity',
            field=models.PositiveIntegerField(default=100, verbose_name='峰值产能'),
        ),
        migrations.CreateModel(
            name='ProductionAssignment',
            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)),
                ('object_id', models.PositiveBigIntegerField(db_index=True, verbose_name='关联对象ID')),
                ('extra', models.JSONField(blank=True, null=True, verbose_name='扩展参数')),
                ('assignee', models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.PROTECT, related_name='received_mes_production_assignments', to='basic_info.employee', verbose_name='被指派人')),
                ('assigner', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='assigned_mes_production_assignments', to='basic_info.employee', verbose_name='指派者')),
                ('content_type', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='mes_production_assignments', to='contenttypes.contenttype', verbose_name='关联对象类型')),
                ('created_by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='created_mes_production_assignments', to=settings.AUTH_USER_MODEL, verbose_name='创建人')),
                ('device', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='production_assignments', to='mes.device', verbose_name='设备')),
                ('merchant', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='mes_production_assignments', to='basic_info.merchant', verbose_name='所属商户')),
                ('operator', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, related_name='operated_mes_production_assignments', to='basic_info.employee', verbose_name='操作人')),
            ],
            options={
                'verbose_name': '生产指派',
                'verbose_name_plural': '生产指派',
                'ordering': ['-created_at', '-id'],
                'indexes': [models.Index(fields=['merchant', 'content_type', 'object_id'], name='mes_product_merchan_a3ff6f_idx'), models.Index(fields=['merchant', 'device', 'created_at'], name='mes_product_merchan_ae938e_idx')],
            },
        ),
    ]
