# Generated by Django 2.0.4 on 2018-07-09 00:25

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


class Migration(migrations.Migration):

    initial = True

    dependencies = [
    ]

    operations = [
        migrations.CreateModel(
            name='item',
            fields=[
                ('item', models.CharField(max_length=40, primary_key=True, serialize=False, verbose_name='料号')),
                ('itemdesc', models.CharField(max_length=200, verbose_name='物料说明')),
                ('uom', models.CharField(max_length=40, verbose_name='单位')),
                ('volume', models.DecimalField(blank=True, decimal_places=6, max_digits=12, null=True, verbose_name='体积(立方米)')),
                ('weight', models.DecimalField(blank=True, decimal_places=6, max_digits=12, null=True, verbose_name='重量(千克)')),
                ('minqty', models.DecimalField(blank=True, decimal_places=4, max_digits=12, null=True, verbose_name='最小存量')),
                ('maxqty', models.DecimalField(blank=True, decimal_places=4, max_digits=12, null=True, verbose_name='最大存量')),
                ('validity', models.DecimalField(blank=True, decimal_places=2, max_digits=12, null=True, verbose_name='有效期(天)')),
                ('lotcontrol', models.BooleanField(default=False, verbose_name='批号管制')),
                ('updatetime', models.DateTimeField(default=django.utils.timezone.now, verbose_name='创建时间')),
            ],
            options={
                'verbose_name': '605存储属性',
                'verbose_name_plural': '605存储属性',
            },
        ),
        migrations.CreateModel(
            name='locator',
            fields=[
                ('code', models.CharField(max_length=40, primary_key=True, serialize=False, verbose_name='储位编码')),
                ('name', models.CharField(max_length=80, verbose_name='储位名称')),
                ('Xaxis', models.DecimalField(decimal_places=3, default=1, max_digits=12, verbose_name='X坐标')),
                ('Yaxis', models.DecimalField(decimal_places=3, default=1, max_digits=12, verbose_name='Y坐标')),
                ('Zaxis', models.DecimalField(decimal_places=3, default=1, max_digits=12, verbose_name='Z坐标')),
                ('length', models.DecimalField(decimal_places=3, default=1, max_digits=12, verbose_name='储位长(m)')),
                ('width', models.DecimalField(decimal_places=3, default=1, max_digits=12, verbose_name='储位宽(m)')),
                ('heigth', models.DecimalField(decimal_places=3, default=1, max_digits=12, verbose_name='储位高(m)')),
                ('states', models.SmallIntegerField(default=1, verbose_name='储位状态')),
                ('updatetime', models.DateTimeField(default=django.utils.timezone.now, verbose_name='创建时间')),
            ],
            options={
                'verbose_name': '602储位定义',
                'verbose_name_plural': '602储位定义',
            },
        ),
        migrations.CreateModel(
            name='storage',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('item', models.CharField(max_length=40, verbose_name='料号')),
                ('lot', models.CharField(max_length=120, null=True, verbose_name='批号')),
                ('qty', models.DecimalField(decimal_places=4, default=0, max_digits=12, verbose_name='进出数量')),
                ('capacity', models.DecimalField(decimal_places=4, default=0, max_digits=8, verbose_name='占用空间')),
                ('updatetime', models.DateTimeField(default=django.utils.timezone.now, verbose_name='创建时间')),
                ('locator', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='storagel', to='p_wms.locator', verbose_name='储位')),
            ],
            options={
                'verbose_name': '604当前存货',
                'verbose_name_plural': '604当前存货',
            },
        ),
        migrations.CreateModel(
            name='transaction',
            fields=[
                ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                ('IO', models.CharField(choices=[('1', '入库'), ('-1', '出库')], max_length=4, verbose_name='作业')),
                ('item', models.CharField(max_length=40, verbose_name='料号')),
                ('lot', models.CharField(blank=True, max_length=120, null=True, verbose_name='批号')),
                ('qty', models.DecimalField(decimal_places=4, default=0, max_digits=12, verbose_name='进出数量')),
                ('capacity', models.DecimalField(blank=True, decimal_places=4, default=0, max_digits=8, null=True, verbose_name='占用空间')),
                ('updatetime', models.DateTimeField(default=django.utils.timezone.now, verbose_name='创建时间')),
                ('updatename', models.CharField(max_length=40, null=True, verbose_name='操作者')),
                ('locator', models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='transactionl', to='p_wms.locator', verbose_name='储位')),
            ],
            options={
                'verbose_name': '603出入库',
                'verbose_name_plural': '603出入库',
            },
        ),
        migrations.CreateModel(
            name='warehouse',
            fields=[
                ('code', models.CharField(max_length=40, primary_key=True, serialize=False, verbose_name='仓库编码')),
                ('name', models.CharField(max_length=80, verbose_name='仓库名称')),
                ('FA', models.CharField(blank=True, max_length=80, null=True, verbose_name='财务')),
                ('wmsdesc', models.TextField(blank=True, null=True, verbose_name='说明')),
                ('updatetime', models.DateTimeField(default=django.utils.timezone.now, verbose_name='创建时间')),
            ],
            options={
                'verbose_name': '601仓库定义',
                'verbose_name_plural': '601仓库定义',
            },
        ),
        migrations.AddField(
            model_name='transaction',
            name='warehouse',
            field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='transactionw', to='p_wms.warehouse', verbose_name='仓库'),
        ),
        migrations.AddField(
            model_name='storage',
            name='warehouse',
            field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='storagew', to='p_wms.warehouse', verbose_name='仓库'),
        ),
        migrations.AddField(
            model_name='locator',
            name='parent',
            field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='locator', to='p_wms.warehouse', verbose_name='所属仓库'),
        ),
        migrations.AddField(
            model_name='item',
            name='locator',
            field=models.ManyToManyField(blank=True, null=True, related_name='iteml', to='p_wms.locator', verbose_name='默认储位'),
        ),
        migrations.AddField(
            model_name='item',
            name='warehouse',
            field=models.ForeignKey(on_delete=django.db.models.deletion.DO_NOTHING, related_name='itemw', to='p_wms.warehouse', verbose_name='仓库'),
        ),
        migrations.AlterUniqueTogether(
            name='storage',
            unique_together={('item', 'lot', 'warehouse', 'locator')},
        ),
    ]
