diff --git a/apps/mtm/migrations/0024_auto_20231116_1416.py b/apps/mtm/migrations/0024_auto_20231116_1416.py new file mode 100644 index 00000000..53a39d5c --- /dev/null +++ b/apps/mtm/migrations/0024_auto_20231116_1416.py @@ -0,0 +1,23 @@ +# Generated by Django 3.2.12 on 2023-11-16 06:16 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('mtm', '0023_auto_20231102_1128'), + ] + + operations = [ + migrations.AddField( + model_name='material', + name='model', + field=models.CharField(blank=True, max_length=100, null=True, verbose_name='型号'), + ), + migrations.AlterField( + model_name='material', + name='specification', + field=models.CharField(blank=True, max_length=100, null=True, verbose_name='规格'), + ), + ] diff --git a/apps/mtm/models.py b/apps/mtm/models.py index b47fec85..4ba0ff58 100644 --- a/apps/mtm/models.py +++ b/apps/mtm/models.py @@ -45,8 +45,10 @@ class Material(CommonAModel): name = models.CharField('名称', max_length=50) cate = models.CharField('大类', max_length=20, default='', blank=True) number = models.CharField('编号', max_length=100, null=True, blank=True) - specification = models.CharField( + model = models.CharField( '型号', max_length=100, null=True, blank=True) + specification = models.CharField( + '规格', max_length=100, null=True, blank=True) code = models.CharField('标识', max_length=50, null=True, blank=True) type = models.PositiveSmallIntegerField( '物料类型', choices=type_choices, default=1, help_text=str(type_choices)) @@ -70,7 +72,7 @@ class Material(CommonAModel): ordering = ['sort', '-create_time'] def __str__(self): - return f'{self.specification}-{self.name}' + return f'{self.name}-{self.model}-{self.specification}' class Shift(CommonAModel): diff --git a/apps/mtm/serializers.py b/apps/mtm/serializers.py index f9be2640..ba47b93b 100644 --- a/apps/mtm/serializers.py +++ b/apps/mtm/serializers.py @@ -17,7 +17,7 @@ class ShiftSerializer(CustomModelSerializer): class MaterialSimpleSerializer(CustomModelSerializer): class Meta: model = Material - fields = ['id', 'name', 'number', + fields = ['id', 'name', 'number', 'model', 'specification', 'type', 'cate', 'brothers']