# Generated by Django 2.0.1 on 2018-01-15 06:46

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
        migrations.swappable_dependency(settings.AUTH_USER_MODEL),
        ('controller', '0001_initial'),
    ]

    operations = [
        migrations.CreateModel(
            name='Brand',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=20)),
            ],
        ),
        migrations.CreateModel(
            name='Item',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('number', models.CharField(max_length=40)),
                ('name', models.CharField(max_length=40)),
                ('client_price', models.DecimalField(decimal_places=2, max_digits=8)),
                ('supplier_price', models.DecimalField(decimal_places=2, max_digits=8)),
                ('is_active', models.BooleanField(default=1)),
                ('create_time', models.DateTimeField(auto_now_add=True)),
                ('update_time', models.DateTimeField(auto_now=True)),
                ('close_time', models.DateTimeField(default=None)),
                ('client', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='controller.Client')),
                ('corresponding_supplier', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='corresponding_supplier', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ItemType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=40)),
                ('pid', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='manager.ItemType')),
            ],
        ),
        migrations.CreateModel(
            name='Material',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('number', models.CharField(max_length=40)),
                ('name', models.CharField(max_length=40)),
                ('size', models.CharField(max_length=200)),
                ('image', models.ImageField(upload_to='')),
                ('opening_price', models.DecimalField(decimal_places=2, max_digits=8)),
                ('selling_price', models.DecimalField(decimal_places=2, max_digits=8)),
                ('is_active', models.BooleanField(default=1)),
                ('create_time', models.DateTimeField(auto_now_add=True)),
                ('update_time', models.DateTimeField(auto_now=True)),
                ('close_time', models.DateTimeField(default=None)),
                ('stock', models.IntegerField()),
                ('storage_location', models.CharField(max_length=80)),
                ('brand', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='manager.Brand')),
                ('client', models.ManyToManyField(to='controller.Client')),
                ('storage', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='storage', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='MaterialType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=40)),
                ('pid', models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='manager.MaterialType')),
            ],
        ),
        migrations.CreateModel(
            name='Order',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('number', models.CharField(max_length=80)),
                ('address', models.CharField(max_length=80)),
                ('create_time', models.DateTimeField(auto_now_add=True)),
                ('close_time', models.DateTimeField()),
                ('status', models.CharField(choices=[('SR', 'storage received orders of foreman'), ('SS', 'storage sent material to foreman'), ('FR', 'foreman has received material'), ('SC', 'storage confirm the order'), ('FC', 'oder has been cancel by foreman')], max_length=2)),
                ('is_close', models.BooleanField()),
                ('foreman', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='oder_foreman', to=settings.AUTH_USER_MODEL)),
                ('storage', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='oder_storage', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='OrderDetail',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('order_number', models.IntegerField()),
                ('is_received', models.BooleanField()),
                ('received_time', models.DateTimeField()),
                ('receive_number', models.IntegerField()),
                ('material', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='manager.Material')),
                ('order', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='manager.Order')),
            ],
        ),
        migrations.CreateModel(
            name='Project',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('number', models.CharField(max_length=80)),
                ('address', models.CharField(max_length=80)),
                ('create_time', models.DateTimeField(auto_now_add=True)),
                ('expected_time', models.DateTimeField()),
                ('finished_time', models.DateTimeField()),
                ('supplier_confirm_time', models.DateTimeField()),
                ('close_time', models.DateTimeField()),
                ('client', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='controller.Client')),
                ('default_supervisor', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='default_supervisor', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ProjectDaily',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('description', models.CharField(max_length=500)),
                ('create_time', models.DateTimeField(auto_now_add=True)),
                ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='manager.Project')),
            ],
        ),
        migrations.CreateModel(
            name='ProjectDetail',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('expected_number', models.IntegerField()),
                ('actual_number', models.IntegerField()),
                ('supplier_number', models.IntegerField()),
                ('item', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='manager.Item')),
                ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='manager.Project')),
            ],
        ),
        migrations.CreateModel(
            name='ProjectFine',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('money', models.IntegerField()),
                ('description', models.CharField(max_length=500)),
                ('project', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='manager.Project')),
                ('user', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='user', to=settings.AUTH_USER_MODEL)),
            ],
        ),
        migrations.CreateModel(
            name='ProjectProperty',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=20)),
                ('description', models.CharField(max_length=500)),
            ],
        ),
        migrations.CreateModel(
            name='ProjectType',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=20)),
                ('description', models.CharField(max_length=500)),
            ],
        ),
        migrations.CreateModel(
            name='Unit',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('name', models.CharField(max_length=20)),
            ],
        ),
        migrations.AddField(
            model_name='project',
            name='project_property',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='manager.ProjectProperty'),
        ),
        migrations.AddField(
            model_name='project',
            name='project_type',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='manager.ProjectType'),
        ),
        migrations.AddField(
            model_name='project',
            name='supplier',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, related_name='supplier', to=settings.AUTH_USER_MODEL),
        ),
        migrations.AddField(
            model_name='material',
            name='type',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='manager.MaterialType'),
        ),
        migrations.AddField(
            model_name='material',
            name='unit',
            field=models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='manager.Unit'),
        ),
        migrations.AddField(
            model_name='item',
            name='type',
            field=models.ForeignKey(null=True, on_delete=django.db.models.deletion.CASCADE, to='manager.ItemType'),
        ),
    ]
