feat: 增加规格型号字段
This commit is contained in:
parent
74ae25faf6
commit
3caf59f33d
|
@ -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='规格'),
|
||||||
|
),
|
||||||
|
]
|
|
@ -45,8 +45,10 @@ class Material(CommonAModel):
|
||||||
name = models.CharField('名称', max_length=50)
|
name = models.CharField('名称', max_length=50)
|
||||||
cate = models.CharField('大类', max_length=20, default='', blank=True)
|
cate = models.CharField('大类', max_length=20, default='', blank=True)
|
||||||
number = models.CharField('编号', max_length=100, null=True, 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)
|
'型号', 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)
|
code = models.CharField('标识', max_length=50, null=True, blank=True)
|
||||||
type = models.PositiveSmallIntegerField(
|
type = models.PositiveSmallIntegerField(
|
||||||
'物料类型', choices=type_choices, default=1, help_text=str(type_choices))
|
'物料类型', choices=type_choices, default=1, help_text=str(type_choices))
|
||||||
|
@ -70,7 +72,7 @@ class Material(CommonAModel):
|
||||||
ordering = ['sort', '-create_time']
|
ordering = ['sort', '-create_time']
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return f'{self.specification}-{self.name}'
|
return f'{self.name}-{self.model}-{self.specification}'
|
||||||
|
|
||||||
|
|
||||||
class Shift(CommonAModel):
|
class Shift(CommonAModel):
|
||||||
|
|
|
@ -17,7 +17,7 @@ class ShiftSerializer(CustomModelSerializer):
|
||||||
class MaterialSimpleSerializer(CustomModelSerializer):
|
class MaterialSimpleSerializer(CustomModelSerializer):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Material
|
model = Material
|
||||||
fields = ['id', 'name', 'number',
|
fields = ['id', 'name', 'number', 'model',
|
||||||
'specification', 'type', 'cate', 'brothers']
|
'specification', 'type', 'cate', 'brothers']
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue