修改输入输出物料计数字段
This commit is contained in:
parent
615e84e04a
commit
107891ad6d
|
@ -0,0 +1,23 @@
|
|||
# Generated by Django 3.2.6 on 2021-08-30 05:31
|
||||
|
||||
from django.db import migrations
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('mtm', '0005_auto_20210830_1313'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.RenameField(
|
||||
model_name='inputmaterial',
|
||||
old_name='number',
|
||||
new_name='count',
|
||||
),
|
||||
migrations.RenameField(
|
||||
model_name='outputmaterial',
|
||||
old_name='number',
|
||||
new_name='count',
|
||||
),
|
||||
]
|
|
@ -116,7 +116,7 @@ class InputMaterial(CommonAModel):
|
|||
输入物料
|
||||
"""
|
||||
material = models.ForeignKey(Material, verbose_name='输入物料', on_delete=models.CASCADE, related_name='inputmaterial')
|
||||
number = models.FloatField('消耗量', default=1)
|
||||
count = models.FloatField('消耗量', default=1)
|
||||
product = models.ForeignKey(Material, verbose_name='关联产品', on_delete=models.CASCADE, related_name='inputmaterial_product')
|
||||
process = models.ForeignKey(Process, verbose_name='关联工序', on_delete=models.CASCADE)
|
||||
sort = models.IntegerField('排序号', default=1)
|
||||
|
@ -131,7 +131,7 @@ class OutputMaterial(CommonAModel):
|
|||
输出物料
|
||||
"""
|
||||
material = models.ForeignKey(Material, verbose_name='输出物料', on_delete=models.CASCADE, related_name='outputmaterial')
|
||||
number = models.FloatField('产出量', default=1)
|
||||
count = models.FloatField('产出量', default=1)
|
||||
product = models.ForeignKey(Material, verbose_name='关联产品', on_delete=models.CASCADE, related_name='outputmaterial_product')
|
||||
process = models.ForeignKey(Process, verbose_name='关联工序', on_delete=models.CASCADE)
|
||||
sort = models.IntegerField('排序号', default=1)
|
||||
|
|
|
@ -70,7 +70,7 @@ class OutputMaterialListSerializer(serializers.ModelSerializer):
|
|||
class InputMaterialSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = InputMaterial
|
||||
fields = ['number', 'unit', 'sort', 'material', 'product', 'process']
|
||||
fields = ['count', 'sort', 'material', 'product', 'process']
|
||||
|
||||
def create(self, validated_data):
|
||||
if InputMaterial.objects.filter(material=validated_data['material'], product=validated_data['product'], process=validated_data['process'], is_deleted=False).exists():
|
||||
|
@ -80,12 +80,12 @@ class InputMaterialSerializer(serializers.ModelSerializer):
|
|||
class InputMaterialUpdateSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = InputMaterial
|
||||
fields = ['number', 'unit', 'sort']
|
||||
fields = ['count', 'sort']
|
||||
|
||||
class OutputMaterialSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = OutputMaterial
|
||||
fields = ['number', 'unit', 'sort', 'material', 'product', 'process']
|
||||
fields = ['count', 'sort', 'material', 'product', 'process']
|
||||
|
||||
def create(self, validated_data):
|
||||
if OutputMaterial.objects.filter(material=validated_data['material'], product=validated_data['product'], process=validated_data['process'], is_deleted=False).exists():
|
||||
|
@ -95,4 +95,4 @@ class OutputMaterialSerializer(serializers.ModelSerializer):
|
|||
class OutputMaterialUpdateSerializer(serializers.ModelSerializer):
|
||||
class Meta:
|
||||
model = OutputMaterial
|
||||
fields = ['number', 'unit', 'sort']
|
||||
fields = ['count', 'sort']
|
Loading…
Reference in New Issue